From 57cfa01676413d05d6f7e80bbcf3199712353005 Mon Sep 17 00:00:00 2001 From: Benjamin Coe Date: Fri, 30 Aug 2019 07:34:32 -0700 Subject: [PATCH 001/213] chore: add initial files for launch --- .../CODE_OF_CONDUCT.md | 43 ++++ .../google-cloud-documentai/CONTRIBUTING.md | 55 +++++ packages/google-cloud-documentai/LICENSE | 202 ++++++++++++++++++ packages/google-cloud-documentai/README.md | 18 ++ packages/google-cloud-documentai/synth.py | 39 ++++ 5 files changed, 357 insertions(+) create mode 100644 packages/google-cloud-documentai/CODE_OF_CONDUCT.md create mode 100644 packages/google-cloud-documentai/CONTRIBUTING.md create mode 100644 packages/google-cloud-documentai/LICENSE create mode 100644 packages/google-cloud-documentai/README.md create mode 100644 packages/google-cloud-documentai/synth.py diff --git a/packages/google-cloud-documentai/CODE_OF_CONDUCT.md b/packages/google-cloud-documentai/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..46b2a08ea6d --- /dev/null +++ b/packages/google-cloud-documentai/CODE_OF_CONDUCT.md @@ -0,0 +1,43 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, +and in the interest of fostering an open and welcoming community, +we pledge to respect all people who contribute through reporting issues, +posting feature requests, updating documentation, +submitting pull requests or patches, and other activities. + +We are committed to making participation in this project +a harassment-free experience for everyone, +regardless of level of experience, gender, gender identity and expression, +sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, +such as physical or electronic +addresses, without explicit permission +* Other unethical or unprofessional conduct. + +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. +By adopting this Code of Conduct, +project maintainers commit themselves to fairly and consistently +applying these principles to every aspect of managing this project. +Project maintainers who do not follow or enforce the Code of Conduct +may be permanently removed from the project team. + +This code of conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior +may be reported by opening an issue +or contacting one or more of the project maintainers. + +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, +available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) diff --git a/packages/google-cloud-documentai/CONTRIBUTING.md b/packages/google-cloud-documentai/CONTRIBUTING.md new file mode 100644 index 00000000000..78aaa61b269 --- /dev/null +++ b/packages/google-cloud-documentai/CONTRIBUTING.md @@ -0,0 +1,55 @@ +# 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. Submit a pull request. + +## Running the tests + +1. [Prepare your environment for Node.js setup][setup]. + +1. Install dependencies: + + npm install + +1. Run the tests: + + npm test + +1. Lint (and maybe fix) any changes: + + npm run fix + +[setup]: https://cloud.google.com/nodejs/docs/setup diff --git a/packages/google-cloud-documentai/LICENSE b/packages/google-cloud-documentai/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/packages/google-cloud-documentai/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-documentai/README.md b/packages/google-cloud-documentai/README.md new file mode 100644 index 00000000000..3b6333b8139 --- /dev/null +++ b/packages/google-cloud-documentai/README.md @@ -0,0 +1,18 @@ +# Node.js Client for Document AI + +Use machine learning to unlock insights from your documents. + +Document API: + +[Product Documentation](https://cloud.google.com/solutions/document-understanding/) + +```bash +$ npm install --save @google-cloud/document-ai +``` + +## License + +Apache Version 2.0 + +See LICENSE + diff --git a/packages/google-cloud-documentai/synth.py b/packages/google-cloud-documentai/synth.py new file mode 100644 index 00000000000..735f273d0ea --- /dev/null +++ b/packages/google-cloud-documentai/synth.py @@ -0,0 +1,39 @@ +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""This script is used to synthesize generated parts of this library.""" + +import synthtool as s +import synthtool.gcp as gcp +import subprocess +import logging + +logging.basicConfig(level=logging.DEBUG) + +# run the gapic generator +gapic = gcp.GAPICGenerator() +versions = ['CHANGE-ME'] +for version in versions: + library = gapic.node_library( + 'document', + version) + s.copy(library, excludes=[]) + +# Copy common templates +common_templates = gcp.CommonTemplates() +templates = common_templates.node_library() +s.copy(templates, excludes=[]) + +# Node.js specific cleanup +subprocess.run(['npm', 'install']) +subprocess.run(['npm', 'run', 'fix']) From 67dae9e6ad18f85514cc68c6ddb85acdc44e31d5 Mon Sep 17 00:00:00 2001 From: Benjamin Coe Date: Wed, 11 Sep 2019 17:22:07 -0700 Subject: [PATCH 002/213] chore: initial build of document ai library --- .../google-cloud-documentai/.eslintignore | 4 + .../google-cloud-documentai/.eslintrc.yml | 15 + packages/google-cloud-documentai/.gitignore | 14 + packages/google-cloud-documentai/.jsdoc.js | 48 + packages/google-cloud-documentai/.nycrc | 24 + .../google-cloud-documentai/.prettierignore | 3 + packages/google-cloud-documentai/.prettierrc | 8 + .../.repo-metadata.json | 13 + packages/google-cloud-documentai/README.md | 112 +- packages/google-cloud-documentai/codecov.yaml | 4 + packages/google-cloud-documentai/package.json | 62 + .../cloud/document/v1beta1/document.proto | 410 +++++ .../v1beta1/document_understanding.proto | 284 +++ .../cloud/document/v1beta1/geometry.proto | 55 + .../protos/protos.json | 1562 +++++++++++++++++ .../samples/.eslintrc.yml | 6 + .../google-cloud-documentai/samples/README.md | 44 + .../samples/package.json | 22 + .../samples/quickstart.js | 39 + .../samples/test/quickstart.js | 31 + .../google-cloud-documentai/src/browser.js | 21 + packages/google-cloud-documentai/src/index.js | 79 + .../v1beta1/doc_document_understanding.js | 420 +++++ .../cloud/document/v1beta1/doc_geometry.js | 74 + .../doc/google/longrunning/doc_operations.js | 63 + .../v1beta1/doc/google/protobuf/doc_any.js | 137 ++ .../src/v1beta1/doc/google/rpc/doc_status.js | 92 + .../document_understanding_service_client.js | 353 ++++ ...t_understanding_service_client_config.json | 31 + ...ment_understanding_service_proto_list.json | 3 + .../src/v1beta1/index.js | 19 + .../google-cloud-documentai/synth.metadata | 39 + packages/google-cloud-documentai/synth.py | 7 +- .../system-test/.eslintrc.yml | 3 + .../system-test/test.js | 27 + .../test/.eslintrc.yml | 5 + .../test/gapic-v1beta1.js | 180 ++ .../google-cloud-documentai/webpack.config.js | 46 + 38 files changed, 4350 insertions(+), 9 deletions(-) create mode 100644 packages/google-cloud-documentai/.eslintignore create mode 100644 packages/google-cloud-documentai/.eslintrc.yml create mode 100644 packages/google-cloud-documentai/.gitignore create mode 100644 packages/google-cloud-documentai/.jsdoc.js create mode 100644 packages/google-cloud-documentai/.nycrc create mode 100644 packages/google-cloud-documentai/.prettierignore create mode 100644 packages/google-cloud-documentai/.prettierrc create mode 100644 packages/google-cloud-documentai/.repo-metadata.json create mode 100644 packages/google-cloud-documentai/codecov.yaml create mode 100644 packages/google-cloud-documentai/package.json create mode 100644 packages/google-cloud-documentai/protos/google/cloud/document/v1beta1/document.proto create mode 100644 packages/google-cloud-documentai/protos/google/cloud/document/v1beta1/document_understanding.proto create mode 100644 packages/google-cloud-documentai/protos/google/cloud/document/v1beta1/geometry.proto create mode 100644 packages/google-cloud-documentai/protos/protos.json create mode 100644 packages/google-cloud-documentai/samples/.eslintrc.yml create mode 100644 packages/google-cloud-documentai/samples/README.md create mode 100644 packages/google-cloud-documentai/samples/package.json create mode 100644 packages/google-cloud-documentai/samples/quickstart.js create mode 100644 packages/google-cloud-documentai/samples/test/quickstart.js create mode 100644 packages/google-cloud-documentai/src/browser.js create mode 100644 packages/google-cloud-documentai/src/index.js create mode 100644 packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/document/v1beta1/doc_document_understanding.js create mode 100644 packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/document/v1beta1/doc_geometry.js create mode 100644 packages/google-cloud-documentai/src/v1beta1/doc/google/longrunning/doc_operations.js create mode 100644 packages/google-cloud-documentai/src/v1beta1/doc/google/protobuf/doc_any.js create mode 100644 packages/google-cloud-documentai/src/v1beta1/doc/google/rpc/doc_status.js create mode 100644 packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.js create mode 100644 packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client_config.json create mode 100644 packages/google-cloud-documentai/src/v1beta1/document_understanding_service_proto_list.json create mode 100644 packages/google-cloud-documentai/src/v1beta1/index.js create mode 100644 packages/google-cloud-documentai/synth.metadata create mode 100644 packages/google-cloud-documentai/system-test/.eslintrc.yml create mode 100644 packages/google-cloud-documentai/system-test/test.js create mode 100644 packages/google-cloud-documentai/test/.eslintrc.yml create mode 100644 packages/google-cloud-documentai/test/gapic-v1beta1.js create mode 100644 packages/google-cloud-documentai/webpack.config.js diff --git a/packages/google-cloud-documentai/.eslintignore b/packages/google-cloud-documentai/.eslintignore new file mode 100644 index 00000000000..f0c7aead4bf --- /dev/null +++ b/packages/google-cloud-documentai/.eslintignore @@ -0,0 +1,4 @@ +**/node_modules +src/**/doc/* +build/ +docs/ diff --git a/packages/google-cloud-documentai/.eslintrc.yml b/packages/google-cloud-documentai/.eslintrc.yml new file mode 100644 index 00000000000..73eeec27612 --- /dev/null +++ b/packages/google-cloud-documentai/.eslintrc.yml @@ -0,0 +1,15 @@ +--- +extends: + - 'eslint:recommended' + - 'plugin:node/recommended' + - prettier +plugins: + - node + - prettier +rules: + prettier/prettier: error + block-scoped-var: error + eqeqeq: error + no-warning-comments: warn + no-var: error + prefer-const: error diff --git a/packages/google-cloud-documentai/.gitignore b/packages/google-cloud-documentai/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/packages/google-cloud-documentai/.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-documentai/.jsdoc.js b/packages/google-cloud-documentai/.jsdoc.js new file mode 100644 index 00000000000..e1d4cf236d3 --- /dev/null +++ b/packages/google-cloud-documentai/.jsdoc.js @@ -0,0 +1,48 @@ +/*! + * Copyright 2018 Google LLC. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +'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' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'src' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2018 Google, LLC.', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/document', + theme: 'lumen' + }, + markdown: { + idInHeadings: true + } +}; diff --git a/packages/google-cloud-documentai/.nycrc b/packages/google-cloud-documentai/.nycrc new file mode 100644 index 00000000000..23e322204ec --- /dev/null +++ b/packages/google-cloud-documentai/.nycrc @@ -0,0 +1,24 @@ +{ + "report-dir": "./.coverage", + "reporter": ["text", "lcov"], + "exclude": [ + "**/*-test", + "**/.coverage", + "**/apis", + "**/benchmark", + "**/conformance", + "**/docs", + "**/samples", + "**/scripts", + "**/src/**/v*/**/*.js", + "**/protos", + "**/test", + ".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-documentai/.prettierignore b/packages/google-cloud-documentai/.prettierignore new file mode 100644 index 00000000000..f6fac98b0a8 --- /dev/null +++ b/packages/google-cloud-documentai/.prettierignore @@ -0,0 +1,3 @@ +node_modules/* +samples/node_modules/* +src/**/doc/* diff --git a/packages/google-cloud-documentai/.prettierrc b/packages/google-cloud-documentai/.prettierrc new file mode 100644 index 00000000000..df6eac07446 --- /dev/null +++ b/packages/google-cloud-documentai/.prettierrc @@ -0,0 +1,8 @@ +--- +bracketSpacing: false +printWidth: 80 +semi: true +singleQuote: true +tabWidth: 2 +trailingComma: es5 +useTabs: false diff --git a/packages/google-cloud-documentai/.repo-metadata.json b/packages/google-cloud-documentai/.repo-metadata.json new file mode 100644 index 00000000000..c493e4148aa --- /dev/null +++ b/packages/google-cloud-documentai/.repo-metadata.json @@ -0,0 +1,13 @@ +{ + "name": "document", + "name_pretty": "Document AI", + "product_documentation": "https://cloud.google.com/document/docs/", + "client_documentation": "https://googleapis.dev/nodejs/document/latest/index.html", + "issue_tracker": "", + "release_level": "alpha", + "language": "nodejs", + "repo": "googleapis/nodejs-document-ai", + "distribution_name": "@google-cloud/document", + "api_id": "document.googleapis.com", + "requires_billing": true +} \ No newline at end of file diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index 3b6333b8139..567ff87889b 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -1,18 +1,118 @@ -# Node.js Client for Document AI +[//]: # "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 -Use machine learning to unlock insights from your documents. +# [Document AI: Node.js Client](https://github.com/googleapis/nodejs-document-ai) -Document API: +[![release level](https://img.shields.io/badge/release%20level-alpha-orange.svg?style=flat)](https://cloud.google.com/terms/launch-stages) +[![npm version](https://img.shields.io/npm/v/@google-cloud/document.svg)](https://www.npmjs.org/package/@google-cloud/document) +[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-document-ai/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-document-ai) -[Product Documentation](https://cloud.google.com/solutions/document-understanding/) + + + +Cloud Document API client for Node.js + + +* [Document AI Node.js Client API Reference][client-docs] +* [Document AI Documentation][product-docs] +* [github.com/googleapis/nodejs-document-ai](https://github.com/googleapis/nodejs-document-ai) + +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 Document AI 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 --save @google-cloud/document-ai +npm install @google-cloud/document +``` + + +### Using the client library + +```javascript + async function batchProcessDocument() { + const { + DocumentUnderstandingServiceClient, + } = require('@google-cloud/document'); + const client = new DocumentUnderstandingServiceClient(); + // TODO: write sample here that demonstrates batch processing of documents. + console.info(client); + } + ``` + + +## Samples + +Samples are in the [`samples/`](https://github.com/googleapis/nodejs-document-ai/tree/master/samples) directory. The samples' `README.md` +has instructions for running the samples. + +| Sample | Source Code | Try it | +| --------------------------- | --------------------------------- | ------ | +| Quickstart | [source code](https://github.com/googleapis/nodejs-document-ai/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-document-ai&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | + + + +The [Document AI Node.js Client API Reference][client-docs] documentation +also contains samples. + +## Versioning + +This library follows [Semantic Versioning](http://semver.org/). + + + + +This library is considered to be in **alpha**. This means it is still a +work-in-progress and under active development. Any release is subject to +backwards-incompatible changes at any time. + + + +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-document-ai/blob/master/CONTRIBUTING.md). + ## License Apache Version 2.0 -See LICENSE +See [LICENSE](https://github.com/googleapis/nodejs-document-ai/blob/master/LICENSE) +[client-docs]: https://googleapis.dev/nodejs/document/latest/index.html +[product-docs]: https://cloud.google.com/document/docs/ +[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=document.googleapis.com +[auth]: https://cloud.google.com/docs/authentication/getting-started diff --git a/packages/google-cloud-documentai/codecov.yaml b/packages/google-cloud-documentai/codecov.yaml new file mode 100644 index 00000000000..5724ea9478d --- /dev/null +++ b/packages/google-cloud-documentai/codecov.yaml @@ -0,0 +1,4 @@ +--- +codecov: + ci: + - source.cloud.google.com diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json new file mode 100644 index 00000000000..294b0ab9839 --- /dev/null +++ b/packages/google-cloud-documentai/package.json @@ -0,0 +1,62 @@ +{ + "name": "@google-cloud/document", + "repository": "googleapis/nodejs-document-ai", + "version": "1.0.0", + "author": "Google LLC", + "description": "Cloud Document API client for Node.js", + "main": "src/index.js", + "browser": "src/browser.js", + "files": [ + "protos", + "src", + "AUTHORS", + "COPYING" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google document", + "document", + "Cloud Document API" + ], + "dependencies": { + "google-gax": "^1.5.0" + }, + "scripts": { + "compile-protos": "compileProtos ./src", + "docs": "jsdoc -c .jsdoc.js", + "fix": "eslint . --fix", + "lint": "eslint .", + "test": "c8 mocha test/*.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs -r --skip 'www.npmjs.org/package/@google-cloud/web-risk'", + "samples-test": "cd samples/ && npm link ../ && c8 npm test && cd ../", + "system-test": "c8 mocha --timeout=5000 system-test/*.js" + }, + "license": "Apache-2.0", + "devDependencies": { + "c8": "^5.0.1", + "chai": "^4.2.0", + "eslint": "^6.3.0", + "eslint-config-prettier": "^6.3.0", + "eslint-plugin-node": "^10.0.0", + "eslint-plugin-prettier": "^3.0.1", + "jsdoc": "^3.6.2", + "jsdoc-fresh": "^1.0.1", + "linkinator": "^1.4.0", + "mocha": "^6.1.4", + "null-loader": "^3.0.0", + "prettier": "^1.17.0", + "webpack": "^4.37.0", + "webpack-cli": "^3.3.6" + }, + "engines": { + "node": ">=8.10.0" + } +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/document/v1beta1/document.proto b/packages/google-cloud-documentai/protos/google/cloud/document/v1beta1/document.proto new file mode 100644 index 00000000000..09804b9e420 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/document/v1beta1/document.proto @@ -0,0 +1,410 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.document.v1beta1; + +import "google/cloud/document/v1beta1/geometry.proto"; +import "google/rpc/status.proto"; +import "google/type/color.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/document/v1beta1;document"; +option java_multiple_files = true; +option java_outer_classname = "DocumentProto"; +option java_package = "com.google.cloud.document.v1beta1"; + +// Document represents the canonical document resource in Document Understanding +// AI. +// It is an interchange format that provides insights into documents and allows +// for collaboration between users and Document Understanding AI to iterate and +// optimize for quality. +message Document { + // For a large document, sharding may be performed to produce several + // document shards. Each document shard contains this field to detail which + // shard it is. + message ShardInfo { + // The 0-based index of this shard. + int64 shard_index = 1; + + // Total number of shards. + int64 shard_count = 2; + + // The index of the first character in [Document.text][google.cloud.document.v1beta1.Document.text] in the overall + // document global text. + int64 text_offset = 3; + } + + // Annotation for common text style attributes. This adheres to CSS + // conventions as much as possible. + message Style { + // Font size with unit. + message FontSize { + // Font size for the text. + float size = 1; + + // Unit for the font size. Follows CSS naming (in, px, pt, etc.). + string unit = 2; + } + + // Text anchor indexing into the [Document.text][google.cloud.document.v1beta1.Document.text]. + TextAnchor text_anchor = 1; + + // Text color. + google.type.Color color = 2; + + // Text background color. + google.type.Color background_color = 3; + + // Font weight. Possible values are normal, bold, bolder, and lighter. + // https://www.w3schools.com/cssref/pr_font_weight.asp + string font_weight = 4; + + // Text style. Possible values are normal, italic, and oblique. + // https://www.w3schools.com/cssref/pr_font_font-style.asp + string text_style = 5; + + // Text decoration. Follows CSS standard. + // + // https://www.w3schools.com/cssref/pr_text_text-decoration.asp + string text_decoration = 6; + + // Font size. + FontSize font_size = 7; + } + + // A page in a [Document][google.cloud.document.v1beta1.Document]. + message Page { + // Dimension for the page. + message Dimension { + // Page width. + float width = 1; + + // Page height. + float height = 2; + + // Dimension unit. + string unit = 3; + } + + // Visual element describing a layout unit on a page. + message Layout { + // Detected human reading orientation. + enum Orientation { + // Unspecified orientation. + ORIENTATION_UNSPECIFIED = 0; + + // Orientation is aligned with page up. + PAGE_UP = 1; + + // Orientation is aligned with page right. + // Turn the head 90 degrees clockwise from upright to read. + PAGE_RIGHT = 2; + + // Orientation is aligned with page down. + // Turn the head 180 degrees from upright to read. + PAGE_DOWN = 3; + + // Orientation is aligned with page left. + // Turn the head 90 degrees counterclockwise from upright to read. + PAGE_LEFT = 4; + } + + // Text anchor indexing into the [Document.text][google.cloud.document.v1beta1.Document.text]. + TextAnchor text_anchor = 1; + + // Confidence of the current [Layout][google.cloud.document.v1beta1.Document.Page.Layout] within context of the object this + // layout is for. e.g. confidence can be for a single token, a table, + // a visual element, etc. depending on context. Range [0, 1]. + float confidence = 2; + + // The bounding polygon for the [Layout][google.cloud.document.v1beta1.Document.Page.Layout]. + BoundingPoly bounding_poly = 3; + + // Detected orientation for the [Layout][google.cloud.document.v1beta1.Document.Page.Layout]. + Orientation orientation = 4; + } + + // A block has a set of lines (collected into paragraphs) that have a + // common line-spacing and orientation. + message Block { + // [Layout][google.cloud.document.v1beta1.Document.Page.Layout] for [Block][google.cloud.document.v1beta1.Document.Page.Block]. + Layout layout = 1; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 2; + } + + // A collection of lines that a human would perceive as a paragraph. + message Paragraph { + // [Layout][google.cloud.document.v1beta1.Document.Page.Layout] for [Paragraph][google.cloud.document.v1beta1.Document.Page.Paragraph]. + Layout layout = 1; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 2; + } + + // A collection of tokens that a human would perceive as a line. + // Does not cross column boundaries, can be horizontal, vertical, etc. + message Line { + // [Layout][google.cloud.document.v1beta1.Document.Page.Layout] for [Line][google.cloud.document.v1beta1.Document.Page.Line]. + Layout layout = 1; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 2; + } + + // A detected token. + message Token { + // Detected break at the end of a [Token][google.cloud.document.v1beta1.Document.Page.Token]. + message DetectedBreak { + // Enum to denote the type of break found. + enum Type { + // Unspecified break type. + TYPE_UNSPECIFIED = 0; + + // A single whitespace. + SPACE = 1; + + // A wider whitespace. + WIDE_SPACE = 2; + + // A hyphen that indicates that a token has been split across lines. + HYPHEN = 3; + } + + // Detected break type. + Type type = 1; + } + + // [Layout][google.cloud.document.v1beta1.Document.Page.Layout] for [Token][google.cloud.document.v1beta1.Document.Page.Token]. + Layout layout = 1; + + // Detected break at the end of a [Token][google.cloud.document.v1beta1.Document.Page.Token]. + DetectedBreak detected_break = 2; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 3; + } + + // Detected non-text visual elements e.g. checkbox, signature etc. on the + // page. + message VisualElement { + // [Layout][google.cloud.document.v1beta1.Document.Page.Layout] for [Token][google.cloud.document.v1beta1.Document.Page.Token]. + Layout layout = 1; + + // Type of the [VisualElement][google.cloud.document.v1beta1.Document.Page.VisualElement]. + string type = 2; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 3; + } + + // A table representation similar to HTML table structure. + message Table { + // A row of table cells. + message TableRow { + // Cells that make up this row. + repeated TableCell cells = 1; + } + + // A cell representation inside the table. + message TableCell { + // [Layout][google.cloud.document.v1beta1.Document.Page.Layout] for [TableCell][google.cloud.document.v1beta1.Document.Page.Table.TableCell]. + Layout layout = 1; + + // How many rows this cell spans. + int32 row_span = 2; + + // How many columns this cell spans. + int32 col_span = 3; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 4; + } + + // [Layout][google.cloud.document.v1beta1.Document.Page.Layout] for [Table][google.cloud.document.v1beta1.Document.Page.Table]. + Layout layout = 1; + + // Header rows of the table. + repeated TableRow header_rows = 2; + + // Body rows of the table. + repeated TableRow body_rows = 3; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 4; + } + + // A form field detected on the page. + message FormField { + // [Layout][google.cloud.document.v1beta1.Document.Page.Layout] for the [FormField][google.cloud.document.v1beta1.Document.Page.FormField] name. e.g. `Address`, `Email`, + // `Grand total`, `Phone number`, etc. + Layout field_name = 1; + + // [Layout][google.cloud.document.v1beta1.Document.Page.Layout] for the [FormField][google.cloud.document.v1beta1.Document.Page.FormField] value. + Layout field_value = 2; + + // A list of detected languages for name together with confidence. + repeated DetectedLanguage name_detected_languages = 3; + + // A list of detected languages for value together with confidence. + repeated DetectedLanguage value_detected_languages = 4; + } + + // Detected language for a structural component. + message DetectedLanguage { + // The BCP-47 language code, such as "en-US" or "sr-Latn". For more + // information, see + // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + string language_code = 1; + + // Confidence of detected language. Range [0, 1]. + float confidence = 2; + } + + // 1-based index for current [Page][google.cloud.document.v1beta1.Document.Page] in a parent [Document][google.cloud.document.v1beta1.Document]. + // Useful when a page is taken out of a [Document][google.cloud.document.v1beta1.Document] for individual + // processing. + int32 page_number = 1; + + // Physical dimension of the page. + Dimension dimension = 2; + + // [Layout][google.cloud.document.v1beta1.Document.Page.Layout] for the page. + Layout layout = 3; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 4; + + // A list of visually detected text blocks on the page. + // A block has a set of lines (collected into paragraphs) that have a common + // line-spacing and orientation. + repeated Block blocks = 5; + + // A list of visually detected text paragraphs on the page. + // A collection of lines that a human would perceive as a paragraph. + repeated Paragraph paragraphs = 6; + + // A list of visually detected text lines on the page. + // A collection of tokens that a human would perceive as a line. + repeated Line lines = 7; + + // A list of visually detected tokens on the page. + repeated Token tokens = 8; + + // A list of detected non-text visual elements e.g. checkbox, + // signature etc. on the page. + repeated VisualElement visual_elements = 9; + + // A list of visually detected tables on the page. + repeated Table tables = 10; + + // A list of visually detected form fields on the page. + repeated FormField form_fields = 11; + } + + // A phrase in the text that is a known entity type, such as a person, an + // organization, or location. + message Entity { + // Provenance of the entity. + // Text anchor indexing into the [Document.text][google.cloud.document.v1beta1.Document.text]. + TextAnchor text_anchor = 1; + + // Entity type from a schema e.g. `Address`. + string type = 2; + + // Text value in the document e.g. `1600 Amphitheatre Pkwy`. + string mention_text = 3; + + // Canonical mention name. This will be a unique value in the entity list + // for this document. + string mention_id = 4; + } + + // Relationship between [Entities][google.cloud.document.v1beta1.Document.Entity]. + message EntityRelation { + // Subject entity mention_id. + string subject_id = 1; + + // Object entity mention_id. + string object_id = 2; + + // Relationship description. + string relation = 3; + } + + // Text reference indexing into the [Document.text][google.cloud.document.v1beta1.Document.text]. + message TextAnchor { + // A text segment in the [Document.text][google.cloud.document.v1beta1.Document.text]. The indices may be out of bounds + // which indicate that the text extends into another document shard for + // large sharded documents. See [ShardInfo.text_offset][google.cloud.document.v1beta1.Document.ShardInfo.text_offset] + message TextSegment { + // [TextSegment][google.cloud.document.v1beta1.Document.TextAnchor.TextSegment] start UTF-8 char index in the [Document.text][google.cloud.document.v1beta1.Document.text]. + int64 start_index = 1; + + // [TextSegment][google.cloud.document.v1beta1.Document.TextAnchor.TextSegment] half open end UTF-8 char index in the + // [Document.text][google.cloud.document.v1beta1.Document.text]. + int64 end_index = 2; + } + + // The text segments from the [Document.text][google.cloud.document.v1beta1.Document.text]. + repeated TextSegment text_segments = 1; + } + + // Original source document from the user. + oneof source { + // Currently supports Google Cloud Storage URI of the form + // `gs://bucket_name/object_name`. Object versioning is not supported. + // See [Google Cloud Storage Request + // URIs](https://cloud.google.com/storage/docs/reference-uris) for more + // info. + string uri = 1; + + // Inline document content, represented as a stream of bytes. + // Note: As with all `bytes` fields, protobuffers use a pure binary + // representation, whereas JSON representations use base64. + bytes content = 2; + } + + // An IANA published MIME type (also referred to as media type). For more + // information, see + // https://www.iana.org/assignments/media-types/media-types.xhtml. + string mime_type = 3; + + // UTF-8 encoded text in reading order from the document. + string text = 4; + + // Styles for the [Document.text][google.cloud.document.v1beta1.Document.text]. + repeated Style text_styles = 5; + + // Visual page layout for the [Document][google.cloud.document.v1beta1.Document]. + repeated Page pages = 6; + + // A list of entities detected on [Document.text][google.cloud.document.v1beta1.Document.text]. For document shards, + // entities in this list may cross shard boundaries. + repeated Entity entities = 7; + + // Relationship among [Document.entities][google.cloud.document.v1beta1.Document.entities]. + repeated EntityRelation entity_relations = 8; + + // Information about the sharding if this document is sharded part of a larger + // document. If the document is not sharded, this message is not specified. + ShardInfo shard_info = 9; + + // Any error that occurred while processing this document. + google.rpc.Status error = 10; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/document/v1beta1/document_understanding.proto b/packages/google-cloud-documentai/protos/google/cloud/document/v1beta1/document_understanding.proto new file mode 100644 index 00000000000..bd355a38928 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/document/v1beta1/document_understanding.proto @@ -0,0 +1,284 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.document.v1beta1; + +import "google/api/annotations.proto"; +import "google/cloud/document/v1beta1/geometry.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/client.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/document/v1beta1;document"; +option java_multiple_files = true; +option java_outer_classname = "DocumentUnderstandingProto"; +option java_package = "com.google.cloud.document.v1beta1"; + +// Service to parse structured information from unstructured or semi-structured +// documents using state-of-the-art Google AI such as natural language, +// computer vision, and translation. +service DocumentUnderstandingService { + option (google.api.default_host) = "document.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // LRO endpoint to batch process many documents. + rpc BatchProcessDocuments(BatchProcessDocumentsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/locations/*}/documents:batchProcess" + body: "*" + additional_bindings { + post: "/v1beta1/{parent=projects/*}/documents:batchProcess" + body: "*" + } + }; + } +} + +// Request to batch process documents as an asynchronous operation. +message BatchProcessDocumentsRequest { + // Individual requests for each document. + repeated ProcessDocumentRequest requests = 1; + + // Target project and location to make a call. + // + // Format: `projects/{project-id}/locations/{location-id}`. + // + // If no location is specified, a region will be chosen automatically. + string parent = 2; +} + +// Request to process one document. +message ProcessDocumentRequest { + // Required. Information about the input file. + InputConfig input_config = 1; + + // Required. The desired output location. + OutputConfig output_config = 2; + + // Specifies a known document type for deeper structure detection. Valid + // values are currently "general" and "invoice". If not provided, "general"\ + // is used as default. If any other value is given, the request is rejected. + string document_type = 3; + + // Controls table extraction behavior. If not specified, the system will + // decide reasonable defaults. + TableExtractionParams table_extraction_params = 4; + + // Controls form extraction behavior. If not specified, the system will + // decide reasonable defaults. + FormExtractionParams form_extraction_params = 5; + + // Controls entity extraction behavior. If not specified, the system will + // decide reasonable defaults. + EntityExtractionParams entity_extraction_params = 6; + + // Controls OCR behavior. If not specified, the system will decide reasonable + // defaults. + OcrParams ocr_params = 7; +} + +// Response to an batch document processing request. This is returned in +// the LRO Operation after the operation is complete. +message BatchProcessDocumentsResponse { + // Responses for each individual document. + repeated ProcessDocumentResponse responses = 1; +} + +// Response to a single document processing request. +message ProcessDocumentResponse { + // Information about the input file. This is the same as the corresponding + // input config in the request. + InputConfig input_config = 1; + + // The output location of the parsed responses. The responses are written to + // this location as JSON-serialized `Document` objects. + OutputConfig output_config = 2; +} + +// Parameters to control Optical Character Recognition (OCR) behavior. +message OcrParams { + // List of languages to use for OCR. In most cases, an empty value + // yields the best results since it enables automatic language detection. For + // languages based on the Latin alphabet, setting `language_hints` is not + // needed. In rare cases, when the language of the text in the image is known, + // setting a hint will help get better results (although it will be a + // significant hindrance if the hint is wrong). Document processing returns an + // error if one or more of the specified languages is not one of the + // supported languages. + repeated string language_hints = 1; +} + +// Parameters to control table extraction behavior. +message TableExtractionParams { + // Whether to enable table extraction. + bool enabled = 1; + + // Optional. Table bounding box hints that can be provided to complex cases + // which our algorithm cannot locate the table(s) in. + repeated TableBoundHint table_bound_hints = 2; + + // Optional. Table header hints. The extraction will bias towards producing + // these terms as table headers, which may improve accuracy. + repeated string header_hints = 3; + + // Model version of the table extraction system. Default is "builtin/stable". + // Specify "builtin/latest" for the latest model. + string model_version = 4; +} + +// A hint for a table bounding box on the page for table parsing. +message TableBoundHint { + // Optional page number for multi-paged inputs this hint applies to. If not + // provided, this hint will apply to all pages by default. This value is + // 1-based. + int32 page_number = 1; + + // Bounding box hint for a table on this page. The coordinates must be + // normalized to [0,1] and the bounding box must be an axis-aligned rectangle. + BoundingPoly bounding_box = 2; +} + +// Parameters to control form extraction behavior. +message FormExtractionParams { + // Whether to enable form extraction. + bool enabled = 1; + + // User can provide pairs of (key text, value type) to improve the parsing + // result. + // + // For example, if a document has a field called "Date" that holds a date + // value and a field called "Amount" that may hold either a currency value + // (e.g., "$500.00") or a simple number value (e.g., "20"), you could use the + // following hints: [ {"key": "Date", value_types: [ "DATE"]}, {"key": + // "Amount", "value_types": [ "PRICE", "NUMBER" ]} ] + // + // If the value type is unknown, but you want to provide hints for the keys, + // you can leave the value_types field blank. e.g. {"key": "Date", + // "value_types": []} + repeated KeyValuePairHint key_value_pair_hints = 2; + + // Model version of the form extraction system. Default is + // "builtin/stable". Specify "builtin/latest" for the latest model. + string model_version = 3; +} + +// User-provided hint for key value pair. +message KeyValuePairHint { + // The key text for the hint. + string key = 1; + + // Type of the value. This is case-insensitive, and could be one of: + // ADDRESS, LOCATION, ORGANIZATION, PERSON, PHONE_NUMBER, + // ID, NUMBER, EMAIL, PRICE, TERMS, DATE, NAME. Types not in this list will + // be ignored. + repeated string value_types = 2; +} + +// Parameters to control entity extraction behavior. +message EntityExtractionParams { + // Whether to enable entity extraction. + bool enabled = 1; + + // Model version of the entity extraction. Default is + // "builtin/stable". Specify "builtin/latest" for the latest model. + string model_version = 2; +} + +// The desired input location and metadata. +message InputConfig { + oneof source { + // The Google Cloud Storage location to read the input from. This must be a + // single file. + GcsSource gcs_source = 1; + } + + // Mimetype of the input. Current supported mimetypes are application/pdf, + // image/tiff, and image/gif. + string mime_type = 2; +} + +// The desired output location and metadata. +message OutputConfig { + oneof destination { + // The Google Cloud Storage location to write the output to. + GcsDestination gcs_destination = 1; + } + + // The max number of pages to include into each output Document shard JSON on + // Google Cloud Storage. + // + // The valid range is [1, 100]. If not specified, the default value is 20. + // + // For example, for one pdf file with 100 pages, 100 parsed pages will be + // produced. If `pages_per_shard` = 20, then 5 Document shard JSON files each + // containing 20 parsed pages will be written under the prefix + // [InputConfig.gcs_destination.uri][] and suffix -pages-x-to-y.json where + // x and y are 1-indexed page numbers. + // + // Example GCS outputs with 157 pages and pages_per_shard = 50: + // + // -pages-001-to-050.json + // -pages-051-to-100.json + // -pages-101-to-150.json + // -pages-151-to-157.json + int32 pages_per_shard = 2; +} + +// The Google Cloud Storage location where the input file will be read from. +message GcsSource { + string uri = 1; +} + +// The Google Cloud Storage location where the output file will be written to. +message GcsDestination { + string uri = 1; +} + +// Contains metadata for the BatchProcessDocuments operation. +message OperationMetadata { + enum State { + // The default value. This value is used if the state is omitted. + STATE_UNSPECIFIED = 0; + + // Request is received. + ACCEPTED = 1; + + // Request operation is waiting for scheduling. + WAITING = 2; + + // Request is being processed. + RUNNING = 3; + + // The batch processing completed successfully. + SUCCEEDED = 4; + + // The batch processing was cancelled. + CANCELLED = 5; + } + + // The state of the current batch processing. + State state = 1; + + // A message providing more details about the current state of processing. + string state_message = 2; + + // The creation time of the operation. + google.protobuf.Timestamp create_time = 3; + + // The last update time of the operation. + google.protobuf.Timestamp update_time = 4; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/document/v1beta1/geometry.proto b/packages/google-cloud-documentai/protos/google/cloud/document/v1beta1/geometry.proto new file mode 100644 index 00000000000..a39fd8ea29d --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/document/v1beta1/geometry.proto @@ -0,0 +1,55 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.document.v1beta1; + +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/document/v1beta1;document"; +option java_multiple_files = true; +option java_outer_classname = "GeometryProto"; +option java_package = "com.google.cloud.document.v1beta1"; + +// A vertex represents a 2D point in the image. +// NOTE: the vertex coordinates are in the same scale as the original image. +message Vertex { + // X coordinate. + int32 x = 1; + + // Y coordinate. + int32 y = 2; +} + +// A vertex represents a 2D point in the image. +// NOTE: the normalized vertex coordinates are relative to the original image +// and range from 0 to 1. +message NormalizedVertex { + // X coordinate. + float x = 1; + + // Y coordinate. + float y = 2; +} + +// A bounding polygon for the detected image annotation. +message BoundingPoly { + // The bounding polygon vertices. + repeated Vertex vertices = 1; + + // The bounding polygon normalized vertices. + repeated NormalizedVertex normalized_vertices = 2; +} diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json new file mode 100644 index 00000000000..fd8ca11d9be --- /dev/null +++ b/packages/google-cloud-documentai/protos/protos.json @@ -0,0 +1,1562 @@ +{ + "nested": { + "google": { + "nested": { + "cloud": { + "nested": { + "document": { + "nested": { + "v1beta1": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/cloud/document/v1beta1;document", + "java_multiple_files": true, + "java_outer_classname": "GeometryProto", + "java_package": "com.google.cloud.document.v1beta1" + }, + "nested": { + "DocumentUnderstandingService": { + "options": { + "(google.api.default_host)": "document.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "BatchProcessDocuments": { + "requestType": "BatchProcessDocumentsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1beta1/{parent=projects/*/locations/*}/documents:batchProcess", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v1beta1/{parent=projects/*}/documents:batchProcess", + "(google.api.http).additional_bindings.body": "*" + } + } + } + }, + "BatchProcessDocumentsRequest": { + "fields": { + "requests": { + "rule": "repeated", + "type": "ProcessDocumentRequest", + "id": 1 + }, + "parent": { + "type": "string", + "id": 2 + } + } + }, + "ProcessDocumentRequest": { + "fields": { + "inputConfig": { + "type": "InputConfig", + "id": 1 + }, + "outputConfig": { + "type": "OutputConfig", + "id": 2 + }, + "documentType": { + "type": "string", + "id": 3 + }, + "tableExtractionParams": { + "type": "TableExtractionParams", + "id": 4 + }, + "formExtractionParams": { + "type": "FormExtractionParams", + "id": 5 + }, + "entityExtractionParams": { + "type": "EntityExtractionParams", + "id": 6 + }, + "ocrParams": { + "type": "OcrParams", + "id": 7 + } + } + }, + "BatchProcessDocumentsResponse": { + "fields": { + "responses": { + "rule": "repeated", + "type": "ProcessDocumentResponse", + "id": 1 + } + } + }, + "ProcessDocumentResponse": { + "fields": { + "inputConfig": { + "type": "InputConfig", + "id": 1 + }, + "outputConfig": { + "type": "OutputConfig", + "id": 2 + } + } + }, + "OcrParams": { + "fields": { + "languageHints": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "TableExtractionParams": { + "fields": { + "enabled": { + "type": "bool", + "id": 1 + }, + "tableBoundHints": { + "rule": "repeated", + "type": "TableBoundHint", + "id": 2 + }, + "headerHints": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "modelVersion": { + "type": "string", + "id": 4 + } + } + }, + "TableBoundHint": { + "fields": { + "pageNumber": { + "type": "int32", + "id": 1 + }, + "boundingBox": { + "type": "BoundingPoly", + "id": 2 + } + } + }, + "FormExtractionParams": { + "fields": { + "enabled": { + "type": "bool", + "id": 1 + }, + "keyValuePairHints": { + "rule": "repeated", + "type": "KeyValuePairHint", + "id": 2 + }, + "modelVersion": { + "type": "string", + "id": 3 + } + } + }, + "KeyValuePairHint": { + "fields": { + "key": { + "type": "string", + "id": 1 + }, + "valueTypes": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, + "EntityExtractionParams": { + "fields": { + "enabled": { + "type": "bool", + "id": 1 + }, + "modelVersion": { + "type": "string", + "id": 2 + } + } + }, + "InputConfig": { + "oneofs": { + "source": { + "oneof": [ + "gcsSource" + ] + } + }, + "fields": { + "gcsSource": { + "type": "GcsSource", + "id": 1 + }, + "mimeType": { + "type": "string", + "id": 2 + } + } + }, + "OutputConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsDestination" + ] + } + }, + "fields": { + "gcsDestination": { + "type": "GcsDestination", + "id": 1 + }, + "pagesPerShard": { + "type": "int32", + "id": 2 + } + } + }, + "GcsSource": { + "fields": { + "uri": { + "type": "string", + "id": 1 + } + } + }, + "GcsDestination": { + "fields": { + "uri": { + "type": "string", + "id": 1 + } + } + }, + "OperationMetadata": { + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "stateMessage": { + "type": "string", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "ACCEPTED": 1, + "WAITING": 2, + "RUNNING": 3, + "SUCCEEDED": 4, + "CANCELLED": 5 + } + } + } + }, + "Vertex": { + "fields": { + "x": { + "type": "int32", + "id": 1 + }, + "y": { + "type": "int32", + "id": 2 + } + } + }, + "NormalizedVertex": { + "fields": { + "x": { + "type": "float", + "id": 1 + }, + "y": { + "type": "float", + "id": 2 + } + } + }, + "BoundingPoly": { + "fields": { + "vertices": { + "rule": "repeated", + "type": "Vertex", + "id": 1 + }, + "normalizedVertices": { + "rule": "repeated", + "type": "NormalizedVertex", + "id": 2 + } + } + } + } + } + } + } + } + }, + "api": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", + "java_multiple_files": true, + "java_outer_classname": "ClientProto", + "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 + } + } + }, + "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" + } + } + }, + "protobuf": { + "options": { + "go_package": "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor", + "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 + } + }, + "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": false + } + }, + "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 + } + } + } + } + }, + "Any": { + "fields": { + "type_url": { + "type": "string", + "id": 1 + }, + "value": { + "type": "bytes", + "id": 2 + } + } + }, + "Duration": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + }, + "Empty": { + "fields": {} + }, + "Timestamp": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "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": { + "methods": { + "ListOperations": { + "requestType": "ListOperationsRequest", + "responseType": "ListOperationsResponse", + "options": { + "(google.api.http).get": "/v1/{name=operations}" + } + }, + "GetOperation": { + "requestType": "GetOperationRequest", + "responseType": "Operation", + "options": { + "(google.api.http).get": "/v1/{name=operations/**}" + } + }, + "DeleteOperation": { + "requestType": "DeleteOperationRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1/{name=operations/**}" + } + }, + "CancelOperation": { + "requestType": "CancelOperationRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).post": "/v1/{name=operations/**}:cancel", + "(google.api.http).body": "*" + } + }, + "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 + } + } + } + } + }, + "rpc": { + "options": { + "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 + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/packages/google-cloud-documentai/samples/.eslintrc.yml b/packages/google-cloud-documentai/samples/.eslintrc.yml new file mode 100644 index 00000000000..eef2752ae86 --- /dev/null +++ b/packages/google-cloud-documentai/samples/.eslintrc.yml @@ -0,0 +1,6 @@ +--- +rules: + no-console: off + node/no-missing-require: off + node/no-extraneous-require: off + \ No newline at end of file diff --git a/packages/google-cloud-documentai/samples/README.md b/packages/google-cloud-documentai/samples/README.md new file mode 100644 index 00000000000..5e92a9305e7 --- /dev/null +++ b/packages/google-cloud-documentai/samples/README.md @@ -0,0 +1,44 @@ +[//]: # "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 + +# [Document AI: Node.js Samples](https://github.com/googleapis/nodejs-document-ai) + +[![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-document-ai#using-the-client-library). + +## Samples + + + +### Quickstart + +View the [source code](https://github.com/googleapis/nodejs-document-ai/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-document-ai&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) + +__Usage:__ + + +`node 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-document-ai&page=editor&open_in_editor=samples/README.md +[product-docs]: https://cloud.google.com/document/docs/ \ No newline at end of file diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json new file mode 100644 index 00000000000..4624513890a --- /dev/null +++ b/packages/google-cloud-documentai/samples/package.json @@ -0,0 +1,22 @@ +{ + "name": "nodejs-document-ai-samples", + "private": true, + "license": "Apache-2.0", + "author": "Google LLC", + "engines": { + "node": ">=8" + }, + "files": [ + "*.js" + ], + "scripts": { + "test": "mocha test/*.js" + }, + "dependencies": { + "@google-cloud/document-ai": "^1.0.0" + }, + "devDependencies": { + "chai": "^4.2.0", + "mocha": "^6.2.0" + } +} diff --git a/packages/google-cloud-documentai/samples/quickstart.js b/packages/google-cloud-documentai/samples/quickstart.js new file mode 100644 index 00000000000..3a544c8c9c3 --- /dev/null +++ b/packages/google-cloud-documentai/samples/quickstart.js @@ -0,0 +1,39 @@ +/** + * Copyright 2019, Google, Inc. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +'use strict'; + +/** + * DESCRIBE WHAT THIS SAMPLE DOES. + * @param {string} LIST EXPECTED ARGUMENTS. + */ +async function main() { + // [START LIBRARY_NAME_quickstart] + async function batchProcessDocument() { + const { + DocumentUnderstandingServiceClient, + } = require('@google-cloud/document'); + const client = new DocumentUnderstandingServiceClient(); + // TODO: write sample here that demonstrates batch processing of documents. + console.info(client); + } + // [END LIBRARY_NAME_quickstart] + await batchProcessDocument(); +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err); + process.exitCode = 1; +}); diff --git a/packages/google-cloud-documentai/samples/test/quickstart.js b/packages/google-cloud-documentai/samples/test/quickstart.js new file mode 100644 index 00000000000..0f0bd0d25c7 --- /dev/null +++ b/packages/google-cloud-documentai/samples/test/quickstart.js @@ -0,0 +1,31 @@ +/** + * Copyright 2019, Google, Inc. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +'use strict'; + +const path = require('path'); +const {assert} = require('chai'); +const cp = require('child_process'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const cwd = path.join(__dirname, '..'); + +describe('Quickstart', () => { + it('should run quickstart', async () => { + const stdout = execSync(`node ./quickstart.js`, {cwd}); + assert.ok(stdout); + }); +}); diff --git a/packages/google-cloud-documentai/src/browser.js b/packages/google-cloud-documentai/src/browser.js new file mode 100644 index 00000000000..ddbcd7ecb9a --- /dev/null +++ b/packages/google-cloud-documentai/src/browser.js @@ -0,0 +1,21 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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'; + +// Set a flag that we are running in a browser bundle. +global.isBrowser = true; + +// Re-export all exports from ./index.js. +module.exports = require('./index'); diff --git a/packages/google-cloud-documentai/src/index.js b/packages/google-cloud-documentai/src/index.js new file mode 100644 index 00000000000..a5130edf3dd --- /dev/null +++ b/packages/google-cloud-documentai/src/index.js @@ -0,0 +1,79 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @namespace google + */ +/** + * @namespace google.cloud + */ +/** + * @namespace google.cloud.document + */ +/** + * @namespace google.cloud.document.v1beta1 + */ + +'use strict'; + +// Import the clients for each version supported by this package. +const gapic = Object.freeze({ + v1beta1: require('./v1beta1'), +}); + +/** + * The `document` package has the following named exports: + * + * - `DocumentUnderstandingServiceClient` - Reference to + * {@link v1beta1.DocumentUnderstandingServiceClient} + * - `v1beta1` - This is used for selecting or pinning a + * particular backend service version. It exports: + * - `DocumentUnderstandingServiceClient` - Reference to + * {@link v1beta1.DocumentUnderstandingServiceClient} + * + * @module {object} document + * @alias nodejs-document + * + * @example Install the client library with npm: + * npm install --save document + * + * @example Import the client library: + * const document = require('document'); + * + * @example Create a client that uses Application Default Credentials (ADC): + * const client = new document.DocumentUnderstandingServiceClient(); + * + * @example Create a client with explicit credentials: + * const client = new document.DocumentUnderstandingServiceClient({ + * projectId: 'your-project-id', + * keyFilename: '/path/to/keyfile.json', + * }); + */ + +/** + * @type {object} + * @property {constructor} DocumentUnderstandingServiceClient + * Reference to {@link v1beta1.DocumentUnderstandingServiceClient} + */ +module.exports = gapic.v1beta1; + +/** + * @type {object} + * @property {constructor} DocumentUnderstandingServiceClient + * Reference to {@link v1beta1.DocumentUnderstandingServiceClient} + */ +module.exports.v1beta1 = gapic.v1beta1; + +// Alias `module.exports` as `module.exports.default`, for future-proofing. +module.exports.default = Object.assign({}, module.exports); diff --git a/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/document/v1beta1/doc_document_understanding.js b/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/document/v1beta1/doc_document_understanding.js new file mode 100644 index 00000000000..77c9d92fe3f --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/document/v1beta1/doc_document_understanding.js @@ -0,0 +1,420 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Note: this file is purely for documentation. Any contents are not expected +// to be loaded as the JS file. + +/** + * Request to batch process documents as an asynchronous operation. + * + * @property {Object[]} requests + * Individual requests for each document. + * + * This object should have the same structure as [ProcessDocumentRequest]{@link google.cloud.document.v1beta1.ProcessDocumentRequest} + * + * @property {string} parent + * Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no location is specified, a region will be chosen automatically. + * + * @typedef BatchProcessDocumentsRequest + * @memberof google.cloud.document.v1beta1 + * @see [google.cloud.document.v1beta1.BatchProcessDocumentsRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} + */ +const BatchProcessDocumentsRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request to process one document. + * + * @property {Object} inputConfig + * Required. Information about the input file. + * + * This object should have the same structure as [InputConfig]{@link google.cloud.document.v1beta1.InputConfig} + * + * @property {Object} outputConfig + * Required. The desired output location. + * + * This object should have the same structure as [OutputConfig]{@link google.cloud.document.v1beta1.OutputConfig} + * + * @property {string} documentType + * Specifies a known document type for deeper structure detection. Valid + * values are currently "general" and "invoice". If not provided, "general"\ + * is used as default. If any other value is given, the request is rejected. + * + * @property {Object} tableExtractionParams + * Controls table extraction behavior. If not specified, the system will + * decide reasonable defaults. + * + * This object should have the same structure as [TableExtractionParams]{@link google.cloud.document.v1beta1.TableExtractionParams} + * + * @property {Object} formExtractionParams + * Controls form extraction behavior. If not specified, the system will + * decide reasonable defaults. + * + * This object should have the same structure as [FormExtractionParams]{@link google.cloud.document.v1beta1.FormExtractionParams} + * + * @property {Object} entityExtractionParams + * Controls entity extraction behavior. If not specified, the system will + * decide reasonable defaults. + * + * This object should have the same structure as [EntityExtractionParams]{@link google.cloud.document.v1beta1.EntityExtractionParams} + * + * @property {Object} ocrParams + * Controls OCR behavior. If not specified, the system will decide reasonable + * defaults. + * + * This object should have the same structure as [OcrParams]{@link google.cloud.document.v1beta1.OcrParams} + * + * @typedef ProcessDocumentRequest + * @memberof google.cloud.document.v1beta1 + * @see [google.cloud.document.v1beta1.ProcessDocumentRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} + */ +const ProcessDocumentRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Response to an batch document processing request. This is returned in + * the LRO Operation after the operation is complete. + * + * @property {Object[]} responses + * Responses for each individual document. + * + * This object should have the same structure as [ProcessDocumentResponse]{@link google.cloud.document.v1beta1.ProcessDocumentResponse} + * + * @typedef BatchProcessDocumentsResponse + * @memberof google.cloud.document.v1beta1 + * @see [google.cloud.document.v1beta1.BatchProcessDocumentsResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} + */ +const BatchProcessDocumentsResponse = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Response to a single document processing request. + * + * @property {Object} inputConfig + * Information about the input file. This is the same as the corresponding + * input config in the request. + * + * This object should have the same structure as [InputConfig]{@link google.cloud.document.v1beta1.InputConfig} + * + * @property {Object} outputConfig + * The output location of the parsed responses. The responses are written to + * this location as JSON-serialized `Document` objects. + * + * This object should have the same structure as [OutputConfig]{@link google.cloud.document.v1beta1.OutputConfig} + * + * @typedef ProcessDocumentResponse + * @memberof google.cloud.document.v1beta1 + * @see [google.cloud.document.v1beta1.ProcessDocumentResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} + */ +const ProcessDocumentResponse = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Parameters to control Optical Character Recognition (OCR) behavior. + * + * @property {string[]} languageHints + * List of languages to use for OCR. In most cases, an empty value + * yields the best results since it enables automatic language detection. For + * languages based on the Latin alphabet, setting `language_hints` is not + * needed. In rare cases, when the language of the text in the image is known, + * setting a hint will help get better results (although it will be a + * significant hindrance if the hint is wrong). Document processing returns an + * error if one or more of the specified languages is not one of the + * supported languages. + * + * @typedef OcrParams + * @memberof google.cloud.document.v1beta1 + * @see [google.cloud.document.v1beta1.OcrParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} + */ +const OcrParams = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Parameters to control table extraction behavior. + * + * @property {boolean} enabled + * Whether to enable table extraction. + * + * @property {Object[]} tableBoundHints + * Optional. Table bounding box hints that can be provided to complex cases + * which our algorithm cannot locate the table(s) in. + * + * This object should have the same structure as [TableBoundHint]{@link google.cloud.document.v1beta1.TableBoundHint} + * + * @property {string[]} headerHints + * Optional. Table header hints. The extraction will bias towards producing + * these terms as table headers, which may improve accuracy. + * + * @property {string} modelVersion + * Model version of the table extraction system. Default is "builtin/stable". + * Specify "builtin/latest" for the latest model. + * + * @typedef TableExtractionParams + * @memberof google.cloud.document.v1beta1 + * @see [google.cloud.document.v1beta1.TableExtractionParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} + */ +const TableExtractionParams = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * A hint for a table bounding box on the page for table parsing. + * + * @property {number} pageNumber + * Optional page number for multi-paged inputs this hint applies to. If not + * provided, this hint will apply to all pages by default. This value is + * 1-based. + * + * @property {Object} boundingBox + * Bounding box hint for a table on this page. The coordinates must be + * normalized to [0,1] and the bounding box must be an axis-aligned rectangle. + * + * This object should have the same structure as [BoundingPoly]{@link google.cloud.document.v1beta1.BoundingPoly} + * + * @typedef TableBoundHint + * @memberof google.cloud.document.v1beta1 + * @see [google.cloud.document.v1beta1.TableBoundHint definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} + */ +const TableBoundHint = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Parameters to control form extraction behavior. + * + * @property {boolean} enabled + * Whether to enable form extraction. + * + * @property {Object[]} keyValuePairHints + * User can provide pairs of (key text, value type) to improve the parsing + * result. + * + * For example, if a document has a field called "Date" that holds a date + * value and a field called "Amount" that may hold either a currency value + * (e.g., "$500.00") or a simple number value (e.g., "20"), you could use the + * following hints: [ {"key": "Date", value_types: [ "DATE"]}, {"key": + * "Amount", "value_types": [ "PRICE", "NUMBER" ]} ] + * + * If the value type is unknown, but you want to provide hints for the keys, + * you can leave the value_types field blank. e.g. {"key": "Date", + * "value_types": []} + * + * This object should have the same structure as [KeyValuePairHint]{@link google.cloud.document.v1beta1.KeyValuePairHint} + * + * @property {string} modelVersion + * Model version of the form extraction system. Default is + * "builtin/stable". Specify "builtin/latest" for the latest model. + * + * @typedef FormExtractionParams + * @memberof google.cloud.document.v1beta1 + * @see [google.cloud.document.v1beta1.FormExtractionParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} + */ +const FormExtractionParams = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * User-provided hint for key value pair. + * + * @property {string} key + * The key text for the hint. + * + * @property {string[]} valueTypes + * Type of the value. This is case-insensitive, and could be one of: + * ADDRESS, LOCATION, ORGANIZATION, PERSON, PHONE_NUMBER, + * ID, NUMBER, EMAIL, PRICE, TERMS, DATE, NAME. Types not in this list will + * be ignored. + * + * @typedef KeyValuePairHint + * @memberof google.cloud.document.v1beta1 + * @see [google.cloud.document.v1beta1.KeyValuePairHint definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} + */ +const KeyValuePairHint = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Parameters to control entity extraction behavior. + * + * @property {boolean} enabled + * Whether to enable entity extraction. + * + * @property {string} modelVersion + * Model version of the entity extraction. Default is + * "builtin/stable". Specify "builtin/latest" for the latest model. + * + * @typedef EntityExtractionParams + * @memberof google.cloud.document.v1beta1 + * @see [google.cloud.document.v1beta1.EntityExtractionParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} + */ +const EntityExtractionParams = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * The desired input location and metadata. + * + * @property {Object} gcsSource + * The Google Cloud Storage location to read the input from. This must be a + * single file. + * + * This object should have the same structure as [GcsSource]{@link google.cloud.document.v1beta1.GcsSource} + * + * @property {string} mimeType + * Mimetype of the input. Current supported mimetypes are application/pdf, + * image/tiff, and image/gif. + * + * @typedef InputConfig + * @memberof google.cloud.document.v1beta1 + * @see [google.cloud.document.v1beta1.InputConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} + */ +const InputConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * The desired output location and metadata. + * + * @property {Object} gcsDestination + * The Google Cloud Storage location to write the output to. + * + * This object should have the same structure as [GcsDestination]{@link google.cloud.document.v1beta1.GcsDestination} + * + * @property {number} pagesPerShard + * The max number of pages to include into each output Document shard JSON on + * Google Cloud Storage. + * + * The valid range is [1, 100]. If not specified, the default value is 20. + * + * For example, for one pdf file with 100 pages, 100 parsed pages will be + * produced. If `pages_per_shard` = 20, then 5 Document shard JSON files each + * containing 20 parsed pages will be written under the prefix + * InputConfig.gcs_destination.uri and suffix -pages-x-to-y.json where + * x and y are 1-indexed page numbers. + * + * Example GCS outputs with 157 pages and pages_per_shard = 50: + * + * -pages-001-to-050.json + * -pages-051-to-100.json + * -pages-101-to-150.json + * -pages-151-to-157.json + * + * @typedef OutputConfig + * @memberof google.cloud.document.v1beta1 + * @see [google.cloud.document.v1beta1.OutputConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} + */ +const OutputConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * The Google Cloud Storage location where the input file will be read from. + * + * @property {string} uri + * + * @typedef GcsSource + * @memberof google.cloud.document.v1beta1 + * @see [google.cloud.document.v1beta1.GcsSource definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} + */ +const GcsSource = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * The Google Cloud Storage location where the output file will be written to. + * + * @property {string} uri + * + * @typedef GcsDestination + * @memberof google.cloud.document.v1beta1 + * @see [google.cloud.document.v1beta1.GcsDestination definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} + */ +const GcsDestination = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Contains metadata for the BatchProcessDocuments operation. + * + * @property {number} state + * The state of the current batch processing. + * + * The number should be among the values of [State]{@link google.cloud.document.v1beta1.State} + * + * @property {string} stateMessage + * A message providing more details about the current state of processing. + * + * @property {Object} createTime + * The creation time of the operation. + * + * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} + * + * @property {Object} updateTime + * The last update time of the operation. + * + * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} + * + * @typedef OperationMetadata + * @memberof google.cloud.document.v1beta1 + * @see [google.cloud.document.v1beta1.OperationMetadata definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} + */ +const OperationMetadata = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * @enum {number} + * @memberof google.cloud.document.v1beta1 + */ + State: { + + /** + * The default value. This value is used if the state is omitted. + */ + STATE_UNSPECIFIED: 0, + + /** + * Request is received. + */ + ACCEPTED: 1, + + /** + * Request operation is waiting for scheduling. + */ + WAITING: 2, + + /** + * Request is being processed. + */ + RUNNING: 3, + + /** + * The batch processing completed successfully. + */ + SUCCEEDED: 4, + + /** + * The batch processing was cancelled. + */ + CANCELLED: 5 + } +}; \ No newline at end of file diff --git a/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/document/v1beta1/doc_geometry.js b/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/document/v1beta1/doc_geometry.js new file mode 100644 index 00000000000..e2c49d465f6 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/document/v1beta1/doc_geometry.js @@ -0,0 +1,74 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Note: this file is purely for documentation. Any contents are not expected +// to be loaded as the JS file. + +/** + * A vertex represents a 2D point in the image. + * NOTE: the vertex coordinates are in the same scale as the original image. + * + * @property {number} x + * X coordinate. + * + * @property {number} y + * Y coordinate. + * + * @typedef Vertex + * @memberof google.cloud.document.v1beta1 + * @see [google.cloud.document.v1beta1.Vertex definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/geometry.proto} + */ +const Vertex = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * A vertex represents a 2D point in the image. + * NOTE: the normalized vertex coordinates are relative to the original image + * and range from 0 to 1. + * + * @property {number} x + * X coordinate. + * + * @property {number} y + * Y coordinate. + * + * @typedef NormalizedVertex + * @memberof google.cloud.document.v1beta1 + * @see [google.cloud.document.v1beta1.NormalizedVertex definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/geometry.proto} + */ +const NormalizedVertex = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * A bounding polygon for the detected image annotation. + * + * @property {Object[]} vertices + * The bounding polygon vertices. + * + * This object should have the same structure as [Vertex]{@link google.cloud.document.v1beta1.Vertex} + * + * @property {Object[]} normalizedVertices + * The bounding polygon normalized vertices. + * + * This object should have the same structure as [NormalizedVertex]{@link google.cloud.document.v1beta1.NormalizedVertex} + * + * @typedef BoundingPoly + * @memberof google.cloud.document.v1beta1 + * @see [google.cloud.document.v1beta1.BoundingPoly definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/geometry.proto} + */ +const BoundingPoly = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; \ No newline at end of file diff --git a/packages/google-cloud-documentai/src/v1beta1/doc/google/longrunning/doc_operations.js b/packages/google-cloud-documentai/src/v1beta1/doc/google/longrunning/doc_operations.js new file mode 100644 index 00000000000..4719aebdc91 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta1/doc/google/longrunning/doc_operations.js @@ -0,0 +1,63 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Note: this file is purely for documentation. Any contents are not expected +// to be loaded as the JS file. + +/** + * This resource represents a long-running operation that is the result of a + * network API call. + * + * @property {string} name + * The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the + * `name` should have the format of `operations/some/unique/name`. + * + * @property {Object} metadata + * Service-specific metadata associated with the operation. It typically + * contains progress information and common metadata such as create time. + * Some services might not provide such metadata. Any method that returns a + * long-running operation should document the metadata type, if any. + * + * This object should have the same structure as [Any]{@link google.protobuf.Any} + * + * @property {boolean} done + * If the value is `false`, it means the operation is still in progress. + * If `true`, the operation is completed, and either `error` or `response` is + * available. + * + * @property {Object} error + * The error result of the operation in case of failure or cancellation. + * + * This object should have the same structure as [Status]{@link google.rpc.Status} + * + * @property {Object} response + * The normal response of the operation in case of success. If the original + * method returns no data on success, such as `Delete`, the response is + * `google.protobuf.Empty`. If the original method is standard + * `Get`/`Create`/`Update`, the response should be the resource. For other + * methods, the response should have the type `XxxResponse`, where `Xxx` + * is the original method name. For example, if the original method name + * is `TakeSnapshot()`, the inferred response type is + * `TakeSnapshotResponse`. + * + * This object should have the same structure as [Any]{@link google.protobuf.Any} + * + * @typedef Operation + * @memberof google.longrunning + * @see [google.longrunning.Operation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/longrunning/operations.proto} + */ +const Operation = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; \ No newline at end of file diff --git a/packages/google-cloud-documentai/src/v1beta1/doc/google/protobuf/doc_any.js b/packages/google-cloud-documentai/src/v1beta1/doc/google/protobuf/doc_any.js new file mode 100644 index 00000000000..cdd2fc80e49 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta1/doc/google/protobuf/doc_any.js @@ -0,0 +1,137 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Note: this file is purely for documentation. Any contents are not expected +// to be loaded as the JS file. + +/** + * `Any` contains an arbitrary serialized protocol buffer message along with a + * URL that describes the type of the serialized message. + * + * Protobuf library provides support to pack/unpack Any values in the form + * of utility functions or additional generated methods of the Any type. + * + * Example 1: Pack and unpack a message in C++. + * + * Foo foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&foo)) { + * ... + * } + * + * Example 2: Pack and unpack a message in Java. + * + * Foo foo = ...; + * Any any = Any.pack(foo); + * ... + * if (any.is(Foo.class)) { + * foo = any.unpack(Foo.class); + * } + * + * Example 3: Pack and unpack a message in Python. + * + * foo = Foo(...) + * any = Any() + * any.Pack(foo) + * ... + * if any.Is(Foo.DESCRIPTOR): + * any.Unpack(foo) + * ... + * + * Example 4: Pack and unpack a message in Go + * + * foo := &pb.Foo{...} + * any, err := ptypes.MarshalAny(foo) + * ... + * foo := &pb.Foo{} + * if err := ptypes.UnmarshalAny(any, foo); err != nil { + * ... + * } + * + * The pack methods provided by protobuf library will by default use + * 'type.googleapis.com/full.type.name' as the type URL and the unpack + * methods only use the fully qualified type name after the last '/' + * in the type URL, for example "foo.bar.com/x/y.z" will yield type + * name "y.z". + * + * + * # JSON + * + * The JSON representation of an `Any` value uses the regular + * representation of the deserialized, embedded message, with an + * additional field `@type` which contains the type URL. Example: + * + * package google.profile; + * message Person { + * string first_name = 1; + * string last_name = 2; + * } + * + * { + * "@type": "type.googleapis.com/google.profile.Person", + * "firstName": , + * "lastName": + * } + * + * If the embedded message type is well-known and has a custom JSON + * representation, that representation will be embedded adding a field + * `value` which holds the custom JSON in addition to the `@type` + * field. Example (for message google.protobuf.Duration): + * + * { + * "@type": "type.googleapis.com/google.protobuf.Duration", + * "value": "1.212s" + * } + * + * @property {string} typeUrl + * A URL/resource name that uniquely identifies the type of the serialized + * protocol buffer message. This string must contain at least + * one "/" character. The last segment of the URL's path must represent + * the fully qualified name of the type (as in + * `path/google.protobuf.Duration`). The name should be in a canonical form + * (e.g., leading "." is not accepted). + * + * In practice, teams usually precompile into the binary all types that they + * expect it to use in the context of Any. However, for URLs which use the + * scheme `http`, `https`, or no scheme, one can optionally set up a type + * server that maps type URLs to message definitions as follows: + * + * * If no scheme is provided, `https` is assumed. + * * An HTTP GET on the URL must yield a google.protobuf.Type + * value in binary format, or produce an error. + * * Applications are allowed to cache lookup results based on the + * URL, or have them precompiled into a binary to avoid any + * lookup. Therefore, binary compatibility needs to be preserved + * on changes to types. (Use versioned type names to manage + * breaking changes.) + * + * Note: this functionality is not currently available in the official + * protobuf release, and it is not used for type URLs beginning with + * type.googleapis.com. + * + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + * + * @property {Buffer} value + * Must be a valid serialized protocol buffer of the above specified type. + * + * @typedef Any + * @memberof google.protobuf + * @see [google.protobuf.Any definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/any.proto} + */ +const Any = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; \ No newline at end of file diff --git a/packages/google-cloud-documentai/src/v1beta1/doc/google/rpc/doc_status.js b/packages/google-cloud-documentai/src/v1beta1/doc/google/rpc/doc_status.js new file mode 100644 index 00000000000..fc4b5be93f0 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta1/doc/google/rpc/doc_status.js @@ -0,0 +1,92 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Note: this file is purely for documentation. Any contents are not expected +// to be loaded as the JS file. + +/** + * The `Status` type defines a logical error model that is suitable for different + * programming environments, including REST APIs and RPC APIs. It is used by + * [gRPC](https://github.com/grpc). The error model is designed to be: + * + * - Simple to use and understand for most users + * - Flexible enough to meet unexpected needs + * + * # Overview + * + * The `Status` message contains three pieces of data: error code, error message, + * and error details. The error code should be an enum value of + * google.rpc.Code, but it may accept additional error codes if needed. The + * error message should be a developer-facing English message that helps + * developers *understand* and *resolve* the error. If a localized user-facing + * error message is needed, put the localized message in the error details or + * localize it in the client. The optional error details may contain arbitrary + * information about the error. There is a predefined set of error detail types + * in the package `google.rpc` that can be used for common error conditions. + * + * # Language mapping + * + * The `Status` message is the logical representation of the error model, but it + * is not necessarily the actual wire format. When the `Status` message is + * exposed in different client libraries and different wire protocols, it can be + * mapped differently. For example, it will likely be mapped to some exceptions + * in Java, but more likely mapped to some error codes in C. + * + * # Other uses + * + * The error model and the `Status` message can be used in a variety of + * environments, either with or without APIs, to provide a + * consistent developer experience across different environments. + * + * Example uses of this error model include: + * + * - Partial errors. If a service needs to return partial errors to the client, + * it may embed the `Status` in the normal response to indicate the partial + * errors. + * + * - Workflow errors. A typical workflow has multiple steps. Each step may + * have a `Status` message for error reporting. + * + * - Batch operations. If a client uses batch request and batch response, the + * `Status` message should be used directly inside batch response, one for + * each error sub-response. + * + * - Asynchronous operations. If an API call embeds asynchronous operation + * results in its response, the status of those operations should be + * represented directly using the `Status` message. + * + * - Logging. If some API errors are stored in logs, the message `Status` could + * be used directly after any stripping needed for security/privacy reasons. + * + * @property {number} code + * The status code, which should be an enum value of google.rpc.Code. + * + * @property {string} message + * A developer-facing error message, which should be in English. Any + * user-facing error message should be localized and sent in the + * google.rpc.Status.details field, or localized by the client. + * + * @property {Object[]} details + * A list of messages that carry the error details. There is a common set of + * message types for APIs to use. + * + * This object should have the same structure as [Any]{@link google.protobuf.Any} + * + * @typedef Status + * @memberof google.rpc + * @see [google.rpc.Status definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto} + */ +const Status = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; \ No newline at end of file diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.js b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.js new file mode 100644 index 00000000000..2f2b6fc3e01 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.js @@ -0,0 +1,353 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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'; + +const gapicConfig = require('./document_understanding_service_client_config.json'); +const gax = require('google-gax'); +const path = require('path'); + +const VERSION = require('../../package.json').version; + +/** + * Service to parse structured information from unstructured or semi-structured + * documents using state-of-the-art Google AI such as natural language, + * computer vision, and translation. + * + * @class + * @memberof v1beta1 + */ +class DocumentUnderstandingServiceClient { + /** + * Construct an instance of DocumentUnderstandingServiceClient. + * + * @param {object} [options] - The configuration object. See the subsequent + * parameters for more details. + * @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 {function} [options.promise] - Custom promise module to use instead + * of native Promises. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + */ + constructor(opts) { + opts = opts || {}; + this._descriptors = {}; + + if (global.isBrowser) { + // If we're in browser, we use gRPC fallback. + opts.fallback = true; + } + + // If we are in browser, we are already using fallback because of the + // "browser" field in package.json. + // But if we were explicitly requested to use fallback, let's do it now. + const gaxModule = !global.isBrowser && opts.fallback ? gax.fallback : gax; + + const servicePath = + opts.servicePath || opts.apiEndpoint || this.constructor.servicePath; + + // Ensure that options include the service address and port. + opts = Object.assign( + { + clientConfig: {}, + port: this.constructor.port, + servicePath, + }, + opts + ); + + // Create a `gaxGrpc` object, with any grpc-specific options + // sent to the client. + opts.scopes = this.constructor.scopes; + const gaxGrpc = new gaxModule.GrpcClient(opts); + + // Save the auth object to the client, for use by other methods. + this.auth = gaxGrpc.auth; + + // Determine the client header string. + const clientHeader = []; + + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } + clientHeader.push(`gax/${gaxModule.version}`); + if (opts.fallback) { + clientHeader.push(`gl-web/${gaxModule.version}`); + } else { + clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); + } + clientHeader.push(`gapic/${VERSION}`); + 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' + ); + const protos = gaxGrpc.loadProto( + opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath + ); + + const protoFilesRoot = opts.fallback + ? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json')) + : gaxModule.protobuf.loadSync(nodejsProtoPath); + + // 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 = new gaxModule.lro({ + auth: gaxGrpc.auth, + grpc: gaxGrpc.grpc, + }).operationsClient(opts); + + const batchProcessDocumentsResponse = protoFilesRoot.lookup( + 'google.cloud.document.v1beta1.BatchProcessDocumentsResponse' + ); + const batchProcessDocumentsMetadata = protoFilesRoot.lookup( + 'google.cloud.document.v1beta1.OperationMetadata' + ); + + this._descriptors.longrunning = { + batchProcessDocuments: new gaxModule.LongrunningDescriptor( + this.operationsClient, + batchProcessDocumentsResponse.decode.bind( + batchProcessDocumentsResponse + ), + batchProcessDocumentsMetadata.decode.bind(batchProcessDocumentsMetadata) + ), + }; + + // Put together the default options sent with requests. + const defaults = gaxGrpc.constructSettings( + 'google.cloud.document.v1beta1.DocumentUnderstandingService', + gapicConfig, + 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 = {}; + + // Put together the "service stub" for + // google.cloud.document.v1beta1.DocumentUnderstandingService. + const documentUnderstandingServiceStub = gaxGrpc.createStub( + opts.fallback + ? protos.lookupService( + 'google.cloud.document.v1beta1.DocumentUnderstandingService' + ) + : protos.google.cloud.document.v1beta1.DocumentUnderstandingService, + opts + ); + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const documentUnderstandingServiceStubMethods = ['batchProcessDocuments']; + for (const methodName of documentUnderstandingServiceStubMethods) { + const innerCallPromise = documentUnderstandingServiceStub.then( + stub => (...args) => { + return stub[methodName].apply(stub, args); + }, + err => () => { + throw err; + } + ); + this._innerApiCalls[methodName] = gaxModule.createApiCall( + innerCallPromise, + defaults[methodName], + this._descriptors.longrunning[methodName] + ); + } + } + + /** + * The DNS address for this API service. + */ + static get servicePath() { + return 'document.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'document.googleapis.com'; + } + + /** + * The port for this API service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + /** + * Return the project ID used by this class. + * @param {function(Error, string)} callback - the callback to + * be called with the current project Id. + */ + getProjectId(callback) { + return this.auth.getProjectId(callback); + } + + // ------------------- + // -- Service calls -- + // ------------------- + + /** + * LRO endpoint to batch process many documents. + * + * @param {Object} request + * The request object that will be sent. + * @param {Object[]} request.requests + * Individual requests for each document. + * + * This object should have the same structure as [ProcessDocumentRequest]{@link google.cloud.document.v1beta1.ProcessDocumentRequest} + * @param {string} [request.parent] + * Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no location is specified, a region will be chosen automatically. + * @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/interfaces/CallOptions.html} 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 a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const document = require('document.v1beta1'); + * + * const client = new document.v1beta1.DocumentUnderstandingServiceClient({ + * // optional auth parameters. + * }); + * + * const requests = []; + * + * // Handle the operation using the promise pattern. + * client.batchProcessDocuments({requests: requests}) + * .then(responses => { + * const [operation, initialApiResponse] = responses; + * + * // Operation#promise starts polling for the completion of the LRO. + * return operation.promise(); + * }) + * .then(responses => { + * const result = responses[0]; + * const metadata = responses[1]; + * const finalApiResponse = responses[2]; + * }) + * .catch(err => { + * console.error(err); + * }); + * + * const requests = []; + * + * // Handle the operation using the event emitter pattern. + * client.batchProcessDocuments({requests: requests}) + * .then(responses => { + * const [operation, initialApiResponse] = responses; + * + * // Adding a listener for the "complete" event starts polling for the + * // completion of the operation. + * operation.on('complete', (result, metadata, finalApiResponse) => { + * // doSomethingWith(result); + * }); + * + * // Adding a listener for the "progress" event causes the callback to be + * // called on any change in metadata when the operation is polled. + * operation.on('progress', (metadata, apiResponse) => { + * // doSomethingWith(metadata) + * }); + * + * // Adding a listener for the "error" event handles any errors found during polling. + * operation.on('error', err => { + * // throw(err); + * }); + * }) + * .catch(err => { + * console.error(err); + * }); + * + * const requests = []; + * + * // Handle the operation using the await pattern. + * const [operation] = await client.batchProcessDocuments({requests: requests}); + * + * const [response] = await operation.promise(); + */ + batchProcessDocuments(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + 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, + }); + + return this._innerApiCalls.batchProcessDocuments( + request, + options, + callback + ); + } +} + +module.exports = DocumentUnderstandingServiceClient; diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client_config.json b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client_config.json new file mode 100644 index 00000000000..e5a54bb9b4d --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.document.v1beta1.DocumentUnderstandingService": { + "retry_codes": { + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "non_idempotent": [] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 20000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 20000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "BatchProcessDocuments": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_proto_list.json b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_proto_list.json new file mode 100644 index 00000000000..7281292ab8d --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/document/v1beta1/document_understanding.proto" +] diff --git a/packages/google-cloud-documentai/src/v1beta1/index.js b/packages/google-cloud-documentai/src/v1beta1/index.js new file mode 100644 index 00000000000..faf0aeae1ae --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta1/index.js @@ -0,0 +1,19 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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'; + +const DocumentUnderstandingServiceClient = require('./document_understanding_service_client'); + +module.exports.DocumentUnderstandingServiceClient = DocumentUnderstandingServiceClient; diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata new file mode 100644 index 00000000000..c477252d6d3 --- /dev/null +++ b/packages/google-cloud-documentai/synth.metadata @@ -0,0 +1,39 @@ +{ + "updateTime": "2019-09-12T00:21:07.274473Z", + "sources": [ + { + "generator": { + "name": "artman", + "version": "0.36.2", + "dockerImage": "googleapis/artman@sha256:0e6f3a668cd68afc768ecbe08817cf6e56a0e64fcbdb1c58c3b97492d12418a1" + } + }, + { + "git": { + "name": "googleapis-private", + "remote": "git@github.com:googleapis/googleapis-private.git", + "sha": "908d03b76ca97370420bd23a282847f0ad175e6d", + "internalRef": "267478864" + } + }, + { + "template": { + "name": "node_library", + "origin": "synthtool.gcp", + "version": "2019.5.2" + } + } + ], + "destinations": [ + { + "client": { + "source": "googleapis-private", + "apiName": "document", + "apiVersion": "v1beta1", + "language": "nodejs", + "generator": "gapic", + "config": "google/cloud/document/artman_document_v1beta1.yaml" + } + } + ] +} \ No newline at end of file diff --git a/packages/google-cloud-documentai/synth.py b/packages/google-cloud-documentai/synth.py index 735f273d0ea..2577d772802 100644 --- a/packages/google-cloud-documentai/synth.py +++ b/packages/google-cloud-documentai/synth.py @@ -22,12 +22,13 @@ # run the gapic generator gapic = gcp.GAPICGenerator() -versions = ['CHANGE-ME'] +versions = ['v1beta1'] for version in versions: library = gapic.node_library( 'document', - version) - s.copy(library, excludes=[]) + version, + private=True) + s.copy(library, excludes=['README.md', 'package.json']) # Copy common templates common_templates = gcp.CommonTemplates() diff --git a/packages/google-cloud-documentai/system-test/.eslintrc.yml b/packages/google-cloud-documentai/system-test/.eslintrc.yml new file mode 100644 index 00000000000..e28757c0a59 --- /dev/null +++ b/packages/google-cloud-documentai/system-test/.eslintrc.yml @@ -0,0 +1,3 @@ +--- +env: + mocha: true \ No newline at end of file diff --git a/packages/google-cloud-documentai/system-test/test.js b/packages/google-cloud-documentai/system-test/test.js new file mode 100644 index 00000000000..c0b1409bd83 --- /dev/null +++ b/packages/google-cloud-documentai/system-test/test.js @@ -0,0 +1,27 @@ +/** + * Copyright 2019, Google, Inc. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +'use strict'; + +const {assert} = require('chai'); + +describe('document-ai', () => { + it('', async () => { + const {DocumentUnderstandingServiceClient} = require('../'); + const client = new DocumentUnderstandingServiceClient(); + // TODO: write sample here that demonstrates batch processing of documents. + assert.ok(client); + }); +}); diff --git a/packages/google-cloud-documentai/test/.eslintrc.yml b/packages/google-cloud-documentai/test/.eslintrc.yml new file mode 100644 index 00000000000..8568e39cdbe --- /dev/null +++ b/packages/google-cloud-documentai/test/.eslintrc.yml @@ -0,0 +1,5 @@ +--- +env: + mocha: true +rules: + no-unused-vars: off \ No newline at end of file diff --git a/packages/google-cloud-documentai/test/gapic-v1beta1.js b/packages/google-cloud-documentai/test/gapic-v1beta1.js new file mode 100644 index 00000000000..2262d120050 --- /dev/null +++ b/packages/google-cloud-documentai/test/gapic-v1beta1.js @@ -0,0 +1,180 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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'; + +const assert = require('assert'); + +const documentModule = require('../src'); + +const FAKE_STATUS_CODE = 1; +const error = new Error(); +error.code = FAKE_STATUS_CODE; + +describe('DocumentUnderstandingServiceClient', () => { + it('has servicePath', () => { + const servicePath = + documentModule.v1beta1.DocumentUnderstandingServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + documentModule.v1beta1.DocumentUnderstandingServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = documentModule.v1beta1.DocumentUnderstandingServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no options', () => { + const client = new documentModule.v1beta1.DocumentUnderstandingServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new documentModule.v1beta1.DocumentUnderstandingServiceClient( + {fallback: true} + ); + assert(client); + }); + + describe('batchProcessDocuments', function() { + it('invokes batchProcessDocuments without error', done => { + const client = new documentModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + + // Mock request + const requests = []; + const request = { + requests: requests, + }; + + // Mock response + const expectedResponse = {}; + + // Mock Grpc layer + client._innerApiCalls.batchProcessDocuments = mockLongRunningGrpcMethod( + request, + expectedResponse + ); + + client + .batchProcessDocuments(request) + .then(responses => { + const operation = responses[0]; + return operation.promise(); + }) + .then(responses => { + assert.deepStrictEqual(responses[0], expectedResponse); + done(); + }) + .catch(err => { + done(err); + }); + }); + + it('invokes batchProcessDocuments with error', done => { + const client = new documentModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + + // Mock request + const requests = []; + const request = { + requests: requests, + }; + + // Mock Grpc layer + client._innerApiCalls.batchProcessDocuments = mockLongRunningGrpcMethod( + request, + null, + error + ); + + client + .batchProcessDocuments(request) + .then(responses => { + const operation = responses[0]; + return operation.promise(); + }) + .then(() => { + assert.fail(); + }) + .catch(err => { + assert(err instanceof Error); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + done(); + }); + }); + + it('has longrunning decoder functions', () => { + const client = new documentModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert( + client._descriptors.longrunning.batchProcessDocuments + .responseDecoder instanceof Function + ); + assert( + client._descriptors.longrunning.batchProcessDocuments + .metadataDecoder instanceof Function + ); + }); + }); +}); + +function mockSimpleGrpcMethod(expectedRequest, response, error) { + return function(actualRequest, options, callback) { + assert.deepStrictEqual(actualRequest, expectedRequest); + if (error) { + callback(error); + } else if (response) { + callback(null, response); + } else { + callback(null); + } + }; +} + +function mockLongRunningGrpcMethod(expectedRequest, response, error) { + return request => { + assert.deepStrictEqual(request, expectedRequest); + const mockOperation = { + promise: function() { + return new Promise((resolve, reject) => { + if (error) { + reject(error); + } else { + resolve([response]); + } + }); + }, + }; + return Promise.resolve([mockOperation]); + }; +} diff --git a/packages/google-cloud-documentai/webpack.config.js b/packages/google-cloud-documentai/webpack.config.js new file mode 100644 index 00000000000..50e5d798ff3 --- /dev/null +++ b/packages/google-cloud-documentai/webpack.config.js @@ -0,0 +1,46 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 = { + entry: './src/browser.js', + output: { + library: 'document', + filename: './document.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + extensions: ['.js', '.json'], + }, + module: { + rules: [ + { + 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 8804e5cd534f7c417710bfb41ebf7b621fb5ac3b Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Wed, 6 Nov 2019 11:16:27 -0800 Subject: [PATCH 003/213] feat!: initial generation of beta client (#5) --- .../google-cloud-documentai/.eslintignore | 1 + packages/google-cloud-documentai/.jsdoc.js | 2 +- packages/google-cloud-documentai/.nycrc | 1 - .../.repo-metadata.json | 12 +- .../google-cloud-documentai/CONTRIBUTING.md | 10 + packages/google-cloud-documentai/README.md | 21 +- .../linkinator.config.json | 8 + packages/google-cloud-documentai/package.json | 10 +- .../cloud/documentai/v1beta1/document.proto | 446 + .../v1beta1/document_understanding.proto | 299 + .../cloud/documentai/v1beta1/geometry.proto | 55 + .../protos/protos.d.ts | 6710 ++++++ .../google-cloud-documentai/protos/protos.js | 17012 ++++++++++++++++ .../protos/protos.json | 79 +- .../google-cloud-documentai/samples/README.md | 2 +- .../samples/package.json | 2 +- .../samples/quickstart.js | 2 +- packages/google-cloud-documentai/src/index.js | 18 +- .../v1beta1/doc_document_understanding.js | 425 + .../cloud/documentai/v1beta1/doc_geometry.js | 74 + .../src/v1beta1/doc/google/rpc/doc_status.js | 31 +- .../document_understanding_service_client.js | 24 +- ...t_understanding_service_client_config.json | 2 +- ...ment_understanding_service_proto_list.json | 2 +- .../google-cloud-documentai/synth.metadata | 22 +- packages/google-cloud-documentai/synth.py | 5 +- .../test/gapic-v1beta1.js | 19 +- .../google-cloud-documentai/webpack.config.js | 4 +- 28 files changed, 25194 insertions(+), 104 deletions(-) create mode 100644 packages/google-cloud-documentai/linkinator.config.json create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document.proto create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document_understanding.proto create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/geometry.proto create mode 100644 packages/google-cloud-documentai/protos/protos.d.ts create mode 100644 packages/google-cloud-documentai/protos/protos.js create mode 100644 packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/documentai/v1beta1/doc_document_understanding.js create mode 100644 packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/documentai/v1beta1/doc_geometry.js diff --git a/packages/google-cloud-documentai/.eslintignore b/packages/google-cloud-documentai/.eslintignore index f0c7aead4bf..09b31fe735a 100644 --- a/packages/google-cloud-documentai/.eslintignore +++ b/packages/google-cloud-documentai/.eslintignore @@ -2,3 +2,4 @@ src/**/doc/* build/ docs/ +protos/ diff --git a/packages/google-cloud-documentai/.jsdoc.js b/packages/google-cloud-documentai/.jsdoc.js index e1d4cf236d3..73b975bd747 100644 --- a/packages/google-cloud-documentai/.jsdoc.js +++ b/packages/google-cloud-documentai/.jsdoc.js @@ -39,7 +39,7 @@ module.exports = { copyright: 'Copyright 2018 Google, LLC.', includeDate: false, sourceFiles: false, - systemName: '@google-cloud/document', + systemName: '@google-cloud/documentai', theme: 'lumen' }, markdown: { diff --git a/packages/google-cloud-documentai/.nycrc b/packages/google-cloud-documentai/.nycrc index 23e322204ec..367688844eb 100644 --- a/packages/google-cloud-documentai/.nycrc +++ b/packages/google-cloud-documentai/.nycrc @@ -10,7 +10,6 @@ "**/docs", "**/samples", "**/scripts", - "**/src/**/v*/**/*.js", "**/protos", "**/test", ".jsdoc.js", diff --git a/packages/google-cloud-documentai/.repo-metadata.json b/packages/google-cloud-documentai/.repo-metadata.json index c493e4148aa..0ecb51b49de 100644 --- a/packages/google-cloud-documentai/.repo-metadata.json +++ b/packages/google-cloud-documentai/.repo-metadata.json @@ -1,13 +1,13 @@ { - "name": "document", + "name": "documentai", "name_pretty": "Document AI", - "product_documentation": "https://cloud.google.com/document/docs/", - "client_documentation": "https://googleapis.dev/nodejs/document/latest/index.html", + "product_documentation": "https://cloud.google.com/document-understanding/docs/", + "client_documentation": "https://googleapis.dev/nodejs/documentai/latest/index.html", "issue_tracker": "", - "release_level": "alpha", + "release_level": "beta", "language": "nodejs", "repo": "googleapis/nodejs-document-ai", - "distribution_name": "@google-cloud/document", - "api_id": "document.googleapis.com", + "distribution_name": "@google-cloud/documentai", + "api_id": "documentai.googleapis.com", "requires_billing": true } \ No newline at end of file diff --git a/packages/google-cloud-documentai/CONTRIBUTING.md b/packages/google-cloud-documentai/CONTRIBUTING.md index 78aaa61b269..f6c4cf010e3 100644 --- a/packages/google-cloud-documentai/CONTRIBUTING.md +++ b/packages/google-cloud-documentai/CONTRIBUTING.md @@ -34,6 +34,7 @@ accept your pull requests. 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. ## Running the tests @@ -46,8 +47,17 @@ accept your pull requests. 1. Run the tests: + # Run unit tests. npm test + # Run sample integration tests. + gcloud auth application-default login + npm run samples-test + + # Run all system tests. + gcloud auth application-default login + npm run system-test + 1. Lint (and maybe fix) any changes: npm run fix diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index 567ff87889b..6543031be22 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -4,8 +4,8 @@ # [Document AI: Node.js Client](https://github.com/googleapis/nodejs-document-ai) -[![release level](https://img.shields.io/badge/release%20level-alpha-orange.svg?style=flat)](https://cloud.google.com/terms/launch-stages) -[![npm version](https://img.shields.io/npm/v/@google-cloud/document.svg)](https://www.npmjs.org/package/@google-cloud/document) +[![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/documentai.svg)](https://www.npmjs.org/package/@google-cloud/documentai) [![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-document-ai/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-document-ai) @@ -48,7 +48,7 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained]. ### Installing the client library ```bash -npm install @google-cloud/document +npm install @google-cloud/documentai ``` @@ -58,7 +58,7 @@ npm install @google-cloud/document async function batchProcessDocument() { const { DocumentUnderstandingServiceClient, - } = require('@google-cloud/document'); + } = require('@google-cloud/documentai'); const client = new DocumentUnderstandingServiceClient(); // TODO: write sample here that demonstrates batch processing of documents. console.info(client); @@ -88,10 +88,11 @@ 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. -This library is considered to be in **alpha**. This means it is still a -work-in-progress and under active development. Any release is subject to -backwards-incompatible changes at any time. @@ -109,10 +110,10 @@ Apache Version 2.0 See [LICENSE](https://github.com/googleapis/nodejs-document-ai/blob/master/LICENSE) -[client-docs]: https://googleapis.dev/nodejs/document/latest/index.html -[product-docs]: https://cloud.google.com/document/docs/ +[client-docs]: https://googleapis.dev/nodejs/documentai/latest/index.html +[product-docs]: https://cloud.google.com/document-understanding/docs/ [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=document.googleapis.com +[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=documentai.googleapis.com [auth]: https://cloud.google.com/docs/authentication/getting-started diff --git a/packages/google-cloud-documentai/linkinator.config.json b/packages/google-cloud-documentai/linkinator.config.json new file mode 100644 index 00000000000..84dab7fcf7d --- /dev/null +++ b/packages/google-cloud-documentai/linkinator.config.json @@ -0,0 +1,8 @@ + +{ + "recurse": true, + "skip": [ + "googleapis.dev.*", + "https://www.npmjs.org/package/.*" + ] +} diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 294b0ab9839..837414ad9a3 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,7 +1,7 @@ { - "name": "@google-cloud/document", + "name": "@google-cloud/documentai", "repository": "googleapis/nodejs-document-ai", - "version": "1.0.0", + "version": "0.0.1", "author": "Google LLC", "description": "Cloud Document API client for Node.js", "main": "src/index.js", @@ -35,13 +35,13 @@ "lint": "eslint .", "test": "c8 mocha test/*.js", "predocs-test": "npm run docs", - "docs-test": "linkinator docs -r --skip 'www.npmjs.org/package/@google-cloud/web-risk'", + "docs-test": "linkinator docs", "samples-test": "cd samples/ && npm link ../ && c8 npm test && cd ../", "system-test": "c8 mocha --timeout=5000 system-test/*.js" }, "license": "Apache-2.0", "devDependencies": { - "c8": "^5.0.1", + "c8": "^6.0.1", "chai": "^4.2.0", "eslint": "^6.3.0", "eslint-config-prettier": "^6.3.0", @@ -49,7 +49,7 @@ "eslint-plugin-prettier": "^3.0.1", "jsdoc": "^3.6.2", "jsdoc-fresh": "^1.0.1", - "linkinator": "^1.4.0", + "linkinator": "^1.6.3", "mocha": "^6.1.4", "null-loader": "^3.0.0", "prettier": "^1.17.0", diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document.proto new file mode 100644 index 00000000000..1303c32dd2b --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document.proto @@ -0,0 +1,446 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.documentai.v1beta1; + +import "google/api/annotations.proto"; +import "google/cloud/documentai/v1beta1/geometry.proto"; +import "google/rpc/status.proto"; +import "google/type/color.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta1;documentai"; +option java_multiple_files = true; +option java_outer_classname = "DocumentProto"; +option java_package = "com.google.cloud.documentai.v1beta1"; + +// Document represents the canonical document resource in Document Understanding +// AI. +// It is an interchange format that provides insights into documents and allows +// for collaboration between users and Document Understanding AI to iterate and +// optimize for quality. +message Document { + // For a large document, sharding may be performed to produce several + // document shards. Each document shard contains this field to detail which + // shard it is. + message ShardInfo { + // The 0-based index of this shard. + int64 shard_index = 1; + + // Total number of shards. + int64 shard_count = 2; + + // The index of the first character in + // [Document.text][google.cloud.documentai.v1beta1.Document.text] in the + // overall document global text. + int64 text_offset = 3; + } + + // Annotation for common text style attributes. This adheres to CSS + // conventions as much as possible. + message Style { + // Font size with unit. + message FontSize { + // Font size for the text. + float size = 1; + + // Unit for the font size. Follows CSS naming (in, px, pt, etc.). + string unit = 2; + } + + // Text anchor indexing into the + // [Document.text][google.cloud.documentai.v1beta1.Document.text]. + TextAnchor text_anchor = 1; + + // Text color. + google.type.Color color = 2; + + // Text background color. + google.type.Color background_color = 3; + + // Font weight. Possible values are normal, bold, bolder, and lighter. + // https://www.w3schools.com/cssref/pr_font_weight.asp + string font_weight = 4; + + // Text style. Possible values are normal, italic, and oblique. + // https://www.w3schools.com/cssref/pr_font_font-style.asp + string text_style = 5; + + // Text decoration. Follows CSS standard. + // + // https://www.w3schools.com/cssref/pr_text_text-decoration.asp + string text_decoration = 6; + + // Font size. + FontSize font_size = 7; + } + + // A page in a [Document][google.cloud.documentai.v1beta1.Document]. + message Page { + // Dimension for the page. + message Dimension { + // Page width. + float width = 1; + + // Page height. + float height = 2; + + // Dimension unit. + string unit = 3; + } + + // Visual element describing a layout unit on a page. + message Layout { + // Detected human reading orientation. + enum Orientation { + // Unspecified orientation. + ORIENTATION_UNSPECIFIED = 0; + + // Orientation is aligned with page up. + PAGE_UP = 1; + + // Orientation is aligned with page right. + // Turn the head 90 degrees clockwise from upright to read. + PAGE_RIGHT = 2; + + // Orientation is aligned with page down. + // Turn the head 180 degrees from upright to read. + PAGE_DOWN = 3; + + // Orientation is aligned with page left. + // Turn the head 90 degrees counterclockwise from upright to read. + PAGE_LEFT = 4; + } + + // Text anchor indexing into the + // [Document.text][google.cloud.documentai.v1beta1.Document.text]. + TextAnchor text_anchor = 1; + + // Confidence of the current + // [Layout][google.cloud.documentai.v1beta1.Document.Page.Layout] within + // context of the object this layout is for. e.g. confidence can be for a + // single token, a table, a visual element, etc. depending on context. + // Range [0, 1]. + float confidence = 2; + + // The bounding polygon for the + // [Layout][google.cloud.documentai.v1beta1.Document.Page.Layout]. + BoundingPoly bounding_poly = 3; + + // Detected orientation for the + // [Layout][google.cloud.documentai.v1beta1.Document.Page.Layout]. + Orientation orientation = 4; + } + + // A block has a set of lines (collected into paragraphs) that have a + // common line-spacing and orientation. + message Block { + // [Layout][google.cloud.documentai.v1beta1.Document.Page.Layout] for + // [Block][google.cloud.documentai.v1beta1.Document.Page.Block]. + Layout layout = 1; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 2; + } + + // A collection of lines that a human would perceive as a paragraph. + message Paragraph { + // [Layout][google.cloud.documentai.v1beta1.Document.Page.Layout] for + // [Paragraph][google.cloud.documentai.v1beta1.Document.Page.Paragraph]. + Layout layout = 1; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 2; + } + + // A collection of tokens that a human would perceive as a line. + // Does not cross column boundaries, can be horizontal, vertical, etc. + message Line { + // [Layout][google.cloud.documentai.v1beta1.Document.Page.Layout] for + // [Line][google.cloud.documentai.v1beta1.Document.Page.Line]. + Layout layout = 1; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 2; + } + + // A detected token. + message Token { + // Detected break at the end of a + // [Token][google.cloud.documentai.v1beta1.Document.Page.Token]. + message DetectedBreak { + // Enum to denote the type of break found. + enum Type { + // Unspecified break type. + TYPE_UNSPECIFIED = 0; + + // A single whitespace. + SPACE = 1; + + // A wider whitespace. + WIDE_SPACE = 2; + + // A hyphen that indicates that a token has been split across lines. + HYPHEN = 3; + } + + // Detected break type. + Type type = 1; + } + + // [Layout][google.cloud.documentai.v1beta1.Document.Page.Layout] for + // [Token][google.cloud.documentai.v1beta1.Document.Page.Token]. + Layout layout = 1; + + // Detected break at the end of a + // [Token][google.cloud.documentai.v1beta1.Document.Page.Token]. + DetectedBreak detected_break = 2; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 3; + } + + // Detected non-text visual elements e.g. checkbox, signature etc. on the + // page. + message VisualElement { + // [Layout][google.cloud.documentai.v1beta1.Document.Page.Layout] for + // [Token][google.cloud.documentai.v1beta1.Document.Page.Token]. + Layout layout = 1; + + // Type of the + // [VisualElement][google.cloud.documentai.v1beta1.Document.Page.VisualElement]. + string type = 2; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 3; + } + + // A table representation similar to HTML table structure. + message Table { + // A row of table cells. + message TableRow { + // Cells that make up this row. + repeated TableCell cells = 1; + } + + // A cell representation inside the table. + message TableCell { + // [Layout][google.cloud.documentai.v1beta1.Document.Page.Layout] for + // [TableCell][google.cloud.documentai.v1beta1.Document.Page.Table.TableCell]. + Layout layout = 1; + + // How many rows this cell spans. + int32 row_span = 2; + + // How many columns this cell spans. + int32 col_span = 3; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 4; + } + + // [Layout][google.cloud.documentai.v1beta1.Document.Page.Layout] for + // [Table][google.cloud.documentai.v1beta1.Document.Page.Table]. + Layout layout = 1; + + // Header rows of the table. + repeated TableRow header_rows = 2; + + // Body rows of the table. + repeated TableRow body_rows = 3; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 4; + } + + // A form field detected on the page. + message FormField { + // [Layout][google.cloud.documentai.v1beta1.Document.Page.Layout] for the + // [FormField][google.cloud.documentai.v1beta1.Document.Page.FormField] + // name. e.g. `Address`, `Email`, `Grand total`, `Phone number`, etc. + Layout field_name = 1; + + // [Layout][google.cloud.documentai.v1beta1.Document.Page.Layout] for the + // [FormField][google.cloud.documentai.v1beta1.Document.Page.FormField] + // value. + Layout field_value = 2; + + // A list of detected languages for name together with confidence. + repeated DetectedLanguage name_detected_languages = 3; + + // A list of detected languages for value together with confidence. + repeated DetectedLanguage value_detected_languages = 4; + } + + // Detected language for a structural component. + message DetectedLanguage { + // The BCP-47 language code, such as "en-US" or "sr-Latn". For more + // information, see + // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + string language_code = 1; + + // Confidence of detected language. Range [0, 1]. + float confidence = 2; + } + + // 1-based index for current + // [Page][google.cloud.documentai.v1beta1.Document.Page] in a parent + // [Document][google.cloud.documentai.v1beta1.Document]. Useful when a page + // is taken out of a [Document][google.cloud.documentai.v1beta1.Document] + // for individual processing. + int32 page_number = 1; + + // Physical dimension of the page. + Dimension dimension = 2; + + // [Layout][google.cloud.documentai.v1beta1.Document.Page.Layout] for the + // page. + Layout layout = 3; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 4; + + // A list of visually detected text blocks on the page. + // A block has a set of lines (collected into paragraphs) that have a common + // line-spacing and orientation. + repeated Block blocks = 5; + + // A list of visually detected text paragraphs on the page. + // A collection of lines that a human would perceive as a paragraph. + repeated Paragraph paragraphs = 6; + + // A list of visually detected text lines on the page. + // A collection of tokens that a human would perceive as a line. + repeated Line lines = 7; + + // A list of visually detected tokens on the page. + repeated Token tokens = 8; + + // A list of detected non-text visual elements e.g. checkbox, + // signature etc. on the page. + repeated VisualElement visual_elements = 9; + + // A list of visually detected tables on the page. + repeated Table tables = 10; + + // A list of visually detected form fields on the page. + repeated FormField form_fields = 11; + } + + // A phrase in the text that is a known entity type, such as a person, an + // organization, or location. + message Entity { + // Provenance of the entity. + // Text anchor indexing into the + // [Document.text][google.cloud.documentai.v1beta1.Document.text]. + TextAnchor text_anchor = 1; + + // Entity type from a schema e.g. `Address`. + string type = 2; + + // Text value in the document e.g. `1600 Amphitheatre Pkwy`. + string mention_text = 3; + + // Canonical mention name. This will be a unique value in the entity list + // for this document. + string mention_id = 4; + } + + // Relationship between + // [Entities][google.cloud.documentai.v1beta1.Document.Entity]. + message EntityRelation { + // Subject entity mention_id. + string subject_id = 1; + + // Object entity mention_id. + string object_id = 2; + + // Relationship description. + string relation = 3; + } + + // Text reference indexing into the + // [Document.text][google.cloud.documentai.v1beta1.Document.text]. + message TextAnchor { + // A text segment in the + // [Document.text][google.cloud.documentai.v1beta1.Document.text]. The + // indices may be out of bounds which indicate that the text extends into + // another document shard for large sharded documents. See + // [ShardInfo.text_offset][google.cloud.documentai.v1beta1.Document.ShardInfo.text_offset] + message TextSegment { + // [TextSegment][google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment] + // start UTF-8 char index in the + // [Document.text][google.cloud.documentai.v1beta1.Document.text]. + int64 start_index = 1; + + // [TextSegment][google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment] + // half open end UTF-8 char index in the + // [Document.text][google.cloud.documentai.v1beta1.Document.text]. + int64 end_index = 2; + } + + // The text segments from the + // [Document.text][google.cloud.documentai.v1beta1.Document.text]. + repeated TextSegment text_segments = 1; + } + + // Original source document from the user. + oneof source { + // Currently supports Google Cloud Storage URI of the form + // `gs://bucket_name/object_name`. Object versioning is not supported. + // See [Google Cloud Storage Request + // URIs](https://cloud.google.com/storage/docs/reference-uris) for more + // info. + string uri = 1; + + // Inline document content, represented as a stream of bytes. + // Note: As with all `bytes` fields, protobuffers use a pure binary + // representation, whereas JSON representations use base64. + bytes content = 2; + } + + // An IANA published MIME type (also referred to as media type). For more + // information, see + // https://www.iana.org/assignments/media-types/media-types.xhtml. + string mime_type = 3; + + // UTF-8 encoded text in reading order from the document. + string text = 4; + + // Styles for the + // [Document.text][google.cloud.documentai.v1beta1.Document.text]. + repeated Style text_styles = 5; + + // Visual page layout for the + // [Document][google.cloud.documentai.v1beta1.Document]. + repeated Page pages = 6; + + // A list of entities detected on + // [Document.text][google.cloud.documentai.v1beta1.Document.text]. For + // document shards, entities in this list may cross shard boundaries. + repeated Entity entities = 7; + + // Relationship among + // [Document.entities][google.cloud.documentai.v1beta1.Document.entities]. + repeated EntityRelation entity_relations = 8; + + // Information about the sharding if this document is sharded part of a larger + // document. If the document is not sharded, this message is not specified. + ShardInfo shard_info = 9; + + // Any error that occurred while processing this document. + google.rpc.Status error = 10; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document_understanding.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document_understanding.proto new file mode 100644 index 00000000000..4f8dfb72298 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document_understanding.proto @@ -0,0 +1,299 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.documentai.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/documentai/v1beta1/geometry.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta1;documentai"; +option java_multiple_files = true; +option java_outer_classname = "DocumentAiProto"; +option java_package = "com.google.cloud.documentai.v1beta1"; + +// Service to parse structured information from unstructured or semi-structured +// documents using state-of-the-art Google AI such as natural language, +// computer vision, and translation. +service DocumentUnderstandingService { + option (google.api.default_host) = "documentai.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // LRO endpoint to batch process many documents. + rpc BatchProcessDocuments(BatchProcessDocumentsRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/locations/*}/documents:batchProcess" + body: "*" + additional_bindings { + post: "/v1beta1/{parent=projects/*}/documents:batchProcess" + body: "*" + } + }; + option (google.api.method_signature) = "requests"; + option (google.longrunning.operation_info) = { + response_type: "BatchProcessDocumentsResponse" + metadata_type: "OperationMetadata" + }; + } +} + +// Request to batch process documents as an asynchronous operation. +message BatchProcessDocumentsRequest { + // Required. Individual requests for each document. + repeated ProcessDocumentRequest requests = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Target project and location to make a call. + // + // Format: `projects/{project-id}/locations/{location-id}`. + // + // If no location is specified, a region will be chosen automatically. + string parent = 2; +} + +// Request to process one document. +message ProcessDocumentRequest { + // Required. Information about the input file. + InputConfig input_config = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The desired output location. + OutputConfig output_config = 2 [(google.api.field_behavior) = REQUIRED]; + + // Specifies a known document type for deeper structure detection. Valid + // values are currently "general" and "invoice". If not provided, "general"\ + // is used as default. If any other value is given, the request is rejected. + string document_type = 3; + + // Controls table extraction behavior. If not specified, the system will + // decide reasonable defaults. + TableExtractionParams table_extraction_params = 4; + + // Controls form extraction behavior. If not specified, the system will + // decide reasonable defaults. + FormExtractionParams form_extraction_params = 5; + + // Controls entity extraction behavior. If not specified, the system will + // decide reasonable defaults. + EntityExtractionParams entity_extraction_params = 6; + + // Controls OCR behavior. If not specified, the system will decide reasonable + // defaults. + OcrParams ocr_params = 7; +} + +// Response to an batch document processing request. This is returned in +// the LRO Operation after the operation is complete. +message BatchProcessDocumentsResponse { + // Responses for each individual document. + repeated ProcessDocumentResponse responses = 1; +} + +// Response to a single document processing request. +message ProcessDocumentResponse { + // Information about the input file. This is the same as the corresponding + // input config in the request. + InputConfig input_config = 1; + + // The output location of the parsed responses. The responses are written to + // this location as JSON-serialized `Document` objects. + OutputConfig output_config = 2; +} + +// Parameters to control Optical Character Recognition (OCR) behavior. +message OcrParams { + // List of languages to use for OCR. In most cases, an empty value + // yields the best results since it enables automatic language detection. For + // languages based on the Latin alphabet, setting `language_hints` is not + // needed. In rare cases, when the language of the text in the image is known, + // setting a hint will help get better results (although it will be a + // significant hindrance if the hint is wrong). Document processing returns an + // error if one or more of the specified languages is not one of the + // supported languages. + repeated string language_hints = 1; +} + +// Parameters to control table extraction behavior. +message TableExtractionParams { + // Whether to enable table extraction. + bool enabled = 1; + + // Optional. Table bounding box hints that can be provided to complex cases + // which our algorithm cannot locate the table(s) in. + repeated TableBoundHint table_bound_hints = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Table header hints. The extraction will bias towards producing + // these terms as table headers, which may improve accuracy. + repeated string header_hints = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Model version of the table extraction system. Default is "builtin/stable". + // Specify "builtin/latest" for the latest model. + string model_version = 4; +} + +// A hint for a table bounding box on the page for table parsing. +message TableBoundHint { + // Optional. Page number for multi-paged inputs this hint applies to. If not + // provided, this hint will apply to all pages by default. This value is + // 1-based. + int32 page_number = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Bounding box hint for a table on this page. The coordinates must be + // normalized to [0,1] and the bounding box must be an axis-aligned rectangle. + BoundingPoly bounding_box = 2; +} + +// Parameters to control form extraction behavior. +message FormExtractionParams { + // Whether to enable form extraction. + bool enabled = 1; + + // User can provide pairs of (key text, value type) to improve the parsing + // result. + // + // For example, if a document has a field called "Date" that holds a date + // value and a field called "Amount" that may hold either a currency value + // (e.g., "$500.00") or a simple number value (e.g., "20"), you could use the + // following hints: [ {"key": "Date", value_types: [ "DATE"]}, {"key": + // "Amount", "value_types": [ "PRICE", "NUMBER" ]} ] + // + // If the value type is unknown, but you want to provide hints for the keys, + // you can leave the value_types field blank. e.g. {"key": "Date", + // "value_types": []} + repeated KeyValuePairHint key_value_pair_hints = 2; + + // Model version of the form extraction system. Default is + // "builtin/stable". Specify "builtin/latest" for the latest model. + string model_version = 3; +} + +// User-provided hint for key value pair. +message KeyValuePairHint { + // The key text for the hint. + string key = 1; + + // Type of the value. This is case-insensitive, and could be one of: + // ADDRESS, LOCATION, ORGANIZATION, PERSON, PHONE_NUMBER, + // ID, NUMBER, EMAIL, PRICE, TERMS, DATE, NAME. Types not in this list will + // be ignored. + repeated string value_types = 2; +} + +// Parameters to control entity extraction behavior. +message EntityExtractionParams { + // Whether to enable entity extraction. + bool enabled = 1; + + // Model version of the entity extraction. Default is + // "builtin/stable". Specify "builtin/latest" for the latest model. + string model_version = 2; +} + +// The desired input location and metadata. +message InputConfig { + // Required. + oneof source { + // The Google Cloud Storage location to read the input from. This must be a + // single file. + GcsSource gcs_source = 1; + } + + // Required. Mimetype of the input. Current supported mimetypes are + // application/pdf, image/tiff, and image/gif. + string mime_type = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The desired output location and metadata. +message OutputConfig { + // Required. + oneof destination { + // The Google Cloud Storage location to write the output to. + GcsDestination gcs_destination = 1; + } + + // The max number of pages to include into each output Document shard JSON on + // Google Cloud Storage. + // + // The valid range is [1, 100]. If not specified, the default value is 20. + // + // For example, for one pdf file with 100 pages, 100 parsed pages will be + // produced. If `pages_per_shard` = 20, then 5 Document shard JSON files each + // containing 20 parsed pages will be written under the prefix + // [OutputConfig.gcs_destination.uri][] and suffix pages-x-to-y.json where + // x and y are 1-indexed page numbers. + // + // Example GCS outputs with 157 pages and pages_per_shard = 50: + // + // pages-001-to-050.json + // pages-051-to-100.json + // pages-101-to-150.json + // pages-151-to-157.json + int32 pages_per_shard = 2; +} + +// The Google Cloud Storage location where the input file will be read from. +message GcsSource { + string uri = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The Google Cloud Storage location where the output file will be written to. +message GcsDestination { + string uri = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Contains metadata for the BatchProcessDocuments operation. +message OperationMetadata { + enum State { + // The default value. This value is used if the state is omitted. + STATE_UNSPECIFIED = 0; + + // Request is received. + ACCEPTED = 1; + + // Request operation is waiting for scheduling. + WAITING = 2; + + // Request is being processed. + RUNNING = 3; + + // The batch processing completed successfully. + SUCCEEDED = 4; + + // The batch processing was cancelled. + CANCELLED = 5; + + // The batch processing has failed. + FAILED = 6; + } + + // The state of the current batch processing. + State state = 1; + + // A message providing more details about the current state of processing. + string state_message = 2; + + // The creation time of the operation. + google.protobuf.Timestamp create_time = 3; + + // The last update time of the operation. + google.protobuf.Timestamp update_time = 4; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/geometry.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/geometry.proto new file mode 100644 index 00000000000..9dbe2b78b13 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/geometry.proto @@ -0,0 +1,55 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.documentai.v1beta1; + +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta1;documentai"; +option java_multiple_files = true; +option java_outer_classname = "GeometryProto"; +option java_package = "com.google.cloud.documentai.v1beta1"; + +// A vertex represents a 2D point in the image. +// NOTE: the vertex coordinates are in the same scale as the original image. +message Vertex { + // X coordinate. + int32 x = 1; + + // Y coordinate. + int32 y = 2; +} + +// A vertex represents a 2D point in the image. +// NOTE: the normalized vertex coordinates are relative to the original image +// and range from 0 to 1. +message NormalizedVertex { + // X coordinate. + float x = 1; + + // Y coordinate. + float y = 2; +} + +// A bounding polygon for the detected image annotation. +message BoundingPoly { + // The bounding polygon vertices. + repeated Vertex vertices = 1; + + // The bounding polygon normalized vertices. + repeated NormalizedVertex normalized_vertices = 2; +} diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts new file mode 100644 index 00000000000..ee6f7083871 --- /dev/null +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -0,0 +1,6710 @@ +import * as $protobuf from "protobufjs"; +/** Namespace google. */ +export namespace google { + + /** Namespace cloud. */ + namespace cloud { + + /** Namespace documentai. */ + namespace documentai { + + /** Namespace v1beta1. */ + namespace v1beta1 { + + /** Represents a DocumentUnderstandingService */ + class DocumentUnderstandingService extends $protobuf.rpc.Service { + + /** + * Constructs a new DocumentUnderstandingService 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 DocumentUnderstandingService 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): DocumentUnderstandingService; + + /** + * Calls BatchProcessDocuments. + * @param request BatchProcessDocumentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchProcessDocuments(request: google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest, callback: google.cloud.documentai.v1beta1.DocumentUnderstandingService.BatchProcessDocumentsCallback): void; + + /** + * Calls BatchProcessDocuments. + * @param request BatchProcessDocumentsRequest message or plain object + * @returns Promise + */ + public batchProcessDocuments(request: google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest): Promise; + } + + namespace DocumentUnderstandingService { + + /** + * Callback as used by {@link google.cloud.documentai.v1beta1.DocumentUnderstandingService#batchProcessDocuments}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchProcessDocumentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a BatchProcessDocumentsRequest. */ + interface IBatchProcessDocumentsRequest { + + /** BatchProcessDocumentsRequest requests */ + requests?: (google.cloud.documentai.v1beta1.IProcessDocumentRequest[]|null); + + /** BatchProcessDocumentsRequest parent */ + parent?: (string|null); + } + + /** Represents a BatchProcessDocumentsRequest. */ + class BatchProcessDocumentsRequest implements IBatchProcessDocumentsRequest { + + /** + * Constructs a new BatchProcessDocumentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest); + + /** BatchProcessDocumentsRequest requests. */ + public requests: google.cloud.documentai.v1beta1.IProcessDocumentRequest[]; + + /** BatchProcessDocumentsRequest parent. */ + public parent: string; + + /** + * Creates a new BatchProcessDocumentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchProcessDocumentsRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest): google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest; + + /** + * Encodes the specified BatchProcessDocumentsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.verify|verify} messages. + * @param message BatchProcessDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchProcessDocumentsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.verify|verify} messages. + * @param message BatchProcessDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchProcessDocumentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchProcessDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest; + + /** + * Decodes a BatchProcessDocumentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchProcessDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest; + + /** + * Verifies a BatchProcessDocumentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchProcessDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchProcessDocumentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest; + + /** + * Creates a plain object from a BatchProcessDocumentsRequest message. Also converts values to other types if specified. + * @param message BatchProcessDocumentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchProcessDocumentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProcessDocumentRequest. */ + interface IProcessDocumentRequest { + + /** ProcessDocumentRequest inputConfig */ + inputConfig?: (google.cloud.documentai.v1beta1.IInputConfig|null); + + /** ProcessDocumentRequest outputConfig */ + outputConfig?: (google.cloud.documentai.v1beta1.IOutputConfig|null); + + /** ProcessDocumentRequest documentType */ + documentType?: (string|null); + + /** ProcessDocumentRequest tableExtractionParams */ + tableExtractionParams?: (google.cloud.documentai.v1beta1.ITableExtractionParams|null); + + /** ProcessDocumentRequest formExtractionParams */ + formExtractionParams?: (google.cloud.documentai.v1beta1.IFormExtractionParams|null); + + /** ProcessDocumentRequest entityExtractionParams */ + entityExtractionParams?: (google.cloud.documentai.v1beta1.IEntityExtractionParams|null); + + /** ProcessDocumentRequest ocrParams */ + ocrParams?: (google.cloud.documentai.v1beta1.IOcrParams|null); + } + + /** Represents a ProcessDocumentRequest. */ + class ProcessDocumentRequest implements IProcessDocumentRequest { + + /** + * Constructs a new ProcessDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IProcessDocumentRequest); + + /** ProcessDocumentRequest inputConfig. */ + public inputConfig?: (google.cloud.documentai.v1beta1.IInputConfig|null); + + /** ProcessDocumentRequest outputConfig. */ + public outputConfig?: (google.cloud.documentai.v1beta1.IOutputConfig|null); + + /** ProcessDocumentRequest documentType. */ + public documentType: string; + + /** ProcessDocumentRequest tableExtractionParams. */ + public tableExtractionParams?: (google.cloud.documentai.v1beta1.ITableExtractionParams|null); + + /** ProcessDocumentRequest formExtractionParams. */ + public formExtractionParams?: (google.cloud.documentai.v1beta1.IFormExtractionParams|null); + + /** ProcessDocumentRequest entityExtractionParams. */ + public entityExtractionParams?: (google.cloud.documentai.v1beta1.IEntityExtractionParams|null); + + /** ProcessDocumentRequest ocrParams. */ + public ocrParams?: (google.cloud.documentai.v1beta1.IOcrParams|null); + + /** + * Creates a new ProcessDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ProcessDocumentRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IProcessDocumentRequest): google.cloud.documentai.v1beta1.ProcessDocumentRequest; + + /** + * Encodes the specified ProcessDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentRequest.verify|verify} messages. + * @param message ProcessDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IProcessDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProcessDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentRequest.verify|verify} messages. + * @param message ProcessDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IProcessDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProcessDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProcessDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.ProcessDocumentRequest; + + /** + * Decodes a ProcessDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProcessDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.ProcessDocumentRequest; + + /** + * Verifies a ProcessDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProcessDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProcessDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.ProcessDocumentRequest; + + /** + * Creates a plain object from a ProcessDocumentRequest message. Also converts values to other types if specified. + * @param message ProcessDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.ProcessDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProcessDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BatchProcessDocumentsResponse. */ + interface IBatchProcessDocumentsResponse { + + /** BatchProcessDocumentsResponse responses */ + responses?: (google.cloud.documentai.v1beta1.IProcessDocumentResponse[]|null); + } + + /** Represents a BatchProcessDocumentsResponse. */ + class BatchProcessDocumentsResponse implements IBatchProcessDocumentsResponse { + + /** + * Constructs a new BatchProcessDocumentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse); + + /** BatchProcessDocumentsResponse responses. */ + public responses: google.cloud.documentai.v1beta1.IProcessDocumentResponse[]; + + /** + * Creates a new BatchProcessDocumentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchProcessDocumentsResponse instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse): google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse; + + /** + * Encodes the specified BatchProcessDocumentsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.verify|verify} messages. + * @param message BatchProcessDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchProcessDocumentsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.verify|verify} messages. + * @param message BatchProcessDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchProcessDocumentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchProcessDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse; + + /** + * Decodes a BatchProcessDocumentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchProcessDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse; + + /** + * Verifies a BatchProcessDocumentsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchProcessDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchProcessDocumentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse; + + /** + * Creates a plain object from a BatchProcessDocumentsResponse message. Also converts values to other types if specified. + * @param message BatchProcessDocumentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchProcessDocumentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProcessDocumentResponse. */ + interface IProcessDocumentResponse { + + /** ProcessDocumentResponse inputConfig */ + inputConfig?: (google.cloud.documentai.v1beta1.IInputConfig|null); + + /** ProcessDocumentResponse outputConfig */ + outputConfig?: (google.cloud.documentai.v1beta1.IOutputConfig|null); + } + + /** Represents a ProcessDocumentResponse. */ + class ProcessDocumentResponse implements IProcessDocumentResponse { + + /** + * Constructs a new ProcessDocumentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IProcessDocumentResponse); + + /** ProcessDocumentResponse inputConfig. */ + public inputConfig?: (google.cloud.documentai.v1beta1.IInputConfig|null); + + /** ProcessDocumentResponse outputConfig. */ + public outputConfig?: (google.cloud.documentai.v1beta1.IOutputConfig|null); + + /** + * Creates a new ProcessDocumentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ProcessDocumentResponse instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IProcessDocumentResponse): google.cloud.documentai.v1beta1.ProcessDocumentResponse; + + /** + * Encodes the specified ProcessDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentResponse.verify|verify} messages. + * @param message ProcessDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IProcessDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProcessDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentResponse.verify|verify} messages. + * @param message ProcessDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IProcessDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProcessDocumentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProcessDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.ProcessDocumentResponse; + + /** + * Decodes a ProcessDocumentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProcessDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.ProcessDocumentResponse; + + /** + * Verifies a ProcessDocumentResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProcessDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProcessDocumentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.ProcessDocumentResponse; + + /** + * Creates a plain object from a ProcessDocumentResponse message. Also converts values to other types if specified. + * @param message ProcessDocumentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.ProcessDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProcessDocumentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an OcrParams. */ + interface IOcrParams { + + /** OcrParams languageHints */ + languageHints?: (string[]|null); + } + + /** Represents an OcrParams. */ + class OcrParams implements IOcrParams { + + /** + * Constructs a new OcrParams. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IOcrParams); + + /** OcrParams languageHints. */ + public languageHints: string[]; + + /** + * Creates a new OcrParams instance using the specified properties. + * @param [properties] Properties to set + * @returns OcrParams instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IOcrParams): google.cloud.documentai.v1beta1.OcrParams; + + /** + * Encodes the specified OcrParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.OcrParams.verify|verify} messages. + * @param message OcrParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IOcrParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OcrParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.OcrParams.verify|verify} messages. + * @param message OcrParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IOcrParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OcrParams message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OcrParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.OcrParams; + + /** + * Decodes an OcrParams message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OcrParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.OcrParams; + + /** + * Verifies an OcrParams message. + * @param message Plain 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 OcrParams message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OcrParams + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.OcrParams; + + /** + * Creates a plain object from an OcrParams message. Also converts values to other types if specified. + * @param message OcrParams + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.OcrParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OcrParams to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TableExtractionParams. */ + interface ITableExtractionParams { + + /** TableExtractionParams enabled */ + enabled?: (boolean|null); + + /** TableExtractionParams tableBoundHints */ + tableBoundHints?: (google.cloud.documentai.v1beta1.ITableBoundHint[]|null); + + /** TableExtractionParams headerHints */ + headerHints?: (string[]|null); + + /** TableExtractionParams modelVersion */ + modelVersion?: (string|null); + } + + /** Represents a TableExtractionParams. */ + class TableExtractionParams implements ITableExtractionParams { + + /** + * Constructs a new TableExtractionParams. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.ITableExtractionParams); + + /** TableExtractionParams enabled. */ + public enabled: boolean; + + /** TableExtractionParams tableBoundHints. */ + public tableBoundHints: google.cloud.documentai.v1beta1.ITableBoundHint[]; + + /** TableExtractionParams headerHints. */ + public headerHints: string[]; + + /** TableExtractionParams modelVersion. */ + public modelVersion: string; + + /** + * Creates a new TableExtractionParams instance using the specified properties. + * @param [properties] Properties to set + * @returns TableExtractionParams instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.ITableExtractionParams): google.cloud.documentai.v1beta1.TableExtractionParams; + + /** + * Encodes the specified TableExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.TableExtractionParams.verify|verify} messages. + * @param message TableExtractionParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.ITableExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.TableExtractionParams.verify|verify} messages. + * @param message TableExtractionParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.ITableExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableExtractionParams message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.TableExtractionParams; + + /** + * Decodes a TableExtractionParams message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.TableExtractionParams; + + /** + * Verifies a TableExtractionParams message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TableExtractionParams message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableExtractionParams + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.TableExtractionParams; + + /** + * Creates a plain object from a TableExtractionParams message. Also converts values to other types if specified. + * @param message TableExtractionParams + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.TableExtractionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableExtractionParams to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TableBoundHint. */ + interface ITableBoundHint { + + /** TableBoundHint pageNumber */ + pageNumber?: (number|null); + + /** TableBoundHint boundingBox */ + boundingBox?: (google.cloud.documentai.v1beta1.IBoundingPoly|null); + } + + /** Represents a TableBoundHint. */ + class TableBoundHint implements ITableBoundHint { + + /** + * Constructs a new TableBoundHint. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.ITableBoundHint); + + /** TableBoundHint pageNumber. */ + public pageNumber: number; + + /** TableBoundHint boundingBox. */ + public boundingBox?: (google.cloud.documentai.v1beta1.IBoundingPoly|null); + + /** + * Creates a new TableBoundHint instance using the specified properties. + * @param [properties] Properties to set + * @returns TableBoundHint instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.ITableBoundHint): google.cloud.documentai.v1beta1.TableBoundHint; + + /** + * Encodes the specified TableBoundHint message. Does not implicitly {@link google.cloud.documentai.v1beta1.TableBoundHint.verify|verify} messages. + * @param message TableBoundHint message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.ITableBoundHint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableBoundHint message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.TableBoundHint.verify|verify} messages. + * @param message TableBoundHint message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.ITableBoundHint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableBoundHint message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableBoundHint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.TableBoundHint; + + /** + * Decodes a TableBoundHint message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableBoundHint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.TableBoundHint; + + /** + * Verifies a TableBoundHint message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TableBoundHint message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableBoundHint + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.TableBoundHint; + + /** + * Creates a plain object from a TableBoundHint message. Also converts values to other types if specified. + * @param message TableBoundHint + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.TableBoundHint, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableBoundHint to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FormExtractionParams. */ + interface IFormExtractionParams { + + /** FormExtractionParams enabled */ + enabled?: (boolean|null); + + /** FormExtractionParams keyValuePairHints */ + keyValuePairHints?: (google.cloud.documentai.v1beta1.IKeyValuePairHint[]|null); + + /** FormExtractionParams modelVersion */ + modelVersion?: (string|null); + } + + /** Represents a FormExtractionParams. */ + class FormExtractionParams implements IFormExtractionParams { + + /** + * Constructs a new FormExtractionParams. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IFormExtractionParams); + + /** FormExtractionParams enabled. */ + public enabled: boolean; + + /** FormExtractionParams keyValuePairHints. */ + public keyValuePairHints: google.cloud.documentai.v1beta1.IKeyValuePairHint[]; + + /** FormExtractionParams modelVersion. */ + public modelVersion: string; + + /** + * Creates a new FormExtractionParams instance using the specified properties. + * @param [properties] Properties to set + * @returns FormExtractionParams instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IFormExtractionParams): google.cloud.documentai.v1beta1.FormExtractionParams; + + /** + * Encodes the specified FormExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.FormExtractionParams.verify|verify} messages. + * @param message FormExtractionParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IFormExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FormExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.FormExtractionParams.verify|verify} messages. + * @param message FormExtractionParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IFormExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FormExtractionParams message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FormExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.FormExtractionParams; + + /** + * Decodes a FormExtractionParams message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FormExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.FormExtractionParams; + + /** + * Verifies a FormExtractionParams message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FormExtractionParams message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FormExtractionParams + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.FormExtractionParams; + + /** + * Creates a plain object from a FormExtractionParams message. Also converts values to other types if specified. + * @param message FormExtractionParams + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.FormExtractionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FormExtractionParams to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a KeyValuePairHint. */ + interface IKeyValuePairHint { + + /** KeyValuePairHint key */ + key?: (string|null); + + /** KeyValuePairHint valueTypes */ + valueTypes?: (string[]|null); + } + + /** Represents a KeyValuePairHint. */ + class KeyValuePairHint implements IKeyValuePairHint { + + /** + * Constructs a new KeyValuePairHint. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IKeyValuePairHint); + + /** KeyValuePairHint key. */ + public key: string; + + /** KeyValuePairHint valueTypes. */ + public valueTypes: string[]; + + /** + * Creates a new KeyValuePairHint instance using the specified properties. + * @param [properties] Properties to set + * @returns KeyValuePairHint instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IKeyValuePairHint): google.cloud.documentai.v1beta1.KeyValuePairHint; + + /** + * Encodes the specified KeyValuePairHint message. Does not implicitly {@link google.cloud.documentai.v1beta1.KeyValuePairHint.verify|verify} messages. + * @param message KeyValuePairHint message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IKeyValuePairHint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified KeyValuePairHint message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.KeyValuePairHint.verify|verify} messages. + * @param message KeyValuePairHint message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IKeyValuePairHint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a KeyValuePairHint message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns KeyValuePairHint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.KeyValuePairHint; + + /** + * Decodes a KeyValuePairHint message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns KeyValuePairHint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.KeyValuePairHint; + + /** + * Verifies a KeyValuePairHint message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a KeyValuePairHint message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns KeyValuePairHint + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.KeyValuePairHint; + + /** + * Creates a plain object from a KeyValuePairHint message. Also converts values to other types if specified. + * @param message KeyValuePairHint + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.KeyValuePairHint, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this KeyValuePairHint to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EntityExtractionParams. */ + interface IEntityExtractionParams { + + /** EntityExtractionParams enabled */ + enabled?: (boolean|null); + + /** EntityExtractionParams modelVersion */ + modelVersion?: (string|null); + } + + /** Represents an EntityExtractionParams. */ + class EntityExtractionParams implements IEntityExtractionParams { + + /** + * Constructs a new EntityExtractionParams. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IEntityExtractionParams); + + /** EntityExtractionParams enabled. */ + public enabled: boolean; + + /** EntityExtractionParams modelVersion. */ + public modelVersion: string; + + /** + * Creates a new EntityExtractionParams instance using the specified properties. + * @param [properties] Properties to set + * @returns EntityExtractionParams instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IEntityExtractionParams): google.cloud.documentai.v1beta1.EntityExtractionParams; + + /** + * Encodes the specified EntityExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.EntityExtractionParams.verify|verify} messages. + * @param message EntityExtractionParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IEntityExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EntityExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.EntityExtractionParams.verify|verify} messages. + * @param message EntityExtractionParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IEntityExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EntityExtractionParams message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EntityExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.EntityExtractionParams; + + /** + * Decodes an EntityExtractionParams message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EntityExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.EntityExtractionParams; + + /** + * Verifies an EntityExtractionParams message. + * @param message Plain 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 EntityExtractionParams message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EntityExtractionParams + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.EntityExtractionParams; + + /** + * Creates a plain object from an EntityExtractionParams message. Also converts values to other types if specified. + * @param message EntityExtractionParams + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.EntityExtractionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EntityExtractionParams to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an InputConfig. */ + interface IInputConfig { + + /** InputConfig gcsSource */ + gcsSource?: (google.cloud.documentai.v1beta1.IGcsSource|null); + + /** InputConfig mimeType */ + mimeType?: (string|null); + } + + /** Represents an InputConfig. */ + class InputConfig implements IInputConfig { + + /** + * Constructs a new InputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IInputConfig); + + /** InputConfig gcsSource. */ + public gcsSource?: (google.cloud.documentai.v1beta1.IGcsSource|null); + + /** InputConfig mimeType. */ + public mimeType: string; + + /** InputConfig source. */ + public source?: "gcsSource"; + + /** + * Creates a new InputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns InputConfig instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IInputConfig): google.cloud.documentai.v1beta1.InputConfig; + + /** + * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta1.InputConfig.verify|verify} messages. + * @param message InputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.InputConfig.verify|verify} messages. + * @param message InputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.InputConfig; + + /** + * Decodes an InputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.InputConfig; + + /** + * Verifies an InputConfig message. + * @param message Plain 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 InputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.InputConfig; + + /** + * Creates a plain object from an InputConfig message. Also converts values to other types if specified. + * @param message InputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.InputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an OutputConfig. */ + interface IOutputConfig { + + /** OutputConfig gcsDestination */ + gcsDestination?: (google.cloud.documentai.v1beta1.IGcsDestination|null); + + /** OutputConfig pagesPerShard */ + pagesPerShard?: (number|null); + } + + /** Represents an OutputConfig. */ + class OutputConfig implements IOutputConfig { + + /** + * Constructs a new OutputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IOutputConfig); + + /** OutputConfig gcsDestination. */ + public gcsDestination?: (google.cloud.documentai.v1beta1.IGcsDestination|null); + + /** OutputConfig pagesPerShard. */ + public pagesPerShard: number; + + /** OutputConfig destination. */ + public destination?: "gcsDestination"; + + /** + * Creates a new OutputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns OutputConfig instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IOutputConfig): google.cloud.documentai.v1beta1.OutputConfig; + + /** + * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta1.OutputConfig.verify|verify} messages. + * @param message OutputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.OutputConfig.verify|verify} messages. + * @param message OutputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OutputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.OutputConfig; + + /** + * Decodes an OutputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.OutputConfig; + + /** + * Verifies an OutputConfig message. + * @param message Plain 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 OutputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OutputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.OutputConfig; + + /** + * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. + * @param message OutputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.OutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OutputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GcsSource. */ + interface IGcsSource { + + /** GcsSource uri */ + uri?: (string|null); + } + + /** Represents a GcsSource. */ + class GcsSource implements IGcsSource { + + /** + * Constructs a new GcsSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IGcsSource); + + /** GcsSource uri. */ + public uri: string; + + /** + * Creates a new GcsSource instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsSource instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IGcsSource): google.cloud.documentai.v1beta1.GcsSource; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.documentai.v1beta1.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.documentai.v1beta1.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.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.documentai.v1beta1.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.documentai.v1beta1.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.documentai.v1beta1.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.documentai.v1beta1.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.documentai.v1beta1.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GcsDestination. */ + interface IGcsDestination { + + /** GcsDestination uri */ + uri?: (string|null); + } + + /** Represents a GcsDestination. */ + class GcsDestination implements IGcsDestination { + + /** + * Constructs a new GcsDestination. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IGcsDestination); + + /** GcsDestination uri. */ + public uri: string; + + /** + * Creates a new GcsDestination instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsDestination instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IGcsDestination): google.cloud.documentai.v1beta1.GcsDestination; + + /** + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.documentai.v1beta1.GcsDestination.verify|verify} messages. + * @param message GcsDestination message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.GcsDestination.verify|verify} messages. + * @param message GcsDestination message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsDestination message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.GcsDestination; + + /** + * Decodes a GcsDestination message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.GcsDestination; + + /** + * Verifies a GcsDestination message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GcsDestination message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsDestination + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.GcsDestination; + + /** + * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. + * @param message GcsDestination + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.GcsDestination, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsDestination to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an OperationMetadata. */ + interface IOperationMetadata { + + /** OperationMetadata state */ + state?: (google.cloud.documentai.v1beta1.OperationMetadata.State|null); + + /** OperationMetadata stateMessage */ + stateMessage?: (string|null); + + /** OperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents an OperationMetadata. */ + class OperationMetadata implements IOperationMetadata { + + /** + * Constructs a new OperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IOperationMetadata); + + /** OperationMetadata state. */ + public state: google.cloud.documentai.v1beta1.OperationMetadata.State; + + /** OperationMetadata stateMessage. */ + public stateMessage: string; + + /** OperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IOperationMetadata): google.cloud.documentai.v1beta1.OperationMetadata; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta1.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.OperationMetadata; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.OperationMetadata; + + /** + * Verifies an OperationMetadata message. + * @param message Plain 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 OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.OperationMetadata; + + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @param message OperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace OperationMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + ACCEPTED = 1, + WAITING = 2, + RUNNING = 3, + SUCCEEDED = 4, + CANCELLED = 5, + FAILED = 6 + } + } + + /** Properties of a Vertex. */ + interface IVertex { + + /** Vertex x */ + x?: (number|null); + + /** Vertex y */ + y?: (number|null); + } + + /** Represents a Vertex. */ + class Vertex implements IVertex { + + /** + * Constructs a new Vertex. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IVertex); + + /** Vertex x. */ + public x: number; + + /** Vertex y. */ + public y: number; + + /** + * Creates a new Vertex instance using the specified properties. + * @param [properties] Properties to set + * @returns Vertex instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IVertex): google.cloud.documentai.v1beta1.Vertex; + + /** + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.documentai.v1beta1.Vertex.verify|verify} messages. + * @param message Vertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Vertex.verify|verify} messages. + * @param message Vertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Vertex message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Vertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Vertex; + + /** + * Decodes a Vertex message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Vertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Vertex; + + /** + * Verifies a Vertex message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Vertex message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Vertex + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Vertex; + + /** + * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * @param message Vertex + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Vertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Vertex to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a NormalizedVertex. */ + interface INormalizedVertex { + + /** NormalizedVertex x */ + x?: (number|null); + + /** NormalizedVertex y */ + y?: (number|null); + } + + /** Represents a NormalizedVertex. */ + class NormalizedVertex implements INormalizedVertex { + + /** + * Constructs a new NormalizedVertex. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.INormalizedVertex); + + /** NormalizedVertex x. */ + public x: number; + + /** NormalizedVertex y. */ + public y: number; + + /** + * Creates a new NormalizedVertex instance using the specified properties. + * @param [properties] Properties to set + * @returns NormalizedVertex instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.INormalizedVertex): google.cloud.documentai.v1beta1.NormalizedVertex; + + /** + * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.documentai.v1beta1.NormalizedVertex.verify|verify} messages. + * @param message NormalizedVertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.NormalizedVertex.verify|verify} messages. + * @param message NormalizedVertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NormalizedVertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.NormalizedVertex; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NormalizedVertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.NormalizedVertex; + + /** + * Verifies a NormalizedVertex message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NormalizedVertex + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.NormalizedVertex; + + /** + * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. + * @param message NormalizedVertex + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.NormalizedVertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NormalizedVertex to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BoundingPoly. */ + interface IBoundingPoly { + + /** BoundingPoly vertices */ + vertices?: (google.cloud.documentai.v1beta1.IVertex[]|null); + + /** BoundingPoly normalizedVertices */ + normalizedVertices?: (google.cloud.documentai.v1beta1.INormalizedVertex[]|null); + } + + /** Represents a BoundingPoly. */ + class BoundingPoly implements IBoundingPoly { + + /** + * Constructs a new BoundingPoly. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IBoundingPoly); + + /** BoundingPoly vertices. */ + public vertices: google.cloud.documentai.v1beta1.IVertex[]; + + /** BoundingPoly normalizedVertices. */ + public normalizedVertices: google.cloud.documentai.v1beta1.INormalizedVertex[]; + + /** + * Creates a new BoundingPoly instance using the specified properties. + * @param [properties] Properties to set + * @returns BoundingPoly instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IBoundingPoly): google.cloud.documentai.v1beta1.BoundingPoly; + + /** + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.documentai.v1beta1.BoundingPoly.verify|verify} messages. + * @param message BoundingPoly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.BoundingPoly.verify|verify} messages. + * @param message BoundingPoly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoundingPoly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.BoundingPoly; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoundingPoly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.BoundingPoly; + + /** + * Verifies a BoundingPoly message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoundingPoly + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.BoundingPoly; + + /** + * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. + * @param message BoundingPoly + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.BoundingPoly, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoundingPoly 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 + } + } + + /** 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|null); + + /** FieldDescriptorProto type */ + type?: (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); + } + + /** 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; + + /** FieldDescriptorProto type. */ + public type: 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); + + /** + * 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|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); + } + + /** 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; + + /** 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); + } + + /** 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|null); + + /** FieldOptions packed */ + packed?: (boolean|null); + + /** FieldOptions jstype */ + jstype?: (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); + } + + /** 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; + + /** FieldOptions packed. */ + public packed: boolean; + + /** FieldOptions jstype. */ + public jstype: 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|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; + + /** 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|null); + + /** UninterpretedOption negativeIntValue */ + negativeIntValue?: (number|Long|null); + + /** UninterpretedOption doubleValue */ + doubleValue?: (number|null); + + /** UninterpretedOption stringValue */ + stringValue?: (Uint8Array|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); + + /** UninterpretedOption negativeIntValue. */ + public negativeIntValue: (number|Long); + + /** UninterpretedOption doubleValue. */ + public doubleValue: number; + + /** UninterpretedOption stringValue. */ + public stringValue: Uint8Array; + + /** 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 Any. */ + interface IAny { + + /** Any type_url */ + type_url?: (string|null); + + /** Any value */ + value?: (Uint8Array|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; + + /** + * 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 Duration. */ + interface IDuration { + + /** Duration seconds */ + seconds?: (number|Long|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); + + /** 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 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 Timestamp. */ + interface ITimestamp { + + /** Timestamp seconds */ + seconds?: (number|Long|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); + + /** 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 }; + } + } + + /** 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 }; + } + } + + /** 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 }; + } + } +} diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js new file mode 100644 index 00000000000..408652a29ac --- /dev/null +++ b/packages/google-cloud-documentai/protos/protos.js @@ -0,0 +1,17012 @@ +/*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("protobufjs/minimal")); + +})(this, function($protobuf) { + "use strict"; + + // Common aliases + var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; + + // Exported root namespace + var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); + + $root.google = (function() { + + /** + * Namespace google. + * @exports google + * @namespace + */ + var google = {}; + + google.cloud = (function() { + + /** + * Namespace cloud. + * @memberof google + * @namespace + */ + var cloud = {}; + + cloud.documentai = (function() { + + /** + * Namespace documentai. + * @memberof google.cloud + * @namespace + */ + var documentai = {}; + + documentai.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof google.cloud.documentai + * @namespace + */ + var v1beta1 = {}; + + v1beta1.DocumentUnderstandingService = (function() { + + /** + * Constructs a new DocumentUnderstandingService service. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a DocumentUnderstandingService + * @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 DocumentUnderstandingService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (DocumentUnderstandingService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = DocumentUnderstandingService; + + /** + * Creates new DocumentUnderstandingService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.documentai.v1beta1.DocumentUnderstandingService + * @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 {DocumentUnderstandingService} RPC service. Useful where requests and/or responses are streamed. + */ + DocumentUnderstandingService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.documentai.v1beta1.DocumentUnderstandingService#batchProcessDocuments}. + * @memberof google.cloud.documentai.v1beta1.DocumentUnderstandingService + * @typedef BatchProcessDocumentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchProcessDocuments. + * @function batchProcessDocuments + * @memberof google.cloud.documentai.v1beta1.DocumentUnderstandingService + * @instance + * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest} request BatchProcessDocumentsRequest message or plain object + * @param {google.cloud.documentai.v1beta1.DocumentUnderstandingService.BatchProcessDocumentsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentUnderstandingService.prototype.batchProcessDocuments = function batchProcessDocuments(request, callback) { + return this.rpcCall(batchProcessDocuments, $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchProcessDocuments" }); + + /** + * Calls BatchProcessDocuments. + * @function batchProcessDocuments + * @memberof google.cloud.documentai.v1beta1.DocumentUnderstandingService + * @instance + * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest} request BatchProcessDocumentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return DocumentUnderstandingService; + })(); + + v1beta1.BatchProcessDocumentsRequest = (function() { + + /** + * Properties of a BatchProcessDocumentsRequest. + * @memberof google.cloud.documentai.v1beta1 + * @interface IBatchProcessDocumentsRequest + * @property {Array.|null} [requests] BatchProcessDocumentsRequest requests + * @property {string|null} [parent] BatchProcessDocumentsRequest parent + */ + + /** + * Constructs a new BatchProcessDocumentsRequest. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a BatchProcessDocumentsRequest. + * @implements IBatchProcessDocumentsRequest + * @constructor + * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest=} [properties] Properties to set + */ + function BatchProcessDocumentsRequest(properties) { + this.requests = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchProcessDocumentsRequest requests. + * @member {Array.} requests + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @instance + */ + BatchProcessDocumentsRequest.prototype.requests = $util.emptyArray; + + /** + * BatchProcessDocumentsRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @instance + */ + BatchProcessDocumentsRequest.prototype.parent = ""; + + /** + * Creates a new BatchProcessDocumentsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @static + * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest} BatchProcessDocumentsRequest instance + */ + BatchProcessDocumentsRequest.create = function create(properties) { + return new BatchProcessDocumentsRequest(properties); + }; + + /** + * Encodes the specified BatchProcessDocumentsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @static + * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest} message BatchProcessDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProcessDocumentsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.requests != null && message.requests.length) + for (var i = 0; i < message.requests.length; ++i) + $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.parent != null && message.hasOwnProperty("parent")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.parent); + return writer; + }; + + /** + * Encodes the specified BatchProcessDocumentsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @static + * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest} message BatchProcessDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProcessDocumentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchProcessDocumentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest} BatchProcessDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProcessDocumentsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.requests && message.requests.length)) + message.requests = []; + message.requests.push($root.google.cloud.documentai.v1beta1.ProcessDocumentRequest.decode(reader, reader.uint32())); + break; + case 2: + message.parent = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchProcessDocumentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest} BatchProcessDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProcessDocumentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchProcessDocumentsRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchProcessDocumentsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.requests != null && message.hasOwnProperty("requests")) { + if (!Array.isArray(message.requests)) + return "requests: array expected"; + for (var i = 0; i < message.requests.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest.verify(message.requests[i]); + if (error) + return "requests." + error; + } + } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + return null; + }; + + /** + * Creates a BatchProcessDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest} BatchProcessDocumentsRequest + */ + BatchProcessDocumentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest(); + if (object.requests) { + if (!Array.isArray(object.requests)) + throw TypeError(".google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.requests: array expected"); + message.requests = []; + for (var i = 0; i < object.requests.length; ++i) { + if (typeof object.requests[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.requests: object expected"); + message.requests[i] = $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest.fromObject(object.requests[i]); + } + } + if (object.parent != null) + message.parent = String(object.parent); + return message; + }; + + /** + * Creates a plain object from a BatchProcessDocumentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @static + * @param {google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest} message BatchProcessDocumentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchProcessDocumentsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.requests = []; + if (options.defaults) + object.parent = ""; + if (message.requests && message.requests.length) { + object.requests = []; + for (var j = 0; j < message.requests.length; ++j) + object.requests[j] = $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest.toObject(message.requests[j], options); + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this BatchProcessDocumentsRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @instance + * @returns {Object.} JSON object + */ + BatchProcessDocumentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BatchProcessDocumentsRequest; + })(); + + v1beta1.ProcessDocumentRequest = (function() { + + /** + * Properties of a ProcessDocumentRequest. + * @memberof google.cloud.documentai.v1beta1 + * @interface IProcessDocumentRequest + * @property {google.cloud.documentai.v1beta1.IInputConfig|null} [inputConfig] ProcessDocumentRequest inputConfig + * @property {google.cloud.documentai.v1beta1.IOutputConfig|null} [outputConfig] ProcessDocumentRequest outputConfig + * @property {string|null} [documentType] ProcessDocumentRequest documentType + * @property {google.cloud.documentai.v1beta1.ITableExtractionParams|null} [tableExtractionParams] ProcessDocumentRequest tableExtractionParams + * @property {google.cloud.documentai.v1beta1.IFormExtractionParams|null} [formExtractionParams] ProcessDocumentRequest formExtractionParams + * @property {google.cloud.documentai.v1beta1.IEntityExtractionParams|null} [entityExtractionParams] ProcessDocumentRequest entityExtractionParams + * @property {google.cloud.documentai.v1beta1.IOcrParams|null} [ocrParams] ProcessDocumentRequest ocrParams + */ + + /** + * Constructs a new ProcessDocumentRequest. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a ProcessDocumentRequest. + * @implements IProcessDocumentRequest + * @constructor + * @param {google.cloud.documentai.v1beta1.IProcessDocumentRequest=} [properties] Properties to set + */ + function ProcessDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProcessDocumentRequest inputConfig. + * @member {google.cloud.documentai.v1beta1.IInputConfig|null|undefined} inputConfig + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.inputConfig = null; + + /** + * ProcessDocumentRequest outputConfig. + * @member {google.cloud.documentai.v1beta1.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.outputConfig = null; + + /** + * ProcessDocumentRequest documentType. + * @member {string} documentType + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.documentType = ""; + + /** + * ProcessDocumentRequest tableExtractionParams. + * @member {google.cloud.documentai.v1beta1.ITableExtractionParams|null|undefined} tableExtractionParams + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.tableExtractionParams = null; + + /** + * ProcessDocumentRequest formExtractionParams. + * @member {google.cloud.documentai.v1beta1.IFormExtractionParams|null|undefined} formExtractionParams + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.formExtractionParams = null; + + /** + * ProcessDocumentRequest entityExtractionParams. + * @member {google.cloud.documentai.v1beta1.IEntityExtractionParams|null|undefined} entityExtractionParams + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.entityExtractionParams = null; + + /** + * ProcessDocumentRequest ocrParams. + * @member {google.cloud.documentai.v1beta1.IOcrParams|null|undefined} ocrParams + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.ocrParams = null; + + /** + * Creates a new ProcessDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta1.IProcessDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.ProcessDocumentRequest} ProcessDocumentRequest instance + */ + ProcessDocumentRequest.create = function create(properties) { + return new ProcessDocumentRequest(properties); + }; + + /** + * Encodes the specified ProcessDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta1.IProcessDocumentRequest} message ProcessDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessDocumentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + $root.google.cloud.documentai.v1beta1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + $root.google.cloud.documentai.v1beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.documentType != null && message.hasOwnProperty("documentType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.documentType); + if (message.tableExtractionParams != null && message.hasOwnProperty("tableExtractionParams")) + $root.google.cloud.documentai.v1beta1.TableExtractionParams.encode(message.tableExtractionParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.formExtractionParams != null && message.hasOwnProperty("formExtractionParams")) + $root.google.cloud.documentai.v1beta1.FormExtractionParams.encode(message.formExtractionParams, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.entityExtractionParams != null && message.hasOwnProperty("entityExtractionParams")) + $root.google.cloud.documentai.v1beta1.EntityExtractionParams.encode(message.entityExtractionParams, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.ocrParams != null && message.hasOwnProperty("ocrParams")) + $root.google.cloud.documentai.v1beta1.OcrParams.encode(message.ocrParams, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProcessDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta1.IProcessDocumentRequest} message ProcessDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProcessDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.ProcessDocumentRequest} ProcessDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.decode(reader, reader.uint32()); + break; + case 2: + message.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.decode(reader, reader.uint32()); + break; + case 3: + message.documentType = reader.string(); + break; + case 4: + message.tableExtractionParams = $root.google.cloud.documentai.v1beta1.TableExtractionParams.decode(reader, reader.uint32()); + break; + case 5: + message.formExtractionParams = $root.google.cloud.documentai.v1beta1.FormExtractionParams.decode(reader, reader.uint32()); + break; + case 6: + message.entityExtractionParams = $root.google.cloud.documentai.v1beta1.EntityExtractionParams.decode(reader, reader.uint32()); + break; + case 7: + message.ocrParams = $root.google.cloud.documentai.v1beta1.OcrParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProcessDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.ProcessDocumentRequest} ProcessDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProcessDocumentRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProcessDocumentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.documentai.v1beta1.InputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.documentai.v1beta1.OutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } + if (message.documentType != null && message.hasOwnProperty("documentType")) + if (!$util.isString(message.documentType)) + return "documentType: string expected"; + if (message.tableExtractionParams != null && message.hasOwnProperty("tableExtractionParams")) { + var error = $root.google.cloud.documentai.v1beta1.TableExtractionParams.verify(message.tableExtractionParams); + if (error) + return "tableExtractionParams." + error; + } + if (message.formExtractionParams != null && message.hasOwnProperty("formExtractionParams")) { + var error = $root.google.cloud.documentai.v1beta1.FormExtractionParams.verify(message.formExtractionParams); + if (error) + return "formExtractionParams." + error; + } + if (message.entityExtractionParams != null && message.hasOwnProperty("entityExtractionParams")) { + var error = $root.google.cloud.documentai.v1beta1.EntityExtractionParams.verify(message.entityExtractionParams); + if (error) + return "entityExtractionParams." + error; + } + if (message.ocrParams != null && message.hasOwnProperty("ocrParams")) { + var error = $root.google.cloud.documentai.v1beta1.OcrParams.verify(message.ocrParams); + if (error) + return "ocrParams." + error; + } + return null; + }; + + /** + * Creates a ProcessDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.ProcessDocumentRequest} ProcessDocumentRequest + */ + ProcessDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest(); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.fromObject(object.inputConfig); + } + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentRequest.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.fromObject(object.outputConfig); + } + if (object.documentType != null) + message.documentType = String(object.documentType); + if (object.tableExtractionParams != null) { + if (typeof object.tableExtractionParams !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentRequest.tableExtractionParams: object expected"); + message.tableExtractionParams = $root.google.cloud.documentai.v1beta1.TableExtractionParams.fromObject(object.tableExtractionParams); + } + if (object.formExtractionParams != null) { + if (typeof object.formExtractionParams !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentRequest.formExtractionParams: object expected"); + message.formExtractionParams = $root.google.cloud.documentai.v1beta1.FormExtractionParams.fromObject(object.formExtractionParams); + } + if (object.entityExtractionParams != null) { + if (typeof object.entityExtractionParams !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentRequest.entityExtractionParams: object expected"); + message.entityExtractionParams = $root.google.cloud.documentai.v1beta1.EntityExtractionParams.fromObject(object.entityExtractionParams); + } + if (object.ocrParams != null) { + if (typeof object.ocrParams !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentRequest.ocrParams: object expected"); + message.ocrParams = $root.google.cloud.documentai.v1beta1.OcrParams.fromObject(object.ocrParams); + } + return message; + }; + + /** + * Creates a plain object from a ProcessDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta1.ProcessDocumentRequest} message ProcessDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProcessDocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.inputConfig = null; + object.outputConfig = null; + object.documentType = ""; + object.tableExtractionParams = null; + object.formExtractionParams = null; + object.entityExtractionParams = null; + object.ocrParams = null; + } + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.toObject(message.inputConfig, options); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.toObject(message.outputConfig, options); + if (message.documentType != null && message.hasOwnProperty("documentType")) + object.documentType = message.documentType; + if (message.tableExtractionParams != null && message.hasOwnProperty("tableExtractionParams")) + object.tableExtractionParams = $root.google.cloud.documentai.v1beta1.TableExtractionParams.toObject(message.tableExtractionParams, options); + if (message.formExtractionParams != null && message.hasOwnProperty("formExtractionParams")) + object.formExtractionParams = $root.google.cloud.documentai.v1beta1.FormExtractionParams.toObject(message.formExtractionParams, options); + if (message.entityExtractionParams != null && message.hasOwnProperty("entityExtractionParams")) + object.entityExtractionParams = $root.google.cloud.documentai.v1beta1.EntityExtractionParams.toObject(message.entityExtractionParams, options); + if (message.ocrParams != null && message.hasOwnProperty("ocrParams")) + object.ocrParams = $root.google.cloud.documentai.v1beta1.OcrParams.toObject(message.ocrParams, options); + return object; + }; + + /** + * Converts this ProcessDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + ProcessDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProcessDocumentRequest; + })(); + + v1beta1.BatchProcessDocumentsResponse = (function() { + + /** + * Properties of a BatchProcessDocumentsResponse. + * @memberof google.cloud.documentai.v1beta1 + * @interface IBatchProcessDocumentsResponse + * @property {Array.|null} [responses] BatchProcessDocumentsResponse responses + */ + + /** + * Constructs a new BatchProcessDocumentsResponse. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a BatchProcessDocumentsResponse. + * @implements IBatchProcessDocumentsResponse + * @constructor + * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse=} [properties] Properties to set + */ + function BatchProcessDocumentsResponse(properties) { + this.responses = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchProcessDocumentsResponse responses. + * @member {Array.} responses + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @instance + */ + BatchProcessDocumentsResponse.prototype.responses = $util.emptyArray; + + /** + * Creates a new BatchProcessDocumentsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @static + * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse} BatchProcessDocumentsResponse instance + */ + BatchProcessDocumentsResponse.create = function create(properties) { + return new BatchProcessDocumentsResponse(properties); + }; + + /** + * Encodes the specified BatchProcessDocumentsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @static + * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse} message BatchProcessDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProcessDocumentsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.responses != null && message.responses.length) + for (var i = 0; i < message.responses.length; ++i) + $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchProcessDocumentsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @static + * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse} message BatchProcessDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProcessDocumentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchProcessDocumentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse} BatchProcessDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProcessDocumentsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.responses && message.responses.length)) + message.responses = []; + message.responses.push($root.google.cloud.documentai.v1beta1.ProcessDocumentResponse.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchProcessDocumentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse} BatchProcessDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProcessDocumentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchProcessDocumentsResponse message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchProcessDocumentsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.responses != null && message.hasOwnProperty("responses")) { + if (!Array.isArray(message.responses)) + return "responses: array expected"; + for (var i = 0; i < message.responses.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse.verify(message.responses[i]); + if (error) + return "responses." + error; + } + } + return null; + }; + + /** + * Creates a BatchProcessDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse} BatchProcessDocumentsResponse + */ + BatchProcessDocumentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse) + return object; + var message = new $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse(); + if (object.responses) { + if (!Array.isArray(object.responses)) + throw TypeError(".google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.responses: array expected"); + message.responses = []; + for (var i = 0; i < object.responses.length; ++i) { + if (typeof object.responses[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.responses: object expected"); + message.responses[i] = $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse.fromObject(object.responses[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BatchProcessDocumentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @static + * @param {google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse} message BatchProcessDocumentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchProcessDocumentsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.responses = []; + if (message.responses && message.responses.length) { + object.responses = []; + for (var j = 0; j < message.responses.length; ++j) + object.responses[j] = $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse.toObject(message.responses[j], options); + } + return object; + }; + + /** + * Converts this BatchProcessDocumentsResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @instance + * @returns {Object.} JSON object + */ + BatchProcessDocumentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BatchProcessDocumentsResponse; + })(); + + v1beta1.ProcessDocumentResponse = (function() { + + /** + * Properties of a ProcessDocumentResponse. + * @memberof google.cloud.documentai.v1beta1 + * @interface IProcessDocumentResponse + * @property {google.cloud.documentai.v1beta1.IInputConfig|null} [inputConfig] ProcessDocumentResponse inputConfig + * @property {google.cloud.documentai.v1beta1.IOutputConfig|null} [outputConfig] ProcessDocumentResponse outputConfig + */ + + /** + * Constructs a new ProcessDocumentResponse. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a ProcessDocumentResponse. + * @implements IProcessDocumentResponse + * @constructor + * @param {google.cloud.documentai.v1beta1.IProcessDocumentResponse=} [properties] Properties to set + */ + function ProcessDocumentResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProcessDocumentResponse inputConfig. + * @member {google.cloud.documentai.v1beta1.IInputConfig|null|undefined} inputConfig + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @instance + */ + ProcessDocumentResponse.prototype.inputConfig = null; + + /** + * ProcessDocumentResponse outputConfig. + * @member {google.cloud.documentai.v1beta1.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @instance + */ + ProcessDocumentResponse.prototype.outputConfig = null; + + /** + * Creates a new ProcessDocumentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta1.IProcessDocumentResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.ProcessDocumentResponse} ProcessDocumentResponse instance + */ + ProcessDocumentResponse.create = function create(properties) { + return new ProcessDocumentResponse(properties); + }; + + /** + * Encodes the specified ProcessDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta1.IProcessDocumentResponse} message ProcessDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessDocumentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + $root.google.cloud.documentai.v1beta1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + $root.google.cloud.documentai.v1beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProcessDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta1.IProcessDocumentResponse} message ProcessDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProcessDocumentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.ProcessDocumentResponse} ProcessDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessDocumentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.decode(reader, reader.uint32()); + break; + case 2: + message.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProcessDocumentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.ProcessDocumentResponse} ProcessDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessDocumentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProcessDocumentResponse message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProcessDocumentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.documentai.v1beta1.InputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.documentai.v1beta1.OutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } + return null; + }; + + /** + * Creates a ProcessDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.ProcessDocumentResponse} ProcessDocumentResponse + */ + ProcessDocumentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse) + return object; + var message = new $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse(); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentResponse.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.fromObject(object.inputConfig); + } + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentResponse.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.fromObject(object.outputConfig); + } + return message; + }; + + /** + * Creates a plain object from a ProcessDocumentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta1.ProcessDocumentResponse} message ProcessDocumentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProcessDocumentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.inputConfig = null; + object.outputConfig = null; + } + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.toObject(message.inputConfig, options); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.toObject(message.outputConfig, options); + return object; + }; + + /** + * Converts this ProcessDocumentResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @instance + * @returns {Object.} JSON object + */ + ProcessDocumentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProcessDocumentResponse; + })(); + + v1beta1.OcrParams = (function() { + + /** + * Properties of an OcrParams. + * @memberof google.cloud.documentai.v1beta1 + * @interface IOcrParams + * @property {Array.|null} [languageHints] OcrParams languageHints + */ + + /** + * Constructs a new OcrParams. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents an OcrParams. + * @implements IOcrParams + * @constructor + * @param {google.cloud.documentai.v1beta1.IOcrParams=} [properties] Properties to set + */ + function OcrParams(properties) { + this.languageHints = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OcrParams languageHints. + * @member {Array.} languageHints + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @instance + */ + OcrParams.prototype.languageHints = $util.emptyArray; + + /** + * Creates a new OcrParams instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @static + * @param {google.cloud.documentai.v1beta1.IOcrParams=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.OcrParams} OcrParams instance + */ + OcrParams.create = function create(properties) { + return new OcrParams(properties); + }; + + /** + * Encodes the specified OcrParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.OcrParams.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @static + * @param {google.cloud.documentai.v1beta1.IOcrParams} message OcrParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OcrParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.languageHints != null && message.languageHints.length) + for (var i = 0; i < message.languageHints.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.languageHints[i]); + return writer; + }; + + /** + * Encodes the specified OcrParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.OcrParams.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @static + * @param {google.cloud.documentai.v1beta1.IOcrParams} message OcrParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OcrParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OcrParams message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.OcrParams} OcrParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OcrParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.OcrParams(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.languageHints && message.languageHints.length)) + message.languageHints = []; + message.languageHints.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OcrParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.OcrParams} OcrParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OcrParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OcrParams message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OcrParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.languageHints != null && message.hasOwnProperty("languageHints")) { + if (!Array.isArray(message.languageHints)) + return "languageHints: array expected"; + for (var i = 0; i < message.languageHints.length; ++i) + if (!$util.isString(message.languageHints[i])) + return "languageHints: string[] expected"; + } + return null; + }; + + /** + * Creates an OcrParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.OcrParams} OcrParams + */ + OcrParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.OcrParams) + return object; + var message = new $root.google.cloud.documentai.v1beta1.OcrParams(); + if (object.languageHints) { + if (!Array.isArray(object.languageHints)) + throw TypeError(".google.cloud.documentai.v1beta1.OcrParams.languageHints: array expected"); + message.languageHints = []; + for (var i = 0; i < object.languageHints.length; ++i) + message.languageHints[i] = String(object.languageHints[i]); + } + return message; + }; + + /** + * Creates a plain object from an OcrParams message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @static + * @param {google.cloud.documentai.v1beta1.OcrParams} message OcrParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OcrParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.languageHints = []; + if (message.languageHints && message.languageHints.length) { + object.languageHints = []; + for (var j = 0; j < message.languageHints.length; ++j) + object.languageHints[j] = message.languageHints[j]; + } + return object; + }; + + /** + * Converts this OcrParams to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @instance + * @returns {Object.} JSON object + */ + OcrParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OcrParams; + })(); + + v1beta1.TableExtractionParams = (function() { + + /** + * Properties of a TableExtractionParams. + * @memberof google.cloud.documentai.v1beta1 + * @interface ITableExtractionParams + * @property {boolean|null} [enabled] TableExtractionParams enabled + * @property {Array.|null} [tableBoundHints] TableExtractionParams tableBoundHints + * @property {Array.|null} [headerHints] TableExtractionParams headerHints + * @property {string|null} [modelVersion] TableExtractionParams modelVersion + */ + + /** + * Constructs a new TableExtractionParams. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a TableExtractionParams. + * @implements ITableExtractionParams + * @constructor + * @param {google.cloud.documentai.v1beta1.ITableExtractionParams=} [properties] Properties to set + */ + function TableExtractionParams(properties) { + this.tableBoundHints = []; + this.headerHints = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TableExtractionParams enabled. + * @member {boolean} enabled + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @instance + */ + TableExtractionParams.prototype.enabled = false; + + /** + * TableExtractionParams tableBoundHints. + * @member {Array.} tableBoundHints + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @instance + */ + TableExtractionParams.prototype.tableBoundHints = $util.emptyArray; + + /** + * TableExtractionParams headerHints. + * @member {Array.} headerHints + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @instance + */ + TableExtractionParams.prototype.headerHints = $util.emptyArray; + + /** + * TableExtractionParams modelVersion. + * @member {string} modelVersion + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @instance + */ + TableExtractionParams.prototype.modelVersion = ""; + + /** + * Creates a new TableExtractionParams instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.ITableExtractionParams=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.TableExtractionParams} TableExtractionParams instance + */ + TableExtractionParams.create = function create(properties) { + return new TableExtractionParams(properties); + }; + + /** + * Encodes the specified TableExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.TableExtractionParams.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.ITableExtractionParams} message TableExtractionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableExtractionParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enabled != null && message.hasOwnProperty("enabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); + if (message.tableBoundHints != null && message.tableBoundHints.length) + for (var i = 0; i < message.tableBoundHints.length; ++i) + $root.google.cloud.documentai.v1beta1.TableBoundHint.encode(message.tableBoundHints[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.headerHints != null && message.headerHints.length) + for (var i = 0; i < message.headerHints.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.headerHints[i]); + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.modelVersion); + return writer; + }; + + /** + * Encodes the specified TableExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.TableExtractionParams.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.ITableExtractionParams} message TableExtractionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableExtractionParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableExtractionParams message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.TableExtractionParams} TableExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableExtractionParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.TableExtractionParams(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.enabled = reader.bool(); + break; + case 2: + if (!(message.tableBoundHints && message.tableBoundHints.length)) + message.tableBoundHints = []; + message.tableBoundHints.push($root.google.cloud.documentai.v1beta1.TableBoundHint.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.headerHints && message.headerHints.length)) + message.headerHints = []; + message.headerHints.push(reader.string()); + break; + case 4: + message.modelVersion = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableExtractionParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.TableExtractionParams} TableExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableExtractionParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableExtractionParams message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableExtractionParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.enabled != null && message.hasOwnProperty("enabled")) + if (typeof message.enabled !== "boolean") + return "enabled: boolean expected"; + if (message.tableBoundHints != null && message.hasOwnProperty("tableBoundHints")) { + if (!Array.isArray(message.tableBoundHints)) + return "tableBoundHints: array expected"; + for (var i = 0; i < message.tableBoundHints.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.TableBoundHint.verify(message.tableBoundHints[i]); + if (error) + return "tableBoundHints." + error; + } + } + if (message.headerHints != null && message.hasOwnProperty("headerHints")) { + if (!Array.isArray(message.headerHints)) + return "headerHints: array expected"; + for (var i = 0; i < message.headerHints.length; ++i) + if (!$util.isString(message.headerHints[i])) + return "headerHints: string[] expected"; + } + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + if (!$util.isString(message.modelVersion)) + return "modelVersion: string expected"; + return null; + }; + + /** + * Creates a TableExtractionParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.TableExtractionParams} TableExtractionParams + */ + TableExtractionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.TableExtractionParams) + return object; + var message = new $root.google.cloud.documentai.v1beta1.TableExtractionParams(); + if (object.enabled != null) + message.enabled = Boolean(object.enabled); + if (object.tableBoundHints) { + if (!Array.isArray(object.tableBoundHints)) + throw TypeError(".google.cloud.documentai.v1beta1.TableExtractionParams.tableBoundHints: array expected"); + message.tableBoundHints = []; + for (var i = 0; i < object.tableBoundHints.length; ++i) { + if (typeof object.tableBoundHints[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.TableExtractionParams.tableBoundHints: object expected"); + message.tableBoundHints[i] = $root.google.cloud.documentai.v1beta1.TableBoundHint.fromObject(object.tableBoundHints[i]); + } + } + if (object.headerHints) { + if (!Array.isArray(object.headerHints)) + throw TypeError(".google.cloud.documentai.v1beta1.TableExtractionParams.headerHints: array expected"); + message.headerHints = []; + for (var i = 0; i < object.headerHints.length; ++i) + message.headerHints[i] = String(object.headerHints[i]); + } + if (object.modelVersion != null) + message.modelVersion = String(object.modelVersion); + return message; + }; + + /** + * Creates a plain object from a TableExtractionParams message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.TableExtractionParams} message TableExtractionParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableExtractionParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.tableBoundHints = []; + object.headerHints = []; + } + if (options.defaults) { + object.enabled = false; + object.modelVersion = ""; + } + if (message.enabled != null && message.hasOwnProperty("enabled")) + object.enabled = message.enabled; + if (message.tableBoundHints && message.tableBoundHints.length) { + object.tableBoundHints = []; + for (var j = 0; j < message.tableBoundHints.length; ++j) + object.tableBoundHints[j] = $root.google.cloud.documentai.v1beta1.TableBoundHint.toObject(message.tableBoundHints[j], options); + } + if (message.headerHints && message.headerHints.length) { + object.headerHints = []; + for (var j = 0; j < message.headerHints.length; ++j) + object.headerHints[j] = message.headerHints[j]; + } + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + object.modelVersion = message.modelVersion; + return object; + }; + + /** + * Converts this TableExtractionParams to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @instance + * @returns {Object.} JSON object + */ + TableExtractionParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TableExtractionParams; + })(); + + v1beta1.TableBoundHint = (function() { + + /** + * Properties of a TableBoundHint. + * @memberof google.cloud.documentai.v1beta1 + * @interface ITableBoundHint + * @property {number|null} [pageNumber] TableBoundHint pageNumber + * @property {google.cloud.documentai.v1beta1.IBoundingPoly|null} [boundingBox] TableBoundHint boundingBox + */ + + /** + * Constructs a new TableBoundHint. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a TableBoundHint. + * @implements ITableBoundHint + * @constructor + * @param {google.cloud.documentai.v1beta1.ITableBoundHint=} [properties] Properties to set + */ + function TableBoundHint(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TableBoundHint pageNumber. + * @member {number} pageNumber + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @instance + */ + TableBoundHint.prototype.pageNumber = 0; + + /** + * TableBoundHint boundingBox. + * @member {google.cloud.documentai.v1beta1.IBoundingPoly|null|undefined} boundingBox + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @instance + */ + TableBoundHint.prototype.boundingBox = null; + + /** + * Creates a new TableBoundHint instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @static + * @param {google.cloud.documentai.v1beta1.ITableBoundHint=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.TableBoundHint} TableBoundHint instance + */ + TableBoundHint.create = function create(properties) { + return new TableBoundHint(properties); + }; + + /** + * Encodes the specified TableBoundHint message. Does not implicitly {@link google.cloud.documentai.v1beta1.TableBoundHint.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @static + * @param {google.cloud.documentai.v1beta1.ITableBoundHint} message TableBoundHint message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableBoundHint.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.pageNumber); + if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) + $root.google.cloud.documentai.v1beta1.BoundingPoly.encode(message.boundingBox, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TableBoundHint message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.TableBoundHint.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @static + * @param {google.cloud.documentai.v1beta1.ITableBoundHint} message TableBoundHint message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableBoundHint.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableBoundHint message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.TableBoundHint} TableBoundHint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableBoundHint.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.TableBoundHint(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pageNumber = reader.int32(); + break; + case 2: + message.boundingBox = $root.google.cloud.documentai.v1beta1.BoundingPoly.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableBoundHint message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.TableBoundHint} TableBoundHint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableBoundHint.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableBoundHint message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableBoundHint.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + if (!$util.isInteger(message.pageNumber)) + return "pageNumber: integer expected"; + if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { + var error = $root.google.cloud.documentai.v1beta1.BoundingPoly.verify(message.boundingBox); + if (error) + return "boundingBox." + error; + } + return null; + }; + + /** + * Creates a TableBoundHint message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.TableBoundHint} TableBoundHint + */ + TableBoundHint.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.TableBoundHint) + return object; + var message = new $root.google.cloud.documentai.v1beta1.TableBoundHint(); + if (object.pageNumber != null) + message.pageNumber = object.pageNumber | 0; + if (object.boundingBox != null) { + if (typeof object.boundingBox !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.TableBoundHint.boundingBox: object expected"); + message.boundingBox = $root.google.cloud.documentai.v1beta1.BoundingPoly.fromObject(object.boundingBox); + } + return message; + }; + + /** + * Creates a plain object from a TableBoundHint message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @static + * @param {google.cloud.documentai.v1beta1.TableBoundHint} message TableBoundHint + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableBoundHint.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.pageNumber = 0; + object.boundingBox = null; + } + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + object.pageNumber = message.pageNumber; + if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) + object.boundingBox = $root.google.cloud.documentai.v1beta1.BoundingPoly.toObject(message.boundingBox, options); + return object; + }; + + /** + * Converts this TableBoundHint to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @instance + * @returns {Object.} JSON object + */ + TableBoundHint.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TableBoundHint; + })(); + + v1beta1.FormExtractionParams = (function() { + + /** + * Properties of a FormExtractionParams. + * @memberof google.cloud.documentai.v1beta1 + * @interface IFormExtractionParams + * @property {boolean|null} [enabled] FormExtractionParams enabled + * @property {Array.|null} [keyValuePairHints] FormExtractionParams keyValuePairHints + * @property {string|null} [modelVersion] FormExtractionParams modelVersion + */ + + /** + * Constructs a new FormExtractionParams. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a FormExtractionParams. + * @implements IFormExtractionParams + * @constructor + * @param {google.cloud.documentai.v1beta1.IFormExtractionParams=} [properties] Properties to set + */ + function FormExtractionParams(properties) { + this.keyValuePairHints = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FormExtractionParams enabled. + * @member {boolean} enabled + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @instance + */ + FormExtractionParams.prototype.enabled = false; + + /** + * FormExtractionParams keyValuePairHints. + * @member {Array.} keyValuePairHints + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @instance + */ + FormExtractionParams.prototype.keyValuePairHints = $util.emptyArray; + + /** + * FormExtractionParams modelVersion. + * @member {string} modelVersion + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @instance + */ + FormExtractionParams.prototype.modelVersion = ""; + + /** + * Creates a new FormExtractionParams instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.IFormExtractionParams=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.FormExtractionParams} FormExtractionParams instance + */ + FormExtractionParams.create = function create(properties) { + return new FormExtractionParams(properties); + }; + + /** + * Encodes the specified FormExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.FormExtractionParams.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.IFormExtractionParams} message FormExtractionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FormExtractionParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enabled != null && message.hasOwnProperty("enabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); + if (message.keyValuePairHints != null && message.keyValuePairHints.length) + for (var i = 0; i < message.keyValuePairHints.length; ++i) + $root.google.cloud.documentai.v1beta1.KeyValuePairHint.encode(message.keyValuePairHints[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.modelVersion); + return writer; + }; + + /** + * Encodes the specified FormExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.FormExtractionParams.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.IFormExtractionParams} message FormExtractionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FormExtractionParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FormExtractionParams message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.FormExtractionParams} FormExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FormExtractionParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.FormExtractionParams(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.enabled = reader.bool(); + break; + case 2: + if (!(message.keyValuePairHints && message.keyValuePairHints.length)) + message.keyValuePairHints = []; + message.keyValuePairHints.push($root.google.cloud.documentai.v1beta1.KeyValuePairHint.decode(reader, reader.uint32())); + break; + case 3: + message.modelVersion = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FormExtractionParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.FormExtractionParams} FormExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FormExtractionParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FormExtractionParams message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FormExtractionParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.enabled != null && message.hasOwnProperty("enabled")) + if (typeof message.enabled !== "boolean") + return "enabled: boolean expected"; + if (message.keyValuePairHints != null && message.hasOwnProperty("keyValuePairHints")) { + if (!Array.isArray(message.keyValuePairHints)) + return "keyValuePairHints: array expected"; + for (var i = 0; i < message.keyValuePairHints.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.KeyValuePairHint.verify(message.keyValuePairHints[i]); + if (error) + return "keyValuePairHints." + error; + } + } + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + if (!$util.isString(message.modelVersion)) + return "modelVersion: string expected"; + return null; + }; + + /** + * Creates a FormExtractionParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.FormExtractionParams} FormExtractionParams + */ + FormExtractionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.FormExtractionParams) + return object; + var message = new $root.google.cloud.documentai.v1beta1.FormExtractionParams(); + if (object.enabled != null) + message.enabled = Boolean(object.enabled); + if (object.keyValuePairHints) { + if (!Array.isArray(object.keyValuePairHints)) + throw TypeError(".google.cloud.documentai.v1beta1.FormExtractionParams.keyValuePairHints: array expected"); + message.keyValuePairHints = []; + for (var i = 0; i < object.keyValuePairHints.length; ++i) { + if (typeof object.keyValuePairHints[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.FormExtractionParams.keyValuePairHints: object expected"); + message.keyValuePairHints[i] = $root.google.cloud.documentai.v1beta1.KeyValuePairHint.fromObject(object.keyValuePairHints[i]); + } + } + if (object.modelVersion != null) + message.modelVersion = String(object.modelVersion); + return message; + }; + + /** + * Creates a plain object from a FormExtractionParams message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.FormExtractionParams} message FormExtractionParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FormExtractionParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.keyValuePairHints = []; + if (options.defaults) { + object.enabled = false; + object.modelVersion = ""; + } + if (message.enabled != null && message.hasOwnProperty("enabled")) + object.enabled = message.enabled; + if (message.keyValuePairHints && message.keyValuePairHints.length) { + object.keyValuePairHints = []; + for (var j = 0; j < message.keyValuePairHints.length; ++j) + object.keyValuePairHints[j] = $root.google.cloud.documentai.v1beta1.KeyValuePairHint.toObject(message.keyValuePairHints[j], options); + } + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + object.modelVersion = message.modelVersion; + return object; + }; + + /** + * Converts this FormExtractionParams to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @instance + * @returns {Object.} JSON object + */ + FormExtractionParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FormExtractionParams; + })(); + + v1beta1.KeyValuePairHint = (function() { + + /** + * Properties of a KeyValuePairHint. + * @memberof google.cloud.documentai.v1beta1 + * @interface IKeyValuePairHint + * @property {string|null} [key] KeyValuePairHint key + * @property {Array.|null} [valueTypes] KeyValuePairHint valueTypes + */ + + /** + * Constructs a new KeyValuePairHint. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a KeyValuePairHint. + * @implements IKeyValuePairHint + * @constructor + * @param {google.cloud.documentai.v1beta1.IKeyValuePairHint=} [properties] Properties to set + */ + function KeyValuePairHint(properties) { + this.valueTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * KeyValuePairHint key. + * @member {string} key + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @instance + */ + KeyValuePairHint.prototype.key = ""; + + /** + * KeyValuePairHint valueTypes. + * @member {Array.} valueTypes + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @instance + */ + KeyValuePairHint.prototype.valueTypes = $util.emptyArray; + + /** + * Creates a new KeyValuePairHint instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @static + * @param {google.cloud.documentai.v1beta1.IKeyValuePairHint=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.KeyValuePairHint} KeyValuePairHint instance + */ + KeyValuePairHint.create = function create(properties) { + return new KeyValuePairHint(properties); + }; + + /** + * Encodes the specified KeyValuePairHint message. Does not implicitly {@link google.cloud.documentai.v1beta1.KeyValuePairHint.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @static + * @param {google.cloud.documentai.v1beta1.IKeyValuePairHint} message KeyValuePairHint message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KeyValuePairHint.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && message.hasOwnProperty("key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.valueTypes != null && message.valueTypes.length) + for (var i = 0; i < message.valueTypes.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.valueTypes[i]); + return writer; + }; + + /** + * Encodes the specified KeyValuePairHint message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.KeyValuePairHint.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @static + * @param {google.cloud.documentai.v1beta1.IKeyValuePairHint} message KeyValuePairHint message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KeyValuePairHint.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a KeyValuePairHint message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.KeyValuePairHint} KeyValuePairHint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KeyValuePairHint.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.KeyValuePairHint(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + if (!(message.valueTypes && message.valueTypes.length)) + message.valueTypes = []; + message.valueTypes.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a KeyValuePairHint message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.KeyValuePairHint} KeyValuePairHint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KeyValuePairHint.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a KeyValuePairHint message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + KeyValuePairHint.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.valueTypes != null && message.hasOwnProperty("valueTypes")) { + if (!Array.isArray(message.valueTypes)) + return "valueTypes: array expected"; + for (var i = 0; i < message.valueTypes.length; ++i) + if (!$util.isString(message.valueTypes[i])) + return "valueTypes: string[] expected"; + } + return null; + }; + + /** + * Creates a KeyValuePairHint message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.KeyValuePairHint} KeyValuePairHint + */ + KeyValuePairHint.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.KeyValuePairHint) + return object; + var message = new $root.google.cloud.documentai.v1beta1.KeyValuePairHint(); + if (object.key != null) + message.key = String(object.key); + if (object.valueTypes) { + if (!Array.isArray(object.valueTypes)) + throw TypeError(".google.cloud.documentai.v1beta1.KeyValuePairHint.valueTypes: array expected"); + message.valueTypes = []; + for (var i = 0; i < object.valueTypes.length; ++i) + message.valueTypes[i] = String(object.valueTypes[i]); + } + return message; + }; + + /** + * Creates a plain object from a KeyValuePairHint message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @static + * @param {google.cloud.documentai.v1beta1.KeyValuePairHint} message KeyValuePairHint + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + KeyValuePairHint.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.valueTypes = []; + if (options.defaults) + object.key = ""; + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.valueTypes && message.valueTypes.length) { + object.valueTypes = []; + for (var j = 0; j < message.valueTypes.length; ++j) + object.valueTypes[j] = message.valueTypes[j]; + } + return object; + }; + + /** + * Converts this KeyValuePairHint to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @instance + * @returns {Object.} JSON object + */ + KeyValuePairHint.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return KeyValuePairHint; + })(); + + v1beta1.EntityExtractionParams = (function() { + + /** + * Properties of an EntityExtractionParams. + * @memberof google.cloud.documentai.v1beta1 + * @interface IEntityExtractionParams + * @property {boolean|null} [enabled] EntityExtractionParams enabled + * @property {string|null} [modelVersion] EntityExtractionParams modelVersion + */ + + /** + * Constructs a new EntityExtractionParams. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents an EntityExtractionParams. + * @implements IEntityExtractionParams + * @constructor + * @param {google.cloud.documentai.v1beta1.IEntityExtractionParams=} [properties] Properties to set + */ + function EntityExtractionParams(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EntityExtractionParams enabled. + * @member {boolean} enabled + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @instance + */ + EntityExtractionParams.prototype.enabled = false; + + /** + * EntityExtractionParams modelVersion. + * @member {string} modelVersion + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @instance + */ + EntityExtractionParams.prototype.modelVersion = ""; + + /** + * Creates a new EntityExtractionParams instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.IEntityExtractionParams=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.EntityExtractionParams} EntityExtractionParams instance + */ + EntityExtractionParams.create = function create(properties) { + return new EntityExtractionParams(properties); + }; + + /** + * Encodes the specified EntityExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.EntityExtractionParams.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.IEntityExtractionParams} message EntityExtractionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityExtractionParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enabled != null && message.hasOwnProperty("enabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.modelVersion); + return writer; + }; + + /** + * Encodes the specified EntityExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.EntityExtractionParams.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.IEntityExtractionParams} message EntityExtractionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityExtractionParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EntityExtractionParams message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.EntityExtractionParams} EntityExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityExtractionParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.EntityExtractionParams(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.enabled = reader.bool(); + break; + case 2: + message.modelVersion = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EntityExtractionParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.EntityExtractionParams} EntityExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityExtractionParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EntityExtractionParams message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EntityExtractionParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.enabled != null && message.hasOwnProperty("enabled")) + if (typeof message.enabled !== "boolean") + return "enabled: boolean expected"; + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + if (!$util.isString(message.modelVersion)) + return "modelVersion: string expected"; + return null; + }; + + /** + * Creates an EntityExtractionParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.EntityExtractionParams} EntityExtractionParams + */ + EntityExtractionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.EntityExtractionParams) + return object; + var message = new $root.google.cloud.documentai.v1beta1.EntityExtractionParams(); + if (object.enabled != null) + message.enabled = Boolean(object.enabled); + if (object.modelVersion != null) + message.modelVersion = String(object.modelVersion); + return message; + }; + + /** + * Creates a plain object from an EntityExtractionParams message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.EntityExtractionParams} message EntityExtractionParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EntityExtractionParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.enabled = false; + object.modelVersion = ""; + } + if (message.enabled != null && message.hasOwnProperty("enabled")) + object.enabled = message.enabled; + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + object.modelVersion = message.modelVersion; + return object; + }; + + /** + * Converts this EntityExtractionParams to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @instance + * @returns {Object.} JSON object + */ + EntityExtractionParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EntityExtractionParams; + })(); + + v1beta1.InputConfig = (function() { + + /** + * Properties of an InputConfig. + * @memberof google.cloud.documentai.v1beta1 + * @interface IInputConfig + * @property {google.cloud.documentai.v1beta1.IGcsSource|null} [gcsSource] InputConfig gcsSource + * @property {string|null} [mimeType] InputConfig mimeType + */ + + /** + * Constructs a new InputConfig. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents an InputConfig. + * @implements IInputConfig + * @constructor + * @param {google.cloud.documentai.v1beta1.IInputConfig=} [properties] Properties to set + */ + function InputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InputConfig gcsSource. + * @member {google.cloud.documentai.v1beta1.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @instance + */ + InputConfig.prototype.gcsSource = null; + + /** + * InputConfig mimeType. + * @member {string} mimeType + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @instance + */ + InputConfig.prototype.mimeType = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * InputConfig source. + * @member {"gcsSource"|undefined} source + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @instance + */ + Object.defineProperty(InputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["gcsSource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new InputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @static + * @param {google.cloud.documentai.v1beta1.IInputConfig=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.InputConfig} InputConfig instance + */ + InputConfig.create = function create(properties) { + return new InputConfig(properties); + }; + + /** + * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta1.InputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @static + * @param {google.cloud.documentai.v1beta1.IInputConfig} message InputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) + $root.google.cloud.documentai.v1beta1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); + return writer; + }; + + /** + * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.InputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @static + * @param {google.cloud.documentai.v1beta1.IInputConfig} message InputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.InputConfig} InputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.InputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsSource = $root.google.cloud.documentai.v1beta1.GcsSource.decode(reader, reader.uint32()); + break; + case 2: + message.mimeType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.InputConfig} InputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InputConfig message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + properties.source = 1; + { + var error = $root.google.cloud.documentai.v1beta1.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + return null; + }; + + /** + * Creates an InputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.InputConfig} InputConfig + */ + InputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.InputConfig) + return object; + var message = new $root.google.cloud.documentai.v1beta1.InputConfig(); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.InputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.documentai.v1beta1.GcsSource.fromObject(object.gcsSource); + } + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + return message; + }; + + /** + * Creates a plain object from an InputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @static + * @param {google.cloud.documentai.v1beta1.InputConfig} message InputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.mimeType = ""; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.documentai.v1beta1.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + return object; + }; + + /** + * Converts this InputConfig to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @instance + * @returns {Object.} JSON object + */ + InputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return InputConfig; + })(); + + v1beta1.OutputConfig = (function() { + + /** + * Properties of an OutputConfig. + * @memberof google.cloud.documentai.v1beta1 + * @interface IOutputConfig + * @property {google.cloud.documentai.v1beta1.IGcsDestination|null} [gcsDestination] OutputConfig gcsDestination + * @property {number|null} [pagesPerShard] OutputConfig pagesPerShard + */ + + /** + * Constructs a new OutputConfig. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents an OutputConfig. + * @implements IOutputConfig + * @constructor + * @param {google.cloud.documentai.v1beta1.IOutputConfig=} [properties] Properties to set + */ + function OutputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OutputConfig gcsDestination. + * @member {google.cloud.documentai.v1beta1.IGcsDestination|null|undefined} gcsDestination + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @instance + */ + OutputConfig.prototype.gcsDestination = null; + + /** + * OutputConfig pagesPerShard. + * @member {number} pagesPerShard + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @instance + */ + OutputConfig.prototype.pagesPerShard = 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * OutputConfig destination. + * @member {"gcsDestination"|undefined} destination + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @instance + */ + Object.defineProperty(OutputConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsDestination"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new OutputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @static + * @param {google.cloud.documentai.v1beta1.IOutputConfig=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.OutputConfig} OutputConfig instance + */ + OutputConfig.create = function create(properties) { + return new OutputConfig(properties); + }; + + /** + * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta1.OutputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @static + * @param {google.cloud.documentai.v1beta1.IOutputConfig} message OutputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + $root.google.cloud.documentai.v1beta1.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagesPerShard != null && message.hasOwnProperty("pagesPerShard")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pagesPerShard); + return writer; + }; + + /** + * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.OutputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @static + * @param {google.cloud.documentai.v1beta1.IOutputConfig} message OutputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OutputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.OutputConfig} OutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.OutputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsDestination = $root.google.cloud.documentai.v1beta1.GcsDestination.decode(reader, reader.uint32()); + break; + case 2: + message.pagesPerShard = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OutputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.OutputConfig} OutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OutputConfig message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OutputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + properties.destination = 1; + { + var error = $root.google.cloud.documentai.v1beta1.GcsDestination.verify(message.gcsDestination); + if (error) + return "gcsDestination." + error; + } + } + if (message.pagesPerShard != null && message.hasOwnProperty("pagesPerShard")) + if (!$util.isInteger(message.pagesPerShard)) + return "pagesPerShard: integer expected"; + return null; + }; + + /** + * Creates an OutputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.OutputConfig} OutputConfig + */ + OutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.OutputConfig) + return object; + var message = new $root.google.cloud.documentai.v1beta1.OutputConfig(); + if (object.gcsDestination != null) { + if (typeof object.gcsDestination !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.OutputConfig.gcsDestination: object expected"); + message.gcsDestination = $root.google.cloud.documentai.v1beta1.GcsDestination.fromObject(object.gcsDestination); + } + if (object.pagesPerShard != null) + message.pagesPerShard = object.pagesPerShard | 0; + return message; + }; + + /** + * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @static + * @param {google.cloud.documentai.v1beta1.OutputConfig} message OutputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OutputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.pagesPerShard = 0; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + object.gcsDestination = $root.google.cloud.documentai.v1beta1.GcsDestination.toObject(message.gcsDestination, options); + if (options.oneofs) + object.destination = "gcsDestination"; + } + if (message.pagesPerShard != null && message.hasOwnProperty("pagesPerShard")) + object.pagesPerShard = message.pagesPerShard; + return object; + }; + + /** + * Converts this OutputConfig to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @instance + * @returns {Object.} JSON object + */ + OutputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OutputConfig; + })(); + + v1beta1.GcsSource = (function() { + + /** + * Properties of a GcsSource. + * @memberof google.cloud.documentai.v1beta1 + * @interface IGcsSource + * @property {string|null} [uri] GcsSource uri + */ + + /** + * Constructs a new GcsSource. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a GcsSource. + * @implements IGcsSource + * @constructor + * @param {google.cloud.documentai.v1beta1.IGcsSource=} [properties] Properties to set + */ + function GcsSource(properties) { + if (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 uri. + * @member {string} uri + * @memberof google.cloud.documentai.v1beta1.GcsSource + * @instance + */ + GcsSource.prototype.uri = ""; + + /** + * Creates a new GcsSource instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.GcsSource + * @static + * @param {google.cloud.documentai.v1beta1.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.GcsSource} GcsSource instance + */ + GcsSource.create = function create(properties) { + return new GcsSource(properties); + }; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.documentai.v1beta1.GcsSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.GcsSource + * @static + * @param {google.cloud.documentai.v1beta1.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.uri != null && message.hasOwnProperty("uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + return writer; + }; + + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.GcsSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.GcsSource + * @static + * @param {google.cloud.documentai.v1beta1.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.documentai.v1beta1.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.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.documentai.v1beta1.GcsSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uri = 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.documentai.v1beta1.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.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.documentai.v1beta1.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.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: 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.documentai.v1beta1.GcsSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.GcsSource} GcsSource + */ + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.GcsSource) + return object; + var message = new $root.google.cloud.documentai.v1beta1.GcsSource(); + if (object.uri != null) + message.uri = String(object.uri); + return message; + }; + + /** + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.GcsSource + * @static + * @param {google.cloud.documentai.v1beta1.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.defaults) + object.uri = ""; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + return object; + }; + + /** + * Converts this GcsSource to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.GcsSource + * @instance + * @returns {Object.} JSON object + */ + GcsSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GcsSource; + })(); + + v1beta1.GcsDestination = (function() { + + /** + * Properties of a GcsDestination. + * @memberof google.cloud.documentai.v1beta1 + * @interface IGcsDestination + * @property {string|null} [uri] GcsDestination uri + */ + + /** + * Constructs a new GcsDestination. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a GcsDestination. + * @implements IGcsDestination + * @constructor + * @param {google.cloud.documentai.v1beta1.IGcsDestination=} [properties] Properties to set + */ + function GcsDestination(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GcsDestination uri. + * @member {string} uri + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @instance + */ + GcsDestination.prototype.uri = ""; + + /** + * Creates a new GcsDestination instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @static + * @param {google.cloud.documentai.v1beta1.IGcsDestination=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.GcsDestination} GcsDestination instance + */ + GcsDestination.create = function create(properties) { + return new GcsDestination(properties); + }; + + /** + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.documentai.v1beta1.GcsDestination.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @static + * @param {google.cloud.documentai.v1beta1.IGcsDestination} message GcsDestination message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsDestination.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uri != null && message.hasOwnProperty("uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + return writer; + }; + + /** + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.GcsDestination.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @static + * @param {google.cloud.documentai.v1beta1.IGcsDestination} message GcsDestination message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsDestination.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GcsDestination message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.GcsDestination} GcsDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsDestination.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.GcsDestination(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uri = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GcsDestination message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.GcsDestination} GcsDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsDestination.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GcsDestination message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsDestination.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"; + return null; + }; + + /** + * Creates a GcsDestination message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.GcsDestination} GcsDestination + */ + GcsDestination.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.GcsDestination) + return object; + var message = new $root.google.cloud.documentai.v1beta1.GcsDestination(); + if (object.uri != null) + message.uri = String(object.uri); + return message; + }; + + /** + * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @static + * @param {google.cloud.documentai.v1beta1.GcsDestination} message GcsDestination + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsDestination.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.uri = ""; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + return object; + }; + + /** + * Converts this GcsDestination to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @instance + * @returns {Object.} JSON object + */ + GcsDestination.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GcsDestination; + })(); + + v1beta1.OperationMetadata = (function() { + + /** + * Properties of an OperationMetadata. + * @memberof google.cloud.documentai.v1beta1 + * @interface IOperationMetadata + * @property {google.cloud.documentai.v1beta1.OperationMetadata.State|null} [state] OperationMetadata state + * @property {string|null} [stateMessage] OperationMetadata stateMessage + * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] OperationMetadata updateTime + */ + + /** + * Constructs a new OperationMetadata. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents an OperationMetadata. + * @implements IOperationMetadata + * @constructor + * @param {google.cloud.documentai.v1beta1.IOperationMetadata=} [properties] Properties to set + */ + function OperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OperationMetadata state. + * @member {google.cloud.documentai.v1beta1.OperationMetadata.State} state + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.state = 0; + + /** + * OperationMetadata stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.stateMessage = ""; + + /** + * OperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.createTime = null; + + /** + * OperationMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.updateTime = null; + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @static + * @param {google.cloud.documentai.v1beta1.IOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.OperationMetadata} OperationMetadata instance + */ + OperationMetadata.create = function create(properties) { + return new OperationMetadata(properties); + }; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta1.OperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @static + * @param {google.cloud.documentai.v1beta1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && message.hasOwnProperty("state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); + if (message.createTime != null && message.hasOwnProperty("createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.OperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @static + * @param {google.cloud.documentai.v1beta1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.OperationMetadata} OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.OperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.int32(); + break; + case 2: + message.stateMessage = reader.string(); + break; + case 3: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.OperationMetadata} OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + if (!$util.isString(message.stateMessage)) + return "stateMessage: string 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 OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.OperationMetadata} OperationMetadata + */ + OperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.OperationMetadata) + return object; + var message = new $root.google.cloud.documentai.v1beta1.OperationMetadata(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "ACCEPTED": + case 1: + message.state = 1; + break; + case "WAITING": + case 2: + message.state = 2; + break; + case "RUNNING": + case 3: + message.state = 3; + break; + case "SUCCEEDED": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + case "FAILED": + case 6: + message.state = 6; + break; + } + if (object.stateMessage != null) + message.stateMessage = String(object.stateMessage); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.OperationMetadata.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.documentai.v1beta1.OperationMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + return message; + }; + + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @static + * @param {google.cloud.documentai.v1beta1.OperationMetadata} message OperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.stateMessage = ""; + object.createTime = null; + object.updateTime = null; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta1.OperationMetadata.State[message.state] : message.state; + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + object.stateMessage = message.stateMessage; + 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 OperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @instance + * @returns {Object.} JSON object + */ + OperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.documentai.v1beta1.OperationMetadata.State + * @enum {string} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} ACCEPTED=1 ACCEPTED value + * @property {number} WAITING=2 WAITING value + * @property {number} RUNNING=3 RUNNING value + * @property {number} SUCCEEDED=4 SUCCEEDED value + * @property {number} CANCELLED=5 CANCELLED value + * @property {number} FAILED=6 FAILED value + */ + OperationMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ACCEPTED"] = 1; + values[valuesById[2] = "WAITING"] = 2; + values[valuesById[3] = "RUNNING"] = 3; + values[valuesById[4] = "SUCCEEDED"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + values[valuesById[6] = "FAILED"] = 6; + return values; + })(); + + return OperationMetadata; + })(); + + v1beta1.Vertex = (function() { + + /** + * Properties of a Vertex. + * @memberof google.cloud.documentai.v1beta1 + * @interface IVertex + * @property {number|null} [x] Vertex x + * @property {number|null} [y] Vertex y + */ + + /** + * Constructs a new Vertex. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a Vertex. + * @implements IVertex + * @constructor + * @param {google.cloud.documentai.v1beta1.IVertex=} [properties] Properties to set + */ + function Vertex(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Vertex x. + * @member {number} x + * @memberof google.cloud.documentai.v1beta1.Vertex + * @instance + */ + Vertex.prototype.x = 0; + + /** + * Vertex y. + * @member {number} y + * @memberof google.cloud.documentai.v1beta1.Vertex + * @instance + */ + Vertex.prototype.y = 0; + + /** + * Creates a new Vertex instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Vertex + * @static + * @param {google.cloud.documentai.v1beta1.IVertex=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Vertex} Vertex instance + */ + Vertex.create = function create(properties) { + return new Vertex(properties); + }; + + /** + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.documentai.v1beta1.Vertex.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Vertex + * @static + * @param {google.cloud.documentai.v1beta1.IVertex} message Vertex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Vertex.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.x != null && message.hasOwnProperty("x")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); + if (message.y != null && message.hasOwnProperty("y")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); + return writer; + }; + + /** + * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Vertex.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Vertex + * @static + * @param {google.cloud.documentai.v1beta1.IVertex} message Vertex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Vertex.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Vertex message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Vertex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Vertex} Vertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Vertex.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Vertex(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.x = reader.int32(); + break; + case 2: + message.y = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Vertex message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Vertex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Vertex} Vertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Vertex.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Vertex message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Vertex + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Vertex.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.x != null && message.hasOwnProperty("x")) + if (!$util.isInteger(message.x)) + return "x: integer expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (!$util.isInteger(message.y)) + return "y: integer expected"; + return null; + }; + + /** + * Creates a Vertex message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Vertex + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Vertex} Vertex + */ + Vertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Vertex) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Vertex(); + if (object.x != null) + message.x = object.x | 0; + if (object.y != null) + message.y = object.y | 0; + return message; + }; + + /** + * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Vertex + * @static + * @param {google.cloud.documentai.v1beta1.Vertex} message Vertex + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Vertex.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.x = 0; + object.y = 0; + } + if (message.x != null && message.hasOwnProperty("x")) + object.x = message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = message.y; + return object; + }; + + /** + * Converts this Vertex to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Vertex + * @instance + * @returns {Object.} JSON object + */ + Vertex.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Vertex; + })(); + + v1beta1.NormalizedVertex = (function() { + + /** + * Properties of a NormalizedVertex. + * @memberof google.cloud.documentai.v1beta1 + * @interface INormalizedVertex + * @property {number|null} [x] NormalizedVertex x + * @property {number|null} [y] NormalizedVertex y + */ + + /** + * Constructs a new NormalizedVertex. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a NormalizedVertex. + * @implements INormalizedVertex + * @constructor + * @param {google.cloud.documentai.v1beta1.INormalizedVertex=} [properties] Properties to set + */ + function NormalizedVertex(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NormalizedVertex x. + * @member {number} x + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @instance + */ + NormalizedVertex.prototype.x = 0; + + /** + * NormalizedVertex y. + * @member {number} y + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @instance + */ + NormalizedVertex.prototype.y = 0; + + /** + * Creates a new NormalizedVertex instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @static + * @param {google.cloud.documentai.v1beta1.INormalizedVertex=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.NormalizedVertex} NormalizedVertex instance + */ + NormalizedVertex.create = function create(properties) { + return new NormalizedVertex(properties); + }; + + /** + * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.documentai.v1beta1.NormalizedVertex.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @static + * @param {google.cloud.documentai.v1beta1.INormalizedVertex} message NormalizedVertex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NormalizedVertex.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.x != null && message.hasOwnProperty("x")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); + if (message.y != null && message.hasOwnProperty("y")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); + return writer; + }; + + /** + * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.NormalizedVertex.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @static + * @param {google.cloud.documentai.v1beta1.INormalizedVertex} message NormalizedVertex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NormalizedVertex.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.NormalizedVertex} NormalizedVertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NormalizedVertex.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.NormalizedVertex(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.x = reader.float(); + break; + case 2: + message.y = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.NormalizedVertex} NormalizedVertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NormalizedVertex.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NormalizedVertex message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NormalizedVertex.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.x != null && message.hasOwnProperty("x")) + if (typeof message.x !== "number") + return "x: number expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (typeof message.y !== "number") + return "y: number expected"; + return null; + }; + + /** + * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.NormalizedVertex} NormalizedVertex + */ + NormalizedVertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.NormalizedVertex) + return object; + var message = new $root.google.cloud.documentai.v1beta1.NormalizedVertex(); + if (object.x != null) + message.x = Number(object.x); + if (object.y != null) + message.y = Number(object.y); + return message; + }; + + /** + * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @static + * @param {google.cloud.documentai.v1beta1.NormalizedVertex} message NormalizedVertex + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NormalizedVertex.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.x = 0; + object.y = 0; + } + if (message.x != null && message.hasOwnProperty("x")) + object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; + return object; + }; + + /** + * Converts this NormalizedVertex to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @instance + * @returns {Object.} JSON object + */ + NormalizedVertex.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NormalizedVertex; + })(); + + v1beta1.BoundingPoly = (function() { + + /** + * Properties of a BoundingPoly. + * @memberof google.cloud.documentai.v1beta1 + * @interface IBoundingPoly + * @property {Array.|null} [vertices] BoundingPoly vertices + * @property {Array.|null} [normalizedVertices] BoundingPoly normalizedVertices + */ + + /** + * Constructs a new BoundingPoly. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a BoundingPoly. + * @implements IBoundingPoly + * @constructor + * @param {google.cloud.documentai.v1beta1.IBoundingPoly=} [properties] Properties to set + */ + function BoundingPoly(properties) { + this.vertices = []; + this.normalizedVertices = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BoundingPoly vertices. + * @member {Array.} vertices + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @instance + */ + BoundingPoly.prototype.vertices = $util.emptyArray; + + /** + * BoundingPoly normalizedVertices. + * @member {Array.} normalizedVertices + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @instance + */ + BoundingPoly.prototype.normalizedVertices = $util.emptyArray; + + /** + * Creates a new BoundingPoly instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @static + * @param {google.cloud.documentai.v1beta1.IBoundingPoly=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.BoundingPoly} BoundingPoly instance + */ + BoundingPoly.create = function create(properties) { + return new BoundingPoly(properties); + }; + + /** + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.documentai.v1beta1.BoundingPoly.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @static + * @param {google.cloud.documentai.v1beta1.IBoundingPoly} message BoundingPoly message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoundingPoly.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.vertices != null && message.vertices.length) + for (var i = 0; i < message.vertices.length; ++i) + $root.google.cloud.documentai.v1beta1.Vertex.encode(message.vertices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.normalizedVertices != null && message.normalizedVertices.length) + for (var i = 0; i < message.normalizedVertices.length; ++i) + $root.google.cloud.documentai.v1beta1.NormalizedVertex.encode(message.normalizedVertices[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.BoundingPoly.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @static + * @param {google.cloud.documentai.v1beta1.IBoundingPoly} message BoundingPoly message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.BoundingPoly} BoundingPoly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoundingPoly.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.BoundingPoly(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.vertices && message.vertices.length)) + message.vertices = []; + message.vertices.push($root.google.cloud.documentai.v1beta1.Vertex.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.normalizedVertices && message.normalizedVertices.length)) + message.normalizedVertices = []; + message.normalizedVertices.push($root.google.cloud.documentai.v1beta1.NormalizedVertex.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.BoundingPoly} BoundingPoly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoundingPoly.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BoundingPoly message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoundingPoly.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.vertices != null && message.hasOwnProperty("vertices")) { + if (!Array.isArray(message.vertices)) + return "vertices: array expected"; + for (var i = 0; i < message.vertices.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Vertex.verify(message.vertices[i]); + if (error) + return "vertices." + error; + } + } + if (message.normalizedVertices != null && message.hasOwnProperty("normalizedVertices")) { + if (!Array.isArray(message.normalizedVertices)) + return "normalizedVertices: array expected"; + for (var i = 0; i < message.normalizedVertices.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.NormalizedVertex.verify(message.normalizedVertices[i]); + if (error) + return "normalizedVertices." + error; + } + } + return null; + }; + + /** + * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.BoundingPoly} BoundingPoly + */ + BoundingPoly.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.BoundingPoly) + return object; + var message = new $root.google.cloud.documentai.v1beta1.BoundingPoly(); + if (object.vertices) { + if (!Array.isArray(object.vertices)) + throw TypeError(".google.cloud.documentai.v1beta1.BoundingPoly.vertices: array expected"); + message.vertices = []; + for (var i = 0; i < object.vertices.length; ++i) { + if (typeof object.vertices[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.BoundingPoly.vertices: object expected"); + message.vertices[i] = $root.google.cloud.documentai.v1beta1.Vertex.fromObject(object.vertices[i]); + } + } + if (object.normalizedVertices) { + if (!Array.isArray(object.normalizedVertices)) + throw TypeError(".google.cloud.documentai.v1beta1.BoundingPoly.normalizedVertices: array expected"); + message.normalizedVertices = []; + for (var i = 0; i < object.normalizedVertices.length; ++i) { + if (typeof object.normalizedVertices[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.BoundingPoly.normalizedVertices: object expected"); + message.normalizedVertices[i] = $root.google.cloud.documentai.v1beta1.NormalizedVertex.fromObject(object.normalizedVertices[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @static + * @param {google.cloud.documentai.v1beta1.BoundingPoly} message BoundingPoly + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoundingPoly.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.vertices = []; + object.normalizedVertices = []; + } + if (message.vertices && message.vertices.length) { + object.vertices = []; + for (var j = 0; j < message.vertices.length; ++j) + object.vertices[j] = $root.google.cloud.documentai.v1beta1.Vertex.toObject(message.vertices[j], options); + } + if (message.normalizedVertices && message.normalizedVertices.length) { + object.normalizedVertices = []; + for (var j = 0; j < message.normalizedVertices.length; ++j) + object.normalizedVertices[j] = $root.google.cloud.documentai.v1beta1.NormalizedVertex.toObject(message.normalizedVertices[j], options); + } + return object; + }; + + /** + * Converts this BoundingPoly to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @instance + * @returns {Object.} JSON object + */ + BoundingPoly.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BoundingPoly; + })(); + + return v1beta1; + })(); + + return documentai; + })(); + + 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 && message.hasOwnProperty("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 && message.hasOwnProperty("selector")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); + if (message.get != null && message.hasOwnProperty("get")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); + if (message.put != null && message.hasOwnProperty("put")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); + if (message.post != null && message.hasOwnProperty("post")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); + if (message["delete"] != null && message.hasOwnProperty("delete")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); + if (message.patch != null && message.hasOwnProperty("patch")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); + if (message.body != null && message.hasOwnProperty("body")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); + if (message.custom != null && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty("kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.path != null && message.hasOwnProperty("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 {string} + * @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; + })(); + + 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 && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message["package"] != null && message.hasOwnProperty("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 && message.hasOwnProperty("options")) + $root.google.protobuf.FileOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.sourceCodeInfo != null && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty("start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && message.hasOwnProperty("end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + if (message.options != null && message.hasOwnProperty("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 && message.hasOwnProperty("start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && message.hasOwnProperty("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 + */ + + /** + * 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; + + /** + * 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 && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.extendee != null && message.hasOwnProperty("extendee")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.extendee); + if (message.number != null && message.hasOwnProperty("number")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.number); + if (message.label != null && message.hasOwnProperty("label")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.label); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.type); + if (message.typeName != null && message.hasOwnProperty("typeName")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.typeName); + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.defaultValue); + if (message.options != null && message.hasOwnProperty("options")) + $root.google.protobuf.FieldOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.oneofIndex); + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.jsonName); + 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; + 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; + } + 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); + } + 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 = ""; + } + 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; + 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 {string} + * @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 {string} + * @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 && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.options != null && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty("start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && message.hasOwnProperty("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 && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.number != null && message.hasOwnProperty("number")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); + if (message.options != null && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.inputType != null && message.hasOwnProperty("inputType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.inputType); + if (message.outputType != null && message.hasOwnProperty("outputType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputType); + if (message.options != null && message.hasOwnProperty("options")) + $root.google.protobuf.MethodOptions.encode(message.options, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.clientStreaming); + if (message.serverStreaming != null && message.hasOwnProperty("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 + */ + + /** + * 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 = []; + if (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 = false; + + /** + * 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; + + /** + * 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 && message.hasOwnProperty("javaPackage")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.javaPackage); + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.javaOuterClassname); + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.optimizeFor); + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.javaMultipleFiles); + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.goPackage); + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.ccGenericServices); + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.javaGenericServices); + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + writer.uint32(/* id 18, wireType 0 =*/144).bool(message.pyGenericServices); + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + writer.uint32(/* id 20, wireType 0 =*/160).bool(message.javaGenerateEqualsAndHash); + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + writer.uint32(/* id 23, wireType 0 =*/184).bool(message.deprecated); + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + writer.uint32(/* id 27, wireType 0 =*/216).bool(message.javaStringCheckUtf8); + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + writer.uint32(/* id 31, wireType 0 =*/248).bool(message.ccEnableArenas); + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + writer.uint32(/* id 36, wireType 2 =*/290).string(message.objcClassPrefix); + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + writer.uint32(/* id 37, wireType 2 =*/298).string(message.csharpNamespace); + if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + writer.uint32(/* id 39, wireType 2 =*/314).string(message.swiftPrefix); + if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + writer.uint32(/* id 40, wireType 2 =*/322).string(message.phpClassPrefix); + if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + writer.uint32(/* id 41, wireType 2 =*/330).string(message.phpNamespace); + if (message.phpGenericServices != null && message.hasOwnProperty("phpGenericServices")) + writer.uint32(/* id 42, wireType 0 =*/336).bool(message.phpGenericServices); + if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + writer.uint32(/* id 44, wireType 2 =*/354).string(message.phpMetadataNamespace); + if (message.rubyPackage != null && message.hasOwnProperty("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(); + 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; + 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; + } + } + 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]); + } + } + 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 = []; + 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 = false; + 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); + } + 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 {string} + * @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 + */ + + /** + * 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; + + /** + * 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 && message.hasOwnProperty("messageSetWireFormat")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.messageSetWireFormat); + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.noStandardDescriptorAccessor); + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.mapEntry != null && message.hasOwnProperty("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(); + 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; + 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; + } + } + 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]); + } + } + 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; + } + 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); + } + 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 + */ + + /** + * 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; + + /** + * 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 && message.hasOwnProperty("ctype")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ctype); + if (message.packed != null && message.hasOwnProperty("packed")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.packed); + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.lazy != null && message.hasOwnProperty("lazy")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.lazy); + if (message.jstype != null && message.hasOwnProperty("jstype")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); + if (message.weak != null && message.hasOwnProperty("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(); + } + 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; + 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; + } + } + 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; + } + } + 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; + } + 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]; + } + 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 {string} + * @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 {string} + * @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 && message.hasOwnProperty("allowAlias")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAlias); + if (message.deprecated != null && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty(".google.api.defaultHost")) + writer.uint32(/* id 1049, wireType 2 =*/8394).string(message[".google.api.defaultHost"]); + if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".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 && message.hasOwnProperty("deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.idempotencyLevel != null && message.hasOwnProperty("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 && message.hasOwnProperty(".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 && message.hasOwnProperty(".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 {string} + * @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 && message.hasOwnProperty("identifierValue")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.identifierValue); + if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.positiveIntValue); + if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.negativeIntValue); + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + writer.uint32(/* id 6, wireType 1 =*/49).double(message.doubleValue); + if (message.stringValue != null && message.hasOwnProperty("stringValue")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.stringValue); + if (message.aggregateValue != null && message.hasOwnProperty("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 && message.hasOwnProperty("leadingComments")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.leadingComments); + if (message.trailingComments != null && message.hasOwnProperty("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 && message.hasOwnProperty("sourceFile")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceFile); + if (message.begin != null && message.hasOwnProperty("begin")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.begin); + if (message.end != null && message.hasOwnProperty("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.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 && message.hasOwnProperty("type_url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type_url); + if (message.value != null && message.hasOwnProperty("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.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 && message.hasOwnProperty("seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && message.hasOwnProperty("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.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.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 && message.hasOwnProperty("seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && message.hasOwnProperty("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; + })(); + + return protobuf; + })(); + + 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 && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.metadata != null && message.hasOwnProperty("metadata")) + $root.google.protobuf.Any.encode(message.metadata, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.done != null && message.hasOwnProperty("done")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.done); + if (message.error != null && message.hasOwnProperty("error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.response != null && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty("filter")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.name != null && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.timeout != null && message.hasOwnProperty("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 && message.hasOwnProperty("responseType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.responseType); + if (message.metadataType != null && message.hasOwnProperty("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; + })(); + + 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 && message.hasOwnProperty("code")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); + if (message.message != null && message.hasOwnProperty("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; + })(); + + return google; + })(); + + return $root; +}); diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index fd8ca11d9be..0ea87517fe3 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -4,19 +4,19 @@ "nested": { "cloud": { "nested": { - "document": { + "documentai": { "nested": { "v1beta1": { "options": { - "go_package": "google.golang.org/genproto/googleapis/cloud/document/v1beta1;document", + "go_package": "google.golang.org/genproto/googleapis/cloud/documentai/v1beta1;documentai", "java_multiple_files": true, "java_outer_classname": "GeometryProto", - "java_package": "com.google.cloud.document.v1beta1" + "java_package": "com.google.cloud.documentai.v1beta1" }, "nested": { "DocumentUnderstandingService": { "options": { - "(google.api.default_host)": "document.googleapis.com", + "(google.api.default_host)": "documentai.googleapis.com", "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" }, "methods": { @@ -27,7 +27,10 @@ "(google.api.http).post": "/v1beta1/{parent=projects/*/locations/*}/documents:batchProcess", "(google.api.http).body": "*", "(google.api.http).additional_bindings.post": "/v1beta1/{parent=projects/*}/documents:batchProcess", - "(google.api.http).additional_bindings.body": "*" + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "requests", + "(google.longrunning.operation_info).response_type": "BatchProcessDocumentsResponse", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" } } } @@ -37,7 +40,10 @@ "requests": { "rule": "repeated", "type": "ProcessDocumentRequest", - "id": 1 + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, "parent": { "type": "string", @@ -49,11 +55,17 @@ "fields": { "inputConfig": { "type": "InputConfig", - "id": 1 + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, "outputConfig": { "type": "OutputConfig", - "id": 2 + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, "documentType": { "type": "string", @@ -116,12 +128,18 @@ "tableBoundHints": { "rule": "repeated", "type": "TableBoundHint", - "id": 2 + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } }, "headerHints": { "rule": "repeated", "type": "string", - "id": 3 + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } }, "modelVersion": { "type": "string", @@ -133,7 +151,10 @@ "fields": { "pageNumber": { "type": "int32", - "id": 1 + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } }, "boundingBox": { "type": "BoundingPoly", @@ -198,7 +219,10 @@ }, "mimeType": { "type": "string", - "id": 2 + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } } } }, @@ -225,7 +249,10 @@ "fields": { "uri": { "type": "string", - "id": 1 + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } } } }, @@ -233,7 +260,10 @@ "fields": { "uri": { "type": "string", - "id": 1 + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } } } }, @@ -264,7 +294,8 @@ "WAITING": 2, "RUNNING": 3, "SUCCEEDED": 4, - "CANCELLED": 5 + "CANCELLED": 5, + "FAILED": 6 } } } @@ -317,7 +348,7 @@ "options": { "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", "java_multiple_files": true, - "java_outer_classname": "ClientProto", + "java_outer_classname": "FieldBehaviorProto", "java_package": "com.google.api", "objc_class_prefix": "GAPI", "cc_enable_arenas": true @@ -425,6 +456,22 @@ "type": "string", "id": 1050, "extend": "google.protobuf.ServiceOptions" + }, + "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 + } } } }, diff --git a/packages/google-cloud-documentai/samples/README.md b/packages/google-cloud-documentai/samples/README.md index 5e92a9305e7..2ad143c1e72 100644 --- a/packages/google-cloud-documentai/samples/README.md +++ b/packages/google-cloud-documentai/samples/README.md @@ -41,4 +41,4 @@ __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-document-ai&page=editor&open_in_editor=samples/README.md -[product-docs]: https://cloud.google.com/document/docs/ \ No newline at end of file +[product-docs]: https://cloud.google.com/document-understanding/docs/ \ No newline at end of file diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 4624513890a..157f22a9f63 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js" }, "dependencies": { - "@google-cloud/document-ai": "^1.0.0" + "@google-cloud/documentai": "^0.0.1" }, "devDependencies": { "chai": "^4.2.0", diff --git a/packages/google-cloud-documentai/samples/quickstart.js b/packages/google-cloud-documentai/samples/quickstart.js index 3a544c8c9c3..f4b6afac5cf 100644 --- a/packages/google-cloud-documentai/samples/quickstart.js +++ b/packages/google-cloud-documentai/samples/quickstart.js @@ -24,7 +24,7 @@ async function main() { async function batchProcessDocument() { const { DocumentUnderstandingServiceClient, - } = require('@google-cloud/document'); + } = require('@google-cloud/documentai'); const client = new DocumentUnderstandingServiceClient(); // TODO: write sample here that demonstrates batch processing of documents. console.info(client); diff --git a/packages/google-cloud-documentai/src/index.js b/packages/google-cloud-documentai/src/index.js index a5130edf3dd..134b6850bf7 100644 --- a/packages/google-cloud-documentai/src/index.js +++ b/packages/google-cloud-documentai/src/index.js @@ -19,10 +19,10 @@ * @namespace google.cloud */ /** - * @namespace google.cloud.document + * @namespace google.cloud.documentai */ /** - * @namespace google.cloud.document.v1beta1 + * @namespace google.cloud.documentai.v1beta1 */ 'use strict'; @@ -33,7 +33,7 @@ const gapic = Object.freeze({ }); /** - * The `document` package has the following named exports: + * The `documentai` package has the following named exports: * * - `DocumentUnderstandingServiceClient` - Reference to * {@link v1beta1.DocumentUnderstandingServiceClient} @@ -42,20 +42,20 @@ const gapic = Object.freeze({ * - `DocumentUnderstandingServiceClient` - Reference to * {@link v1beta1.DocumentUnderstandingServiceClient} * - * @module {object} document - * @alias nodejs-document + * @module {object} documentai + * @alias nodejs-documentai * * @example Install the client library with npm: - * npm install --save document + * npm install --save documentai * * @example Import the client library: - * const document = require('document'); + * const documentai = require('documentai'); * * @example Create a client that uses Application Default Credentials (ADC): - * const client = new document.DocumentUnderstandingServiceClient(); + * const client = new documentai.DocumentUnderstandingServiceClient(); * * @example Create a client with explicit credentials: - * const client = new document.DocumentUnderstandingServiceClient({ + * const client = new documentai.DocumentUnderstandingServiceClient({ * projectId: 'your-project-id', * keyFilename: '/path/to/keyfile.json', * }); diff --git a/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/documentai/v1beta1/doc_document_understanding.js b/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/documentai/v1beta1/doc_document_understanding.js new file mode 100644 index 00000000000..d430593338a --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/documentai/v1beta1/doc_document_understanding.js @@ -0,0 +1,425 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Note: this file is purely for documentation. Any contents are not expected +// to be loaded as the JS file. + +/** + * Request to batch process documents as an asynchronous operation. + * + * @property {Object[]} requests + * Required. Individual requests for each document. + * + * This object should have the same structure as [ProcessDocumentRequest]{@link google.cloud.documentai.v1beta1.ProcessDocumentRequest} + * + * @property {string} parent + * Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no location is specified, a region will be chosen automatically. + * + * @typedef BatchProcessDocumentsRequest + * @memberof google.cloud.documentai.v1beta1 + * @see [google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} + */ +const BatchProcessDocumentsRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request to process one document. + * + * @property {Object} inputConfig + * Required. Information about the input file. + * + * This object should have the same structure as [InputConfig]{@link google.cloud.documentai.v1beta1.InputConfig} + * + * @property {Object} outputConfig + * Required. The desired output location. + * + * This object should have the same structure as [OutputConfig]{@link google.cloud.documentai.v1beta1.OutputConfig} + * + * @property {string} documentType + * Specifies a known document type for deeper structure detection. Valid + * values are currently "general" and "invoice". If not provided, "general"\ + * is used as default. If any other value is given, the request is rejected. + * + * @property {Object} tableExtractionParams + * Controls table extraction behavior. If not specified, the system will + * decide reasonable defaults. + * + * This object should have the same structure as [TableExtractionParams]{@link google.cloud.documentai.v1beta1.TableExtractionParams} + * + * @property {Object} formExtractionParams + * Controls form extraction behavior. If not specified, the system will + * decide reasonable defaults. + * + * This object should have the same structure as [FormExtractionParams]{@link google.cloud.documentai.v1beta1.FormExtractionParams} + * + * @property {Object} entityExtractionParams + * Controls entity extraction behavior. If not specified, the system will + * decide reasonable defaults. + * + * This object should have the same structure as [EntityExtractionParams]{@link google.cloud.documentai.v1beta1.EntityExtractionParams} + * + * @property {Object} ocrParams + * Controls OCR behavior. If not specified, the system will decide reasonable + * defaults. + * + * This object should have the same structure as [OcrParams]{@link google.cloud.documentai.v1beta1.OcrParams} + * + * @typedef ProcessDocumentRequest + * @memberof google.cloud.documentai.v1beta1 + * @see [google.cloud.documentai.v1beta1.ProcessDocumentRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} + */ +const ProcessDocumentRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Response to an batch document processing request. This is returned in + * the LRO Operation after the operation is complete. + * + * @property {Object[]} responses + * Responses for each individual document. + * + * This object should have the same structure as [ProcessDocumentResponse]{@link google.cloud.documentai.v1beta1.ProcessDocumentResponse} + * + * @typedef BatchProcessDocumentsResponse + * @memberof google.cloud.documentai.v1beta1 + * @see [google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} + */ +const BatchProcessDocumentsResponse = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Response to a single document processing request. + * + * @property {Object} inputConfig + * Information about the input file. This is the same as the corresponding + * input config in the request. + * + * This object should have the same structure as [InputConfig]{@link google.cloud.documentai.v1beta1.InputConfig} + * + * @property {Object} outputConfig + * The output location of the parsed responses. The responses are written to + * this location as JSON-serialized `Document` objects. + * + * This object should have the same structure as [OutputConfig]{@link google.cloud.documentai.v1beta1.OutputConfig} + * + * @typedef ProcessDocumentResponse + * @memberof google.cloud.documentai.v1beta1 + * @see [google.cloud.documentai.v1beta1.ProcessDocumentResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} + */ +const ProcessDocumentResponse = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Parameters to control Optical Character Recognition (OCR) behavior. + * + * @property {string[]} languageHints + * List of languages to use for OCR. In most cases, an empty value + * yields the best results since it enables automatic language detection. For + * languages based on the Latin alphabet, setting `language_hints` is not + * needed. In rare cases, when the language of the text in the image is known, + * setting a hint will help get better results (although it will be a + * significant hindrance if the hint is wrong). Document processing returns an + * error if one or more of the specified languages is not one of the + * supported languages. + * + * @typedef OcrParams + * @memberof google.cloud.documentai.v1beta1 + * @see [google.cloud.documentai.v1beta1.OcrParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} + */ +const OcrParams = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Parameters to control table extraction behavior. + * + * @property {boolean} enabled + * Whether to enable table extraction. + * + * @property {Object[]} tableBoundHints + * Optional. Table bounding box hints that can be provided to complex cases + * which our algorithm cannot locate the table(s) in. + * + * This object should have the same structure as [TableBoundHint]{@link google.cloud.documentai.v1beta1.TableBoundHint} + * + * @property {string[]} headerHints + * Optional. Table header hints. The extraction will bias towards producing + * these terms as table headers, which may improve accuracy. + * + * @property {string} modelVersion + * Model version of the table extraction system. Default is "builtin/stable". + * Specify "builtin/latest" for the latest model. + * + * @typedef TableExtractionParams + * @memberof google.cloud.documentai.v1beta1 + * @see [google.cloud.documentai.v1beta1.TableExtractionParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} + */ +const TableExtractionParams = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * A hint for a table bounding box on the page for table parsing. + * + * @property {number} pageNumber + * Optional. Page number for multi-paged inputs this hint applies to. If not + * provided, this hint will apply to all pages by default. This value is + * 1-based. + * + * @property {Object} boundingBox + * Bounding box hint for a table on this page. The coordinates must be + * normalized to [0,1] and the bounding box must be an axis-aligned rectangle. + * + * This object should have the same structure as [BoundingPoly]{@link google.cloud.documentai.v1beta1.BoundingPoly} + * + * @typedef TableBoundHint + * @memberof google.cloud.documentai.v1beta1 + * @see [google.cloud.documentai.v1beta1.TableBoundHint definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} + */ +const TableBoundHint = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Parameters to control form extraction behavior. + * + * @property {boolean} enabled + * Whether to enable form extraction. + * + * @property {Object[]} keyValuePairHints + * User can provide pairs of (key text, value type) to improve the parsing + * result. + * + * For example, if a document has a field called "Date" that holds a date + * value and a field called "Amount" that may hold either a currency value + * (e.g., "$500.00") or a simple number value (e.g., "20"), you could use the + * following hints: [ {"key": "Date", value_types: [ "DATE"]}, {"key": + * "Amount", "value_types": [ "PRICE", "NUMBER" ]} ] + * + * If the value type is unknown, but you want to provide hints for the keys, + * you can leave the value_types field blank. e.g. {"key": "Date", + * "value_types": []} + * + * This object should have the same structure as [KeyValuePairHint]{@link google.cloud.documentai.v1beta1.KeyValuePairHint} + * + * @property {string} modelVersion + * Model version of the form extraction system. Default is + * "builtin/stable". Specify "builtin/latest" for the latest model. + * + * @typedef FormExtractionParams + * @memberof google.cloud.documentai.v1beta1 + * @see [google.cloud.documentai.v1beta1.FormExtractionParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} + */ +const FormExtractionParams = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * User-provided hint for key value pair. + * + * @property {string} key + * The key text for the hint. + * + * @property {string[]} valueTypes + * Type of the value. This is case-insensitive, and could be one of: + * ADDRESS, LOCATION, ORGANIZATION, PERSON, PHONE_NUMBER, + * ID, NUMBER, EMAIL, PRICE, TERMS, DATE, NAME. Types not in this list will + * be ignored. + * + * @typedef KeyValuePairHint + * @memberof google.cloud.documentai.v1beta1 + * @see [google.cloud.documentai.v1beta1.KeyValuePairHint definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} + */ +const KeyValuePairHint = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Parameters to control entity extraction behavior. + * + * @property {boolean} enabled + * Whether to enable entity extraction. + * + * @property {string} modelVersion + * Model version of the entity extraction. Default is + * "builtin/stable". Specify "builtin/latest" for the latest model. + * + * @typedef EntityExtractionParams + * @memberof google.cloud.documentai.v1beta1 + * @see [google.cloud.documentai.v1beta1.EntityExtractionParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} + */ +const EntityExtractionParams = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * The desired input location and metadata. + * + * @property {Object} gcsSource + * The Google Cloud Storage location to read the input from. This must be a + * single file. + * + * This object should have the same structure as [GcsSource]{@link google.cloud.documentai.v1beta1.GcsSource} + * + * @property {string} mimeType + * Required. Mimetype of the input. Current supported mimetypes are + * application/pdf, image/tiff, and image/gif. + * + * @typedef InputConfig + * @memberof google.cloud.documentai.v1beta1 + * @see [google.cloud.documentai.v1beta1.InputConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} + */ +const InputConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * The desired output location and metadata. + * + * @property {Object} gcsDestination + * The Google Cloud Storage location to write the output to. + * + * This object should have the same structure as [GcsDestination]{@link google.cloud.documentai.v1beta1.GcsDestination} + * + * @property {number} pagesPerShard + * The max number of pages to include into each output Document shard JSON on + * Google Cloud Storage. + * + * The valid range is [1, 100]. If not specified, the default value is 20. + * + * For example, for one pdf file with 100 pages, 100 parsed pages will be + * produced. If `pages_per_shard` = 20, then 5 Document shard JSON files each + * containing 20 parsed pages will be written under the prefix + * OutputConfig.gcs_destination.uri and suffix pages-x-to-y.json where + * x and y are 1-indexed page numbers. + * + * Example GCS outputs with 157 pages and pages_per_shard = 50: + * + * pages-001-to-050.json + * pages-051-to-100.json + * pages-101-to-150.json + * pages-151-to-157.json + * + * @typedef OutputConfig + * @memberof google.cloud.documentai.v1beta1 + * @see [google.cloud.documentai.v1beta1.OutputConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} + */ +const OutputConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * The Google Cloud Storage location where the input file will be read from. + * + * @property {string} uri + * + * @typedef GcsSource + * @memberof google.cloud.documentai.v1beta1 + * @see [google.cloud.documentai.v1beta1.GcsSource definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} + */ +const GcsSource = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * The Google Cloud Storage location where the output file will be written to. + * + * @property {string} uri + * + * @typedef GcsDestination + * @memberof google.cloud.documentai.v1beta1 + * @see [google.cloud.documentai.v1beta1.GcsDestination definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} + */ +const GcsDestination = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Contains metadata for the BatchProcessDocuments operation. + * + * @property {number} state + * The state of the current batch processing. + * + * The number should be among the values of [State]{@link google.cloud.documentai.v1beta1.State} + * + * @property {string} stateMessage + * A message providing more details about the current state of processing. + * + * @property {Object} createTime + * The creation time of the operation. + * + * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} + * + * @property {Object} updateTime + * The last update time of the operation. + * + * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} + * + * @typedef OperationMetadata + * @memberof google.cloud.documentai.v1beta1 + * @see [google.cloud.documentai.v1beta1.OperationMetadata definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} + */ +const OperationMetadata = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * @enum {number} + * @memberof google.cloud.documentai.v1beta1 + */ + State: { + + /** + * The default value. This value is used if the state is omitted. + */ + STATE_UNSPECIFIED: 0, + + /** + * Request is received. + */ + ACCEPTED: 1, + + /** + * Request operation is waiting for scheduling. + */ + WAITING: 2, + + /** + * Request is being processed. + */ + RUNNING: 3, + + /** + * The batch processing completed successfully. + */ + SUCCEEDED: 4, + + /** + * The batch processing was cancelled. + */ + CANCELLED: 5, + + /** + * The batch processing has failed. + */ + FAILED: 6 + } +}; \ No newline at end of file diff --git a/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/documentai/v1beta1/doc_geometry.js b/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/documentai/v1beta1/doc_geometry.js new file mode 100644 index 00000000000..df07f269c86 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/documentai/v1beta1/doc_geometry.js @@ -0,0 +1,74 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Note: this file is purely for documentation. Any contents are not expected +// to be loaded as the JS file. + +/** + * A vertex represents a 2D point in the image. + * NOTE: the vertex coordinates are in the same scale as the original image. + * + * @property {number} x + * X coordinate. + * + * @property {number} y + * Y coordinate. + * + * @typedef Vertex + * @memberof google.cloud.documentai.v1beta1 + * @see [google.cloud.documentai.v1beta1.Vertex definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/geometry.proto} + */ +const Vertex = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * A vertex represents a 2D point in the image. + * NOTE: the normalized vertex coordinates are relative to the original image + * and range from 0 to 1. + * + * @property {number} x + * X coordinate. + * + * @property {number} y + * Y coordinate. + * + * @typedef NormalizedVertex + * @memberof google.cloud.documentai.v1beta1 + * @see [google.cloud.documentai.v1beta1.NormalizedVertex definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/geometry.proto} + */ +const NormalizedVertex = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * A bounding polygon for the detected image annotation. + * + * @property {Object[]} vertices + * The bounding polygon vertices. + * + * This object should have the same structure as [Vertex]{@link google.cloud.documentai.v1beta1.Vertex} + * + * @property {Object[]} normalizedVertices + * The bounding polygon normalized vertices. + * + * This object should have the same structure as [NormalizedVertex]{@link google.cloud.documentai.v1beta1.NormalizedVertex} + * + * @typedef BoundingPoly + * @memberof google.cloud.documentai.v1beta1 + * @see [google.cloud.documentai.v1beta1.BoundingPoly definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/geometry.proto} + */ +const BoundingPoly = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; \ No newline at end of file diff --git a/packages/google-cloud-documentai/src/v1beta1/doc/google/rpc/doc_status.js b/packages/google-cloud-documentai/src/v1beta1/doc/google/rpc/doc_status.js index fc4b5be93f0..432ab6bb928 100644 --- a/packages/google-cloud-documentai/src/v1beta1/doc/google/rpc/doc_status.js +++ b/packages/google-cloud-documentai/src/v1beta1/doc/google/rpc/doc_status.js @@ -16,24 +16,25 @@ // to be loaded as the JS file. /** - * The `Status` type defines a logical error model that is suitable for different - * programming environments, including REST APIs and RPC APIs. It is used by - * [gRPC](https://github.com/grpc). The error model is designed to be: + * The `Status` type defines a logical error model that is suitable for + * different programming environments, including REST APIs and RPC APIs. It is + * used by [gRPC](https://github.com/grpc). The error model is designed to be: * * - Simple to use and understand for most users * - Flexible enough to meet unexpected needs * * # Overview * - * The `Status` message contains three pieces of data: error code, error message, - * and error details. The error code should be an enum value of - * google.rpc.Code, but it may accept additional error codes if needed. The - * error message should be a developer-facing English message that helps - * developers *understand* and *resolve* the error. If a localized user-facing - * error message is needed, put the localized message in the error details or - * localize it in the client. The optional error details may contain arbitrary - * information about the error. There is a predefined set of error detail types - * in the package `google.rpc` that can be used for common error conditions. + * The `Status` message contains three pieces of data: error code, error + * message, and error details. The error code should be an enum value of + * google.rpc.Code, but it may accept additional error codes + * if needed. The error message should be a developer-facing English message + * that helps developers *understand* and *resolve* the error. If a localized + * user-facing error message is needed, put the localized message in the error + * details or localize it in the client. The optional error details may contain + * arbitrary information about the error. There is a predefined set of error + * detail types in the package `google.rpc` that can be used for common error + * conditions. * * # Language mapping * @@ -70,12 +71,14 @@ * be used directly after any stripping needed for security/privacy reasons. * * @property {number} code - * The status code, which should be an enum value of google.rpc.Code. + * The status code, which should be an enum value of + * google.rpc.Code. * * @property {string} message * A developer-facing error message, which should be in English. Any * user-facing error message should be localized and sent in the - * google.rpc.Status.details field, or localized by the client. + * google.rpc.Status.details field, or localized + * by the client. * * @property {Object[]} details * A list of messages that carry the error details. There is a common set of diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.js b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.js index 2f2b6fc3e01..f20983e54a7 100644 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.js +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.js @@ -136,10 +136,10 @@ class DocumentUnderstandingServiceClient { }).operationsClient(opts); const batchProcessDocumentsResponse = protoFilesRoot.lookup( - 'google.cloud.document.v1beta1.BatchProcessDocumentsResponse' + 'google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse' ); const batchProcessDocumentsMetadata = protoFilesRoot.lookup( - 'google.cloud.document.v1beta1.OperationMetadata' + 'google.cloud.documentai.v1beta1.OperationMetadata' ); this._descriptors.longrunning = { @@ -154,7 +154,7 @@ class DocumentUnderstandingServiceClient { // Put together the default options sent with requests. const defaults = gaxGrpc.constructSettings( - 'google.cloud.document.v1beta1.DocumentUnderstandingService', + 'google.cloud.documentai.v1beta1.DocumentUnderstandingService', gapicConfig, opts.clientConfig, {'x-goog-api-client': clientHeader.join(' ')} @@ -166,13 +166,13 @@ class DocumentUnderstandingServiceClient { this._innerApiCalls = {}; // Put together the "service stub" for - // google.cloud.document.v1beta1.DocumentUnderstandingService. + // google.cloud.documentai.v1beta1.DocumentUnderstandingService. const documentUnderstandingServiceStub = gaxGrpc.createStub( opts.fallback ? protos.lookupService( - 'google.cloud.document.v1beta1.DocumentUnderstandingService' + 'google.cloud.documentai.v1beta1.DocumentUnderstandingService' ) - : protos.google.cloud.document.v1beta1.DocumentUnderstandingService, + : protos.google.cloud.documentai.v1beta1.DocumentUnderstandingService, opts ); @@ -200,7 +200,7 @@ class DocumentUnderstandingServiceClient { * The DNS address for this API service. */ static get servicePath() { - return 'document.googleapis.com'; + return 'documentai.googleapis.com'; } /** @@ -208,7 +208,7 @@ class DocumentUnderstandingServiceClient { * exists for compatibility reasons. */ static get apiEndpoint() { - return 'document.googleapis.com'; + return 'documentai.googleapis.com'; } /** @@ -245,9 +245,9 @@ class DocumentUnderstandingServiceClient { * @param {Object} request * The request object that will be sent. * @param {Object[]} request.requests - * Individual requests for each document. + * Required. Individual requests for each document. * - * This object should have the same structure as [ProcessDocumentRequest]{@link google.cloud.document.v1beta1.ProcessDocumentRequest} + * This object should have the same structure as [ProcessDocumentRequest]{@link google.cloud.documentai.v1beta1.ProcessDocumentRequest} * @param {string} [request.parent] * Target project and location to make a call. * @@ -267,9 +267,9 @@ class DocumentUnderstandingServiceClient { * * @example * - * const document = require('document.v1beta1'); + * const documentai = require('documentai.v1beta1'); * - * const client = new document.v1beta1.DocumentUnderstandingServiceClient({ + * const client = new documentai.v1beta1.DocumentUnderstandingServiceClient({ * // optional auth parameters. * }); * diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client_config.json b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client_config.json index e5a54bb9b4d..49040593fe2 100644 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client_config.json +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client_config.json @@ -1,6 +1,6 @@ { "interfaces": { - "google.cloud.document.v1beta1.DocumentUnderstandingService": { + "google.cloud.documentai.v1beta1.DocumentUnderstandingService": { "retry_codes": { "idempotent": [ "DEADLINE_EXCEEDED", diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_proto_list.json b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_proto_list.json index 7281292ab8d..248bdec2d31 100644 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_proto_list.json +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_proto_list.json @@ -1,3 +1,3 @@ [ - "../../protos/google/cloud/document/v1beta1/document_understanding.proto" + "../../protos/google/cloud/documentai/v1beta1/document_understanding.proto" ] diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index c477252d6d3..ddb41d473ba 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -1,38 +1,38 @@ { - "updateTime": "2019-09-12T00:21:07.274473Z", + "updateTime": "2019-11-06T17:52:39.407684Z", "sources": [ { "generator": { "name": "artman", - "version": "0.36.2", - "dockerImage": "googleapis/artman@sha256:0e6f3a668cd68afc768ecbe08817cf6e56a0e64fcbdb1c58c3b97492d12418a1" + "version": "0.41.0", + "dockerImage": "googleapis/artman@sha256:75b38a3b073a7b243545f2332463096624c802bb1e56b8cb6f22ba1ecd325fa9" } }, { "git": { - "name": "googleapis-private", - "remote": "git@github.com:googleapis/googleapis-private.git", - "sha": "908d03b76ca97370420bd23a282847f0ad175e6d", - "internalRef": "267478864" + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "5691fcb7c1a926b52577aa1834f31d9c50efda54", + "internalRef": "278731899" } }, { "template": { "name": "node_library", "origin": "synthtool.gcp", - "version": "2019.5.2" + "version": "2019.10.17" } } ], "destinations": [ { "client": { - "source": "googleapis-private", - "apiName": "document", + "source": "googleapis", + "apiName": "documentai", "apiVersion": "v1beta1", "language": "nodejs", "generator": "gapic", - "config": "google/cloud/document/artman_document_v1beta1.yaml" + "config": "google/cloud/documentai/artman_documentai_v1beta1.yaml" } } ] diff --git a/packages/google-cloud-documentai/synth.py b/packages/google-cloud-documentai/synth.py index 2577d772802..7bdfb4fe258 100644 --- a/packages/google-cloud-documentai/synth.py +++ b/packages/google-cloud-documentai/synth.py @@ -25,9 +25,8 @@ versions = ['v1beta1'] for version in versions: library = gapic.node_library( - 'document', - version, - private=True) + 'documentai', + version) s.copy(library, excludes=['README.md', 'package.json']) # Copy common templates diff --git a/packages/google-cloud-documentai/test/gapic-v1beta1.js b/packages/google-cloud-documentai/test/gapic-v1beta1.js index 2262d120050..412f8c20e6e 100644 --- a/packages/google-cloud-documentai/test/gapic-v1beta1.js +++ b/packages/google-cloud-documentai/test/gapic-v1beta1.js @@ -16,7 +16,7 @@ const assert = require('assert'); -const documentModule = require('../src'); +const documentaiModule = require('../src'); const FAKE_STATUS_CODE = 1; const error = new Error(); @@ -25,29 +25,30 @@ error.code = FAKE_STATUS_CODE; describe('DocumentUnderstandingServiceClient', () => { it('has servicePath', () => { const servicePath = - documentModule.v1beta1.DocumentUnderstandingServiceClient.servicePath; + documentaiModule.v1beta1.DocumentUnderstandingServiceClient.servicePath; assert(servicePath); }); it('has apiEndpoint', () => { const apiEndpoint = - documentModule.v1beta1.DocumentUnderstandingServiceClient.apiEndpoint; + documentaiModule.v1beta1.DocumentUnderstandingServiceClient.apiEndpoint; assert(apiEndpoint); }); it('has port', () => { - const port = documentModule.v1beta1.DocumentUnderstandingServiceClient.port; + const port = + documentaiModule.v1beta1.DocumentUnderstandingServiceClient.port; assert(port); assert(typeof port === 'number'); }); it('should create a client with no options', () => { - const client = new documentModule.v1beta1.DocumentUnderstandingServiceClient(); + const client = new documentaiModule.v1beta1.DocumentUnderstandingServiceClient(); assert(client); }); it('should create a client with gRPC fallback', () => { - const client = new documentModule.v1beta1.DocumentUnderstandingServiceClient( + const client = new documentaiModule.v1beta1.DocumentUnderstandingServiceClient( {fallback: true} ); assert(client); @@ -55,7 +56,7 @@ describe('DocumentUnderstandingServiceClient', () => { describe('batchProcessDocuments', function() { it('invokes batchProcessDocuments without error', done => { - const client = new documentModule.v1beta1.DocumentUnderstandingServiceClient( + const client = new documentaiModule.v1beta1.DocumentUnderstandingServiceClient( { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', @@ -93,7 +94,7 @@ describe('DocumentUnderstandingServiceClient', () => { }); it('invokes batchProcessDocuments with error', done => { - const client = new documentModule.v1beta1.DocumentUnderstandingServiceClient( + const client = new documentaiModule.v1beta1.DocumentUnderstandingServiceClient( { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', @@ -130,7 +131,7 @@ describe('DocumentUnderstandingServiceClient', () => { }); it('has longrunning decoder functions', () => { - const client = new documentModule.v1beta1.DocumentUnderstandingServiceClient( + const client = new documentaiModule.v1beta1.DocumentUnderstandingServiceClient( { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', diff --git a/packages/google-cloud-documentai/webpack.config.js b/packages/google-cloud-documentai/webpack.config.js index 50e5d798ff3..284673f2c57 100644 --- a/packages/google-cloud-documentai/webpack.config.js +++ b/packages/google-cloud-documentai/webpack.config.js @@ -15,8 +15,8 @@ module.exports = { entry: './src/browser.js', output: { - library: 'document', - filename: './document.js', + library: 'documentai', + filename: './documentai.js', }, node: { child_process: 'empty', From c3c5fc1ad8039b82598aaa5eac744751daab781b Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Fri, 14 Feb 2020 12:09:20 -0800 Subject: [PATCH 004/213] feat(samples): adds Document AI parse table, forms samples (#8) --- packages/google-cloud-documentai/.gitignore | 2 ++ packages/google-cloud-documentai/samples/package.json | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-documentai/.gitignore b/packages/google-cloud-documentai/.gitignore index 5d32b23782f..6c085d4f6a0 100644 --- a/packages/google-cloud-documentai/.gitignore +++ b/packages/google-cloud-documentai/.gitignore @@ -12,3 +12,5 @@ system-test/*key.json .DS_Store package-lock.json __pycache__ +launch.json +.vscode \ No newline at end of file diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 157f22a9f63..7435dab506b 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -10,13 +10,14 @@ "*.js" ], "scripts": { - "test": "mocha test/*.js" + "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^0.0.1" + "@google-cloud/documentai": "^0.0.1", + "@google-cloud/storage": "^4.2.0" }, "devDependencies": { "chai": "^4.2.0", "mocha": "^6.2.0" } -} +} \ No newline at end of file From 05ba653134ac0d60b56deb436fa8c33143f8e802 Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Wed, 18 Mar 2020 15:45:05 -0700 Subject: [PATCH 005/213] feat: updated library from protos (#9) --- packages/google-cloud-documentai/.gitignore | 2 - packages/google-cloud-documentai/.jsdoc.js | 45 +- packages/google-cloud-documentai/.mocharc.js | 28 + .../google-cloud-documentai/.mocharc.json | 5 + packages/google-cloud-documentai/.nycrc | 1 + packages/google-cloud-documentai/README.md | 62 +- .../linkinator.config.json | 11 +- packages/google-cloud-documentai/package.json | 86 +- .../google/cloud/common_resources.proto | 52 + .../cloud/documentai/v1beta2/document.proto | 516 + .../v1beta2/document_understanding.proto | 343 + .../cloud/documentai/v1beta2/geometry.proto | 54 + .../protos/protos.d.ts | 5967 ++++-- .../google-cloud-documentai/protos/protos.js | 16198 ++++++++++++---- .../protos/protos.json | 910 +- .../google-cloud-documentai/samples/README.md | 46 +- .../samples/package.json | 4 +- .../samples/quickstart.js | 72 +- .../{quickstart.js => quickstart.test.js} | 8 +- packages/google-cloud-documentai/src/index.js | 79 - packages/google-cloud-documentai/src/index.ts | 27 + .../v1beta1/doc_document_understanding.js | 420 - .../cloud/document/v1beta1/doc_geometry.js | 74 - .../v1beta1/doc_document_understanding.js | 425 - .../cloud/documentai/v1beta1/doc_geometry.js | 74 - .../doc/google/longrunning/doc_operations.js | 63 - .../v1beta1/doc/google/protobuf/doc_any.js | 137 - .../src/v1beta1/doc/google/rpc/doc_status.js | 95 - .../document_understanding_service_client.js | 353 - ...ment_understanding_service_proto_list.json | 3 - .../document_understanding_service_client.ts | 540 + ...t_understanding_service_client_config.json | 19 +- ...ment_understanding_service_proto_list.json | 5 + .../src/{browser.js => v1beta2/index.ts} | 12 +- .../google-cloud-documentai/synth.metadata | 28 +- packages/google-cloud-documentai/synth.py | 21 +- .../system-test/fixtures/sample/src/index.js | 27 + .../fixtures/sample/src/index.ts} | 12 +- .../system-test/install.ts | 51 + .../test/.eslintrc.yml | 5 - ...-document_understanding_service-v1beta2.ts | 260 + .../test/gapic-v1beta1.js | 181 - .../google-cloud-documentai/tsconfig.json | 19 + packages/google-cloud-documentai/tslint.json | 3 + .../google-cloud-documentai/webpack.config.js | 38 +- 45 files changed, 20790 insertions(+), 6591 deletions(-) create mode 100644 packages/google-cloud-documentai/.mocharc.js create mode 100644 packages/google-cloud-documentai/.mocharc.json create mode 100644 packages/google-cloud-documentai/protos/google/cloud/common_resources.proto create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document_understanding.proto create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/geometry.proto rename packages/google-cloud-documentai/samples/test/{quickstart.js => quickstart.test.js} (80%) delete mode 100644 packages/google-cloud-documentai/src/index.js create mode 100644 packages/google-cloud-documentai/src/index.ts delete mode 100644 packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/document/v1beta1/doc_document_understanding.js delete mode 100644 packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/document/v1beta1/doc_geometry.js delete mode 100644 packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/documentai/v1beta1/doc_document_understanding.js delete mode 100644 packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/documentai/v1beta1/doc_geometry.js delete mode 100644 packages/google-cloud-documentai/src/v1beta1/doc/google/longrunning/doc_operations.js delete mode 100644 packages/google-cloud-documentai/src/v1beta1/doc/google/protobuf/doc_any.js delete mode 100644 packages/google-cloud-documentai/src/v1beta1/doc/google/rpc/doc_status.js delete mode 100644 packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.js delete mode 100644 packages/google-cloud-documentai/src/v1beta1/document_understanding_service_proto_list.json create mode 100644 packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts rename packages/google-cloud-documentai/src/{v1beta1 => v1beta2}/document_understanding_service_client_config.json (54%) create mode 100644 packages/google-cloud-documentai/src/v1beta2/document_understanding_service_proto_list.json rename packages/google-cloud-documentai/src/{browser.js => v1beta2/index.ts} (66%) create mode 100644 packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js rename packages/google-cloud-documentai/{src/v1beta1/index.js => system-test/fixtures/sample/src/index.ts} (60%) create mode 100644 packages/google-cloud-documentai/system-test/install.ts delete mode 100644 packages/google-cloud-documentai/test/.eslintrc.yml create mode 100644 packages/google-cloud-documentai/test/gapic-document_understanding_service-v1beta2.ts delete mode 100644 packages/google-cloud-documentai/test/gapic-v1beta1.js create mode 100644 packages/google-cloud-documentai/tsconfig.json create mode 100644 packages/google-cloud-documentai/tslint.json diff --git a/packages/google-cloud-documentai/.gitignore b/packages/google-cloud-documentai/.gitignore index 6c085d4f6a0..5d32b23782f 100644 --- a/packages/google-cloud-documentai/.gitignore +++ b/packages/google-cloud-documentai/.gitignore @@ -12,5 +12,3 @@ system-test/*key.json .DS_Store package-lock.json __pycache__ -launch.json -.vscode \ No newline at end of file diff --git a/packages/google-cloud-documentai/.jsdoc.js b/packages/google-cloud-documentai/.jsdoc.js index 73b975bd747..cd83b15bb85 100644 --- a/packages/google-cloud-documentai/.jsdoc.js +++ b/packages/google-cloud-documentai/.jsdoc.js @@ -1,18 +1,20 @@ -/*! - * Copyright 2018 Google LLC. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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'; @@ -26,21 +28,26 @@ module.exports = { destination: './docs/' }, plugins: [ - 'plugins/markdown' + 'plugins/markdown', + 'jsdoc-region-tag' ], source: { excludePattern: '(^|\\/|\\\\)[._]', include: [ - 'src' + 'build/src', + 'protos' ], includePattern: '\\.js$' }, templates: { - copyright: 'Copyright 2018 Google, LLC.', + copyright: 'Copyright 2019 Google, LLC.', includeDate: false, sourceFiles: false, systemName: '@google-cloud/documentai', - theme: 'lumen' + theme: 'lumen', + default: { + outputSourceFiles: false + } }, markdown: { idInHeadings: true diff --git a/packages/google-cloud-documentai/.mocharc.js b/packages/google-cloud-documentai/.mocharc.js new file mode 100644 index 00000000000..ff7b34fa5d1 --- /dev/null +++ b/packages/google-cloud-documentai/.mocharc.js @@ -0,0 +1,28 @@ +// 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 +} +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-documentai/.mocharc.json b/packages/google-cloud-documentai/.mocharc.json new file mode 100644 index 00000000000..670c5e2c24b --- /dev/null +++ b/packages/google-cloud-documentai/.mocharc.json @@ -0,0 +1,5 @@ +{ + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} diff --git a/packages/google-cloud-documentai/.nycrc b/packages/google-cloud-documentai/.nycrc index 367688844eb..b18d5472b62 100644 --- a/packages/google-cloud-documentai/.nycrc +++ b/packages/google-cloud-documentai/.nycrc @@ -12,6 +12,7 @@ "**/scripts", "**/protos", "**/test", + "**/*.d.ts", ".jsdoc.js", "**/.jsdoc.js", "karma.conf.js", diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index 6543031be22..1b75b024b68 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -11,7 +11,7 @@ -Cloud Document API client for Node.js +Document AI client for Node.js * [Document AI Node.js Client API Reference][client-docs] @@ -55,13 +55,51 @@ npm install @google-cloud/documentai ### Using the client library ```javascript - async function batchProcessDocument() { - const { - DocumentUnderstandingServiceClient, - } = require('@google-cloud/documentai'); - const client = new DocumentUnderstandingServiceClient(); - // TODO: write sample here that demonstrates batch processing of documents. - console.info(client); + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'YOUR_PROJECT_ID'; + // const location = 'YOUR_PROJECT_LOCATION'; + // const gcsInputUri = 'YOUR_SOURCE_PDF'; + + const { + DocumentUnderstandingServiceClient, + } = require('@google-cloud/documentai'); + const client = new DocumentUnderstandingServiceClient(); + + async function quickstart() { + // Configure the request for processing the PDF + const parent = `projects/${projectId}/locations/${location}`; + const request = { + parent, + inputConfig: { + gcsSource: { + uri: gcsInputUri, + }, + mimeType: 'application/pdf', + }, + }; + + // Recognizes text entities in the PDF document + const [result] = await client.processDocument(request); + + // Get all of the document text as one big string + const {text} = result; + + // Extract shards from the text field + function extractText(textAnchor) { + // First shard in document doesn't have startIndex property + const startIndex = textAnchor.textSegments[0].startIndex || 0; + const endIndex = textAnchor.textSegments[0].endIndex; + + return text.substring(startIndex, endIndex); + } + + for (const entity of result.entities) { + console.log(`\nEntity text: ${extractText(entity.textAnchor)}`); + console.log(`Entity type: ${entity.type}`); + console.log(`Entity mention text: ${entity.mentionText}`); + } } ``` @@ -75,6 +113,8 @@ has instructions for running the samples. | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | +| Parse Form | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parseForm.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parseForm.js,samples/README.md) | +| Parse Table | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parseTable.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parseTable.js,samples/README.md) | | Quickstart | [source code](https://github.com/googleapis/nodejs-document-ai/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-document-ai&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | @@ -104,6 +144,12 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-document-ai/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 diff --git a/packages/google-cloud-documentai/linkinator.config.json b/packages/google-cloud-documentai/linkinator.config.json index 84dab7fcf7d..b9e629720b7 100644 --- a/packages/google-cloud-documentai/linkinator.config.json +++ b/packages/google-cloud-documentai/linkinator.config.json @@ -1,8 +1,11 @@ - { "recurse": true, "skip": [ - "googleapis.dev.*", - "https://www.npmjs.org/package/.*" - ] + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://googleapis.dev/nodejs/documentai/latest/index.html" + ], + "silent": true, + "concurrency": 10 } diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 837414ad9a3..a49364fc36a 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,62 +1,56 @@ { "name": "@google-cloud/documentai", + "version": "0.1.0", + "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", - "version": "0.0.1", + "license": "Apache-2.0", "author": "Google LLC", - "description": "Cloud Document API client for Node.js", - "main": "src/index.js", - "browser": "src/browser.js", "files": [ - "protos", - "src", - "AUTHORS", - "COPYING" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google document", - "document", - "Cloud Document API" + "build/src", + "build/protos" ], - "dependencies": { - "google-gax": "^1.5.0" - }, + "main": "build/src/index.js", "scripts": { - "compile-protos": "compileProtos ./src", + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", "docs": "jsdoc -c .jsdoc.js", - "fix": "eslint . --fix", - "lint": "eslint .", - "test": "c8 mocha test/*.js", - "predocs-test": "npm run docs", "docs-test": "linkinator docs", - "samples-test": "cd samples/ && npm link ../ && c8 npm test && cd ../", - "system-test": "c8 mocha --timeout=5000 system-test/*.js" + "fix": "gts fix && eslint samples --fix", + "lint": "gts check && eslint samples", + "prelint": "cd samples; npm link ../; npm i", + "predocs-test": "npm run docs", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^1.14.2" }, - "license": "Apache-2.0", "devDependencies": { - "c8": "^6.0.1", - "chai": "^4.2.0", - "eslint": "^6.3.0", - "eslint-config-prettier": "^6.3.0", - "eslint-plugin-node": "^10.0.0", - "eslint-plugin-prettier": "^3.0.1", - "jsdoc": "^3.6.2", - "jsdoc-fresh": "^1.0.1", - "linkinator": "^1.6.3", - "mocha": "^6.1.4", + "@types/mocha": "^5.2.7", + "@types/node": "^12.12.29", + "c8": "^7.1.0", + "eslint": "^6.8.0", + "eslint-config-prettier": "^6.10.0", + "eslint-plugin-node": "^11.0.0", + "eslint-plugin-prettier": "^3.1.2", + "gts": "^1.1.2", + "jsdoc": "^3.6.3", + "jsdoc-fresh": "^1.0.2", + "jsdoc-region-tag": "^1.0.4", + "linkinator": "^2.0.3", + "mocha": "^6.2.2", "null-loader": "^3.0.0", - "prettier": "^1.17.0", - "webpack": "^4.37.0", - "webpack-cli": "^3.3.6" + "pack-n-play": "^1.0.0-2", + "prettier": "^1.19.1", + "ts-loader": "^6.2.1", + "typescript": "~3.7.5", + "webpack": "^4.42.0", + "webpack-cli": "^3.3.11" }, "engines": { - "node": ">=8.10.0" + "node": ">=8.13.0" } } diff --git a/packages/google-cloud-documentai/protos/google/cloud/common_resources.proto b/packages/google-cloud-documentai/protos/google/cloud/common_resources.proto new file mode 100644 index 00000000000..56c9f800d5e --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/common_resources.proto @@ -0,0 +1,52 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file contains stub messages for common resources in GCP. +// It is not intended to be directly generated, and is instead used by +// other tooling to be able to match common resource patterns. +syntax = "proto3"; + +package google.cloud; + +import "google/api/resource.proto"; + + +option (google.api.resource_definition) = { + type: "cloudresourcemanager.googleapis.com/Project" + pattern: "projects/{project}" +}; + + +option (google.api.resource_definition) = { + type: "cloudresourcemanager.googleapis.com/Organization" + pattern: "organizations/{organization}" +}; + + +option (google.api.resource_definition) = { + type: "cloudresourcemanager.googleapis.com/Folder" + pattern: "folders/{folder}" +}; + + +option (google.api.resource_definition) = { + type: "cloudbilling.googleapis.com/BillingAccount" + pattern: "billingAccounts/{billing_account}" +}; + +option (google.api.resource_definition) = { + type: "locations.googleapis.com/Location" + pattern: "projects/{project}/locations/{location}" +}; + diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto new file mode 100644 index 00000000000..d50320b12d7 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto @@ -0,0 +1,516 @@ +// 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.documentai.v1beta2; + +import "google/api/field_behavior.proto"; +import "google/cloud/documentai/v1beta2/geometry.proto"; +import "google/rpc/status.proto"; +import "google/type/color.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta2;documentai"; +option java_multiple_files = true; +option java_outer_classname = "DocumentProto"; +option java_package = "com.google.cloud.documentai.v1beta2"; + +// Document represents the canonical document resource in Document Understanding +// AI. +// It is an interchange format that provides insights into documents and allows +// for collaboration between users and Document Understanding AI to iterate and +// optimize for quality. +message Document { + // For a large document, sharding may be performed to produce several + // document shards. Each document shard contains this field to detail which + // shard it is. + message ShardInfo { + // The 0-based index of this shard. + int64 shard_index = 1; + + // Total number of shards. + int64 shard_count = 2; + + // The index of the first character in [Document.text][google.cloud.documentai.v1beta2.Document.text] in the overall + // document global text. + int64 text_offset = 3; + } + + // Label attaches schema information and/or other metadata to segments within + // a [Document][google.cloud.documentai.v1beta2.Document]. Multiple [Label][google.cloud.documentai.v1beta2.Document.Label]s on a single field can denote either + // different labels, different instances of the same label created at + // different times, or some combination of both. + message Label { + // Provenance of the label. + oneof source { + // Label is generated AutoML model. This field stores the full resource + // name of the AutoML model. + // + // Format: + // `projects/{project-id}/locations/{location-id}/models/{model-id}` + string automl_model = 2; + } + + // Name of the label. + // + // When the label is generated from AutoML Text Classification model, this + // field represents the name of the category. + string name = 1; + + // Confidence score between 0 and 1 for label assignment. + float confidence = 3; + } + + // Annotation for common text style attributes. This adheres to CSS + // conventions as much as possible. + message Style { + // Font size with unit. + message FontSize { + // Font size for the text. + float size = 1; + + // Unit for the font size. Follows CSS naming (in, px, pt, etc.). + string unit = 2; + } + + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta2.Document.text]. + TextAnchor text_anchor = 1; + + // Text color. + google.type.Color color = 2; + + // Text background color. + google.type.Color background_color = 3; + + // Font weight. Possible values are normal, bold, bolder, and lighter. + // https://www.w3schools.com/cssref/pr_font_weight.asp + string font_weight = 4; + + // Text style. Possible values are normal, italic, and oblique. + // https://www.w3schools.com/cssref/pr_font_font-style.asp + string text_style = 5; + + // Text decoration. Follows CSS standard. + // + // https://www.w3schools.com/cssref/pr_text_text-decoration.asp + string text_decoration = 6; + + // Font size. + FontSize font_size = 7; + } + + // A page in a [Document][google.cloud.documentai.v1beta2.Document]. + message Page { + // Dimension for the page. + message Dimension { + // Page width. + float width = 1; + + // Page height. + float height = 2; + + // Dimension unit. + string unit = 3; + } + + // Visual element describing a layout unit on a page. + message Layout { + // Detected human reading orientation. + enum Orientation { + // Unspecified orientation. + ORIENTATION_UNSPECIFIED = 0; + + // Orientation is aligned with page up. + PAGE_UP = 1; + + // Orientation is aligned with page right. + // Turn the head 90 degrees clockwise from upright to read. + PAGE_RIGHT = 2; + + // Orientation is aligned with page down. + // Turn the head 180 degrees from upright to read. + PAGE_DOWN = 3; + + // Orientation is aligned with page left. + // Turn the head 90 degrees counterclockwise from upright to read. + PAGE_LEFT = 4; + } + + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta2.Document.text]. + TextAnchor text_anchor = 1; + + // Confidence of the current [Layout][google.cloud.documentai.v1beta2.Document.Page.Layout] within context of the object this + // layout is for. e.g. confidence can be for a single token, a table, + // a visual element, etc. depending on context. Range [0, 1]. + float confidence = 2; + + // The bounding polygon for the [Layout][google.cloud.documentai.v1beta2.Document.Page.Layout]. + BoundingPoly bounding_poly = 3; + + // Detected orientation for the [Layout][google.cloud.documentai.v1beta2.Document.Page.Layout]. + Orientation orientation = 4; + + // Optional. This is the identifier used by referencing [PageAnchor][google.cloud.documentai.v1beta2.Document.PageAnchor]s. + string id = 5 [(google.api.field_behavior) = OPTIONAL]; + } + + // A block has a set of lines (collected into paragraphs) that have a + // common line-spacing and orientation. + message Block { + // [Layout][google.cloud.documentai.v1beta2.Document.Page.Layout] for [Block][google.cloud.documentai.v1beta2.Document.Page.Block]. + Layout layout = 1; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 2; + } + + // A collection of lines that a human would perceive as a paragraph. + message Paragraph { + // [Layout][google.cloud.documentai.v1beta2.Document.Page.Layout] for [Paragraph][google.cloud.documentai.v1beta2.Document.Page.Paragraph]. + Layout layout = 1; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 2; + } + + // A collection of tokens that a human would perceive as a line. + // Does not cross column boundaries, can be horizontal, vertical, etc. + message Line { + // [Layout][google.cloud.documentai.v1beta2.Document.Page.Layout] for [Line][google.cloud.documentai.v1beta2.Document.Page.Line]. + Layout layout = 1; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 2; + } + + // A detected token. + message Token { + // Detected break at the end of a [Token][google.cloud.documentai.v1beta2.Document.Page.Token]. + message DetectedBreak { + // Enum to denote the type of break found. + enum Type { + // Unspecified break type. + TYPE_UNSPECIFIED = 0; + + // A single whitespace. + SPACE = 1; + + // A wider whitespace. + WIDE_SPACE = 2; + + // A hyphen that indicates that a token has been split across lines. + HYPHEN = 3; + } + + // Detected break type. + Type type = 1; + } + + // [Layout][google.cloud.documentai.v1beta2.Document.Page.Layout] for [Token][google.cloud.documentai.v1beta2.Document.Page.Token]. + Layout layout = 1; + + // Detected break at the end of a [Token][google.cloud.documentai.v1beta2.Document.Page.Token]. + DetectedBreak detected_break = 2; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 3; + } + + // Detected non-text visual elements e.g. checkbox, signature etc. on the + // page. + message VisualElement { + // [Layout][google.cloud.documentai.v1beta2.Document.Page.Layout] for [VisualElement][google.cloud.documentai.v1beta2.Document.Page.VisualElement]. + Layout layout = 1; + + // Type of the [VisualElement][google.cloud.documentai.v1beta2.Document.Page.VisualElement]. + string type = 2; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 3; + } + + // A table representation similar to HTML table structure. + message Table { + // A row of table cells. + message TableRow { + // Cells that make up this row. + repeated TableCell cells = 1; + } + + // A cell representation inside the table. + message TableCell { + // [Layout][google.cloud.documentai.v1beta2.Document.Page.Layout] for [TableCell][google.cloud.documentai.v1beta2.Document.Page.Table.TableCell]. + Layout layout = 1; + + // How many rows this cell spans. + int32 row_span = 2; + + // How many columns this cell spans. + int32 col_span = 3; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 4; + } + + // [Layout][google.cloud.documentai.v1beta2.Document.Page.Layout] for [Table][google.cloud.documentai.v1beta2.Document.Page.Table]. + Layout layout = 1; + + // Header rows of the table. + repeated TableRow header_rows = 2; + + // Body rows of the table. + repeated TableRow body_rows = 3; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 4; + } + + // A form field detected on the page. + message FormField { + // [Layout][google.cloud.documentai.v1beta2.Document.Page.Layout] for the [FormField][google.cloud.documentai.v1beta2.Document.Page.FormField] name. e.g. `Address`, `Email`, + // `Grand total`, `Phone number`, etc. + Layout field_name = 1; + + // [Layout][google.cloud.documentai.v1beta2.Document.Page.Layout] for the [FormField][google.cloud.documentai.v1beta2.Document.Page.FormField] value. + Layout field_value = 2; + + // A list of detected languages for name together with confidence. + repeated DetectedLanguage name_detected_languages = 3; + + // A list of detected languages for value together with confidence. + repeated DetectedLanguage value_detected_languages = 4; + + // If the value is non-textual, this field represents the type. Current + // valid values are: + // - blank (this indicates the field_value is normal text) + // - "unfilled_checkbox" + // - "filled_checkbox" + string value_type = 5; + + // An internal field, created for Labeling UI to export key text. + string corrected_key_text = 6; + + // An internal field, created for Labeling UI to export value text. + string corrected_value_text = 7; + } + + // Detected language for a structural component. + message DetectedLanguage { + // The BCP-47 language code, such as "en-US" or "sr-Latn". For more + // information, see + // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + string language_code = 1; + + // Confidence of detected language. Range [0, 1]. + float confidence = 2; + } + + // 1-based index for current [Page][google.cloud.documentai.v1beta2.Document.Page] in a parent [Document][google.cloud.documentai.v1beta2.Document]. + // Useful when a page is taken out of a [Document][google.cloud.documentai.v1beta2.Document] for individual + // processing. + int32 page_number = 1; + + // Physical dimension of the page. + Dimension dimension = 2; + + // [Layout][google.cloud.documentai.v1beta2.Document.Page.Layout] for the page. + Layout layout = 3; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 4; + + // A list of visually detected text blocks on the page. + // A block has a set of lines (collected into paragraphs) that have a common + // line-spacing and orientation. + repeated Block blocks = 5; + + // A list of visually detected text paragraphs on the page. + // A collection of lines that a human would perceive as a paragraph. + repeated Paragraph paragraphs = 6; + + // A list of visually detected text lines on the page. + // A collection of tokens that a human would perceive as a line. + repeated Line lines = 7; + + // A list of visually detected tokens on the page. + repeated Token tokens = 8; + + // A list of detected non-text visual elements e.g. checkbox, + // signature etc. on the page. + repeated VisualElement visual_elements = 9; + + // A list of visually detected tables on the page. + repeated Table tables = 10; + + // A list of visually detected form fields on the page. + repeated FormField form_fields = 11; + } + + // A phrase in the text that is a known entity type, such as a person, an + // organization, or location. + message Entity { + // Provenance of the entity. + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta2.Document.text]. + TextAnchor text_anchor = 1; + + // Entity type from a schema e.g. `Address`. + string type = 2; + + // Text value in the document e.g. `1600 Amphitheatre Pkwy`. + string mention_text = 3; + + // Deprecated. Use `id` field instead. + string mention_id = 4; + + // Optional. Confidence of detected Schema entity. Range [0, 1]. + float confidence = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Represents the provenance of this entity wrt. the location on the + // page where it was found. + PageAnchor page_anchor = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Canonical id. This will be a unique value in the entity list + // for this document. + string id = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Temporary field to store the bounding poly for short-term POCs. Used by + // the frontend only. Do not use before you talk to ybo@ and lukasr@. + BoundingPoly bounding_poly_for_demo_frontend = 8 [(google.api.field_behavior) = OPTIONAL]; + } + + // Relationship between [Entities][google.cloud.documentai.v1beta2.Document.Entity]. + message EntityRelation { + // Subject entity id. + string subject_id = 1; + + // Object entity id. + string object_id = 2; + + // Relationship description. + string relation = 3; + } + + // Text reference indexing into the [Document.text][google.cloud.documentai.v1beta2.Document.text]. + message TextAnchor { + // A text segment in the [Document.text][google.cloud.documentai.v1beta2.Document.text]. The indices may be out of bounds + // which indicate that the text extends into another document shard for + // large sharded documents. See [ShardInfo.text_offset][google.cloud.documentai.v1beta2.Document.ShardInfo.text_offset] + message TextSegment { + // [TextSegment][google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment] start UTF-8 char index in the [Document.text][google.cloud.documentai.v1beta2.Document.text]. + int64 start_index = 1; + + // [TextSegment][google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment] half open end UTF-8 char index in the + // [Document.text][google.cloud.documentai.v1beta2.Document.text]. + int64 end_index = 2; + } + + // The text segments from the [Document.text][google.cloud.documentai.v1beta2.Document.text]. + repeated TextSegment text_segments = 1; + } + + // Referencing elements in [Document.pages][google.cloud.documentai.v1beta2.Document.pages]. + message PageAnchor { + // Represents a weak reference to a page element within a document. + message PageRef { + // The type of layout that is being referenced. + enum LayoutType { + // Layout Unspecified. + LAYOUT_TYPE_UNSPECIFIED = 0; + + // References a [Page.blocks][google.cloud.documentai.v1beta2.Document.Page.blocks] element. + BLOCK = 1; + + // References a [Page.paragraphs][google.cloud.documentai.v1beta2.Document.Page.paragraphs] element. + PARAGRAPH = 2; + + // References a [Page.lines][google.cloud.documentai.v1beta2.Document.Page.lines] element. + LINE = 3; + + // References a [Page.tokens][google.cloud.documentai.v1beta2.Document.Page.tokens] element. + TOKEN = 4; + + // References a [Page.visual_elements][google.cloud.documentai.v1beta2.Document.Page.visual_elements] element. + VISUAL_ELEMENT = 5; + + // Refrrences a [Page.tables][google.cloud.documentai.v1beta2.Document.Page.tables] element. + TABLE = 6; + + // References a [Page.form_fields][google.cloud.documentai.v1beta2.Document.Page.form_fields] element. + FORM_FIELD = 7; + } + + // Required. Index into the [Document.pages][google.cloud.documentai.v1beta2.Document.pages] element + int64 page = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The type of the layout element that is being referenced. If not + // specified the whole page is assumed to be referenced. + LayoutType layout_type = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The [Page.Layout.id][google.cloud.documentai.v1beta2.Document.Page.Layout.id] on the page that this element + // references. If [LayoutRef.type][] is specified this id must also be + // specified. + string layout_id = 3 [(google.api.field_behavior) = OPTIONAL]; + } + + // One or more references to visual page elements + repeated PageRef page_refs = 1; + } + + // Original source document from the user. + oneof source { + // Currently supports Google Cloud Storage URI of the form + // `gs://bucket_name/object_name`. Object versioning is not supported. + // See [Google Cloud Storage Request + // URIs](https://cloud.google.com/storage/docs/reference-uris) for more + // info. + string uri = 1; + + // Inline document content, represented as a stream of bytes. + // Note: As with all `bytes` fields, protobuffers use a pure binary + // representation, whereas JSON representations use base64. + bytes content = 2; + } + + // An IANA published MIME type (also referred to as media type). For more + // information, see + // https://www.iana.org/assignments/media-types/media-types.xhtml. + string mime_type = 3; + + // UTF-8 encoded text in reading order from the document. + string text = 4; + + // Styles for the [Document.text][google.cloud.documentai.v1beta2.Document.text]. + repeated Style text_styles = 5; + + // Visual page layout for the [Document][google.cloud.documentai.v1beta2.Document]. + repeated Page pages = 6; + + // A list of entities detected on [Document.text][google.cloud.documentai.v1beta2.Document.text]. For document shards, + // entities in this list may cross shard boundaries. + repeated Entity entities = 7; + + // Relationship among [Document.entities][google.cloud.documentai.v1beta2.Document.entities]. + repeated EntityRelation entity_relations = 8; + + // Information about the sharding if this document is sharded part of a larger + // document. If the document is not sharded, this message is not specified. + ShardInfo shard_info = 9; + + // [Label][google.cloud.documentai.v1beta2.Document.Label]s for this document. + repeated Label labels = 11; + + // Any error that occurred while processing this document. + google.rpc.Status error = 10; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document_understanding.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document_understanding.proto new file mode 100644 index 00000000000..e0f94aa22fd --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document_understanding.proto @@ -0,0 +1,343 @@ +// 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.documentai.v1beta2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/documentai/v1beta2/document.proto"; +import "google/cloud/documentai/v1beta2/geometry.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta2;documentai"; +option java_multiple_files = true; +option java_outer_classname = "DocumentAiProto"; +option java_package = "com.google.cloud.documentai.v1beta2"; + +// Service to parse structured information from unstructured or semi-structured +// documents using state-of-the-art Google AI such as natural language, +// computer vision, and translation. +service DocumentUnderstandingService { + option (google.api.default_host) = "us-documentai.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // LRO endpoint to batch process many documents. The output is written + // to Cloud Storage as JSON in the [Document] format. + rpc BatchProcessDocuments(BatchProcessDocumentsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta2/{parent=projects/*/locations/*}/documents:batchProcess" + body: "*" + additional_bindings { + post: "/v1beta2/{parent=projects/*}/documents:batchProcess" + body: "*" + } + }; + option (google.api.method_signature) = "requests"; + option (google.longrunning.operation_info) = { + response_type: "BatchProcessDocumentsResponse" + metadata_type: "OperationMetadata" + }; + } + + // Processes a single document. + rpc ProcessDocument(ProcessDocumentRequest) returns (Document) { + option (google.api.http) = { + post: "/v1beta2/{parent=projects/*/locations/*}/documents:process" + body: "*" + additional_bindings { + post: "/v1beta2/{parent=projects/*}/documents:process" + body: "*" + } + }; + } +} + +// Request to batch process documents as an asynchronous operation. The output +// is written to Cloud Storage as JSON in the [Document] format. +message BatchProcessDocumentsRequest { + // Required. Individual requests for each document. + repeated ProcessDocumentRequest requests = 1 [(google.api.field_behavior) = REQUIRED]; + + // Target project and location to make a call. + // + // Format: `projects/{project-id}/locations/{location-id}`. + // + // If no location is specified, a region will be chosen automatically. + string parent = 2; +} + +// Request to process one document. +message ProcessDocumentRequest { + // Target project and location to make a call. + // + // Format: `projects/{project-id}/locations/{location-id}`. + // + // If no location is specified, a region will be chosen automatically. + // This field is only populated when used in ProcessDocument method. + string parent = 9; + + // Required. Information about the input file. + InputConfig input_config = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The desired output location. This field is only needed in + // BatchProcessDocumentsRequest. + OutputConfig output_config = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Specifies a known document type for deeper structure detection. Valid + // values are currently "general" and "invoice". If not provided, "general"\ + // is used as default. If any other value is given, the request is rejected. + string document_type = 3; + + // Controls table extraction behavior. If not specified, the system will + // decide reasonable defaults. + TableExtractionParams table_extraction_params = 4; + + // Controls form extraction behavior. If not specified, the system will + // decide reasonable defaults. + FormExtractionParams form_extraction_params = 5; + + // Controls entity extraction behavior. If not specified, the system will + // decide reasonable defaults. + EntityExtractionParams entity_extraction_params = 6; + + // Controls OCR behavior. If not specified, the system will decide reasonable + // defaults. + OcrParams ocr_params = 7; + + // Controls AutoML model prediction behavior. AutoMlParams cannot be used + // together with other Params. + AutoMlParams automl_params = 8; +} + +// Response to an batch document processing request. This is returned in +// the LRO Operation after the operation is complete. +message BatchProcessDocumentsResponse { + // Responses for each individual document. + repeated ProcessDocumentResponse responses = 1; +} + +// Response to a single document processing request. +message ProcessDocumentResponse { + // Information about the input file. This is the same as the corresponding + // input config in the request. + InputConfig input_config = 1; + + // The output location of the parsed responses. The responses are written to + // this location as JSON-serialized `Document` objects. + OutputConfig output_config = 2; +} + +// Parameters to control Optical Character Recognition (OCR) behavior. +message OcrParams { + // List of languages to use for OCR. In most cases, an empty value + // yields the best results since it enables automatic language detection. For + // languages based on the Latin alphabet, setting `language_hints` is not + // needed. In rare cases, when the language of the text in the image is known, + // setting a hint will help get better results (although it will be a + // significant hindrance if the hint is wrong). Document processing returns an + // error if one or more of the specified languages is not one of the + // supported languages. + repeated string language_hints = 1; +} + +// Parameters to control table extraction behavior. +message TableExtractionParams { + // Whether to enable table extraction. + bool enabled = 1; + + // Optional. Table bounding box hints that can be provided to complex cases + // which our algorithm cannot locate the table(s) in. + repeated TableBoundHint table_bound_hints = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Table header hints. The extraction will bias towards producing + // these terms as table headers, which may improve accuracy. + repeated string header_hints = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Model version of the table extraction system. Default is "builtin/stable". + // Specify "builtin/latest" for the latest model. + string model_version = 4; +} + +// A hint for a table bounding box on the page for table parsing. +message TableBoundHint { + // Optional. Page number for multi-paged inputs this hint applies to. If not + // provided, this hint will apply to all pages by default. This value is + // 1-based. + int32 page_number = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Bounding box hint for a table on this page. The coordinates must be + // normalized to [0,1] and the bounding box must be an axis-aligned rectangle. + BoundingPoly bounding_box = 2; +} + +// Parameters to control form extraction behavior. +message FormExtractionParams { + // Whether to enable form extraction. + bool enabled = 1; + + // User can provide pairs of (key text, value type) to improve the parsing + // result. + // + // For example, if a document has a field called "Date" that holds a date + // value and a field called "Amount" that may hold either a currency value + // (e.g., "$500.00") or a simple number value (e.g., "20"), you could use the + // following hints: [ {"key": "Date", value_types: [ "DATE"]}, {"key": + // "Amount", "value_types": [ "PRICE", "NUMBER" ]} ] + // + // If the value type is unknown, but you want to provide hints for the keys, + // you can leave the value_types field blank. e.g. {"key": "Date", + // "value_types": []} + repeated KeyValuePairHint key_value_pair_hints = 2; + + // Model version of the form extraction system. Default is + // "builtin/stable". Specify "builtin/latest" for the latest model. + // For custom form models, specify: “custom/{model_name}". Model name + // format is "bucket_name/path/to/modeldir" corresponding to + // "gs://bucket_name/path/to/modeldir" where annotated examples are stored. + string model_version = 3; +} + +// User-provided hint for key value pair. +message KeyValuePairHint { + // The key text for the hint. + string key = 1; + + // Type of the value. This is case-insensitive, and could be one of: + // ADDRESS, LOCATION, ORGANIZATION, PERSON, PHONE_NUMBER, + // ID, NUMBER, EMAIL, PRICE, TERMS, DATE, NAME. Types not in this list will + // be ignored. + repeated string value_types = 2; +} + +// Parameters to control entity extraction behavior. +message EntityExtractionParams { + // Whether to enable entity extraction. + bool enabled = 1; + + // Model version of the entity extraction. Default is + // "builtin/stable". Specify "builtin/latest" for the latest model. + string model_version = 2; +} + +// Parameters to control AutoML model prediction behavior. +message AutoMlParams { + // Resource name of the AutoML model. + // + // Format: `projects/{project-id}/locations/{location-id}/models/{model-id}`. + string model = 1; +} + +// The desired input location and metadata. +message InputConfig { + // Required. + oneof source { + // The Google Cloud Storage location to read the input from. This must be a + // single file. + GcsSource gcs_source = 1; + + // Content in bytes, represented as a stream of bytes. + // Note: As with all `bytes` fields, proto buffer messages use a pure binary + // representation, whereas JSON representations use base64. + // + // This field only works for synchronous ProcessDocument method. + bytes contents = 3; + } + + // Required. Mimetype of the input. Current supported mimetypes are application/pdf, + // image/tiff, and image/gif. + // In addition, application/json type is supported for requests with + // [ProcessDocumentRequest.automl_params][google.cloud.documentai.v1beta2.ProcessDocumentRequest.automl_params] field set. The JSON file needs to + // be in [Document][google.cloud.documentai.v1beta2.Document] format. + string mime_type = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The desired output location and metadata. +message OutputConfig { + // Required. + oneof destination { + // The Google Cloud Storage location to write the output to. + GcsDestination gcs_destination = 1; + } + + // The max number of pages to include into each output Document shard JSON on + // Google Cloud Storage. + // + // The valid range is [1, 100]. If not specified, the default value is 20. + // + // For example, for one pdf file with 100 pages, 100 parsed pages will be + // produced. If `pages_per_shard` = 20, then 5 Document shard JSON files each + // containing 20 parsed pages will be written under the prefix + // [OutputConfig.gcs_destination.uri][] and suffix pages-x-to-y.json where + // x and y are 1-indexed page numbers. + // + // Example GCS outputs with 157 pages and pages_per_shard = 50: + // + // pages-001-to-050.json + // pages-051-to-100.json + // pages-101-to-150.json + // pages-151-to-157.json + int32 pages_per_shard = 2; +} + +// The Google Cloud Storage location where the input file will be read from. +message GcsSource { + string uri = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The Google Cloud Storage location where the output file will be written to. +message GcsDestination { + string uri = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Contains metadata for the BatchProcessDocuments operation. +message OperationMetadata { + enum State { + // The default value. This value is used if the state is omitted. + STATE_UNSPECIFIED = 0; + + // Request is received. + ACCEPTED = 1; + + // Request operation is waiting for scheduling. + WAITING = 2; + + // Request is being processed. + RUNNING = 3; + + // The batch processing completed successfully. + SUCCEEDED = 4; + + // The batch processing was cancelled. + CANCELLED = 5; + + // The batch processing has failed. + FAILED = 6; + } + + // The state of the current batch processing. + State state = 1; + + // A message providing more details about the current state of processing. + string state_message = 2; + + // The creation time of the operation. + google.protobuf.Timestamp create_time = 3; + + // The last update time of the operation. + google.protobuf.Timestamp update_time = 4; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/geometry.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/geometry.proto new file mode 100644 index 00000000000..7f53217fedf --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/geometry.proto @@ -0,0 +1,54 @@ +// 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.documentai.v1beta2; + +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta2;documentai"; +option java_multiple_files = true; +option java_outer_classname = "GeometryProto"; +option java_package = "com.google.cloud.documentai.v1beta2"; + +// A vertex represents a 2D point in the image. +// NOTE: the vertex coordinates are in the same scale as the original image. +message Vertex { + // X coordinate. + int32 x = 1; + + // Y coordinate. + int32 y = 2; +} + +// A vertex represents a 2D point in the image. +// NOTE: the normalized vertex coordinates are relative to the original image +// and range from 0 to 1. +message NormalizedVertex { + // X coordinate. + float x = 1; + + // Y coordinate. + float y = 2; +} + +// A bounding polygon for the detected image annotation. +message BoundingPoly { + // The bounding polygon vertices. + repeated Vertex vertices = 1; + + // The bounding polygon normalized vertices. + repeated NormalizedVertex normalized_vertices = 2; +} diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index ee6f7083871..cb586ed1cbd 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -1,3 +1,18 @@ +// 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. + +import * as Long from "long"; import * as $protobuf from "protobufjs"; /** Namespace google. */ export namespace google { @@ -8,1936 +23,4804 @@ export namespace google { /** Namespace documentai. */ namespace documentai { - /** Namespace v1beta1. */ - namespace v1beta1 { + /** Namespace v1beta2. */ + namespace v1beta2 { - /** Represents a DocumentUnderstandingService */ - class DocumentUnderstandingService extends $protobuf.rpc.Service { + /** Properties of a Document. */ + interface IDocument { - /** - * Constructs a new DocumentUnderstandingService 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); + /** Document uri */ + uri?: (string|null); - /** - * Creates new DocumentUnderstandingService 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): DocumentUnderstandingService; + /** Document content */ + content?: (Uint8Array|string|null); - /** - * Calls BatchProcessDocuments. - * @param request BatchProcessDocumentsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public batchProcessDocuments(request: google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest, callback: google.cloud.documentai.v1beta1.DocumentUnderstandingService.BatchProcessDocumentsCallback): void; + /** Document mimeType */ + mimeType?: (string|null); - /** - * Calls BatchProcessDocuments. - * @param request BatchProcessDocumentsRequest message or plain object - * @returns Promise - */ - public batchProcessDocuments(request: google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest): Promise; - } + /** Document text */ + text?: (string|null); - namespace DocumentUnderstandingService { + /** Document textStyles */ + textStyles?: (google.cloud.documentai.v1beta2.Document.IStyle[]|null); - /** - * Callback as used by {@link google.cloud.documentai.v1beta1.DocumentUnderstandingService#batchProcessDocuments}. - * @param error Error, if any - * @param [response] Operation - */ - type BatchProcessDocumentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - } + /** Document pages */ + pages?: (google.cloud.documentai.v1beta2.Document.IPage[]|null); - /** Properties of a BatchProcessDocumentsRequest. */ - interface IBatchProcessDocumentsRequest { + /** Document entities */ + entities?: (google.cloud.documentai.v1beta2.Document.IEntity[]|null); - /** BatchProcessDocumentsRequest requests */ - requests?: (google.cloud.documentai.v1beta1.IProcessDocumentRequest[]|null); + /** Document entityRelations */ + entityRelations?: (google.cloud.documentai.v1beta2.Document.IEntityRelation[]|null); - /** BatchProcessDocumentsRequest parent */ - parent?: (string|null); + /** Document shardInfo */ + shardInfo?: (google.cloud.documentai.v1beta2.Document.IShardInfo|null); + + /** Document labels */ + labels?: (google.cloud.documentai.v1beta2.Document.ILabel[]|null); + + /** Document error */ + error?: (google.rpc.IStatus|null); } - /** Represents a BatchProcessDocumentsRequest. */ - class BatchProcessDocumentsRequest implements IBatchProcessDocumentsRequest { + /** Represents a Document. */ + class Document implements IDocument { /** - * Constructs a new BatchProcessDocumentsRequest. + * Constructs a new Document. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest); + constructor(properties?: google.cloud.documentai.v1beta2.IDocument); - /** BatchProcessDocumentsRequest requests. */ - public requests: google.cloud.documentai.v1beta1.IProcessDocumentRequest[]; + /** Document uri. */ + public uri: string; - /** BatchProcessDocumentsRequest parent. */ - public parent: string; + /** Document content. */ + public content: (Uint8Array|string); + + /** Document mimeType. */ + public mimeType: string; + + /** Document text. */ + public text: string; + + /** Document textStyles. */ + public textStyles: google.cloud.documentai.v1beta2.Document.IStyle[]; + + /** Document pages. */ + public pages: google.cloud.documentai.v1beta2.Document.IPage[]; + + /** Document entities. */ + public entities: google.cloud.documentai.v1beta2.Document.IEntity[]; + + /** Document entityRelations. */ + public entityRelations: google.cloud.documentai.v1beta2.Document.IEntityRelation[]; + + /** Document shardInfo. */ + public shardInfo?: (google.cloud.documentai.v1beta2.Document.IShardInfo|null); + + /** Document labels. */ + public labels: google.cloud.documentai.v1beta2.Document.ILabel[]; + + /** Document error. */ + public error?: (google.rpc.IStatus|null); + + /** Document source. */ + public source?: ("uri"|"content"); /** - * Creates a new BatchProcessDocumentsRequest instance using the specified properties. + * Creates a new Document instance using the specified properties. * @param [properties] Properties to set - * @returns BatchProcessDocumentsRequest instance + * @returns Document instance */ - public static create(properties?: google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest): google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest; + public static create(properties?: google.cloud.documentai.v1beta2.IDocument): google.cloud.documentai.v1beta2.Document; /** - * Encodes the specified BatchProcessDocumentsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.verify|verify} messages. - * @param message BatchProcessDocumentsRequest message or plain object to encode + * Encodes the specified Document message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.verify|verify} messages. + * @param message Document message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta2.IDocument, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BatchProcessDocumentsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.verify|verify} messages. - * @param message BatchProcessDocumentsRequest message or plain object to encode + * Encodes the specified Document message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.verify|verify} messages. + * @param message Document message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta2.IDocument, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BatchProcessDocumentsRequest message from the specified reader or buffer. + * Decodes a Document message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BatchProcessDocumentsRequest + * @returns Document * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document; /** - * Decodes a BatchProcessDocumentsRequest message from the specified reader or buffer, length delimited. + * Decodes a Document message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BatchProcessDocumentsRequest + * @returns Document * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document; /** - * Verifies a BatchProcessDocumentsRequest message. + * Verifies a Document message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a BatchProcessDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Document message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BatchProcessDocumentsRequest + * @returns Document */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document; /** - * Creates a plain object from a BatchProcessDocumentsRequest message. Also converts values to other types if specified. - * @param message BatchProcessDocumentsRequest + * Creates a plain object from a Document message. Also converts values to other types if specified. + * @param message Document * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta2.Document, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BatchProcessDocumentsRequest to JSON. + * Converts this Document to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ProcessDocumentRequest. */ - interface IProcessDocumentRequest { + namespace Document { - /** ProcessDocumentRequest inputConfig */ - inputConfig?: (google.cloud.documentai.v1beta1.IInputConfig|null); + /** Properties of a ShardInfo. */ + interface IShardInfo { - /** ProcessDocumentRequest outputConfig */ - outputConfig?: (google.cloud.documentai.v1beta1.IOutputConfig|null); + /** ShardInfo shardIndex */ + shardIndex?: (number|Long|string|null); - /** ProcessDocumentRequest documentType */ - documentType?: (string|null); + /** ShardInfo shardCount */ + shardCount?: (number|Long|string|null); - /** ProcessDocumentRequest tableExtractionParams */ - tableExtractionParams?: (google.cloud.documentai.v1beta1.ITableExtractionParams|null); + /** ShardInfo textOffset */ + textOffset?: (number|Long|string|null); + } - /** ProcessDocumentRequest formExtractionParams */ - formExtractionParams?: (google.cloud.documentai.v1beta1.IFormExtractionParams|null); + /** Represents a ShardInfo. */ + class ShardInfo implements IShardInfo { + + /** + * Constructs a new ShardInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.IShardInfo); + + /** ShardInfo shardIndex. */ + public shardIndex: (number|Long|string); + + /** ShardInfo shardCount. */ + public shardCount: (number|Long|string); + + /** ShardInfo textOffset. */ + public textOffset: (number|Long|string); + + /** + * Creates a new ShardInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns ShardInfo instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.IShardInfo): google.cloud.documentai.v1beta2.Document.ShardInfo; + + /** + * Encodes the specified ShardInfo message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.ShardInfo.verify|verify} messages. + * @param message ShardInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.IShardInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ShardInfo message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.ShardInfo.verify|verify} messages. + * @param message ShardInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.IShardInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ShardInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ShardInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.ShardInfo; + + /** + * Decodes a ShardInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ShardInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.ShardInfo; + + /** + * Verifies a ShardInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ShardInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ShardInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.ShardInfo; + + /** + * Creates a plain object from a ShardInfo message. Also converts values to other types if specified. + * @param message ShardInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.ShardInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ShardInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** ProcessDocumentRequest entityExtractionParams */ - entityExtractionParams?: (google.cloud.documentai.v1beta1.IEntityExtractionParams|null); + /** Properties of a Label. */ + interface ILabel { - /** ProcessDocumentRequest ocrParams */ - ocrParams?: (google.cloud.documentai.v1beta1.IOcrParams|null); - } + /** Label automlModel */ + automlModel?: (string|null); - /** Represents a ProcessDocumentRequest. */ - class ProcessDocumentRequest implements IProcessDocumentRequest { + /** Label name */ + name?: (string|null); - /** - * Constructs a new ProcessDocumentRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.documentai.v1beta1.IProcessDocumentRequest); + /** Label confidence */ + confidence?: (number|null); + } - /** ProcessDocumentRequest inputConfig. */ - public inputConfig?: (google.cloud.documentai.v1beta1.IInputConfig|null); + /** Represents a Label. */ + class Label implements ILabel { + + /** + * Constructs a new Label. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.ILabel); + + /** Label automlModel. */ + public automlModel: string; + + /** Label name. */ + public name: string; + + /** Label confidence. */ + public confidence: number; + + /** Label source. */ + public source?: "automlModel"; + + /** + * Creates a new Label instance using the specified properties. + * @param [properties] Properties to set + * @returns Label instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.ILabel): google.cloud.documentai.v1beta2.Document.Label; + + /** + * Encodes the specified Label message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Label.verify|verify} messages. + * @param message Label message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.ILabel, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Label message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Label.verify|verify} messages. + * @param message Label message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.ILabel, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Label message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Label + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.Label; + + /** + * Decodes a Label message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Label + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.Label; + + /** + * Verifies a Label message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Label message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Label + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.Label; + + /** + * Creates a plain object from a Label message. Also converts values to other types if specified. + * @param message Label + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.Label, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Label to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** ProcessDocumentRequest outputConfig. */ - public outputConfig?: (google.cloud.documentai.v1beta1.IOutputConfig|null); + /** Properties of a Style. */ + interface IStyle { - /** ProcessDocumentRequest documentType. */ - public documentType: string; + /** Style textAnchor */ + textAnchor?: (google.cloud.documentai.v1beta2.Document.ITextAnchor|null); - /** ProcessDocumentRequest tableExtractionParams. */ - public tableExtractionParams?: (google.cloud.documentai.v1beta1.ITableExtractionParams|null); + /** Style color */ + color?: (google.type.IColor|null); - /** ProcessDocumentRequest formExtractionParams. */ - public formExtractionParams?: (google.cloud.documentai.v1beta1.IFormExtractionParams|null); + /** Style backgroundColor */ + backgroundColor?: (google.type.IColor|null); - /** ProcessDocumentRequest entityExtractionParams. */ - public entityExtractionParams?: (google.cloud.documentai.v1beta1.IEntityExtractionParams|null); + /** Style fontWeight */ + fontWeight?: (string|null); - /** ProcessDocumentRequest ocrParams. */ - public ocrParams?: (google.cloud.documentai.v1beta1.IOcrParams|null); + /** Style textStyle */ + textStyle?: (string|null); + + /** Style textDecoration */ + textDecoration?: (string|null); + + /** Style fontSize */ + fontSize?: (google.cloud.documentai.v1beta2.Document.Style.IFontSize|null); + } + + /** Represents a Style. */ + class Style implements IStyle { + + /** + * Constructs a new Style. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.IStyle); + + /** Style textAnchor. */ + public textAnchor?: (google.cloud.documentai.v1beta2.Document.ITextAnchor|null); + + /** Style color. */ + public color?: (google.type.IColor|null); + + /** Style backgroundColor. */ + public backgroundColor?: (google.type.IColor|null); + + /** Style fontWeight. */ + public fontWeight: string; + + /** Style textStyle. */ + public textStyle: string; + + /** Style textDecoration. */ + public textDecoration: string; + + /** Style fontSize. */ + public fontSize?: (google.cloud.documentai.v1beta2.Document.Style.IFontSize|null); + + /** + * Creates a new Style instance using the specified properties. + * @param [properties] Properties to set + * @returns Style instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.IStyle): google.cloud.documentai.v1beta2.Document.Style; + + /** + * Encodes the specified Style message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Style.verify|verify} messages. + * @param message Style message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.IStyle, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Style message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Style.verify|verify} messages. + * @param message Style message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.IStyle, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Style message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Style + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.Style; + + /** + * Decodes a Style message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Style + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.Style; + + /** + * Verifies a Style message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Style message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Style + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.Style; + + /** + * Creates a plain object from a Style message. Also converts values to other types if specified. + * @param message Style + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.Style, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Style to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Style { + + /** Properties of a FontSize. */ + interface IFontSize { + + /** FontSize size */ + size?: (number|null); + + /** FontSize unit */ + unit?: (string|null); + } + + /** Represents a FontSize. */ + class FontSize implements IFontSize { + + /** + * Constructs a new FontSize. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.Style.IFontSize); + + /** FontSize size. */ + public size: number; + + /** FontSize unit. */ + public unit: string; + + /** + * Creates a new FontSize instance using the specified properties. + * @param [properties] Properties to set + * @returns FontSize instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.Style.IFontSize): google.cloud.documentai.v1beta2.Document.Style.FontSize; + + /** + * Encodes the specified FontSize message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Style.FontSize.verify|verify} messages. + * @param message FontSize message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.Style.IFontSize, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FontSize message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Style.FontSize.verify|verify} messages. + * @param message FontSize message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.Style.IFontSize, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FontSize message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FontSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.Style.FontSize; + + /** + * Decodes a FontSize message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FontSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.Style.FontSize; + + /** + * Verifies a FontSize message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FontSize message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FontSize + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.Style.FontSize; + + /** + * Creates a plain object from a FontSize message. Also converts values to other types if specified. + * @param message FontSize + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.Style.FontSize, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FontSize to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a Page. */ + interface IPage { + + /** Page pageNumber */ + pageNumber?: (number|null); + + /** Page dimension */ + dimension?: (google.cloud.documentai.v1beta2.Document.Page.IDimension|null); + + /** Page layout */ + layout?: (google.cloud.documentai.v1beta2.Document.Page.ILayout|null); + + /** Page detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage[]|null); + + /** Page blocks */ + blocks?: (google.cloud.documentai.v1beta2.Document.Page.IBlock[]|null); + + /** Page paragraphs */ + paragraphs?: (google.cloud.documentai.v1beta2.Document.Page.IParagraph[]|null); + + /** Page lines */ + lines?: (google.cloud.documentai.v1beta2.Document.Page.ILine[]|null); + + /** Page tokens */ + tokens?: (google.cloud.documentai.v1beta2.Document.Page.IToken[]|null); + + /** Page visualElements */ + visualElements?: (google.cloud.documentai.v1beta2.Document.Page.IVisualElement[]|null); + + /** Page tables */ + tables?: (google.cloud.documentai.v1beta2.Document.Page.ITable[]|null); + + /** Page formFields */ + formFields?: (google.cloud.documentai.v1beta2.Document.Page.IFormField[]|null); + } + + /** Represents a Page. */ + class Page implements IPage { + + /** + * Constructs a new Page. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.IPage); + + /** Page pageNumber. */ + public pageNumber: number; + + /** Page dimension. */ + public dimension?: (google.cloud.documentai.v1beta2.Document.Page.IDimension|null); + + /** Page layout. */ + public layout?: (google.cloud.documentai.v1beta2.Document.Page.ILayout|null); + + /** Page detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage[]; + + /** Page blocks. */ + public blocks: google.cloud.documentai.v1beta2.Document.Page.IBlock[]; + + /** Page paragraphs. */ + public paragraphs: google.cloud.documentai.v1beta2.Document.Page.IParagraph[]; + + /** Page lines. */ + public lines: google.cloud.documentai.v1beta2.Document.Page.ILine[]; + + /** Page tokens. */ + public tokens: google.cloud.documentai.v1beta2.Document.Page.IToken[]; + + /** Page visualElements. */ + public visualElements: google.cloud.documentai.v1beta2.Document.Page.IVisualElement[]; + + /** Page tables. */ + public tables: google.cloud.documentai.v1beta2.Document.Page.ITable[]; + + /** Page formFields. */ + public formFields: google.cloud.documentai.v1beta2.Document.Page.IFormField[]; + + /** + * Creates a new Page instance using the specified properties. + * @param [properties] Properties to set + * @returns Page instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.IPage): google.cloud.documentai.v1beta2.Document.Page; + + /** + * Encodes the specified Page message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.verify|verify} messages. + * @param message Page message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.IPage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Page message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.verify|verify} messages. + * @param message Page message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.IPage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Page message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Page + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.Page; + + /** + * Decodes a Page message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Page + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.Page; + + /** + * Verifies a Page message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Page message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Page + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.Page; + + /** + * Creates a plain object from a Page message. Also converts values to other types if specified. + * @param message Page + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.Page, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Page to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Page { + + /** Properties of a Dimension. */ + interface IDimension { + + /** Dimension width */ + width?: (number|null); + + /** Dimension height */ + height?: (number|null); + + /** Dimension unit */ + unit?: (string|null); + } + + /** Represents a Dimension. */ + class Dimension implements IDimension { + + /** + * Constructs a new Dimension. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.Page.IDimension); + + /** Dimension width. */ + public width: number; + + /** Dimension height. */ + public height: number; + + /** Dimension unit. */ + public unit: string; + + /** + * Creates a new Dimension instance using the specified properties. + * @param [properties] Properties to set + * @returns Dimension instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.Page.IDimension): google.cloud.documentai.v1beta2.Document.Page.Dimension; + + /** + * Encodes the specified Dimension message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Dimension.verify|verify} messages. + * @param message Dimension message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.Page.IDimension, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Dimension message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Dimension.verify|verify} messages. + * @param message Dimension message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.Page.IDimension, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Dimension message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Dimension + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.Page.Dimension; + + /** + * Decodes a Dimension message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Dimension + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.Page.Dimension; + + /** + * Verifies a Dimension message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Dimension message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Dimension + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.Page.Dimension; + + /** + * Creates a plain object from a Dimension message. Also converts values to other types if specified. + * @param message Dimension + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.Page.Dimension, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Dimension to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Layout. */ + interface ILayout { + + /** Layout textAnchor */ + textAnchor?: (google.cloud.documentai.v1beta2.Document.ITextAnchor|null); + + /** Layout confidence */ + confidence?: (number|null); + + /** Layout boundingPoly */ + boundingPoly?: (google.cloud.documentai.v1beta2.IBoundingPoly|null); + + /** Layout orientation */ + orientation?: (google.cloud.documentai.v1beta2.Document.Page.Layout.Orientation|keyof typeof google.cloud.documentai.v1beta2.Document.Page.Layout.Orientation|null); + + /** Layout id */ + id?: (string|null); + } + + /** Represents a Layout. */ + class Layout implements ILayout { + + /** + * Constructs a new Layout. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.Page.ILayout); + + /** Layout textAnchor. */ + public textAnchor?: (google.cloud.documentai.v1beta2.Document.ITextAnchor|null); + + /** Layout confidence. */ + public confidence: number; + + /** Layout boundingPoly. */ + public boundingPoly?: (google.cloud.documentai.v1beta2.IBoundingPoly|null); + + /** Layout orientation. */ + public orientation: (google.cloud.documentai.v1beta2.Document.Page.Layout.Orientation|keyof typeof google.cloud.documentai.v1beta2.Document.Page.Layout.Orientation); + + /** Layout id. */ + public id: string; + + /** + * Creates a new Layout instance using the specified properties. + * @param [properties] Properties to set + * @returns Layout instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.Page.ILayout): google.cloud.documentai.v1beta2.Document.Page.Layout; + + /** + * Encodes the specified Layout message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Layout.verify|verify} messages. + * @param message Layout message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.Page.ILayout, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Layout message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Layout.verify|verify} messages. + * @param message Layout message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.Page.ILayout, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Layout message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Layout + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.Page.Layout; + + /** + * Decodes a Layout message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Layout + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.Page.Layout; + + /** + * Verifies a Layout message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Layout message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Layout + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.Page.Layout; + + /** + * Creates a plain object from a Layout message. Also converts values to other types if specified. + * @param message Layout + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.Page.Layout, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Layout to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Layout { + + /** Orientation enum. */ + enum Orientation { + ORIENTATION_UNSPECIFIED = 0, + PAGE_UP = 1, + PAGE_RIGHT = 2, + PAGE_DOWN = 3, + PAGE_LEFT = 4 + } + } + + /** Properties of a Block. */ + interface IBlock { + + /** Block layout */ + layout?: (google.cloud.documentai.v1beta2.Document.Page.ILayout|null); + + /** Block detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a Block. */ + class Block implements IBlock { + + /** + * Constructs a new Block. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.Page.IBlock); + + /** Block layout. */ + public layout?: (google.cloud.documentai.v1beta2.Document.Page.ILayout|null); + + /** Block detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new Block instance using the specified properties. + * @param [properties] Properties to set + * @returns Block instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.Page.IBlock): google.cloud.documentai.v1beta2.Document.Page.Block; + + /** + * Encodes the specified Block message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Block.verify|verify} messages. + * @param message Block message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.Page.IBlock, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Block message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Block.verify|verify} messages. + * @param message Block message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.Page.IBlock, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Block message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Block + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.Page.Block; + + /** + * Decodes a Block message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Block + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.Page.Block; + + /** + * Verifies a Block message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Block message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Block + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.Page.Block; + + /** + * Creates a plain object from a Block message. Also converts values to other types if specified. + * @param message Block + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.Page.Block, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Block to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Paragraph. */ + interface IParagraph { + + /** Paragraph layout */ + layout?: (google.cloud.documentai.v1beta2.Document.Page.ILayout|null); + + /** Paragraph detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a Paragraph. */ + class Paragraph implements IParagraph { + + /** + * Constructs a new Paragraph. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.Page.IParagraph); + + /** Paragraph layout. */ + public layout?: (google.cloud.documentai.v1beta2.Document.Page.ILayout|null); + + /** Paragraph detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new Paragraph instance using the specified properties. + * @param [properties] Properties to set + * @returns Paragraph instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.Page.IParagraph): google.cloud.documentai.v1beta2.Document.Page.Paragraph; + + /** + * Encodes the specified Paragraph message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Paragraph.verify|verify} messages. + * @param message Paragraph message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.Page.IParagraph, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Paragraph message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Paragraph.verify|verify} messages. + * @param message Paragraph message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.Page.IParagraph, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Paragraph message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Paragraph + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.Page.Paragraph; + + /** + * Decodes a Paragraph message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Paragraph + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.Page.Paragraph; + + /** + * Verifies a Paragraph message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Paragraph message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Paragraph + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.Page.Paragraph; + + /** + * Creates a plain object from a Paragraph message. Also converts values to other types if specified. + * @param message Paragraph + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.Page.Paragraph, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Paragraph to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Line. */ + interface ILine { + + /** Line layout */ + layout?: (google.cloud.documentai.v1beta2.Document.Page.ILayout|null); + + /** Line detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a Line. */ + class Line implements ILine { + + /** + * Constructs a new Line. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.Page.ILine); + + /** Line layout. */ + public layout?: (google.cloud.documentai.v1beta2.Document.Page.ILayout|null); + + /** Line detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new Line instance using the specified properties. + * @param [properties] Properties to set + * @returns Line instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.Page.ILine): google.cloud.documentai.v1beta2.Document.Page.Line; + + /** + * Encodes the specified Line message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Line.verify|verify} messages. + * @param message Line message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.Page.ILine, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Line message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Line.verify|verify} messages. + * @param message Line message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.Page.ILine, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Line message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.Page.Line; + + /** + * Decodes a Line message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.Page.Line; + + /** + * Verifies a Line message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Line message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Line + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.Page.Line; + + /** + * Creates a plain object from a Line message. Also converts values to other types if specified. + * @param message Line + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.Page.Line, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Line to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Token. */ + interface IToken { + + /** Token layout */ + layout?: (google.cloud.documentai.v1beta2.Document.Page.ILayout|null); + + /** Token detectedBreak */ + detectedBreak?: (google.cloud.documentai.v1beta2.Document.Page.Token.IDetectedBreak|null); + + /** Token detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a Token. */ + class Token implements IToken { + + /** + * Constructs a new Token. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.Page.IToken); + + /** Token layout. */ + public layout?: (google.cloud.documentai.v1beta2.Document.Page.ILayout|null); + + /** Token detectedBreak. */ + public detectedBreak?: (google.cloud.documentai.v1beta2.Document.Page.Token.IDetectedBreak|null); + + /** Token detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new Token instance using the specified properties. + * @param [properties] Properties to set + * @returns Token instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.Page.IToken): google.cloud.documentai.v1beta2.Document.Page.Token; + + /** + * Encodes the specified Token message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Token.verify|verify} messages. + * @param message Token message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.Page.IToken, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Token message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Token.verify|verify} messages. + * @param message Token message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.Page.IToken, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Token message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Token + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.Page.Token; + + /** + * Decodes a Token message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Token + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.Page.Token; + + /** + * Verifies a Token message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Token message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Token + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.Page.Token; + + /** + * Creates a plain object from a Token message. Also converts values to other types if specified. + * @param message Token + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.Page.Token, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Token to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Token { + + /** Properties of a DetectedBreak. */ + interface IDetectedBreak { + + /** DetectedBreak type */ + type?: (google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.Type|keyof typeof google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.Type|null); + } + + /** Represents a DetectedBreak. */ + class DetectedBreak implements IDetectedBreak { + + /** + * Constructs a new DetectedBreak. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.Page.Token.IDetectedBreak); + + /** DetectedBreak type. */ + public type: (google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.Type|keyof typeof google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.Type); + + /** + * Creates a new DetectedBreak instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectedBreak instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.Page.Token.IDetectedBreak): google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak; + + /** + * Encodes the specified DetectedBreak message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.verify|verify} messages. + * @param message DetectedBreak message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.Page.Token.IDetectedBreak, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectedBreak message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.verify|verify} messages. + * @param message DetectedBreak message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.Page.Token.IDetectedBreak, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectedBreak message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectedBreak + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak; + + /** + * Decodes a DetectedBreak message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectedBreak + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak; + + /** + * Verifies a DetectedBreak message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DetectedBreak message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectedBreak + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak; + + /** + * Creates a plain object from a DetectedBreak message. Also converts values to other types if specified. + * @param message DetectedBreak + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectedBreak to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace DetectedBreak { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + SPACE = 1, + WIDE_SPACE = 2, + HYPHEN = 3 + } + } + } + + /** Properties of a VisualElement. */ + interface IVisualElement { + + /** VisualElement layout */ + layout?: (google.cloud.documentai.v1beta2.Document.Page.ILayout|null); + + /** VisualElement type */ + type?: (string|null); + + /** VisualElement detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a VisualElement. */ + class VisualElement implements IVisualElement { + + /** + * Constructs a new VisualElement. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.Page.IVisualElement); + + /** VisualElement layout. */ + public layout?: (google.cloud.documentai.v1beta2.Document.Page.ILayout|null); + + /** VisualElement type. */ + public type: string; + + /** VisualElement detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new VisualElement instance using the specified properties. + * @param [properties] Properties to set + * @returns VisualElement instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.Page.IVisualElement): google.cloud.documentai.v1beta2.Document.Page.VisualElement; + + /** + * Encodes the specified VisualElement message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.VisualElement.verify|verify} messages. + * @param message VisualElement message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.Page.IVisualElement, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VisualElement message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.VisualElement.verify|verify} messages. + * @param message VisualElement message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.Page.IVisualElement, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VisualElement message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VisualElement + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.Page.VisualElement; + + /** + * Decodes a VisualElement message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VisualElement + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.Page.VisualElement; + + /** + * Verifies a VisualElement message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a VisualElement message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VisualElement + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.Page.VisualElement; + + /** + * Creates a plain object from a VisualElement message. Also converts values to other types if specified. + * @param message VisualElement + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.Page.VisualElement, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VisualElement to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Table. */ + interface ITable { + + /** Table layout */ + layout?: (google.cloud.documentai.v1beta2.Document.Page.ILayout|null); + + /** Table headerRows */ + headerRows?: (google.cloud.documentai.v1beta2.Document.Page.Table.ITableRow[]|null); + + /** Table bodyRows */ + bodyRows?: (google.cloud.documentai.v1beta2.Document.Page.Table.ITableRow[]|null); + + /** Table detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a Table. */ + class Table implements ITable { + + /** + * Constructs a new Table. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.Page.ITable); + + /** Table layout. */ + public layout?: (google.cloud.documentai.v1beta2.Document.Page.ILayout|null); + + /** Table headerRows. */ + public headerRows: google.cloud.documentai.v1beta2.Document.Page.Table.ITableRow[]; + + /** Table bodyRows. */ + public bodyRows: google.cloud.documentai.v1beta2.Document.Page.Table.ITableRow[]; + + /** Table detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new Table instance using the specified properties. + * @param [properties] Properties to set + * @returns Table instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.Page.ITable): google.cloud.documentai.v1beta2.Document.Page.Table; + + /** + * Encodes the specified Table message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Table.verify|verify} messages. + * @param message Table message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.Page.ITable, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Table message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Table.verify|verify} messages. + * @param message Table message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.Page.ITable, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Table message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Table + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.Page.Table; + + /** + * Decodes a Table message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Table + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.Page.Table; + + /** + * Verifies a Table message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Table message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Table + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.Page.Table; + + /** + * Creates a plain object from a Table message. Also converts values to other types if specified. + * @param message Table + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.Page.Table, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Table to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Table { + + /** Properties of a TableRow. */ + interface ITableRow { + + /** TableRow cells */ + cells?: (google.cloud.documentai.v1beta2.Document.Page.Table.ITableCell[]|null); + } + + /** Represents a TableRow. */ + class TableRow implements ITableRow { + + /** + * Constructs a new TableRow. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.Page.Table.ITableRow); + + /** TableRow cells. */ + public cells: google.cloud.documentai.v1beta2.Document.Page.Table.ITableCell[]; + + /** + * Creates a new TableRow instance using the specified properties. + * @param [properties] Properties to set + * @returns TableRow instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.Page.Table.ITableRow): google.cloud.documentai.v1beta2.Document.Page.Table.TableRow; + + /** + * Encodes the specified TableRow message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Table.TableRow.verify|verify} messages. + * @param message TableRow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.Page.Table.ITableRow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableRow message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Table.TableRow.verify|verify} messages. + * @param message TableRow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.Page.Table.ITableRow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableRow message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.Page.Table.TableRow; + + /** + * Decodes a TableRow message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.Page.Table.TableRow; + + /** + * Verifies a TableRow message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TableRow message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableRow + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.Page.Table.TableRow; + + /** + * Creates a plain object from a TableRow message. Also converts values to other types if specified. + * @param message TableRow + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.Page.Table.TableRow, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableRow to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TableCell. */ + interface ITableCell { + + /** TableCell layout */ + layout?: (google.cloud.documentai.v1beta2.Document.Page.ILayout|null); + + /** TableCell rowSpan */ + rowSpan?: (number|null); + + /** TableCell colSpan */ + colSpan?: (number|null); + + /** TableCell detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a TableCell. */ + class TableCell implements ITableCell { + + /** + * Constructs a new TableCell. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.Page.Table.ITableCell); + + /** TableCell layout. */ + public layout?: (google.cloud.documentai.v1beta2.Document.Page.ILayout|null); + + /** TableCell rowSpan. */ + public rowSpan: number; + + /** TableCell colSpan. */ + public colSpan: number; + + /** TableCell detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new TableCell instance using the specified properties. + * @param [properties] Properties to set + * @returns TableCell instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.Page.Table.ITableCell): google.cloud.documentai.v1beta2.Document.Page.Table.TableCell; + + /** + * Encodes the specified TableCell message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Table.TableCell.verify|verify} messages. + * @param message TableCell message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.Page.Table.ITableCell, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableCell message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Table.TableCell.verify|verify} messages. + * @param message TableCell message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.Page.Table.ITableCell, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableCell message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.Page.Table.TableCell; + + /** + * Decodes a TableCell message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.Page.Table.TableCell; + + /** + * Verifies a TableCell message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TableCell message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableCell + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.Page.Table.TableCell; + + /** + * Creates a plain object from a TableCell message. Also converts values to other types if specified. + * @param message TableCell + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.Page.Table.TableCell, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableCell to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a FormField. */ + interface IFormField { + + /** FormField fieldName */ + fieldName?: (google.cloud.documentai.v1beta2.Document.Page.ILayout|null); + + /** FormField fieldValue */ + fieldValue?: (google.cloud.documentai.v1beta2.Document.Page.ILayout|null); + + /** FormField nameDetectedLanguages */ + nameDetectedLanguages?: (google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage[]|null); + + /** FormField valueDetectedLanguages */ + valueDetectedLanguages?: (google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage[]|null); + + /** FormField valueType */ + valueType?: (string|null); + + /** FormField correctedKeyText */ + correctedKeyText?: (string|null); + + /** FormField correctedValueText */ + correctedValueText?: (string|null); + } + + /** Represents a FormField. */ + class FormField implements IFormField { + + /** + * Constructs a new FormField. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.Page.IFormField); + + /** FormField fieldName. */ + public fieldName?: (google.cloud.documentai.v1beta2.Document.Page.ILayout|null); + + /** FormField fieldValue. */ + public fieldValue?: (google.cloud.documentai.v1beta2.Document.Page.ILayout|null); + + /** FormField nameDetectedLanguages. */ + public nameDetectedLanguages: google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage[]; + + /** FormField valueDetectedLanguages. */ + public valueDetectedLanguages: google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage[]; + + /** FormField valueType. */ + public valueType: string; + + /** FormField correctedKeyText. */ + public correctedKeyText: string; + + /** FormField correctedValueText. */ + public correctedValueText: string; + + /** + * Creates a new FormField instance using the specified properties. + * @param [properties] Properties to set + * @returns FormField instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.Page.IFormField): google.cloud.documentai.v1beta2.Document.Page.FormField; + + /** + * Encodes the specified FormField message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.FormField.verify|verify} messages. + * @param message FormField message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.Page.IFormField, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FormField message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.FormField.verify|verify} messages. + * @param message FormField message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.Page.IFormField, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FormField message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FormField + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.Page.FormField; + + /** + * Decodes a FormField message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FormField + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.Page.FormField; + + /** + * Verifies a FormField message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FormField message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FormField + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.Page.FormField; + + /** + * Creates a plain object from a FormField message. Also converts values to other types if specified. + * @param message FormField + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.Page.FormField, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FormField to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DetectedLanguage. */ + interface IDetectedLanguage { + + /** DetectedLanguage languageCode */ + languageCode?: (string|null); + + /** DetectedLanguage confidence */ + confidence?: (number|null); + } + + /** Represents a DetectedLanguage. */ + class DetectedLanguage implements IDetectedLanguage { + + /** + * Constructs a new DetectedLanguage. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage); + + /** DetectedLanguage languageCode. */ + public languageCode: string; + + /** DetectedLanguage confidence. */ + public confidence: number; + + /** + * Creates a new DetectedLanguage instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectedLanguage instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage): google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage; + + /** + * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.verify|verify} messages. + * @param message DetectedLanguage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.verify|verify} messages. + * @param message DetectedLanguage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectedLanguage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage; + + /** + * Decodes a DetectedLanguage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage; + + /** + * Verifies a DetectedLanguage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DetectedLanguage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectedLanguage + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage; + + /** + * Creates a plain object from a DetectedLanguage message. Also converts values to other types if specified. + * @param message DetectedLanguage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectedLanguage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an Entity. */ + interface IEntity { + + /** Entity textAnchor */ + textAnchor?: (google.cloud.documentai.v1beta2.Document.ITextAnchor|null); + + /** Entity type */ + type?: (string|null); + + /** Entity mentionText */ + mentionText?: (string|null); + + /** Entity mentionId */ + mentionId?: (string|null); + + /** Entity confidence */ + confidence?: (number|null); + + /** Entity pageAnchor */ + pageAnchor?: (google.cloud.documentai.v1beta2.Document.IPageAnchor|null); + + /** Entity id */ + id?: (string|null); + + /** Entity boundingPolyForDemoFrontend */ + boundingPolyForDemoFrontend?: (google.cloud.documentai.v1beta2.IBoundingPoly|null); + } + + /** Represents an Entity. */ + class Entity implements IEntity { + + /** + * Constructs a new Entity. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.IEntity); + + /** Entity textAnchor. */ + public textAnchor?: (google.cloud.documentai.v1beta2.Document.ITextAnchor|null); + + /** Entity type. */ + public type: string; + + /** Entity mentionText. */ + public mentionText: string; + + /** Entity mentionId. */ + public mentionId: string; + + /** Entity confidence. */ + public confidence: number; + + /** Entity pageAnchor. */ + public pageAnchor?: (google.cloud.documentai.v1beta2.Document.IPageAnchor|null); + + /** Entity id. */ + public id: string; + + /** Entity boundingPolyForDemoFrontend. */ + public boundingPolyForDemoFrontend?: (google.cloud.documentai.v1beta2.IBoundingPoly|null); + + /** + * Creates a new Entity instance using the specified properties. + * @param [properties] Properties to set + * @returns Entity instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.IEntity): google.cloud.documentai.v1beta2.Document.Entity; + + /** + * Encodes the specified Entity message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Entity.verify|verify} messages. + * @param message Entity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.IEntity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Entity message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Entity.verify|verify} messages. + * @param message Entity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.IEntity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Entity message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.Entity; + + /** + * Decodes an Entity message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.Entity; + + /** + * Verifies an Entity message. + * @param message Plain 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 Entity message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Entity + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.Entity; + + /** + * Creates a plain object from an Entity message. Also converts values to other types if specified. + * @param message Entity + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.Entity, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Entity to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EntityRelation. */ + interface IEntityRelation { + + /** EntityRelation subjectId */ + subjectId?: (string|null); + + /** EntityRelation objectId */ + objectId?: (string|null); + + /** EntityRelation relation */ + relation?: (string|null); + } + + /** Represents an EntityRelation. */ + class EntityRelation implements IEntityRelation { + + /** + * Constructs a new EntityRelation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.IEntityRelation); + + /** EntityRelation subjectId. */ + public subjectId: string; + + /** EntityRelation objectId. */ + public objectId: string; + + /** EntityRelation relation. */ + public relation: string; + + /** + * Creates a new EntityRelation instance using the specified properties. + * @param [properties] Properties to set + * @returns EntityRelation instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.IEntityRelation): google.cloud.documentai.v1beta2.Document.EntityRelation; + + /** + * Encodes the specified EntityRelation message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.EntityRelation.verify|verify} messages. + * @param message EntityRelation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.IEntityRelation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EntityRelation message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.EntityRelation.verify|verify} messages. + * @param message EntityRelation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.IEntityRelation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EntityRelation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EntityRelation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.EntityRelation; + + /** + * Decodes an EntityRelation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EntityRelation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.EntityRelation; + + /** + * Verifies an EntityRelation message. + * @param message Plain 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 EntityRelation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EntityRelation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.EntityRelation; + + /** + * Creates a plain object from an EntityRelation message. Also converts values to other types if specified. + * @param message EntityRelation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.EntityRelation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EntityRelation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TextAnchor. */ + interface ITextAnchor { + + /** TextAnchor textSegments */ + textSegments?: (google.cloud.documentai.v1beta2.Document.TextAnchor.ITextSegment[]|null); + } + + /** Represents a TextAnchor. */ + class TextAnchor implements ITextAnchor { + + /** + * Constructs a new TextAnchor. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.ITextAnchor); + + /** TextAnchor textSegments. */ + public textSegments: google.cloud.documentai.v1beta2.Document.TextAnchor.ITextSegment[]; + + /** + * Creates a new TextAnchor instance using the specified properties. + * @param [properties] Properties to set + * @returns TextAnchor instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.ITextAnchor): google.cloud.documentai.v1beta2.Document.TextAnchor; + + /** + * Encodes the specified TextAnchor message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.TextAnchor.verify|verify} messages. + * @param message TextAnchor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.ITextAnchor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TextAnchor message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.TextAnchor.verify|verify} messages. + * @param message TextAnchor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.ITextAnchor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TextAnchor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TextAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.TextAnchor; + + /** + * Decodes a TextAnchor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TextAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.TextAnchor; + + /** + * Verifies a TextAnchor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TextAnchor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TextAnchor + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.TextAnchor; + + /** + * Creates a plain object from a TextAnchor message. Also converts values to other types if specified. + * @param message TextAnchor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.TextAnchor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TextAnchor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace TextAnchor { + + /** Properties of a TextSegment. */ + interface ITextSegment { + + /** TextSegment startIndex */ + startIndex?: (number|Long|string|null); + + /** TextSegment endIndex */ + endIndex?: (number|Long|string|null); + } + + /** Represents a TextSegment. */ + class TextSegment implements ITextSegment { + + /** + * Constructs a new TextSegment. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.TextAnchor.ITextSegment); + + /** TextSegment startIndex. */ + public startIndex: (number|Long|string); + + /** TextSegment endIndex. */ + public endIndex: (number|Long|string); + + /** + * Creates a new TextSegment instance using the specified properties. + * @param [properties] Properties to set + * @returns TextSegment instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.TextAnchor.ITextSegment): google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment; + + /** + * Encodes the specified TextSegment message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment.verify|verify} messages. + * @param message TextSegment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.TextAnchor.ITextSegment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TextSegment message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment.verify|verify} messages. + * @param message TextSegment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.TextAnchor.ITextSegment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TextSegment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TextSegment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment; + + /** + * Decodes a TextSegment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TextSegment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment; + + /** + * Verifies a TextSegment message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TextSegment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TextSegment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment; + + /** + * Creates a plain object from a TextSegment message. Also converts values to other types if specified. + * @param message TextSegment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TextSegment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a PageAnchor. */ + interface IPageAnchor { + + /** PageAnchor pageRefs */ + pageRefs?: (google.cloud.documentai.v1beta2.Document.PageAnchor.IPageRef[]|null); + } + + /** Represents a PageAnchor. */ + class PageAnchor implements IPageAnchor { + + /** + * Constructs a new PageAnchor. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.IPageAnchor); + + /** PageAnchor pageRefs. */ + public pageRefs: google.cloud.documentai.v1beta2.Document.PageAnchor.IPageRef[]; + + /** + * Creates a new PageAnchor instance using the specified properties. + * @param [properties] Properties to set + * @returns PageAnchor instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.IPageAnchor): google.cloud.documentai.v1beta2.Document.PageAnchor; + + /** + * Encodes the specified PageAnchor message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.PageAnchor.verify|verify} messages. + * @param message PageAnchor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.IPageAnchor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PageAnchor message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.PageAnchor.verify|verify} messages. + * @param message PageAnchor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.IPageAnchor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PageAnchor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PageAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.PageAnchor; + + /** + * Decodes a PageAnchor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PageAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.PageAnchor; + + /** + * Verifies a PageAnchor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PageAnchor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PageAnchor + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.PageAnchor; + + /** + * Creates a plain object from a PageAnchor message. Also converts values to other types if specified. + * @param message PageAnchor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.PageAnchor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PageAnchor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PageAnchor { + + /** Properties of a PageRef. */ + interface IPageRef { + + /** PageRef page */ + page?: (number|Long|string|null); + + /** PageRef layoutType */ + layoutType?: (google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.LayoutType|keyof typeof google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.LayoutType|null); + + /** PageRef layoutId */ + layoutId?: (string|null); + } + + /** Represents a PageRef. */ + class PageRef implements IPageRef { + + /** + * Constructs a new PageRef. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.Document.PageAnchor.IPageRef); + + /** PageRef page. */ + public page: (number|Long|string); + + /** PageRef layoutType. */ + public layoutType: (google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.LayoutType|keyof typeof google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.LayoutType); + + /** PageRef layoutId. */ + public layoutId: string; + + /** + * Creates a new PageRef instance using the specified properties. + * @param [properties] Properties to set + * @returns PageRef instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.Document.PageAnchor.IPageRef): google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef; + + /** + * Encodes the specified PageRef message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.verify|verify} messages. + * @param message PageRef message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.Document.PageAnchor.IPageRef, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PageRef message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.verify|verify} messages. + * @param message PageRef message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.Document.PageAnchor.IPageRef, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PageRef message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PageRef + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef; + + /** + * Decodes a PageRef message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PageRef + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef; + + /** + * Verifies a PageRef message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PageRef message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PageRef + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef; + + /** + * Creates a plain object from a PageRef message. Also converts values to other types if specified. + * @param message PageRef + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PageRef to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PageRef { + + /** LayoutType enum. */ + enum LayoutType { + LAYOUT_TYPE_UNSPECIFIED = 0, + BLOCK = 1, + PARAGRAPH = 2, + LINE = 3, + TOKEN = 4, + VISUAL_ELEMENT = 5, + TABLE = 6, + FORM_FIELD = 7 + } + } + } + } + + /** Properties of a Vertex. */ + interface IVertex { + + /** Vertex x */ + x?: (number|null); + + /** Vertex y */ + y?: (number|null); + } + + /** Represents a Vertex. */ + class Vertex implements IVertex { /** - * Creates a new ProcessDocumentRequest instance using the specified properties. + * Constructs a new Vertex. * @param [properties] Properties to set - * @returns ProcessDocumentRequest instance */ - public static create(properties?: google.cloud.documentai.v1beta1.IProcessDocumentRequest): google.cloud.documentai.v1beta1.ProcessDocumentRequest; + constructor(properties?: google.cloud.documentai.v1beta2.IVertex); + + /** Vertex x. */ + public x: number; + + /** Vertex y. */ + public y: number; + + /** + * Creates a new Vertex instance using the specified properties. + * @param [properties] Properties to set + * @returns Vertex instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.IVertex): google.cloud.documentai.v1beta2.Vertex; /** - * Encodes the specified ProcessDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentRequest.verify|verify} messages. - * @param message ProcessDocumentRequest message or plain object to encode + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.documentai.v1beta2.Vertex.verify|verify} messages. + * @param message Vertex message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta1.IProcessDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta2.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProcessDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentRequest.verify|verify} messages. - * @param message ProcessDocumentRequest message or plain object to encode + * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Vertex.verify|verify} messages. + * @param message Vertex message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta1.IProcessDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta2.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProcessDocumentRequest message from the specified reader or buffer. + * Decodes a Vertex message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProcessDocumentRequest + * @returns Vertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.ProcessDocumentRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.Vertex; /** - * Decodes a ProcessDocumentRequest message from the specified reader or buffer, length delimited. + * Decodes a Vertex message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProcessDocumentRequest + * @returns Vertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.ProcessDocumentRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.Vertex; /** - * Verifies a ProcessDocumentRequest message. + * Verifies a Vertex message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProcessDocumentRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Vertex message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProcessDocumentRequest + * @returns Vertex */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.ProcessDocumentRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.Vertex; /** - * Creates a plain object from a ProcessDocumentRequest message. Also converts values to other types if specified. - * @param message ProcessDocumentRequest + * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * @param message Vertex * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta1.ProcessDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta2.Vertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProcessDocumentRequest to JSON. + * Converts this Vertex to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a BatchProcessDocumentsResponse. */ - interface IBatchProcessDocumentsResponse { + /** Properties of a NormalizedVertex. */ + interface INormalizedVertex { - /** BatchProcessDocumentsResponse responses */ - responses?: (google.cloud.documentai.v1beta1.IProcessDocumentResponse[]|null); + /** NormalizedVertex x */ + x?: (number|null); + + /** NormalizedVertex y */ + y?: (number|null); } - /** Represents a BatchProcessDocumentsResponse. */ - class BatchProcessDocumentsResponse implements IBatchProcessDocumentsResponse { + /** Represents a NormalizedVertex. */ + class NormalizedVertex implements INormalizedVertex { /** - * Constructs a new BatchProcessDocumentsResponse. + * Constructs a new NormalizedVertex. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse); + constructor(properties?: google.cloud.documentai.v1beta2.INormalizedVertex); - /** BatchProcessDocumentsResponse responses. */ - public responses: google.cloud.documentai.v1beta1.IProcessDocumentResponse[]; + /** NormalizedVertex x. */ + public x: number; + + /** NormalizedVertex y. */ + public y: number; /** - * Creates a new BatchProcessDocumentsResponse instance using the specified properties. + * Creates a new NormalizedVertex instance using the specified properties. * @param [properties] Properties to set - * @returns BatchProcessDocumentsResponse instance + * @returns NormalizedVertex instance */ - public static create(properties?: google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse): google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse; + public static create(properties?: google.cloud.documentai.v1beta2.INormalizedVertex): google.cloud.documentai.v1beta2.NormalizedVertex; /** - * Encodes the specified BatchProcessDocumentsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.verify|verify} messages. - * @param message BatchProcessDocumentsResponse message or plain object to encode + * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.documentai.v1beta2.NormalizedVertex.verify|verify} messages. + * @param message NormalizedVertex message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta2.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BatchProcessDocumentsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.verify|verify} messages. - * @param message BatchProcessDocumentsResponse message or plain object to encode + * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.NormalizedVertex.verify|verify} messages. + * @param message NormalizedVertex message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta2.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BatchProcessDocumentsResponse message from the specified reader or buffer. + * Decodes a NormalizedVertex message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BatchProcessDocumentsResponse + * @returns NormalizedVertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.NormalizedVertex; /** - * Decodes a BatchProcessDocumentsResponse message from the specified reader or buffer, length delimited. + * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BatchProcessDocumentsResponse + * @returns NormalizedVertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.NormalizedVertex; /** - * Verifies a BatchProcessDocumentsResponse message. + * Verifies a NormalizedVertex message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a BatchProcessDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BatchProcessDocumentsResponse + * @returns NormalizedVertex */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.NormalizedVertex; /** - * Creates a plain object from a BatchProcessDocumentsResponse message. Also converts values to other types if specified. - * @param message BatchProcessDocumentsResponse + * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. + * @param message NormalizedVertex * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta2.NormalizedVertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BatchProcessDocumentsResponse to JSON. + * Converts this NormalizedVertex to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ProcessDocumentResponse. */ - interface IProcessDocumentResponse { + /** Properties of a BoundingPoly. */ + interface IBoundingPoly { - /** ProcessDocumentResponse inputConfig */ - inputConfig?: (google.cloud.documentai.v1beta1.IInputConfig|null); + /** BoundingPoly vertices */ + vertices?: (google.cloud.documentai.v1beta2.IVertex[]|null); - /** ProcessDocumentResponse outputConfig */ - outputConfig?: (google.cloud.documentai.v1beta1.IOutputConfig|null); + /** BoundingPoly normalizedVertices */ + normalizedVertices?: (google.cloud.documentai.v1beta2.INormalizedVertex[]|null); } - /** Represents a ProcessDocumentResponse. */ - class ProcessDocumentResponse implements IProcessDocumentResponse { + /** Represents a BoundingPoly. */ + class BoundingPoly implements IBoundingPoly { /** - * Constructs a new ProcessDocumentResponse. + * Constructs a new BoundingPoly. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta1.IProcessDocumentResponse); + constructor(properties?: google.cloud.documentai.v1beta2.IBoundingPoly); - /** ProcessDocumentResponse inputConfig. */ - public inputConfig?: (google.cloud.documentai.v1beta1.IInputConfig|null); + /** BoundingPoly vertices. */ + public vertices: google.cloud.documentai.v1beta2.IVertex[]; - /** ProcessDocumentResponse outputConfig. */ - public outputConfig?: (google.cloud.documentai.v1beta1.IOutputConfig|null); + /** BoundingPoly normalizedVertices. */ + public normalizedVertices: google.cloud.documentai.v1beta2.INormalizedVertex[]; /** - * Creates a new ProcessDocumentResponse instance using the specified properties. + * Creates a new BoundingPoly instance using the specified properties. * @param [properties] Properties to set - * @returns ProcessDocumentResponse instance + * @returns BoundingPoly instance */ - public static create(properties?: google.cloud.documentai.v1beta1.IProcessDocumentResponse): google.cloud.documentai.v1beta1.ProcessDocumentResponse; + public static create(properties?: google.cloud.documentai.v1beta2.IBoundingPoly): google.cloud.documentai.v1beta2.BoundingPoly; /** - * Encodes the specified ProcessDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentResponse.verify|verify} messages. - * @param message ProcessDocumentResponse message or plain object to encode + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.documentai.v1beta2.BoundingPoly.verify|verify} messages. + * @param message BoundingPoly message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta1.IProcessDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta2.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProcessDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentResponse.verify|verify} messages. - * @param message ProcessDocumentResponse message or plain object to encode + * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.BoundingPoly.verify|verify} messages. + * @param message BoundingPoly message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta1.IProcessDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta2.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProcessDocumentResponse message from the specified reader or buffer. + * Decodes a BoundingPoly message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProcessDocumentResponse + * @returns BoundingPoly * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.ProcessDocumentResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.BoundingPoly; /** - * Decodes a ProcessDocumentResponse message from the specified reader or buffer, length delimited. + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProcessDocumentResponse + * @returns BoundingPoly * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.ProcessDocumentResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.BoundingPoly; /** - * Verifies a ProcessDocumentResponse message. + * Verifies a BoundingPoly message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProcessDocumentResponse message from a plain object. Also converts values to their respective internal types. + * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProcessDocumentResponse + * @returns BoundingPoly */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.ProcessDocumentResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.BoundingPoly; /** - * Creates a plain object from a ProcessDocumentResponse message. Also converts values to other types if specified. - * @param message ProcessDocumentResponse + * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. + * @param message BoundingPoly * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta1.ProcessDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta2.BoundingPoly, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProcessDocumentResponse to JSON. + * Converts this BoundingPoly to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an OcrParams. */ - interface IOcrParams { + /** Represents a DocumentUnderstandingService */ + class DocumentUnderstandingService extends $protobuf.rpc.Service { - /** OcrParams languageHints */ - languageHints?: (string[]|null); + /** + * Constructs a new DocumentUnderstandingService 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 DocumentUnderstandingService 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): DocumentUnderstandingService; + + /** + * Calls BatchProcessDocuments. + * @param request BatchProcessDocumentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchProcessDocuments(request: google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, callback: google.cloud.documentai.v1beta2.DocumentUnderstandingService.BatchProcessDocumentsCallback): void; + + /** + * Calls BatchProcessDocuments. + * @param request BatchProcessDocumentsRequest message or plain object + * @returns Promise + */ + public batchProcessDocuments(request: google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest): Promise; + + /** + * Calls ProcessDocument. + * @param request ProcessDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Document + */ + public processDocument(request: google.cloud.documentai.v1beta2.IProcessDocumentRequest, callback: google.cloud.documentai.v1beta2.DocumentUnderstandingService.ProcessDocumentCallback): void; + + /** + * Calls ProcessDocument. + * @param request ProcessDocumentRequest message or plain object + * @returns Promise + */ + public processDocument(request: google.cloud.documentai.v1beta2.IProcessDocumentRequest): Promise; } - /** Represents an OcrParams. */ - class OcrParams implements IOcrParams { + namespace DocumentUnderstandingService { /** - * Constructs a new OcrParams. + * Callback as used by {@link google.cloud.documentai.v1beta2.DocumentUnderstandingService#batchProcessDocuments}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchProcessDocumentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1beta2.DocumentUnderstandingService#processDocument}. + * @param error Error, if any + * @param [response] Document + */ + type ProcessDocumentCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta2.Document) => void; + } + + /** Properties of a BatchProcessDocumentsRequest. */ + interface IBatchProcessDocumentsRequest { + + /** BatchProcessDocumentsRequest requests */ + requests?: (google.cloud.documentai.v1beta2.IProcessDocumentRequest[]|null); + + /** BatchProcessDocumentsRequest parent */ + parent?: (string|null); + } + + /** Represents a BatchProcessDocumentsRequest. */ + class BatchProcessDocumentsRequest implements IBatchProcessDocumentsRequest { + + /** + * Constructs a new BatchProcessDocumentsRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta1.IOcrParams); + constructor(properties?: google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest); - /** OcrParams languageHints. */ - public languageHints: string[]; + /** BatchProcessDocumentsRequest requests. */ + public requests: google.cloud.documentai.v1beta2.IProcessDocumentRequest[]; + + /** BatchProcessDocumentsRequest parent. */ + public parent: string; /** - * Creates a new OcrParams instance using the specified properties. + * Creates a new BatchProcessDocumentsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns OcrParams instance + * @returns BatchProcessDocumentsRequest instance */ - public static create(properties?: google.cloud.documentai.v1beta1.IOcrParams): google.cloud.documentai.v1beta1.OcrParams; + public static create(properties?: google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest): google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest; /** - * Encodes the specified OcrParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.OcrParams.verify|verify} messages. - * @param message OcrParams message or plain object to encode + * Encodes the specified BatchProcessDocumentsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest.verify|verify} messages. + * @param message BatchProcessDocumentsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta1.IOcrParams, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified OcrParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.OcrParams.verify|verify} messages. - * @param message OcrParams message or plain object to encode + * Encodes the specified BatchProcessDocumentsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest.verify|verify} messages. + * @param message BatchProcessDocumentsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta1.IOcrParams, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an OcrParams message from the specified reader or buffer. + * Decodes a BatchProcessDocumentsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns OcrParams + * @returns BatchProcessDocumentsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.OcrParams; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest; /** - * Decodes an OcrParams message from the specified reader or buffer, length delimited. + * Decodes a BatchProcessDocumentsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns OcrParams + * @returns BatchProcessDocumentsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.OcrParams; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest; /** - * Verifies an OcrParams message. + * Verifies a BatchProcessDocumentsRequest message. * @param message Plain 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 OcrParams message from a plain object. Also converts values to their respective internal types. + * Creates a BatchProcessDocumentsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns OcrParams + * @returns BatchProcessDocumentsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.OcrParams; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest; /** - * Creates a plain object from an OcrParams message. Also converts values to other types if specified. - * @param message OcrParams + * Creates a plain object from a BatchProcessDocumentsRequest message. Also converts values to other types if specified. + * @param message BatchProcessDocumentsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta1.OcrParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this OcrParams to JSON. + * Converts this BatchProcessDocumentsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a TableExtractionParams. */ - interface ITableExtractionParams { + /** Properties of a ProcessDocumentRequest. */ + interface IProcessDocumentRequest { - /** TableExtractionParams enabled */ - enabled?: (boolean|null); + /** ProcessDocumentRequest parent */ + parent?: (string|null); - /** TableExtractionParams tableBoundHints */ - tableBoundHints?: (google.cloud.documentai.v1beta1.ITableBoundHint[]|null); + /** ProcessDocumentRequest inputConfig */ + inputConfig?: (google.cloud.documentai.v1beta2.IInputConfig|null); - /** TableExtractionParams headerHints */ - headerHints?: (string[]|null); + /** ProcessDocumentRequest outputConfig */ + outputConfig?: (google.cloud.documentai.v1beta2.IOutputConfig|null); - /** TableExtractionParams modelVersion */ - modelVersion?: (string|null); + /** ProcessDocumentRequest documentType */ + documentType?: (string|null); + + /** ProcessDocumentRequest tableExtractionParams */ + tableExtractionParams?: (google.cloud.documentai.v1beta2.ITableExtractionParams|null); + + /** ProcessDocumentRequest formExtractionParams */ + formExtractionParams?: (google.cloud.documentai.v1beta2.IFormExtractionParams|null); + + /** ProcessDocumentRequest entityExtractionParams */ + entityExtractionParams?: (google.cloud.documentai.v1beta2.IEntityExtractionParams|null); + + /** ProcessDocumentRequest ocrParams */ + ocrParams?: (google.cloud.documentai.v1beta2.IOcrParams|null); + + /** ProcessDocumentRequest automlParams */ + automlParams?: (google.cloud.documentai.v1beta2.IAutoMlParams|null); } - /** Represents a TableExtractionParams. */ - class TableExtractionParams implements ITableExtractionParams { + /** Represents a ProcessDocumentRequest. */ + class ProcessDocumentRequest implements IProcessDocumentRequest { /** - * Constructs a new TableExtractionParams. + * Constructs a new ProcessDocumentRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta1.ITableExtractionParams); + constructor(properties?: google.cloud.documentai.v1beta2.IProcessDocumentRequest); - /** TableExtractionParams enabled. */ - public enabled: boolean; + /** ProcessDocumentRequest parent. */ + public parent: string; - /** TableExtractionParams tableBoundHints. */ - public tableBoundHints: google.cloud.documentai.v1beta1.ITableBoundHint[]; + /** ProcessDocumentRequest inputConfig. */ + public inputConfig?: (google.cloud.documentai.v1beta2.IInputConfig|null); - /** TableExtractionParams headerHints. */ - public headerHints: string[]; + /** ProcessDocumentRequest outputConfig. */ + public outputConfig?: (google.cloud.documentai.v1beta2.IOutputConfig|null); - /** TableExtractionParams modelVersion. */ - public modelVersion: string; + /** ProcessDocumentRequest documentType. */ + public documentType: string; + + /** ProcessDocumentRequest tableExtractionParams. */ + public tableExtractionParams?: (google.cloud.documentai.v1beta2.ITableExtractionParams|null); + + /** ProcessDocumentRequest formExtractionParams. */ + public formExtractionParams?: (google.cloud.documentai.v1beta2.IFormExtractionParams|null); + + /** ProcessDocumentRequest entityExtractionParams. */ + public entityExtractionParams?: (google.cloud.documentai.v1beta2.IEntityExtractionParams|null); + + /** ProcessDocumentRequest ocrParams. */ + public ocrParams?: (google.cloud.documentai.v1beta2.IOcrParams|null); + + /** ProcessDocumentRequest automlParams. */ + public automlParams?: (google.cloud.documentai.v1beta2.IAutoMlParams|null); /** - * Creates a new TableExtractionParams instance using the specified properties. + * Creates a new ProcessDocumentRequest instance using the specified properties. * @param [properties] Properties to set - * @returns TableExtractionParams instance + * @returns ProcessDocumentRequest instance */ - public static create(properties?: google.cloud.documentai.v1beta1.ITableExtractionParams): google.cloud.documentai.v1beta1.TableExtractionParams; + public static create(properties?: google.cloud.documentai.v1beta2.IProcessDocumentRequest): google.cloud.documentai.v1beta2.ProcessDocumentRequest; /** - * Encodes the specified TableExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.TableExtractionParams.verify|verify} messages. - * @param message TableExtractionParams message or plain object to encode + * Encodes the specified ProcessDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta2.ProcessDocumentRequest.verify|verify} messages. + * @param message ProcessDocumentRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta1.ITableExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta2.IProcessDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified TableExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.TableExtractionParams.verify|verify} messages. - * @param message TableExtractionParams message or plain object to encode + * Encodes the specified ProcessDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.ProcessDocumentRequest.verify|verify} messages. + * @param message ProcessDocumentRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta1.ITableExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta2.IProcessDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a TableExtractionParams message from the specified reader or buffer. + * Decodes a ProcessDocumentRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns TableExtractionParams + * @returns ProcessDocumentRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.TableExtractionParams; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.ProcessDocumentRequest; /** - * Decodes a TableExtractionParams message from the specified reader or buffer, length delimited. + * Decodes a ProcessDocumentRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns TableExtractionParams + * @returns ProcessDocumentRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.TableExtractionParams; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.ProcessDocumentRequest; /** - * Verifies a TableExtractionParams message. + * Verifies a ProcessDocumentRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a TableExtractionParams message from a plain object. Also converts values to their respective internal types. + * Creates a ProcessDocumentRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns TableExtractionParams + * @returns ProcessDocumentRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.TableExtractionParams; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.ProcessDocumentRequest; /** - * Creates a plain object from a TableExtractionParams message. Also converts values to other types if specified. - * @param message TableExtractionParams + * Creates a plain object from a ProcessDocumentRequest message. Also converts values to other types if specified. + * @param message ProcessDocumentRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta1.TableExtractionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta2.ProcessDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this TableExtractionParams to JSON. + * Converts this ProcessDocumentRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a TableBoundHint. */ - interface ITableBoundHint { - - /** TableBoundHint pageNumber */ - pageNumber?: (number|null); + /** Properties of a BatchProcessDocumentsResponse. */ + interface IBatchProcessDocumentsResponse { - /** TableBoundHint boundingBox */ - boundingBox?: (google.cloud.documentai.v1beta1.IBoundingPoly|null); + /** BatchProcessDocumentsResponse responses */ + responses?: (google.cloud.documentai.v1beta2.IProcessDocumentResponse[]|null); } - /** Represents a TableBoundHint. */ - class TableBoundHint implements ITableBoundHint { + /** Represents a BatchProcessDocumentsResponse. */ + class BatchProcessDocumentsResponse implements IBatchProcessDocumentsResponse { /** - * Constructs a new TableBoundHint. + * Constructs a new BatchProcessDocumentsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta1.ITableBoundHint); + constructor(properties?: google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse); - /** TableBoundHint pageNumber. */ - public pageNumber: number; - - /** TableBoundHint boundingBox. */ - public boundingBox?: (google.cloud.documentai.v1beta1.IBoundingPoly|null); + /** BatchProcessDocumentsResponse responses. */ + public responses: google.cloud.documentai.v1beta2.IProcessDocumentResponse[]; /** - * Creates a new TableBoundHint instance using the specified properties. + * Creates a new BatchProcessDocumentsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns TableBoundHint instance + * @returns BatchProcessDocumentsResponse instance */ - public static create(properties?: google.cloud.documentai.v1beta1.ITableBoundHint): google.cloud.documentai.v1beta1.TableBoundHint; + public static create(properties?: google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse): google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse; /** - * Encodes the specified TableBoundHint message. Does not implicitly {@link google.cloud.documentai.v1beta1.TableBoundHint.verify|verify} messages. - * @param message TableBoundHint message or plain object to encode + * Encodes the specified BatchProcessDocumentsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse.verify|verify} messages. + * @param message BatchProcessDocumentsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta1.ITableBoundHint, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified TableBoundHint message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.TableBoundHint.verify|verify} messages. - * @param message TableBoundHint message or plain object to encode + * Encodes the specified BatchProcessDocumentsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse.verify|verify} messages. + * @param message BatchProcessDocumentsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta1.ITableBoundHint, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a TableBoundHint message from the specified reader or buffer. + * Decodes a BatchProcessDocumentsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns TableBoundHint + * @returns BatchProcessDocumentsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.TableBoundHint; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse; /** - * Decodes a TableBoundHint message from the specified reader or buffer, length delimited. + * Decodes a BatchProcessDocumentsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns TableBoundHint + * @returns BatchProcessDocumentsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.TableBoundHint; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse; /** - * Verifies a TableBoundHint message. + * Verifies a BatchProcessDocumentsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a TableBoundHint message from a plain object. Also converts values to their respective internal types. + * Creates a BatchProcessDocumentsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns TableBoundHint + * @returns BatchProcessDocumentsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.TableBoundHint; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse; /** - * Creates a plain object from a TableBoundHint message. Also converts values to other types if specified. - * @param message TableBoundHint + * Creates a plain object from a BatchProcessDocumentsResponse message. Also converts values to other types if specified. + * @param message BatchProcessDocumentsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta1.TableBoundHint, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this TableBoundHint to JSON. + * Converts this BatchProcessDocumentsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a FormExtractionParams. */ - interface IFormExtractionParams { - - /** FormExtractionParams enabled */ - enabled?: (boolean|null); + /** Properties of a ProcessDocumentResponse. */ + interface IProcessDocumentResponse { - /** FormExtractionParams keyValuePairHints */ - keyValuePairHints?: (google.cloud.documentai.v1beta1.IKeyValuePairHint[]|null); + /** ProcessDocumentResponse inputConfig */ + inputConfig?: (google.cloud.documentai.v1beta2.IInputConfig|null); - /** FormExtractionParams modelVersion */ - modelVersion?: (string|null); + /** ProcessDocumentResponse outputConfig */ + outputConfig?: (google.cloud.documentai.v1beta2.IOutputConfig|null); } - /** Represents a FormExtractionParams. */ - class FormExtractionParams implements IFormExtractionParams { + /** Represents a ProcessDocumentResponse. */ + class ProcessDocumentResponse implements IProcessDocumentResponse { /** - * Constructs a new FormExtractionParams. + * Constructs a new ProcessDocumentResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta1.IFormExtractionParams); + constructor(properties?: google.cloud.documentai.v1beta2.IProcessDocumentResponse); - /** FormExtractionParams enabled. */ - public enabled: boolean; - - /** FormExtractionParams keyValuePairHints. */ - public keyValuePairHints: google.cloud.documentai.v1beta1.IKeyValuePairHint[]; + /** ProcessDocumentResponse inputConfig. */ + public inputConfig?: (google.cloud.documentai.v1beta2.IInputConfig|null); - /** FormExtractionParams modelVersion. */ - public modelVersion: string; + /** ProcessDocumentResponse outputConfig. */ + public outputConfig?: (google.cloud.documentai.v1beta2.IOutputConfig|null); /** - * Creates a new FormExtractionParams instance using the specified properties. + * Creates a new ProcessDocumentResponse instance using the specified properties. * @param [properties] Properties to set - * @returns FormExtractionParams instance + * @returns ProcessDocumentResponse instance */ - public static create(properties?: google.cloud.documentai.v1beta1.IFormExtractionParams): google.cloud.documentai.v1beta1.FormExtractionParams; + public static create(properties?: google.cloud.documentai.v1beta2.IProcessDocumentResponse): google.cloud.documentai.v1beta2.ProcessDocumentResponse; /** - * Encodes the specified FormExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.FormExtractionParams.verify|verify} messages. - * @param message FormExtractionParams message or plain object to encode + * Encodes the specified ProcessDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta2.ProcessDocumentResponse.verify|verify} messages. + * @param message ProcessDocumentResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta1.IFormExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta2.IProcessDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified FormExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.FormExtractionParams.verify|verify} messages. - * @param message FormExtractionParams message or plain object to encode + * Encodes the specified ProcessDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.ProcessDocumentResponse.verify|verify} messages. + * @param message ProcessDocumentResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta1.IFormExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta2.IProcessDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a FormExtractionParams message from the specified reader or buffer. + * Decodes a ProcessDocumentResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns FormExtractionParams + * @returns ProcessDocumentResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.FormExtractionParams; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.ProcessDocumentResponse; /** - * Decodes a FormExtractionParams message from the specified reader or buffer, length delimited. + * Decodes a ProcessDocumentResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns FormExtractionParams + * @returns ProcessDocumentResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.FormExtractionParams; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.ProcessDocumentResponse; /** - * Verifies a FormExtractionParams message. + * Verifies a ProcessDocumentResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a FormExtractionParams message from a plain object. Also converts values to their respective internal types. + * Creates a ProcessDocumentResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns FormExtractionParams + * @returns ProcessDocumentResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.FormExtractionParams; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.ProcessDocumentResponse; /** - * Creates a plain object from a FormExtractionParams message. Also converts values to other types if specified. - * @param message FormExtractionParams + * Creates a plain object from a ProcessDocumentResponse message. Also converts values to other types if specified. + * @param message ProcessDocumentResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta1.FormExtractionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta2.ProcessDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this FormExtractionParams to JSON. + * Converts this ProcessDocumentResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a KeyValuePairHint. */ - interface IKeyValuePairHint { - - /** KeyValuePairHint key */ - key?: (string|null); + /** Properties of an OcrParams. */ + interface IOcrParams { - /** KeyValuePairHint valueTypes */ - valueTypes?: (string[]|null); + /** OcrParams languageHints */ + languageHints?: (string[]|null); } - /** Represents a KeyValuePairHint. */ - class KeyValuePairHint implements IKeyValuePairHint { + /** Represents an OcrParams. */ + class OcrParams implements IOcrParams { /** - * Constructs a new KeyValuePairHint. + * Constructs a new OcrParams. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta1.IKeyValuePairHint); - - /** KeyValuePairHint key. */ - public key: string; + constructor(properties?: google.cloud.documentai.v1beta2.IOcrParams); - /** KeyValuePairHint valueTypes. */ - public valueTypes: string[]; + /** OcrParams languageHints. */ + public languageHints: string[]; /** - * Creates a new KeyValuePairHint instance using the specified properties. + * Creates a new OcrParams instance using the specified properties. * @param [properties] Properties to set - * @returns KeyValuePairHint instance + * @returns OcrParams instance */ - public static create(properties?: google.cloud.documentai.v1beta1.IKeyValuePairHint): google.cloud.documentai.v1beta1.KeyValuePairHint; + public static create(properties?: google.cloud.documentai.v1beta2.IOcrParams): google.cloud.documentai.v1beta2.OcrParams; /** - * Encodes the specified KeyValuePairHint message. Does not implicitly {@link google.cloud.documentai.v1beta1.KeyValuePairHint.verify|verify} messages. - * @param message KeyValuePairHint message or plain object to encode + * Encodes the specified OcrParams message. Does not implicitly {@link google.cloud.documentai.v1beta2.OcrParams.verify|verify} messages. + * @param message OcrParams message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta1.IKeyValuePairHint, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta2.IOcrParams, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified KeyValuePairHint message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.KeyValuePairHint.verify|verify} messages. - * @param message KeyValuePairHint message or plain object to encode + * Encodes the specified OcrParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.OcrParams.verify|verify} messages. + * @param message OcrParams message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta1.IKeyValuePairHint, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta2.IOcrParams, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a KeyValuePairHint message from the specified reader or buffer. + * Decodes an OcrParams message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns KeyValuePairHint + * @returns OcrParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.KeyValuePairHint; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.OcrParams; /** - * Decodes a KeyValuePairHint message from the specified reader or buffer, length delimited. + * Decodes an OcrParams message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns KeyValuePairHint + * @returns OcrParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.KeyValuePairHint; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.OcrParams; /** - * Verifies a KeyValuePairHint message. + * Verifies an OcrParams message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a KeyValuePairHint message from a plain object. Also converts values to their respective internal types. + * Creates an OcrParams message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns KeyValuePairHint + * @returns OcrParams */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.KeyValuePairHint; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.OcrParams; /** - * Creates a plain object from a KeyValuePairHint message. Also converts values to other types if specified. - * @param message KeyValuePairHint + * Creates a plain object from an OcrParams message. Also converts values to other types if specified. + * @param message OcrParams * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta1.KeyValuePairHint, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta2.OcrParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this KeyValuePairHint to JSON. + * Converts this OcrParams to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an EntityExtractionParams. */ - interface IEntityExtractionParams { + /** Properties of a TableExtractionParams. */ + interface ITableExtractionParams { - /** EntityExtractionParams enabled */ + /** TableExtractionParams enabled */ enabled?: (boolean|null); - /** EntityExtractionParams modelVersion */ + /** TableExtractionParams tableBoundHints */ + tableBoundHints?: (google.cloud.documentai.v1beta2.ITableBoundHint[]|null); + + /** TableExtractionParams headerHints */ + headerHints?: (string[]|null); + + /** TableExtractionParams modelVersion */ modelVersion?: (string|null); } - /** Represents an EntityExtractionParams. */ - class EntityExtractionParams implements IEntityExtractionParams { + /** Represents a TableExtractionParams. */ + class TableExtractionParams implements ITableExtractionParams { /** - * Constructs a new EntityExtractionParams. + * Constructs a new TableExtractionParams. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta1.IEntityExtractionParams); + constructor(properties?: google.cloud.documentai.v1beta2.ITableExtractionParams); - /** EntityExtractionParams enabled. */ + /** TableExtractionParams enabled. */ public enabled: boolean; - /** EntityExtractionParams modelVersion. */ + /** TableExtractionParams tableBoundHints. */ + public tableBoundHints: google.cloud.documentai.v1beta2.ITableBoundHint[]; + + /** TableExtractionParams headerHints. */ + public headerHints: string[]; + + /** TableExtractionParams modelVersion. */ public modelVersion: string; /** - * Creates a new EntityExtractionParams instance using the specified properties. + * Creates a new TableExtractionParams instance using the specified properties. * @param [properties] Properties to set - * @returns EntityExtractionParams instance + * @returns TableExtractionParams instance */ - public static create(properties?: google.cloud.documentai.v1beta1.IEntityExtractionParams): google.cloud.documentai.v1beta1.EntityExtractionParams; + public static create(properties?: google.cloud.documentai.v1beta2.ITableExtractionParams): google.cloud.documentai.v1beta2.TableExtractionParams; /** - * Encodes the specified EntityExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.EntityExtractionParams.verify|verify} messages. - * @param message EntityExtractionParams message or plain object to encode + * Encodes the specified TableExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta2.TableExtractionParams.verify|verify} messages. + * @param message TableExtractionParams message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta1.IEntityExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta2.ITableExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified EntityExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.EntityExtractionParams.verify|verify} messages. - * @param message EntityExtractionParams message or plain object to encode + * Encodes the specified TableExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.TableExtractionParams.verify|verify} messages. + * @param message TableExtractionParams message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta1.IEntityExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta2.ITableExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an EntityExtractionParams message from the specified reader or buffer. + * Decodes a TableExtractionParams message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns EntityExtractionParams + * @returns TableExtractionParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.EntityExtractionParams; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.TableExtractionParams; /** - * Decodes an EntityExtractionParams message from the specified reader or buffer, length delimited. + * Decodes a TableExtractionParams message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns EntityExtractionParams + * @returns TableExtractionParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.EntityExtractionParams; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.TableExtractionParams; /** - * Verifies an EntityExtractionParams message. + * Verifies a TableExtractionParams message. * @param message Plain 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 EntityExtractionParams message from a plain object. Also converts values to their respective internal types. + * Creates a TableExtractionParams message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns EntityExtractionParams + * @returns TableExtractionParams */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.EntityExtractionParams; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.TableExtractionParams; /** - * Creates a plain object from an EntityExtractionParams message. Also converts values to other types if specified. - * @param message EntityExtractionParams + * Creates a plain object from a TableExtractionParams message. Also converts values to other types if specified. + * @param message TableExtractionParams * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta1.EntityExtractionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta2.TableExtractionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this EntityExtractionParams to JSON. + * Converts this TableExtractionParams to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an InputConfig. */ - interface IInputConfig { + /** Properties of a TableBoundHint. */ + interface ITableBoundHint { - /** InputConfig gcsSource */ - gcsSource?: (google.cloud.documentai.v1beta1.IGcsSource|null); + /** TableBoundHint pageNumber */ + pageNumber?: (number|null); - /** InputConfig mimeType */ - mimeType?: (string|null); + /** TableBoundHint boundingBox */ + boundingBox?: (google.cloud.documentai.v1beta2.IBoundingPoly|null); } - /** Represents an InputConfig. */ - class InputConfig implements IInputConfig { + /** Represents a TableBoundHint. */ + class TableBoundHint implements ITableBoundHint { /** - * Constructs a new InputConfig. + * Constructs a new TableBoundHint. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta1.IInputConfig); + constructor(properties?: google.cloud.documentai.v1beta2.ITableBoundHint); - /** InputConfig gcsSource. */ - public gcsSource?: (google.cloud.documentai.v1beta1.IGcsSource|null); - - /** InputConfig mimeType. */ - public mimeType: string; + /** TableBoundHint pageNumber. */ + public pageNumber: number; - /** InputConfig source. */ - public source?: "gcsSource"; + /** TableBoundHint boundingBox. */ + public boundingBox?: (google.cloud.documentai.v1beta2.IBoundingPoly|null); /** - * Creates a new InputConfig instance using the specified properties. + * Creates a new TableBoundHint instance using the specified properties. * @param [properties] Properties to set - * @returns InputConfig instance + * @returns TableBoundHint instance */ - public static create(properties?: google.cloud.documentai.v1beta1.IInputConfig): google.cloud.documentai.v1beta1.InputConfig; + public static create(properties?: google.cloud.documentai.v1beta2.ITableBoundHint): google.cloud.documentai.v1beta2.TableBoundHint; /** - * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta1.InputConfig.verify|verify} messages. - * @param message InputConfig message or plain object to encode + * Encodes the specified TableBoundHint message. Does not implicitly {@link google.cloud.documentai.v1beta2.TableBoundHint.verify|verify} messages. + * @param message TableBoundHint message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta1.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta2.ITableBoundHint, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.InputConfig.verify|verify} messages. - * @param message InputConfig message or plain object to encode + * Encodes the specified TableBoundHint message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.TableBoundHint.verify|verify} messages. + * @param message TableBoundHint message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta1.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta2.ITableBoundHint, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an InputConfig message from the specified reader or buffer. + * Decodes a TableBoundHint message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns InputConfig + * @returns TableBoundHint * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.InputConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.TableBoundHint; /** - * Decodes an InputConfig message from the specified reader or buffer, length delimited. + * Decodes a TableBoundHint message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns InputConfig + * @returns TableBoundHint * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.InputConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.TableBoundHint; /** - * Verifies an InputConfig message. + * Verifies a TableBoundHint message. * @param message Plain 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 InputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a TableBoundHint message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns InputConfig + * @returns TableBoundHint */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.InputConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.TableBoundHint; /** - * Creates a plain object from an InputConfig message. Also converts values to other types if specified. - * @param message InputConfig + * Creates a plain object from a TableBoundHint message. Also converts values to other types if specified. + * @param message TableBoundHint * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta1.InputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta2.TableBoundHint, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this InputConfig to JSON. + * Converts this TableBoundHint to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an OutputConfig. */ - interface IOutputConfig { + /** Properties of a FormExtractionParams. */ + interface IFormExtractionParams { - /** OutputConfig gcsDestination */ - gcsDestination?: (google.cloud.documentai.v1beta1.IGcsDestination|null); + /** FormExtractionParams enabled */ + enabled?: (boolean|null); - /** OutputConfig pagesPerShard */ - pagesPerShard?: (number|null); - } + /** FormExtractionParams keyValuePairHints */ + keyValuePairHints?: (google.cloud.documentai.v1beta2.IKeyValuePairHint[]|null); - /** Represents an OutputConfig. */ - class OutputConfig implements IOutputConfig { + /** FormExtractionParams modelVersion */ + modelVersion?: (string|null); + } + + /** Represents a FormExtractionParams. */ + class FormExtractionParams implements IFormExtractionParams { /** - * Constructs a new OutputConfig. + * Constructs a new FormExtractionParams. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta1.IOutputConfig); + constructor(properties?: google.cloud.documentai.v1beta2.IFormExtractionParams); - /** OutputConfig gcsDestination. */ - public gcsDestination?: (google.cloud.documentai.v1beta1.IGcsDestination|null); + /** FormExtractionParams enabled. */ + public enabled: boolean; - /** OutputConfig pagesPerShard. */ - public pagesPerShard: number; + /** FormExtractionParams keyValuePairHints. */ + public keyValuePairHints: google.cloud.documentai.v1beta2.IKeyValuePairHint[]; - /** OutputConfig destination. */ - public destination?: "gcsDestination"; + /** FormExtractionParams modelVersion. */ + public modelVersion: string; /** - * Creates a new OutputConfig instance using the specified properties. + * Creates a new FormExtractionParams instance using the specified properties. * @param [properties] Properties to set - * @returns OutputConfig instance + * @returns FormExtractionParams instance */ - public static create(properties?: google.cloud.documentai.v1beta1.IOutputConfig): google.cloud.documentai.v1beta1.OutputConfig; + public static create(properties?: google.cloud.documentai.v1beta2.IFormExtractionParams): google.cloud.documentai.v1beta2.FormExtractionParams; /** - * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta1.OutputConfig.verify|verify} messages. - * @param message OutputConfig message or plain object to encode + * Encodes the specified FormExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta2.FormExtractionParams.verify|verify} messages. + * @param message FormExtractionParams message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta1.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta2.IFormExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.OutputConfig.verify|verify} messages. - * @param message OutputConfig message or plain object to encode + * Encodes the specified FormExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.FormExtractionParams.verify|verify} messages. + * @param message FormExtractionParams message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta1.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta2.IFormExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an OutputConfig message from the specified reader or buffer. + * Decodes a FormExtractionParams message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns OutputConfig + * @returns FormExtractionParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.OutputConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.FormExtractionParams; /** - * Decodes an OutputConfig message from the specified reader or buffer, length delimited. + * Decodes a FormExtractionParams message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns OutputConfig + * @returns FormExtractionParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.OutputConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.FormExtractionParams; /** - * Verifies an OutputConfig message. + * Verifies a FormExtractionParams message. * @param message Plain 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 OutputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a FormExtractionParams message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns OutputConfig + * @returns FormExtractionParams */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.OutputConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.FormExtractionParams; /** - * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. - * @param message OutputConfig + * Creates a plain object from a FormExtractionParams message. Also converts values to other types if specified. + * @param message FormExtractionParams * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta1.OutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta2.FormExtractionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this OutputConfig to JSON. + * Converts this FormExtractionParams to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a GcsSource. */ - interface IGcsSource { + /** Properties of a KeyValuePairHint. */ + interface IKeyValuePairHint { - /** GcsSource uri */ - uri?: (string|null); + /** KeyValuePairHint key */ + key?: (string|null); + + /** KeyValuePairHint valueTypes */ + valueTypes?: (string[]|null); } - /** Represents a GcsSource. */ - class GcsSource implements IGcsSource { + /** Represents a KeyValuePairHint. */ + class KeyValuePairHint implements IKeyValuePairHint { /** - * Constructs a new GcsSource. + * Constructs a new KeyValuePairHint. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta1.IGcsSource); + constructor(properties?: google.cloud.documentai.v1beta2.IKeyValuePairHint); - /** GcsSource uri. */ - public uri: string; + /** KeyValuePairHint key. */ + public key: string; + + /** KeyValuePairHint valueTypes. */ + public valueTypes: string[]; /** - * Creates a new GcsSource instance using the specified properties. + * Creates a new KeyValuePairHint instance using the specified properties. * @param [properties] Properties to set - * @returns GcsSource instance + * @returns KeyValuePairHint instance */ - public static create(properties?: google.cloud.documentai.v1beta1.IGcsSource): google.cloud.documentai.v1beta1.GcsSource; + public static create(properties?: google.cloud.documentai.v1beta2.IKeyValuePairHint): google.cloud.documentai.v1beta2.KeyValuePairHint; /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.documentai.v1beta1.GcsSource.verify|verify} messages. - * @param message GcsSource message or plain object to encode + * Encodes the specified KeyValuePairHint message. Does not implicitly {@link google.cloud.documentai.v1beta2.KeyValuePairHint.verify|verify} messages. + * @param message KeyValuePairHint message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta1.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta2.IKeyValuePairHint, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.GcsSource.verify|verify} messages. - * @param message GcsSource message or plain object to encode + * Encodes the specified KeyValuePairHint message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.KeyValuePairHint.verify|verify} messages. + * @param message KeyValuePairHint message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta1.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta2.IKeyValuePairHint, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes a KeyValuePairHint 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 KeyValuePairHint * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.GcsSource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.KeyValuePairHint; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes a KeyValuePairHint message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GcsSource + * @returns KeyValuePairHint * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.GcsSource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.KeyValuePairHint; /** - * Verifies a GcsSource message. + * Verifies a KeyValuePairHint message. * @param message Plain object 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 KeyValuePairHint message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GcsSource + * @returns KeyValuePairHint */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.GcsSource; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.KeyValuePairHint; /** - * 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 KeyValuePairHint message. Also converts values to other types if specified. + * @param message KeyValuePairHint * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta1.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta2.KeyValuePairHint, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GcsSource to JSON. + * Converts this KeyValuePairHint to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a GcsDestination. */ - interface IGcsDestination { + /** Properties of an EntityExtractionParams. */ + interface IEntityExtractionParams { - /** GcsDestination uri */ - uri?: (string|null); + /** EntityExtractionParams enabled */ + enabled?: (boolean|null); + + /** EntityExtractionParams modelVersion */ + modelVersion?: (string|null); } - /** Represents a GcsDestination. */ - class GcsDestination implements IGcsDestination { + /** Represents an EntityExtractionParams. */ + class EntityExtractionParams implements IEntityExtractionParams { /** - * Constructs a new GcsDestination. + * Constructs a new EntityExtractionParams. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta1.IGcsDestination); + constructor(properties?: google.cloud.documentai.v1beta2.IEntityExtractionParams); - /** GcsDestination uri. */ - public uri: string; + /** EntityExtractionParams enabled. */ + public enabled: boolean; + + /** EntityExtractionParams modelVersion. */ + public modelVersion: string; /** - * Creates a new GcsDestination instance using the specified properties. + * Creates a new EntityExtractionParams instance using the specified properties. * @param [properties] Properties to set - * @returns GcsDestination instance + * @returns EntityExtractionParams instance */ - public static create(properties?: google.cloud.documentai.v1beta1.IGcsDestination): google.cloud.documentai.v1beta1.GcsDestination; + public static create(properties?: google.cloud.documentai.v1beta2.IEntityExtractionParams): google.cloud.documentai.v1beta2.EntityExtractionParams; /** - * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.documentai.v1beta1.GcsDestination.verify|verify} messages. - * @param message GcsDestination message or plain object to encode + * Encodes the specified EntityExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta2.EntityExtractionParams.verify|verify} messages. + * @param message EntityExtractionParams message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta1.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta2.IEntityExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.GcsDestination.verify|verify} messages. - * @param message GcsDestination message or plain object to encode + * Encodes the specified EntityExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.EntityExtractionParams.verify|verify} messages. + * @param message EntityExtractionParams message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta1.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta2.IEntityExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GcsDestination message from the specified reader or buffer. + * Decodes an EntityExtractionParams message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GcsDestination + * @returns EntityExtractionParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.GcsDestination; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.EntityExtractionParams; /** - * Decodes a GcsDestination message from the specified reader or buffer, length delimited. + * Decodes an EntityExtractionParams message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GcsDestination + * @returns EntityExtractionParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.GcsDestination; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.EntityExtractionParams; /** - * Verifies a GcsDestination message. + * Verifies an EntityExtractionParams message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GcsDestination message from a plain object. Also converts values to their respective internal types. + * Creates an EntityExtractionParams message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GcsDestination + * @returns EntityExtractionParams */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.GcsDestination; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.EntityExtractionParams; /** - * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. - * @param message GcsDestination + * Creates a plain object from an EntityExtractionParams message. Also converts values to other types if specified. + * @param message EntityExtractionParams * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta1.GcsDestination, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta2.EntityExtractionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GcsDestination to JSON. + * Converts this EntityExtractionParams to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an OperationMetadata. */ - interface IOperationMetadata { - - /** OperationMetadata state */ - state?: (google.cloud.documentai.v1beta1.OperationMetadata.State|null); - - /** OperationMetadata stateMessage */ - stateMessage?: (string|null); - - /** OperationMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); + /** Properties of an AutoMlParams. */ + interface IAutoMlParams { - /** OperationMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); + /** AutoMlParams model */ + model?: (string|null); } - /** Represents an OperationMetadata. */ - class OperationMetadata implements IOperationMetadata { + /** Represents an AutoMlParams. */ + class AutoMlParams implements IAutoMlParams { /** - * Constructs a new OperationMetadata. + * Constructs a new AutoMlParams. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta1.IOperationMetadata); - - /** OperationMetadata state. */ - public state: google.cloud.documentai.v1beta1.OperationMetadata.State; + constructor(properties?: google.cloud.documentai.v1beta2.IAutoMlParams); - /** OperationMetadata stateMessage. */ - public stateMessage: string; - - /** OperationMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); - - /** OperationMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); + /** AutoMlParams model. */ + public model: string; /** - * Creates a new OperationMetadata instance using the specified properties. + * Creates a new AutoMlParams instance using the specified properties. * @param [properties] Properties to set - * @returns OperationMetadata instance + * @returns AutoMlParams instance */ - public static create(properties?: google.cloud.documentai.v1beta1.IOperationMetadata): google.cloud.documentai.v1beta1.OperationMetadata; + public static create(properties?: google.cloud.documentai.v1beta2.IAutoMlParams): google.cloud.documentai.v1beta2.AutoMlParams; /** - * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta1.OperationMetadata.verify|verify} messages. - * @param message OperationMetadata message or plain object to encode + * Encodes the specified AutoMlParams message. Does not implicitly {@link google.cloud.documentai.v1beta2.AutoMlParams.verify|verify} messages. + * @param message AutoMlParams message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta2.IAutoMlParams, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.OperationMetadata.verify|verify} messages. - * @param message OperationMetadata message or plain object to encode + * Encodes the specified AutoMlParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.AutoMlParams.verify|verify} messages. + * @param message AutoMlParams message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta2.IAutoMlParams, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an OperationMetadata message from the specified reader or buffer. + * Decodes an AutoMlParams message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns OperationMetadata + * @returns AutoMlParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.OperationMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.AutoMlParams; /** - * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * Decodes an AutoMlParams message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns OperationMetadata + * @returns AutoMlParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.OperationMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.AutoMlParams; /** - * Verifies an OperationMetadata message. + * Verifies an AutoMlParams message. * @param message Plain 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 OperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an AutoMlParams message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns OperationMetadata + * @returns AutoMlParams */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.OperationMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.AutoMlParams; /** - * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. - * @param message OperationMetadata + * Creates a plain object from an AutoMlParams message. Also converts values to other types if specified. + * @param message AutoMlParams * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta1.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta2.AutoMlParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this OperationMetadata to JSON. + * Converts this AutoMlParams to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace OperationMetadata { - - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - ACCEPTED = 1, - WAITING = 2, - RUNNING = 3, - SUCCEEDED = 4, - CANCELLED = 5, - FAILED = 6 - } - } + /** Properties of an InputConfig. */ + interface IInputConfig { - /** Properties of a Vertex. */ - interface IVertex { + /** InputConfig gcsSource */ + gcsSource?: (google.cloud.documentai.v1beta2.IGcsSource|null); - /** Vertex x */ - x?: (number|null); + /** InputConfig contents */ + contents?: (Uint8Array|string|null); - /** Vertex y */ - y?: (number|null); + /** InputConfig mimeType */ + mimeType?: (string|null); } - /** Represents a Vertex. */ - class Vertex implements IVertex { + /** Represents an InputConfig. */ + class InputConfig implements IInputConfig { /** - * Constructs a new Vertex. + * Constructs a new InputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta1.IVertex); + constructor(properties?: google.cloud.documentai.v1beta2.IInputConfig); - /** Vertex x. */ - public x: number; + /** InputConfig gcsSource. */ + public gcsSource?: (google.cloud.documentai.v1beta2.IGcsSource|null); - /** Vertex y. */ - public y: number; + /** InputConfig contents. */ + public contents: (Uint8Array|string); + + /** InputConfig mimeType. */ + public mimeType: string; + + /** InputConfig source. */ + public source?: ("gcsSource"|"contents"); /** - * Creates a new Vertex instance using the specified properties. + * Creates a new InputConfig instance using the specified properties. * @param [properties] Properties to set - * @returns Vertex instance + * @returns InputConfig instance */ - public static create(properties?: google.cloud.documentai.v1beta1.IVertex): google.cloud.documentai.v1beta1.Vertex; + public static create(properties?: google.cloud.documentai.v1beta2.IInputConfig): google.cloud.documentai.v1beta2.InputConfig; /** - * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.documentai.v1beta1.Vertex.verify|verify} messages. - * @param message Vertex message or plain object to encode + * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta2.InputConfig.verify|verify} messages. + * @param message InputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta2.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Vertex.verify|verify} messages. - * @param message Vertex message or plain object to encode + * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.InputConfig.verify|verify} messages. + * @param message InputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta2.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Vertex message from the specified reader or buffer. + * Decodes an InputConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Vertex + * @returns InputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Vertex; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.InputConfig; /** - * Decodes a Vertex message from the specified reader or buffer, length delimited. + * Decodes an InputConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Vertex + * @returns InputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Vertex; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.InputConfig; /** - * Verifies a Vertex message. + * Verifies an InputConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Vertex message from a plain object. Also converts values to their respective internal types. + * Creates an InputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Vertex + * @returns InputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Vertex; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.InputConfig; /** - * Creates a plain object from a Vertex message. Also converts values to other types if specified. - * @param message Vertex + * Creates a plain object from an InputConfig message. Also converts values to other types if specified. + * @param message InputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta1.Vertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta2.InputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Vertex to JSON. + * Converts this InputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a NormalizedVertex. */ - interface INormalizedVertex { + /** Properties of an OutputConfig. */ + interface IOutputConfig { - /** NormalizedVertex x */ - x?: (number|null); + /** OutputConfig gcsDestination */ + gcsDestination?: (google.cloud.documentai.v1beta2.IGcsDestination|null); - /** NormalizedVertex y */ - y?: (number|null); + /** OutputConfig pagesPerShard */ + pagesPerShard?: (number|null); } - /** Represents a NormalizedVertex. */ - class NormalizedVertex implements INormalizedVertex { + /** Represents an OutputConfig. */ + class OutputConfig implements IOutputConfig { /** - * Constructs a new NormalizedVertex. + * Constructs a new OutputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta1.INormalizedVertex); + constructor(properties?: google.cloud.documentai.v1beta2.IOutputConfig); - /** NormalizedVertex x. */ - public x: number; + /** OutputConfig gcsDestination. */ + public gcsDestination?: (google.cloud.documentai.v1beta2.IGcsDestination|null); - /** NormalizedVertex y. */ - public y: number; + /** OutputConfig pagesPerShard. */ + public pagesPerShard: number; + + /** OutputConfig destination. */ + public destination?: "gcsDestination"; /** - * Creates a new NormalizedVertex instance using the specified properties. + * Creates a new OutputConfig instance using the specified properties. * @param [properties] Properties to set - * @returns NormalizedVertex instance + * @returns OutputConfig instance */ - public static create(properties?: google.cloud.documentai.v1beta1.INormalizedVertex): google.cloud.documentai.v1beta1.NormalizedVertex; + public static create(properties?: google.cloud.documentai.v1beta2.IOutputConfig): google.cloud.documentai.v1beta2.OutputConfig; /** - * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.documentai.v1beta1.NormalizedVertex.verify|verify} messages. - * @param message NormalizedVertex message or plain object to encode + * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta2.OutputConfig.verify|verify} messages. + * @param message OutputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta2.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.NormalizedVertex.verify|verify} messages. - * @param message NormalizedVertex message or plain object to encode + * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.OutputConfig.verify|verify} messages. + * @param message OutputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta2.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a NormalizedVertex message from the specified reader or buffer. + * Decodes an OutputConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns NormalizedVertex + * @returns OutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.NormalizedVertex; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.OutputConfig; /** - * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. + * Decodes an OutputConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns NormalizedVertex + * @returns OutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.NormalizedVertex; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.OutputConfig; /** - * Verifies a NormalizedVertex message. + * Verifies an OutputConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. + * Creates an OutputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns NormalizedVertex + * @returns OutputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.NormalizedVertex; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.OutputConfig; /** - * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. - * @param message NormalizedVertex + * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. + * @param message OutputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta1.NormalizedVertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta2.OutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this NormalizedVertex to JSON. + * Converts this OutputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a BoundingPoly. */ - interface IBoundingPoly { - - /** BoundingPoly vertices */ - vertices?: (google.cloud.documentai.v1beta1.IVertex[]|null); + /** Properties of a GcsSource. */ + interface IGcsSource { - /** BoundingPoly normalizedVertices */ - normalizedVertices?: (google.cloud.documentai.v1beta1.INormalizedVertex[]|null); + /** GcsSource uri */ + uri?: (string|null); } - /** Represents a BoundingPoly. */ - class BoundingPoly implements IBoundingPoly { + /** Represents a GcsSource. */ + class GcsSource implements IGcsSource { /** - * Constructs a new BoundingPoly. + * Constructs a new GcsSource. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta1.IBoundingPoly); + constructor(properties?: google.cloud.documentai.v1beta2.IGcsSource); - /** BoundingPoly vertices. */ - public vertices: google.cloud.documentai.v1beta1.IVertex[]; - - /** BoundingPoly normalizedVertices. */ - public normalizedVertices: google.cloud.documentai.v1beta1.INormalizedVertex[]; + /** GcsSource uri. */ + public uri: string; /** - * Creates a new BoundingPoly instance using the specified properties. + * Creates a new GcsSource instance using the specified properties. * @param [properties] Properties to set - * @returns BoundingPoly instance + * @returns GcsSource instance */ - public static create(properties?: google.cloud.documentai.v1beta1.IBoundingPoly): google.cloud.documentai.v1beta1.BoundingPoly; + public static create(properties?: google.cloud.documentai.v1beta2.IGcsSource): google.cloud.documentai.v1beta2.GcsSource; /** - * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.documentai.v1beta1.BoundingPoly.verify|verify} messages. - * @param message BoundingPoly message or plain object to encode + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.documentai.v1beta2.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.documentai.v1beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta2.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.BoundingPoly.verify|verify} messages. - * @param message BoundingPoly message or plain object to encode + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.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.documentai.v1beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta2.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BoundingPoly 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 BoundingPoly + * @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.documentai.v1beta1.BoundingPoly; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.GcsSource; /** - * Decodes a BoundingPoly 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 BoundingPoly + * @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.documentai.v1beta1.BoundingPoly; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.GcsSource; /** - * Verifies a BoundingPoly 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 BoundingPoly 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 BoundingPoly + * @returns GcsSource */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.BoundingPoly; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.GcsSource; /** - * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. - * @param message BoundingPoly + * 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.documentai.v1beta1.BoundingPoly, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta2.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BoundingPoly to JSON. + * Converts this GcsSource to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - } - } - } - /** Namespace api. */ - namespace api { + /** Properties of a GcsDestination. */ + interface IGcsDestination { - /** Properties of a Http. */ - interface IHttp { + /** GcsDestination uri */ + uri?: (string|null); + } - /** Http rules */ - rules?: (google.api.IHttpRule[]|null); + /** Represents a GcsDestination. */ + class GcsDestination implements IGcsDestination { - /** Http fullyDecodeReservedExpansion */ - fullyDecodeReservedExpansion?: (boolean|null); - } + /** + * Constructs a new GcsDestination. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.IGcsDestination); - /** Represents a Http. */ - class Http implements IHttp { + /** GcsDestination uri. */ + public uri: string; - /** - * Constructs a new Http. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IHttp); + /** + * Creates a new GcsDestination instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsDestination instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.IGcsDestination): google.cloud.documentai.v1beta2.GcsDestination; - /** Http rules. */ - public rules: google.api.IHttpRule[]; + /** + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.documentai.v1beta2.GcsDestination.verify|verify} messages. + * @param message GcsDestination message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; - /** Http fullyDecodeReservedExpansion. */ - public fullyDecodeReservedExpansion: boolean; + /** + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.GcsDestination.verify|verify} messages. + * @param message GcsDestination message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * 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; + /** + * Decodes a GcsDestination message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.GcsDestination; - /** - * 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; + /** + * Decodes a GcsDestination message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.GcsDestination; - /** - * 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; + /** + * Verifies a GcsDestination message. + * @param message 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 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; + /** + * Creates a GcsDestination message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsDestination + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.GcsDestination; - /** - * 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; + /** + * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. + * @param message GcsDestination + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.GcsDestination, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * 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); + /** + * Converts this GcsDestination to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * 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; + /** Properties of an OperationMetadata. */ + interface IOperationMetadata { - /** - * 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 }; + /** OperationMetadata state */ + state?: (google.cloud.documentai.v1beta2.OperationMetadata.State|keyof typeof google.cloud.documentai.v1beta2.OperationMetadata.State|null); - /** - * Converts this Http to JSON. - * @returns JSON object + /** OperationMetadata stateMessage */ + stateMessage?: (string|null); + + /** OperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents an OperationMetadata. */ + class OperationMetadata implements IOperationMetadata { + + /** + * Constructs a new OperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.IOperationMetadata); + + /** OperationMetadata state. */ + public state: (google.cloud.documentai.v1beta2.OperationMetadata.State|keyof typeof google.cloud.documentai.v1beta2.OperationMetadata.State); + + /** OperationMetadata stateMessage. */ + public stateMessage: string; + + /** OperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.IOperationMetadata): google.cloud.documentai.v1beta2.OperationMetadata; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta2.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta2.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta2.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta2.OperationMetadata; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta2.OperationMetadata; + + /** + * Verifies an OperationMetadata message. + * @param message Plain 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 OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.OperationMetadata; + + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @param message OperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta2.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace OperationMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + ACCEPTED = 1, + WAITING = 2, + RUNNING = 3, + SUCCEEDED = 4, + CANCELLED = 5, + FAILED = 6 + } + } + } + } + } + + /** Namespace api. */ + namespace api { + + /** FieldBehavior enum. */ + enum FieldBehavior { + FIELD_BEHAVIOR_UNSPECIFIED = 0, + OPTIONAL = 1, + REQUIRED = 2, + OUTPUT_ONLY = 3, + INPUT_ONLY = 4, + IMMUTABLE = 5 + } + + /** 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 }; } @@ -2184,16 +5067,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 - } } /** Namespace protobuf. */ @@ -2890,10 +5763,10 @@ export namespace google { number?: (number|null); /** FieldDescriptorProto label */ - label?: (google.protobuf.FieldDescriptorProto.Label|null); + label?: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label|null); /** FieldDescriptorProto type */ - type?: (google.protobuf.FieldDescriptorProto.Type|null); + type?: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type|null); /** FieldDescriptorProto typeName */ typeName?: (string|null); @@ -2930,10 +5803,10 @@ export namespace google { public number: number; /** FieldDescriptorProto label. */ - public label: google.protobuf.FieldDescriptorProto.Label; + public label: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label); /** FieldDescriptorProto type. */ - public type: google.protobuf.FieldDescriptorProto.Type; + public type: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type); /** FieldDescriptorProto typeName. */ public typeName: string; @@ -3708,7 +6581,7 @@ export namespace google { javaStringCheckUtf8?: (boolean|null); /** FileOptions optimizeFor */ - optimizeFor?: (google.protobuf.FileOptions.OptimizeMode|null); + optimizeFor?: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode|null); /** FileOptions goPackage */ goPackage?: (string|null); @@ -3781,7 +6654,7 @@ export namespace google { public javaStringCheckUtf8: boolean; /** FileOptions optimizeFor. */ - public optimizeFor: google.protobuf.FileOptions.OptimizeMode; + public optimizeFor: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode); /** FileOptions goPackage. */ public goPackage: string; @@ -4027,13 +6900,13 @@ export namespace google { interface IFieldOptions { /** FieldOptions ctype */ - ctype?: (google.protobuf.FieldOptions.CType|null); + ctype?: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType|null); /** FieldOptions packed */ packed?: (boolean|null); /** FieldOptions jstype */ - jstype?: (google.protobuf.FieldOptions.JSType|null); + jstype?: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType|null); /** FieldOptions lazy */ lazy?: (boolean|null); @@ -4061,13 +6934,13 @@ export namespace google { constructor(properties?: google.protobuf.IFieldOptions); /** FieldOptions ctype. */ - public ctype: google.protobuf.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; + public jstype: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType); /** FieldOptions lazy. */ public lazy: boolean; @@ -4566,7 +7439,7 @@ export namespace google { deprecated?: (boolean|null); /** MethodOptions idempotencyLevel */ - idempotencyLevel?: (google.protobuf.MethodOptions.IdempotencyLevel|null); + idempotencyLevel?: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel|null); /** MethodOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); @@ -4594,7 +7467,7 @@ export namespace google { public deprecated: boolean; /** MethodOptions idempotencyLevel. */ - public idempotencyLevel: google.protobuf.MethodOptions.IdempotencyLevel; + public idempotencyLevel: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel); /** MethodOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -4690,16 +7563,16 @@ export namespace google { identifierValue?: (string|null); /** UninterpretedOption positiveIntValue */ - positiveIntValue?: (number|Long|null); + positiveIntValue?: (number|Long|string|null); /** UninterpretedOption negativeIntValue */ - negativeIntValue?: (number|Long|null); + negativeIntValue?: (number|Long|string|null); /** UninterpretedOption doubleValue */ doubleValue?: (number|null); /** UninterpretedOption stringValue */ - stringValue?: (Uint8Array|null); + stringValue?: (Uint8Array|string|null); /** UninterpretedOption aggregateValue */ aggregateValue?: (string|null); @@ -4721,16 +7594,16 @@ export namespace google { public identifierValue: string; /** UninterpretedOption positiveIntValue. */ - public positiveIntValue: (number|Long); + public positiveIntValue: (number|Long|string); /** UninterpretedOption negativeIntValue. */ - public negativeIntValue: (number|Long); + public negativeIntValue: (number|Long|string); /** UninterpretedOption doubleValue. */ public doubleValue: number; /** UninterpretedOption stringValue. */ - public stringValue: Uint8Array; + public stringValue: (Uint8Array|string); /** UninterpretedOption aggregateValue. */ public aggregateValue: string; @@ -5320,7 +8193,7 @@ export namespace google { type_url?: (string|null); /** Any value */ - value?: (Uint8Array|null); + value?: (Uint8Array|string|null); } /** Represents an Any. */ @@ -5336,7 +8209,7 @@ export namespace google { public type_url: string; /** Any value. */ - public value: Uint8Array; + public value: (Uint8Array|string); /** * Creates a new Any instance using the specified properties. @@ -5409,277 +8282,1305 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** Properties of a Duration. */ - interface IDuration { - - /** Duration seconds */ - seconds?: (number|Long|null); + /** Properties of a DoubleValue. */ + interface IDoubleValue { - /** Duration nanos */ - nanos?: (number|null); + /** DoubleValue value */ + value?: (number|null); } - /** Represents a Duration. */ - class Duration implements IDuration { + /** Represents a DoubleValue. */ + class DoubleValue implements IDoubleValue { /** - * Constructs a new Duration. + * Constructs a new DoubleValue. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IDuration); - - /** Duration seconds. */ - public seconds: (number|Long); + constructor(properties?: google.protobuf.IDoubleValue); - /** Duration nanos. */ - public nanos: number; + /** DoubleValue value. */ + public value: number; /** - * Creates a new Duration instance using the specified properties. + * Creates a new DoubleValue instance using the specified properties. * @param [properties] Properties to set - * @returns Duration instance + * @returns DoubleValue instance */ - public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; + public static create(properties?: google.protobuf.IDoubleValue): google.protobuf.DoubleValue; /** - * 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 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.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IDoubleValue, 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 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.IDuration, writer?: $protobuf.Writer): $protobuf.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 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 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 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 Duration 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 Duration + * @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.Duration; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Timestamp; /** - * Decodes a Duration 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 Duration + * @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.Duration; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Timestamp; /** - * Verifies a Duration 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 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. * @param object Plain object - * @returns Duration + * @returns Timestamp */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Duration; + public static fromObject(object: { [k: string]: any }): google.protobuf.Timestamp; /** - * 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 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.Duration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.Timestamp, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Duration to JSON. + * Converts this Timestamp to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } + } - /** Properties of an Empty. */ - interface IEmpty { + /** 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 an Empty. */ - class Empty implements IEmpty { + /** Represents a Status. */ + class Status implements IStatus { /** - * Constructs a new Empty. + * Constructs a new Status. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IEmpty); + 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 Empty instance using the specified properties. + * Creates a new Status instance using the specified properties. * @param [properties] Properties to set - * @returns Empty instance + * @returns Status instance */ - public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; + public static create(properties?: google.rpc.IStatus): google.rpc.Status; /** - * 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 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.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.rpc.IStatus, 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 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.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Empty 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 Empty + * @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.Empty; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.rpc.Status; /** - * Decodes an Empty 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 Empty + * @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.Empty; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.rpc.Status; /** - * Verifies an Empty 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 an Empty 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 Empty + * @returns Status */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; + public static fromObject(object: { [k: string]: any }): google.rpc.Status; /** - * 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 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.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.rpc.Status, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Empty to JSON. + * Converts this Status to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } + } - /** Properties of a Timestamp. */ - interface ITimestamp { + /** Namespace type. */ + namespace type { - /** Timestamp seconds */ - seconds?: (number|Long|null); + /** Properties of a Color. */ + interface IColor { - /** Timestamp nanos */ - nanos?: (number|null); + /** Color red */ + red?: (number|null); + + /** Color green */ + green?: (number|null); + + /** Color blue */ + blue?: (number|null); + + /** Color alpha */ + alpha?: (google.protobuf.IFloatValue|null); } - /** Represents a Timestamp. */ - class Timestamp implements ITimestamp { + /** Represents a Color. */ + class Color implements IColor { /** - * Constructs a new Timestamp. + * Constructs a new Color. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.ITimestamp); + constructor(properties?: google.type.IColor); - /** Timestamp seconds. */ - public seconds: (number|Long); + /** Color red. */ + public red: number; - /** Timestamp nanos. */ - public nanos: number; + /** Color green. */ + public green: number; + + /** Color blue. */ + public blue: number; + + /** Color alpha. */ + public alpha?: (google.protobuf.IFloatValue|null); /** - * Creates a new Timestamp instance using the specified properties. + * Creates a new Color instance using the specified properties. * @param [properties] Properties to set - * @returns Timestamp instance + * @returns Color instance */ - public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; + public static create(properties?: google.type.IColor): google.type.Color; /** - * 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 Color message. Does not implicitly {@link google.type.Color.verify|verify} messages. + * @param message Color 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.type.IColor, 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 Color message, length delimited. Does not implicitly {@link google.type.Color.verify|verify} messages. + * @param message Color 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.type.IColor, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Timestamp message from the specified reader or buffer. + * Decodes a Color 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 Color * @throws {Error} If the payload is not 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.type.Color; /** - * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * Decodes a Color message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Timestamp + * @returns Color * @throws {Error} If the payload 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.type.Color; /** - * Verifies a Timestamp message. + * Verifies a Color message. * @param message Plain object 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 Color message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Timestamp + * @returns Color */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Timestamp; + public static fromObject(object: { [k: string]: any }): google.type.Color; /** - * 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 Color message. Also converts values to other types if specified. + * @param message Color * @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.type.Color, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Timestamp to JSON. + * Converts this Color to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; @@ -6601,110 +10502,4 @@ export namespace google { 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 }; - } - } } diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 408652a29ac..92eaeee0779 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -1,3 +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 +// +// 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 */ @@ -43,195 +57,283 @@ */ var documentai = {}; - documentai.v1beta1 = (function() { + documentai.v1beta2 = (function() { /** - * Namespace v1beta1. + * Namespace v1beta2. * @memberof google.cloud.documentai * @namespace */ - var v1beta1 = {}; + var v1beta2 = {}; - v1beta1.DocumentUnderstandingService = (function() { + v1beta2.Document = (function() { /** - * Constructs a new DocumentUnderstandingService service. - * @memberof google.cloud.documentai.v1beta1 - * @classdesc Represents a DocumentUnderstandingService - * @extends $protobuf.rpc.Service + * Properties of a Document. + * @memberof google.cloud.documentai.v1beta2 + * @interface IDocument + * @property {string|null} [uri] Document uri + * @property {Uint8Array|null} [content] Document content + * @property {string|null} [mimeType] Document mimeType + * @property {string|null} [text] Document text + * @property {Array.|null} [textStyles] Document textStyles + * @property {Array.|null} [pages] Document pages + * @property {Array.|null} [entities] Document entities + * @property {Array.|null} [entityRelations] Document entityRelations + * @property {google.cloud.documentai.v1beta2.Document.IShardInfo|null} [shardInfo] Document shardInfo + * @property {Array.|null} [labels] Document labels + * @property {google.rpc.IStatus|null} [error] Document error + */ + + /** + * Constructs a new Document. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a Document. + * @implements IDocument * @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.documentai.v1beta2.IDocument=} [properties] Properties to set */ - function DocumentUnderstandingService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + function Document(properties) { + this.textStyles = []; + this.pages = []; + this.entities = []; + this.entityRelations = []; + 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]]; } - (DocumentUnderstandingService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = DocumentUnderstandingService; + /** + * Document uri. + * @member {string} uri + * @memberof google.cloud.documentai.v1beta2.Document + * @instance + */ + Document.prototype.uri = ""; /** - * Creates new DocumentUnderstandingService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.documentai.v1beta1.DocumentUnderstandingService - * @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 {DocumentUnderstandingService} RPC service. Useful where requests and/or responses are streamed. + * Document content. + * @member {Uint8Array} content + * @memberof google.cloud.documentai.v1beta2.Document + * @instance */ - DocumentUnderstandingService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; + Document.prototype.content = $util.newBuffer([]); /** - * Callback as used by {@link google.cloud.documentai.v1beta1.DocumentUnderstandingService#batchProcessDocuments}. - * @memberof google.cloud.documentai.v1beta1.DocumentUnderstandingService - * @typedef BatchProcessDocumentsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Document mimeType. + * @member {string} mimeType + * @memberof google.cloud.documentai.v1beta2.Document + * @instance */ + Document.prototype.mimeType = ""; /** - * Calls BatchProcessDocuments. - * @function batchProcessDocuments - * @memberof google.cloud.documentai.v1beta1.DocumentUnderstandingService + * Document text. + * @member {string} text + * @memberof google.cloud.documentai.v1beta2.Document * @instance - * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest} request BatchProcessDocumentsRequest message or plain object - * @param {google.cloud.documentai.v1beta1.DocumentUnderstandingService.BatchProcessDocumentsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 */ - Object.defineProperty(DocumentUnderstandingService.prototype.batchProcessDocuments = function batchProcessDocuments(request, callback) { - return this.rpcCall(batchProcessDocuments, $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "BatchProcessDocuments" }); + Document.prototype.text = ""; /** - * Calls BatchProcessDocuments. - * @function batchProcessDocuments - * @memberof google.cloud.documentai.v1beta1.DocumentUnderstandingService + * Document textStyles. + * @member {Array.} textStyles + * @memberof google.cloud.documentai.v1beta2.Document * @instance - * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest} request BatchProcessDocumentsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 */ + Document.prototype.textStyles = $util.emptyArray; - return DocumentUnderstandingService; - })(); + /** + * Document pages. + * @member {Array.} pages + * @memberof google.cloud.documentai.v1beta2.Document + * @instance + */ + Document.prototype.pages = $util.emptyArray; - v1beta1.BatchProcessDocumentsRequest = (function() { + /** + * Document entities. + * @member {Array.} entities + * @memberof google.cloud.documentai.v1beta2.Document + * @instance + */ + Document.prototype.entities = $util.emptyArray; /** - * Properties of a BatchProcessDocumentsRequest. - * @memberof google.cloud.documentai.v1beta1 - * @interface IBatchProcessDocumentsRequest - * @property {Array.|null} [requests] BatchProcessDocumentsRequest requests - * @property {string|null} [parent] BatchProcessDocumentsRequest parent + * Document entityRelations. + * @member {Array.} entityRelations + * @memberof google.cloud.documentai.v1beta2.Document + * @instance */ + Document.prototype.entityRelations = $util.emptyArray; /** - * Constructs a new BatchProcessDocumentsRequest. - * @memberof google.cloud.documentai.v1beta1 - * @classdesc Represents a BatchProcessDocumentsRequest. - * @implements IBatchProcessDocumentsRequest - * @constructor - * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest=} [properties] Properties to set + * Document shardInfo. + * @member {google.cloud.documentai.v1beta2.Document.IShardInfo|null|undefined} shardInfo + * @memberof google.cloud.documentai.v1beta2.Document + * @instance */ - function BatchProcessDocumentsRequest(properties) { - this.requests = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + Document.prototype.shardInfo = null; /** - * BatchProcessDocumentsRequest requests. - * @member {Array.} requests - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * Document labels. + * @member {Array.} labels + * @memberof google.cloud.documentai.v1beta2.Document * @instance */ - BatchProcessDocumentsRequest.prototype.requests = $util.emptyArray; + Document.prototype.labels = $util.emptyArray; /** - * BatchProcessDocumentsRequest parent. - * @member {string} parent - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * Document error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.cloud.documentai.v1beta2.Document * @instance */ - BatchProcessDocumentsRequest.prototype.parent = ""; + Document.prototype.error = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * Creates a new BatchProcessDocumentsRequest instance using the specified properties. + * Document source. + * @member {"uri"|"content"|undefined} source + * @memberof google.cloud.documentai.v1beta2.Document + * @instance + */ + Object.defineProperty(Document.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["uri", "content"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Document instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @memberof google.cloud.documentai.v1beta2.Document * @static - * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest} BatchProcessDocumentsRequest instance + * @param {google.cloud.documentai.v1beta2.IDocument=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document} Document instance */ - BatchProcessDocumentsRequest.create = function create(properties) { - return new BatchProcessDocumentsRequest(properties); + Document.create = function create(properties) { + return new Document(properties); }; /** - * Encodes the specified BatchProcessDocumentsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.verify|verify} messages. + * Encodes the specified Document message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @memberof google.cloud.documentai.v1beta2.Document * @static - * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest} message BatchProcessDocumentsRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IDocument} message Document message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchProcessDocumentsRequest.encode = function encode(message, writer) { + Document.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.requests != null && message.requests.length) - for (var i = 0; i < message.requests.length; ++i) - $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.parent != null && message.hasOwnProperty("parent")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.parent); + if (message.uri != null && message.hasOwnProperty("uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.content != null && message.hasOwnProperty("content")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.content); + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.mimeType); + if (message.text != null && message.hasOwnProperty("text")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.text); + if (message.textStyles != null && message.textStyles.length) + for (var i = 0; i < message.textStyles.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Style.encode(message.textStyles[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.pages != null && message.pages.length) + for (var i = 0; i < message.pages.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.encode(message.pages[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.entities != null && message.entities.length) + for (var i = 0; i < message.entities.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Entity.encode(message.entities[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.entityRelations != null && message.entityRelations.length) + for (var i = 0; i < message.entityRelations.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.EntityRelation.encode(message.entityRelations[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.shardInfo != null && message.hasOwnProperty("shardInfo")) + $root.google.cloud.documentai.v1beta2.Document.ShardInfo.encode(message.shardInfo, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.error != null && message.hasOwnProperty("error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.labels != null && message.labels.length) + for (var i = 0; i < message.labels.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Label.encode(message.labels[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); return writer; }; /** - * Encodes the specified BatchProcessDocumentsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.verify|verify} messages. + * Encodes the specified Document message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @memberof google.cloud.documentai.v1beta2.Document * @static - * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest} message BatchProcessDocumentsRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IDocument} message Document message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchProcessDocumentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + Document.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BatchProcessDocumentsRequest message from the specified reader or buffer. + * Decodes a Document message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @memberof google.cloud.documentai.v1beta2.Document * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest} BatchProcessDocumentsRequest + * @returns {google.cloud.documentai.v1beta2.Document} Document * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchProcessDocumentsRequest.decode = function decode(reader, length) { + Document.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.requests && message.requests.length)) - message.requests = []; - message.requests.push($root.google.cloud.documentai.v1beta1.ProcessDocumentRequest.decode(reader, reader.uint32())); + message.uri = reader.string(); break; case 2: - message.parent = reader.string(); + message.content = reader.bytes(); + break; + case 3: + message.mimeType = reader.string(); + break; + case 4: + message.text = reader.string(); + break; + case 5: + if (!(message.textStyles && message.textStyles.length)) + message.textStyles = []; + message.textStyles.push($root.google.cloud.documentai.v1beta2.Document.Style.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.pages && message.pages.length)) + message.pages = []; + message.pages.push($root.google.cloud.documentai.v1beta2.Document.Page.decode(reader, reader.uint32())); + break; + case 7: + if (!(message.entities && message.entities.length)) + message.entities = []; + message.entities.push($root.google.cloud.documentai.v1beta2.Document.Entity.decode(reader, reader.uint32())); + break; + case 8: + if (!(message.entityRelations && message.entityRelations.length)) + message.entityRelations = []; + message.entityRelations.push($root.google.cloud.documentai.v1beta2.Document.EntityRelation.decode(reader, reader.uint32())); + break; + case 9: + message.shardInfo = $root.google.cloud.documentai.v1beta2.Document.ShardInfo.decode(reader, reader.uint32()); + break; + case 11: + if (!(message.labels && message.labels.length)) + message.labels = []; + message.labels.push($root.google.cloud.documentai.v1beta2.Document.Label.decode(reader, reader.uint32())); + break; + case 10: + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -242,293 +344,7031 @@ }; /** - * Decodes a BatchProcessDocumentsRequest message from the specified reader or buffer, length delimited. + * Decodes a Document message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @memberof google.cloud.documentai.v1beta2.Document * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest} BatchProcessDocumentsRequest + * @returns {google.cloud.documentai.v1beta2.Document} Document * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchProcessDocumentsRequest.decodeDelimited = function decodeDelimited(reader) { + Document.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BatchProcessDocumentsRequest message. + * Verifies a Document message. * @function verify - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @memberof google.cloud.documentai.v1beta2.Document * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BatchProcessDocumentsRequest.verify = function verify(message) { + Document.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.requests != null && message.hasOwnProperty("requests")) { - if (!Array.isArray(message.requests)) - return "requests: array expected"; - for (var i = 0; i < message.requests.length; ++i) { - var error = $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest.verify(message.requests[i]); + var properties = {}; + if (message.uri != null && message.hasOwnProperty("uri")) { + properties.source = 1; + if (!$util.isString(message.uri)) + return "uri: string expected"; + } + if (message.content != null && message.hasOwnProperty("content")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) + return "content: buffer expected"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.textStyles != null && message.hasOwnProperty("textStyles")) { + if (!Array.isArray(message.textStyles)) + return "textStyles: array expected"; + for (var i = 0; i < message.textStyles.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Style.verify(message.textStyles[i]); if (error) - return "requests." + error; + return "textStyles." + error; } } - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; + if (message.pages != null && message.hasOwnProperty("pages")) { + if (!Array.isArray(message.pages)) + return "pages: array expected"; + for (var i = 0; i < message.pages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.verify(message.pages[i]); + if (error) + return "pages." + error; + } + } + if (message.entities != null && message.hasOwnProperty("entities")) { + if (!Array.isArray(message.entities)) + return "entities: array expected"; + for (var i = 0; i < message.entities.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Entity.verify(message.entities[i]); + if (error) + return "entities." + error; + } + } + if (message.entityRelations != null && message.hasOwnProperty("entityRelations")) { + if (!Array.isArray(message.entityRelations)) + return "entityRelations: array expected"; + for (var i = 0; i < message.entityRelations.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.EntityRelation.verify(message.entityRelations[i]); + if (error) + return "entityRelations." + error; + } + } + if (message.shardInfo != null && message.hasOwnProperty("shardInfo")) { + var error = $root.google.cloud.documentai.v1beta2.Document.ShardInfo.verify(message.shardInfo); + if (error) + return "shardInfo." + error; + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!Array.isArray(message.labels)) + return "labels: array expected"; + for (var i = 0; i < message.labels.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Label.verify(message.labels[i]); + if (error) + return "labels." + error; + } + } + if (message.error != null && message.hasOwnProperty("error")) { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; + } return null; }; /** - * Creates a BatchProcessDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Document message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @memberof google.cloud.documentai.v1beta2.Document * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest} BatchProcessDocumentsRequest + * @returns {google.cloud.documentai.v1beta2.Document} Document */ - BatchProcessDocumentsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest) + Document.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document) return object; - var message = new $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest(); - if (object.requests) { - if (!Array.isArray(object.requests)) - throw TypeError(".google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.requests: array expected"); - message.requests = []; - for (var i = 0; i < object.requests.length; ++i) { - if (typeof object.requests[i] !== "object") - throw TypeError(".google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.requests: object expected"); - message.requests[i] = $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest.fromObject(object.requests[i]); + var message = new $root.google.cloud.documentai.v1beta2.Document(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.content != null) + if (typeof object.content === "string") + $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); + else if (object.content.length) + message.content = object.content; + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + if (object.text != null) + message.text = String(object.text); + if (object.textStyles) { + if (!Array.isArray(object.textStyles)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.textStyles: array expected"); + message.textStyles = []; + for (var i = 0; i < object.textStyles.length; ++i) { + if (typeof object.textStyles[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.textStyles: object expected"); + message.textStyles[i] = $root.google.cloud.documentai.v1beta2.Document.Style.fromObject(object.textStyles[i]); } } - if (object.parent != null) - message.parent = String(object.parent); + if (object.pages) { + if (!Array.isArray(object.pages)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.pages: array expected"); + message.pages = []; + for (var i = 0; i < object.pages.length; ++i) { + if (typeof object.pages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.pages: object expected"); + message.pages[i] = $root.google.cloud.documentai.v1beta2.Document.Page.fromObject(object.pages[i]); + } + } + if (object.entities) { + if (!Array.isArray(object.entities)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.entities: array expected"); + message.entities = []; + for (var i = 0; i < object.entities.length; ++i) { + if (typeof object.entities[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.entities: object expected"); + message.entities[i] = $root.google.cloud.documentai.v1beta2.Document.Entity.fromObject(object.entities[i]); + } + } + if (object.entityRelations) { + if (!Array.isArray(object.entityRelations)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.entityRelations: array expected"); + message.entityRelations = []; + for (var i = 0; i < object.entityRelations.length; ++i) { + if (typeof object.entityRelations[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.entityRelations: object expected"); + message.entityRelations[i] = $root.google.cloud.documentai.v1beta2.Document.EntityRelation.fromObject(object.entityRelations[i]); + } + } + if (object.shardInfo != null) { + if (typeof object.shardInfo !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.shardInfo: object expected"); + message.shardInfo = $root.google.cloud.documentai.v1beta2.Document.ShardInfo.fromObject(object.shardInfo); + } + if (object.labels) { + if (!Array.isArray(object.labels)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.labels: array expected"); + message.labels = []; + for (var i = 0; i < object.labels.length; ++i) { + if (typeof object.labels[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.labels: object expected"); + message.labels[i] = $root.google.cloud.documentai.v1beta2.Document.Label.fromObject(object.labels[i]); + } + } + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error); + } return message; }; /** - * Creates a plain object from a BatchProcessDocumentsRequest message. Also converts values to other types if specified. + * Creates a plain object from a Document message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @memberof google.cloud.documentai.v1beta2.Document * @static - * @param {google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest} message BatchProcessDocumentsRequest + * @param {google.cloud.documentai.v1beta2.Document} message Document * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BatchProcessDocumentsRequest.toObject = function toObject(message, options) { + Document.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.requests = []; - if (options.defaults) - object.parent = ""; - if (message.requests && message.requests.length) { - object.requests = []; - for (var j = 0; j < message.requests.length; ++j) - object.requests[j] = $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest.toObject(message.requests[j], options); + if (options.arrays || options.defaults) { + object.textStyles = []; + object.pages = []; + object.entities = []; + object.entityRelations = []; + object.labels = []; + } + if (options.defaults) { + object.mimeType = ""; + object.text = ""; + object.shardInfo = null; + object.error = null; + } + if (message.uri != null && message.hasOwnProperty("uri")) { + object.uri = message.uri; + if (options.oneofs) + object.source = "uri"; + } + if (message.content != null && message.hasOwnProperty("content")) { + object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; + if (options.oneofs) + object.source = "content"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.textStyles && message.textStyles.length) { + object.textStyles = []; + for (var j = 0; j < message.textStyles.length; ++j) + object.textStyles[j] = $root.google.cloud.documentai.v1beta2.Document.Style.toObject(message.textStyles[j], options); + } + if (message.pages && message.pages.length) { + object.pages = []; + for (var j = 0; j < message.pages.length; ++j) + object.pages[j] = $root.google.cloud.documentai.v1beta2.Document.Page.toObject(message.pages[j], options); + } + if (message.entities && message.entities.length) { + object.entities = []; + for (var j = 0; j < message.entities.length; ++j) + object.entities[j] = $root.google.cloud.documentai.v1beta2.Document.Entity.toObject(message.entities[j], options); + } + if (message.entityRelations && message.entityRelations.length) { + object.entityRelations = []; + for (var j = 0; j < message.entityRelations.length; ++j) + object.entityRelations[j] = $root.google.cloud.documentai.v1beta2.Document.EntityRelation.toObject(message.entityRelations[j], options); + } + if (message.shardInfo != null && message.hasOwnProperty("shardInfo")) + object.shardInfo = $root.google.cloud.documentai.v1beta2.Document.ShardInfo.toObject(message.shardInfo, options); + if (message.error != null && message.hasOwnProperty("error")) + object.error = $root.google.rpc.Status.toObject(message.error, options); + if (message.labels && message.labels.length) { + object.labels = []; + for (var j = 0; j < message.labels.length; ++j) + object.labels[j] = $root.google.cloud.documentai.v1beta2.Document.Label.toObject(message.labels[j], options); } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; return object; }; /** - * Converts this BatchProcessDocumentsRequest to JSON. + * Converts this Document to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @memberof google.cloud.documentai.v1beta2.Document * @instance * @returns {Object.} JSON object */ - BatchProcessDocumentsRequest.prototype.toJSON = function toJSON() { + Document.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BatchProcessDocumentsRequest; - })(); - - v1beta1.ProcessDocumentRequest = (function() { + Document.ShardInfo = (function() { + + /** + * Properties of a ShardInfo. + * @memberof google.cloud.documentai.v1beta2.Document + * @interface IShardInfo + * @property {number|Long|null} [shardIndex] ShardInfo shardIndex + * @property {number|Long|null} [shardCount] ShardInfo shardCount + * @property {number|Long|null} [textOffset] ShardInfo textOffset + */ + + /** + * Constructs a new ShardInfo. + * @memberof google.cloud.documentai.v1beta2.Document + * @classdesc Represents a ShardInfo. + * @implements IShardInfo + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.IShardInfo=} [properties] Properties to set + */ + function ShardInfo(properties) { + if (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 ProcessDocumentRequest. - * @memberof google.cloud.documentai.v1beta1 - * @interface IProcessDocumentRequest - * @property {google.cloud.documentai.v1beta1.IInputConfig|null} [inputConfig] ProcessDocumentRequest inputConfig - * @property {google.cloud.documentai.v1beta1.IOutputConfig|null} [outputConfig] ProcessDocumentRequest outputConfig - * @property {string|null} [documentType] ProcessDocumentRequest documentType - * @property {google.cloud.documentai.v1beta1.ITableExtractionParams|null} [tableExtractionParams] ProcessDocumentRequest tableExtractionParams - * @property {google.cloud.documentai.v1beta1.IFormExtractionParams|null} [formExtractionParams] ProcessDocumentRequest formExtractionParams - * @property {google.cloud.documentai.v1beta1.IEntityExtractionParams|null} [entityExtractionParams] ProcessDocumentRequest entityExtractionParams - * @property {google.cloud.documentai.v1beta1.IOcrParams|null} [ocrParams] ProcessDocumentRequest ocrParams - */ + /** + * ShardInfo shardIndex. + * @member {number|Long} shardIndex + * @memberof google.cloud.documentai.v1beta2.Document.ShardInfo + * @instance + */ + ShardInfo.prototype.shardIndex = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ShardInfo shardCount. + * @member {number|Long} shardCount + * @memberof google.cloud.documentai.v1beta2.Document.ShardInfo + * @instance + */ + ShardInfo.prototype.shardCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ShardInfo textOffset. + * @member {number|Long} textOffset + * @memberof google.cloud.documentai.v1beta2.Document.ShardInfo + * @instance + */ + ShardInfo.prototype.textOffset = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new ShardInfo instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.ShardInfo + * @static + * @param {google.cloud.documentai.v1beta2.Document.IShardInfo=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.ShardInfo} ShardInfo instance + */ + ShardInfo.create = function create(properties) { + return new ShardInfo(properties); + }; + + /** + * Encodes the specified ShardInfo message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.ShardInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.ShardInfo + * @static + * @param {google.cloud.documentai.v1beta2.Document.IShardInfo} message ShardInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ShardInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.shardIndex != null && message.hasOwnProperty("shardIndex")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.shardIndex); + if (message.shardCount != null && message.hasOwnProperty("shardCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.shardCount); + if (message.textOffset != null && message.hasOwnProperty("textOffset")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.textOffset); + return writer; + }; + + /** + * Encodes the specified ShardInfo message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.ShardInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.ShardInfo + * @static + * @param {google.cloud.documentai.v1beta2.Document.IShardInfo} message ShardInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ShardInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ShardInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.ShardInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.ShardInfo} ShardInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ShardInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.ShardInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.shardIndex = reader.int64(); + break; + case 2: + message.shardCount = reader.int64(); + break; + case 3: + message.textOffset = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ShardInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.ShardInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.ShardInfo} ShardInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ShardInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ShardInfo message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.ShardInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ShardInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.shardIndex != null && message.hasOwnProperty("shardIndex")) + if (!$util.isInteger(message.shardIndex) && !(message.shardIndex && $util.isInteger(message.shardIndex.low) && $util.isInteger(message.shardIndex.high))) + return "shardIndex: integer|Long expected"; + if (message.shardCount != null && message.hasOwnProperty("shardCount")) + if (!$util.isInteger(message.shardCount) && !(message.shardCount && $util.isInteger(message.shardCount.low) && $util.isInteger(message.shardCount.high))) + return "shardCount: integer|Long expected"; + if (message.textOffset != null && message.hasOwnProperty("textOffset")) + if (!$util.isInteger(message.textOffset) && !(message.textOffset && $util.isInteger(message.textOffset.low) && $util.isInteger(message.textOffset.high))) + return "textOffset: integer|Long expected"; + return null; + }; + + /** + * Creates a ShardInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.ShardInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.ShardInfo} ShardInfo + */ + ShardInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.ShardInfo) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.ShardInfo(); + if (object.shardIndex != null) + if ($util.Long) + (message.shardIndex = $util.Long.fromValue(object.shardIndex)).unsigned = false; + else if (typeof object.shardIndex === "string") + message.shardIndex = parseInt(object.shardIndex, 10); + else if (typeof object.shardIndex === "number") + message.shardIndex = object.shardIndex; + else if (typeof object.shardIndex === "object") + message.shardIndex = new $util.LongBits(object.shardIndex.low >>> 0, object.shardIndex.high >>> 0).toNumber(); + if (object.shardCount != null) + if ($util.Long) + (message.shardCount = $util.Long.fromValue(object.shardCount)).unsigned = false; + else if (typeof object.shardCount === "string") + message.shardCount = parseInt(object.shardCount, 10); + else if (typeof object.shardCount === "number") + message.shardCount = object.shardCount; + else if (typeof object.shardCount === "object") + message.shardCount = new $util.LongBits(object.shardCount.low >>> 0, object.shardCount.high >>> 0).toNumber(); + if (object.textOffset != null) + if ($util.Long) + (message.textOffset = $util.Long.fromValue(object.textOffset)).unsigned = false; + else if (typeof object.textOffset === "string") + message.textOffset = parseInt(object.textOffset, 10); + else if (typeof object.textOffset === "number") + message.textOffset = object.textOffset; + else if (typeof object.textOffset === "object") + message.textOffset = new $util.LongBits(object.textOffset.low >>> 0, object.textOffset.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a ShardInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.ShardInfo + * @static + * @param {google.cloud.documentai.v1beta2.Document.ShardInfo} message ShardInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ShardInfo.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.shardIndex = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.shardIndex = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.shardCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.shardCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.textOffset = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.textOffset = options.longs === String ? "0" : 0; + } + if (message.shardIndex != null && message.hasOwnProperty("shardIndex")) + if (typeof message.shardIndex === "number") + object.shardIndex = options.longs === String ? String(message.shardIndex) : message.shardIndex; + else + object.shardIndex = options.longs === String ? $util.Long.prototype.toString.call(message.shardIndex) : options.longs === Number ? new $util.LongBits(message.shardIndex.low >>> 0, message.shardIndex.high >>> 0).toNumber() : message.shardIndex; + if (message.shardCount != null && message.hasOwnProperty("shardCount")) + if (typeof message.shardCount === "number") + object.shardCount = options.longs === String ? String(message.shardCount) : message.shardCount; + else + object.shardCount = options.longs === String ? $util.Long.prototype.toString.call(message.shardCount) : options.longs === Number ? new $util.LongBits(message.shardCount.low >>> 0, message.shardCount.high >>> 0).toNumber() : message.shardCount; + if (message.textOffset != null && message.hasOwnProperty("textOffset")) + if (typeof message.textOffset === "number") + object.textOffset = options.longs === String ? String(message.textOffset) : message.textOffset; + else + object.textOffset = options.longs === String ? $util.Long.prototype.toString.call(message.textOffset) : options.longs === Number ? new $util.LongBits(message.textOffset.low >>> 0, message.textOffset.high >>> 0).toNumber() : message.textOffset; + return object; + }; + + /** + * Converts this ShardInfo to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.ShardInfo + * @instance + * @returns {Object.} JSON object + */ + ShardInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ShardInfo; + })(); - /** - * Constructs a new ProcessDocumentRequest. - * @memberof google.cloud.documentai.v1beta1 - * @classdesc Represents a ProcessDocumentRequest. - * @implements IProcessDocumentRequest - * @constructor - * @param {google.cloud.documentai.v1beta1.IProcessDocumentRequest=} [properties] Properties to set - */ - function ProcessDocumentRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + Document.Label = (function() { + + /** + * Properties of a Label. + * @memberof google.cloud.documentai.v1beta2.Document + * @interface ILabel + * @property {string|null} [automlModel] Label automlModel + * @property {string|null} [name] Label name + * @property {number|null} [confidence] Label confidence + */ + + /** + * Constructs a new Label. + * @memberof google.cloud.documentai.v1beta2.Document + * @classdesc Represents a Label. + * @implements ILabel + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.ILabel=} [properties] Properties to set + */ + function Label(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * ProcessDocumentRequest inputConfig. - * @member {google.cloud.documentai.v1beta1.IInputConfig|null|undefined} inputConfig - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest - * @instance - */ - ProcessDocumentRequest.prototype.inputConfig = null; + /** + * Label automlModel. + * @member {string} automlModel + * @memberof google.cloud.documentai.v1beta2.Document.Label + * @instance + */ + Label.prototype.automlModel = ""; + + /** + * Label name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta2.Document.Label + * @instance + */ + Label.prototype.name = ""; + + /** + * Label confidence. + * @member {number} confidence + * @memberof google.cloud.documentai.v1beta2.Document.Label + * @instance + */ + Label.prototype.confidence = 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Label source. + * @member {"automlModel"|undefined} source + * @memberof google.cloud.documentai.v1beta2.Document.Label + * @instance + */ + Object.defineProperty(Label.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["automlModel"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Label instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.Label + * @static + * @param {google.cloud.documentai.v1beta2.Document.ILabel=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.Label} Label instance + */ + Label.create = function create(properties) { + return new Label(properties); + }; + + /** + * Encodes the specified Label message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Label.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.Label + * @static + * @param {google.cloud.documentai.v1beta2.Document.ILabel} message Label message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Label.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.automlModel != null && message.hasOwnProperty("automlModel")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.automlModel); + if (message.confidence != null && message.hasOwnProperty("confidence")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.confidence); + return writer; + }; + + /** + * Encodes the specified Label message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Label.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Label + * @static + * @param {google.cloud.documentai.v1beta2.Document.ILabel} message Label message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Label.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Label message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.Label + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.Label} Label + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Label.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.Label(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.automlModel = reader.string(); + break; + case 1: + message.name = reader.string(); + break; + case 3: + message.confidence = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Label message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Label + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.Label} Label + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Label.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Label message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.Label + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Label.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.automlModel != null && message.hasOwnProperty("automlModel")) { + properties.source = 1; + if (!$util.isString(message.automlModel)) + return "automlModel: string expected"; + } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + return null; + }; + + /** + * Creates a Label message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.Label + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.Label} Label + */ + Label.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.Label) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.Label(); + if (object.automlModel != null) + message.automlModel = String(object.automlModel); + if (object.name != null) + message.name = String(object.name); + if (object.confidence != null) + message.confidence = Number(object.confidence); + return message; + }; + + /** + * Creates a plain object from a Label message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.Label + * @static + * @param {google.cloud.documentai.v1beta2.Document.Label} message Label + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Label.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.confidence = 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.automlModel != null && message.hasOwnProperty("automlModel")) { + object.automlModel = message.automlModel; + if (options.oneofs) + object.source = "automlModel"; + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + return object; + }; + + /** + * Converts this Label to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.Label + * @instance + * @returns {Object.} JSON object + */ + Label.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Label; + })(); - /** - * ProcessDocumentRequest outputConfig. - * @member {google.cloud.documentai.v1beta1.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest - * @instance - */ - ProcessDocumentRequest.prototype.outputConfig = null; + Document.Style = (function() { + + /** + * Properties of a Style. + * @memberof google.cloud.documentai.v1beta2.Document + * @interface IStyle + * @property {google.cloud.documentai.v1beta2.Document.ITextAnchor|null} [textAnchor] Style textAnchor + * @property {google.type.IColor|null} [color] Style color + * @property {google.type.IColor|null} [backgroundColor] Style backgroundColor + * @property {string|null} [fontWeight] Style fontWeight + * @property {string|null} [textStyle] Style textStyle + * @property {string|null} [textDecoration] Style textDecoration + * @property {google.cloud.documentai.v1beta2.Document.Style.IFontSize|null} [fontSize] Style fontSize + */ + + /** + * Constructs a new Style. + * @memberof google.cloud.documentai.v1beta2.Document + * @classdesc Represents a Style. + * @implements IStyle + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.IStyle=} [properties] Properties to set + */ + function Style(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * ProcessDocumentRequest documentType. - * @member {string} documentType - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest - * @instance - */ - ProcessDocumentRequest.prototype.documentType = ""; + /** + * Style textAnchor. + * @member {google.cloud.documentai.v1beta2.Document.ITextAnchor|null|undefined} textAnchor + * @memberof google.cloud.documentai.v1beta2.Document.Style + * @instance + */ + Style.prototype.textAnchor = null; + + /** + * Style color. + * @member {google.type.IColor|null|undefined} color + * @memberof google.cloud.documentai.v1beta2.Document.Style + * @instance + */ + Style.prototype.color = null; + + /** + * Style backgroundColor. + * @member {google.type.IColor|null|undefined} backgroundColor + * @memberof google.cloud.documentai.v1beta2.Document.Style + * @instance + */ + Style.prototype.backgroundColor = null; + + /** + * Style fontWeight. + * @member {string} fontWeight + * @memberof google.cloud.documentai.v1beta2.Document.Style + * @instance + */ + Style.prototype.fontWeight = ""; + + /** + * Style textStyle. + * @member {string} textStyle + * @memberof google.cloud.documentai.v1beta2.Document.Style + * @instance + */ + Style.prototype.textStyle = ""; + + /** + * Style textDecoration. + * @member {string} textDecoration + * @memberof google.cloud.documentai.v1beta2.Document.Style + * @instance + */ + Style.prototype.textDecoration = ""; + + /** + * Style fontSize. + * @member {google.cloud.documentai.v1beta2.Document.Style.IFontSize|null|undefined} fontSize + * @memberof google.cloud.documentai.v1beta2.Document.Style + * @instance + */ + Style.prototype.fontSize = null; + + /** + * Creates a new Style instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.Style + * @static + * @param {google.cloud.documentai.v1beta2.Document.IStyle=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.Style} Style instance + */ + Style.create = function create(properties) { + return new Style(properties); + }; + + /** + * Encodes the specified Style message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Style.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.Style + * @static + * @param {google.cloud.documentai.v1beta2.Document.IStyle} message Style message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Style.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + $root.google.cloud.documentai.v1beta2.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.color != null && message.hasOwnProperty("color")) + $root.google.type.Color.encode(message.color, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.backgroundColor != null && message.hasOwnProperty("backgroundColor")) + $root.google.type.Color.encode(message.backgroundColor, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.fontWeight != null && message.hasOwnProperty("fontWeight")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.fontWeight); + if (message.textStyle != null && message.hasOwnProperty("textStyle")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.textStyle); + if (message.textDecoration != null && message.hasOwnProperty("textDecoration")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.textDecoration); + if (message.fontSize != null && message.hasOwnProperty("fontSize")) + $root.google.cloud.documentai.v1beta2.Document.Style.FontSize.encode(message.fontSize, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Style message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Style.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Style + * @static + * @param {google.cloud.documentai.v1beta2.Document.IStyle} message Style message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Style.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Style message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.Style + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.Style} Style + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Style.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.Style(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.textAnchor = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.decode(reader, reader.uint32()); + break; + case 2: + message.color = $root.google.type.Color.decode(reader, reader.uint32()); + break; + case 3: + message.backgroundColor = $root.google.type.Color.decode(reader, reader.uint32()); + break; + case 4: + message.fontWeight = reader.string(); + break; + case 5: + message.textStyle = reader.string(); + break; + case 6: + message.textDecoration = reader.string(); + break; + case 7: + message.fontSize = $root.google.cloud.documentai.v1beta2.Document.Style.FontSize.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Style message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Style + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.Style} Style + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Style.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Style message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.Style + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Style.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) { + var error = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.verify(message.textAnchor); + if (error) + return "textAnchor." + error; + } + if (message.color != null && message.hasOwnProperty("color")) { + var error = $root.google.type.Color.verify(message.color); + if (error) + return "color." + error; + } + if (message.backgroundColor != null && message.hasOwnProperty("backgroundColor")) { + var error = $root.google.type.Color.verify(message.backgroundColor); + if (error) + return "backgroundColor." + error; + } + if (message.fontWeight != null && message.hasOwnProperty("fontWeight")) + if (!$util.isString(message.fontWeight)) + return "fontWeight: string expected"; + if (message.textStyle != null && message.hasOwnProperty("textStyle")) + if (!$util.isString(message.textStyle)) + return "textStyle: string expected"; + if (message.textDecoration != null && message.hasOwnProperty("textDecoration")) + if (!$util.isString(message.textDecoration)) + return "textDecoration: string expected"; + if (message.fontSize != null && message.hasOwnProperty("fontSize")) { + var error = $root.google.cloud.documentai.v1beta2.Document.Style.FontSize.verify(message.fontSize); + if (error) + return "fontSize." + error; + } + return null; + }; + + /** + * Creates a Style message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.Style + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.Style} Style + */ + Style.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.Style) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.Style(); + if (object.textAnchor != null) { + if (typeof object.textAnchor !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Style.textAnchor: object expected"); + message.textAnchor = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.fromObject(object.textAnchor); + } + if (object.color != null) { + if (typeof object.color !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Style.color: object expected"); + message.color = $root.google.type.Color.fromObject(object.color); + } + if (object.backgroundColor != null) { + if (typeof object.backgroundColor !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Style.backgroundColor: object expected"); + message.backgroundColor = $root.google.type.Color.fromObject(object.backgroundColor); + } + if (object.fontWeight != null) + message.fontWeight = String(object.fontWeight); + if (object.textStyle != null) + message.textStyle = String(object.textStyle); + if (object.textDecoration != null) + message.textDecoration = String(object.textDecoration); + if (object.fontSize != null) { + if (typeof object.fontSize !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Style.fontSize: object expected"); + message.fontSize = $root.google.cloud.documentai.v1beta2.Document.Style.FontSize.fromObject(object.fontSize); + } + return message; + }; + + /** + * Creates a plain object from a Style message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.Style + * @static + * @param {google.cloud.documentai.v1beta2.Document.Style} message Style + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Style.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.textAnchor = null; + object.color = null; + object.backgroundColor = null; + object.fontWeight = ""; + object.textStyle = ""; + object.textDecoration = ""; + object.fontSize = null; + } + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + object.textAnchor = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.toObject(message.textAnchor, options); + if (message.color != null && message.hasOwnProperty("color")) + object.color = $root.google.type.Color.toObject(message.color, options); + if (message.backgroundColor != null && message.hasOwnProperty("backgroundColor")) + object.backgroundColor = $root.google.type.Color.toObject(message.backgroundColor, options); + if (message.fontWeight != null && message.hasOwnProperty("fontWeight")) + object.fontWeight = message.fontWeight; + if (message.textStyle != null && message.hasOwnProperty("textStyle")) + object.textStyle = message.textStyle; + if (message.textDecoration != null && message.hasOwnProperty("textDecoration")) + object.textDecoration = message.textDecoration; + if (message.fontSize != null && message.hasOwnProperty("fontSize")) + object.fontSize = $root.google.cloud.documentai.v1beta2.Document.Style.FontSize.toObject(message.fontSize, options); + return object; + }; + + /** + * Converts this Style to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.Style + * @instance + * @returns {Object.} JSON object + */ + Style.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Style.FontSize = (function() { + + /** + * Properties of a FontSize. + * @memberof google.cloud.documentai.v1beta2.Document.Style + * @interface IFontSize + * @property {number|null} [size] FontSize size + * @property {string|null} [unit] FontSize unit + */ + + /** + * Constructs a new FontSize. + * @memberof google.cloud.documentai.v1beta2.Document.Style + * @classdesc Represents a FontSize. + * @implements IFontSize + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.Style.IFontSize=} [properties] Properties to set + */ + function FontSize(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FontSize size. + * @member {number} size + * @memberof google.cloud.documentai.v1beta2.Document.Style.FontSize + * @instance + */ + FontSize.prototype.size = 0; + + /** + * FontSize unit. + * @member {string} unit + * @memberof google.cloud.documentai.v1beta2.Document.Style.FontSize + * @instance + */ + FontSize.prototype.unit = ""; + + /** + * Creates a new FontSize instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.Style.FontSize + * @static + * @param {google.cloud.documentai.v1beta2.Document.Style.IFontSize=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.Style.FontSize} FontSize instance + */ + FontSize.create = function create(properties) { + return new FontSize(properties); + }; + + /** + * Encodes the specified FontSize message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Style.FontSize.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.Style.FontSize + * @static + * @param {google.cloud.documentai.v1beta2.Document.Style.IFontSize} message FontSize message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FontSize.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.size != null && message.hasOwnProperty("size")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.size); + if (message.unit != null && message.hasOwnProperty("unit")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.unit); + return writer; + }; + + /** + * Encodes the specified FontSize message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Style.FontSize.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Style.FontSize + * @static + * @param {google.cloud.documentai.v1beta2.Document.Style.IFontSize} message FontSize message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FontSize.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FontSize message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.Style.FontSize + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.Style.FontSize} FontSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FontSize.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.Style.FontSize(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.size = reader.float(); + break; + case 2: + message.unit = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FontSize message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Style.FontSize + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.Style.FontSize} FontSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FontSize.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FontSize message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.Style.FontSize + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FontSize.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.size != null && message.hasOwnProperty("size")) + if (typeof message.size !== "number") + return "size: number expected"; + if (message.unit != null && message.hasOwnProperty("unit")) + if (!$util.isString(message.unit)) + return "unit: string expected"; + return null; + }; + + /** + * Creates a FontSize message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.Style.FontSize + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.Style.FontSize} FontSize + */ + FontSize.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.Style.FontSize) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.Style.FontSize(); + if (object.size != null) + message.size = Number(object.size); + if (object.unit != null) + message.unit = String(object.unit); + return message; + }; + + /** + * Creates a plain object from a FontSize message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.Style.FontSize + * @static + * @param {google.cloud.documentai.v1beta2.Document.Style.FontSize} message FontSize + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FontSize.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.size = 0; + object.unit = ""; + } + if (message.size != null && message.hasOwnProperty("size")) + object.size = options.json && !isFinite(message.size) ? String(message.size) : message.size; + if (message.unit != null && message.hasOwnProperty("unit")) + object.unit = message.unit; + return object; + }; + + /** + * Converts this FontSize to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.Style.FontSize + * @instance + * @returns {Object.} JSON object + */ + FontSize.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FontSize; + })(); + + return Style; + })(); + + Document.Page = (function() { + + /** + * Properties of a Page. + * @memberof google.cloud.documentai.v1beta2.Document + * @interface IPage + * @property {number|null} [pageNumber] Page pageNumber + * @property {google.cloud.documentai.v1beta2.Document.Page.IDimension|null} [dimension] Page dimension + * @property {google.cloud.documentai.v1beta2.Document.Page.ILayout|null} [layout] Page layout + * @property {Array.|null} [detectedLanguages] Page detectedLanguages + * @property {Array.|null} [blocks] Page blocks + * @property {Array.|null} [paragraphs] Page paragraphs + * @property {Array.|null} [lines] Page lines + * @property {Array.|null} [tokens] Page tokens + * @property {Array.|null} [visualElements] Page visualElements + * @property {Array.|null} [tables] Page tables + * @property {Array.|null} [formFields] Page formFields + */ + + /** + * Constructs a new Page. + * @memberof google.cloud.documentai.v1beta2.Document + * @classdesc Represents a Page. + * @implements IPage + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.IPage=} [properties] Properties to set + */ + function Page(properties) { + this.detectedLanguages = []; + this.blocks = []; + this.paragraphs = []; + this.lines = []; + this.tokens = []; + this.visualElements = []; + this.tables = []; + this.formFields = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Page pageNumber. + * @member {number} pageNumber + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @instance + */ + Page.prototype.pageNumber = 0; + + /** + * Page dimension. + * @member {google.cloud.documentai.v1beta2.Document.Page.IDimension|null|undefined} dimension + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @instance + */ + Page.prototype.dimension = null; + + /** + * Page layout. + * @member {google.cloud.documentai.v1beta2.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @instance + */ + Page.prototype.layout = null; + + /** + * Page detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @instance + */ + Page.prototype.detectedLanguages = $util.emptyArray; + + /** + * Page blocks. + * @member {Array.} blocks + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @instance + */ + Page.prototype.blocks = $util.emptyArray; + + /** + * Page paragraphs. + * @member {Array.} paragraphs + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @instance + */ + Page.prototype.paragraphs = $util.emptyArray; + + /** + * Page lines. + * @member {Array.} lines + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @instance + */ + Page.prototype.lines = $util.emptyArray; + + /** + * Page tokens. + * @member {Array.} tokens + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @instance + */ + Page.prototype.tokens = $util.emptyArray; + + /** + * Page visualElements. + * @member {Array.} visualElements + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @instance + */ + Page.prototype.visualElements = $util.emptyArray; + + /** + * Page tables. + * @member {Array.} tables + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @instance + */ + Page.prototype.tables = $util.emptyArray; + + /** + * Page formFields. + * @member {Array.} formFields + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @instance + */ + Page.prototype.formFields = $util.emptyArray; + + /** + * Creates a new Page instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @static + * @param {google.cloud.documentai.v1beta2.Document.IPage=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.Page} Page instance + */ + Page.create = function create(properties) { + return new Page(properties); + }; + + /** + * Encodes the specified Page message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @static + * @param {google.cloud.documentai.v1beta2.Document.IPage} message Page message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Page.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.pageNumber); + if (message.dimension != null && message.hasOwnProperty("dimension")) + $root.google.cloud.documentai.v1beta2.Document.Page.Dimension.encode(message.dimension, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.layout != null && message.hasOwnProperty("layout")) + $root.google.cloud.documentai.v1beta2.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.blocks != null && message.blocks.length) + for (var i = 0; i < message.blocks.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.Block.encode(message.blocks[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.paragraphs != null && message.paragraphs.length) + for (var i = 0; i < message.paragraphs.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.Paragraph.encode(message.paragraphs[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.lines != null && message.lines.length) + for (var i = 0; i < message.lines.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.Line.encode(message.lines[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.tokens != null && message.tokens.length) + for (var i = 0; i < message.tokens.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.Token.encode(message.tokens[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.visualElements != null && message.visualElements.length) + for (var i = 0; i < message.visualElements.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.VisualElement.encode(message.visualElements[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.tables != null && message.tables.length) + for (var i = 0; i < message.tables.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.Table.encode(message.tables[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.formFields != null && message.formFields.length) + for (var i = 0; i < message.formFields.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.FormField.encode(message.formFields[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Page message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @static + * @param {google.cloud.documentai.v1beta2.Document.IPage} message Page message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Page.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Page message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.Page} Page + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Page.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.Page(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pageNumber = reader.int32(); + break; + case 2: + message.dimension = $root.google.cloud.documentai.v1beta2.Document.Page.Dimension.decode(reader, reader.uint32()); + break; + case 3: + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.blocks && message.blocks.length)) + message.blocks = []; + message.blocks.push($root.google.cloud.documentai.v1beta2.Document.Page.Block.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.paragraphs && message.paragraphs.length)) + message.paragraphs = []; + message.paragraphs.push($root.google.cloud.documentai.v1beta2.Document.Page.Paragraph.decode(reader, reader.uint32())); + break; + case 7: + if (!(message.lines && message.lines.length)) + message.lines = []; + message.lines.push($root.google.cloud.documentai.v1beta2.Document.Page.Line.decode(reader, reader.uint32())); + break; + case 8: + if (!(message.tokens && message.tokens.length)) + message.tokens = []; + message.tokens.push($root.google.cloud.documentai.v1beta2.Document.Page.Token.decode(reader, reader.uint32())); + break; + case 9: + if (!(message.visualElements && message.visualElements.length)) + message.visualElements = []; + message.visualElements.push($root.google.cloud.documentai.v1beta2.Document.Page.VisualElement.decode(reader, reader.uint32())); + break; + case 10: + if (!(message.tables && message.tables.length)) + message.tables = []; + message.tables.push($root.google.cloud.documentai.v1beta2.Document.Page.Table.decode(reader, reader.uint32())); + break; + case 11: + if (!(message.formFields && message.formFields.length)) + message.formFields = []; + message.formFields.push($root.google.cloud.documentai.v1beta2.Document.Page.FormField.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Page message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.Page} Page + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Page.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Page message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Page.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + if (!$util.isInteger(message.pageNumber)) + return "pageNumber: integer expected"; + if (message.dimension != null && message.hasOwnProperty("dimension")) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.Dimension.verify(message.dimension); + if (error) + return "dimension." + error; + } + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + if (message.blocks != null && message.hasOwnProperty("blocks")) { + if (!Array.isArray(message.blocks)) + return "blocks: array expected"; + for (var i = 0; i < message.blocks.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.Block.verify(message.blocks[i]); + if (error) + return "blocks." + error; + } + } + if (message.paragraphs != null && message.hasOwnProperty("paragraphs")) { + if (!Array.isArray(message.paragraphs)) + return "paragraphs: array expected"; + for (var i = 0; i < message.paragraphs.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.Paragraph.verify(message.paragraphs[i]); + if (error) + return "paragraphs." + error; + } + } + if (message.lines != null && message.hasOwnProperty("lines")) { + if (!Array.isArray(message.lines)) + return "lines: array expected"; + for (var i = 0; i < message.lines.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.Line.verify(message.lines[i]); + if (error) + return "lines." + error; + } + } + if (message.tokens != null && message.hasOwnProperty("tokens")) { + if (!Array.isArray(message.tokens)) + return "tokens: array expected"; + for (var i = 0; i < message.tokens.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.Token.verify(message.tokens[i]); + if (error) + return "tokens." + error; + } + } + if (message.visualElements != null && message.hasOwnProperty("visualElements")) { + if (!Array.isArray(message.visualElements)) + return "visualElements: array expected"; + for (var i = 0; i < message.visualElements.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.VisualElement.verify(message.visualElements[i]); + if (error) + return "visualElements." + error; + } + } + if (message.tables != null && message.hasOwnProperty("tables")) { + if (!Array.isArray(message.tables)) + return "tables: array expected"; + for (var i = 0; i < message.tables.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.Table.verify(message.tables[i]); + if (error) + return "tables." + error; + } + } + if (message.formFields != null && message.hasOwnProperty("formFields")) { + if (!Array.isArray(message.formFields)) + return "formFields: array expected"; + for (var i = 0; i < message.formFields.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.FormField.verify(message.formFields[i]); + if (error) + return "formFields." + error; + } + } + return null; + }; + + /** + * Creates a Page message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.Page} Page + */ + Page.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.Page) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.Page(); + if (object.pageNumber != null) + message.pageNumber = object.pageNumber | 0; + if (object.dimension != null) { + if (typeof object.dimension !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.dimension: object expected"); + message.dimension = $root.google.cloud.documentai.v1beta2.Document.Page.Dimension.fromObject(object.dimension); + } + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + if (object.blocks) { + if (!Array.isArray(object.blocks)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.blocks: array expected"); + message.blocks = []; + for (var i = 0; i < object.blocks.length; ++i) { + if (typeof object.blocks[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.blocks: object expected"); + message.blocks[i] = $root.google.cloud.documentai.v1beta2.Document.Page.Block.fromObject(object.blocks[i]); + } + } + if (object.paragraphs) { + if (!Array.isArray(object.paragraphs)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.paragraphs: array expected"); + message.paragraphs = []; + for (var i = 0; i < object.paragraphs.length; ++i) { + if (typeof object.paragraphs[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.paragraphs: object expected"); + message.paragraphs[i] = $root.google.cloud.documentai.v1beta2.Document.Page.Paragraph.fromObject(object.paragraphs[i]); + } + } + if (object.lines) { + if (!Array.isArray(object.lines)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.lines: array expected"); + message.lines = []; + for (var i = 0; i < object.lines.length; ++i) { + if (typeof object.lines[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.lines: object expected"); + message.lines[i] = $root.google.cloud.documentai.v1beta2.Document.Page.Line.fromObject(object.lines[i]); + } + } + if (object.tokens) { + if (!Array.isArray(object.tokens)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.tokens: array expected"); + message.tokens = []; + for (var i = 0; i < object.tokens.length; ++i) { + if (typeof object.tokens[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.tokens: object expected"); + message.tokens[i] = $root.google.cloud.documentai.v1beta2.Document.Page.Token.fromObject(object.tokens[i]); + } + } + if (object.visualElements) { + if (!Array.isArray(object.visualElements)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.visualElements: array expected"); + message.visualElements = []; + for (var i = 0; i < object.visualElements.length; ++i) { + if (typeof object.visualElements[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.visualElements: object expected"); + message.visualElements[i] = $root.google.cloud.documentai.v1beta2.Document.Page.VisualElement.fromObject(object.visualElements[i]); + } + } + if (object.tables) { + if (!Array.isArray(object.tables)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.tables: array expected"); + message.tables = []; + for (var i = 0; i < object.tables.length; ++i) { + if (typeof object.tables[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.tables: object expected"); + message.tables[i] = $root.google.cloud.documentai.v1beta2.Document.Page.Table.fromObject(object.tables[i]); + } + } + if (object.formFields) { + if (!Array.isArray(object.formFields)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.formFields: array expected"); + message.formFields = []; + for (var i = 0; i < object.formFields.length; ++i) { + if (typeof object.formFields[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.formFields: object expected"); + message.formFields[i] = $root.google.cloud.documentai.v1beta2.Document.Page.FormField.fromObject(object.formFields[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Page message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page} message Page + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Page.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.detectedLanguages = []; + object.blocks = []; + object.paragraphs = []; + object.lines = []; + object.tokens = []; + object.visualElements = []; + object.tables = []; + object.formFields = []; + } + if (options.defaults) { + object.pageNumber = 0; + object.dimension = null; + object.layout = null; + } + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + object.pageNumber = message.pageNumber; + if (message.dimension != null && message.hasOwnProperty("dimension")) + object.dimension = $root.google.cloud.documentai.v1beta2.Document.Page.Dimension.toObject(message.dimension, options); + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + if (message.blocks && message.blocks.length) { + object.blocks = []; + for (var j = 0; j < message.blocks.length; ++j) + object.blocks[j] = $root.google.cloud.documentai.v1beta2.Document.Page.Block.toObject(message.blocks[j], options); + } + if (message.paragraphs && message.paragraphs.length) { + object.paragraphs = []; + for (var j = 0; j < message.paragraphs.length; ++j) + object.paragraphs[j] = $root.google.cloud.documentai.v1beta2.Document.Page.Paragraph.toObject(message.paragraphs[j], options); + } + if (message.lines && message.lines.length) { + object.lines = []; + for (var j = 0; j < message.lines.length; ++j) + object.lines[j] = $root.google.cloud.documentai.v1beta2.Document.Page.Line.toObject(message.lines[j], options); + } + if (message.tokens && message.tokens.length) { + object.tokens = []; + for (var j = 0; j < message.tokens.length; ++j) + object.tokens[j] = $root.google.cloud.documentai.v1beta2.Document.Page.Token.toObject(message.tokens[j], options); + } + if (message.visualElements && message.visualElements.length) { + object.visualElements = []; + for (var j = 0; j < message.visualElements.length; ++j) + object.visualElements[j] = $root.google.cloud.documentai.v1beta2.Document.Page.VisualElement.toObject(message.visualElements[j], options); + } + if (message.tables && message.tables.length) { + object.tables = []; + for (var j = 0; j < message.tables.length; ++j) + object.tables[j] = $root.google.cloud.documentai.v1beta2.Document.Page.Table.toObject(message.tables[j], options); + } + if (message.formFields && message.formFields.length) { + object.formFields = []; + for (var j = 0; j < message.formFields.length; ++j) + object.formFields[j] = $root.google.cloud.documentai.v1beta2.Document.Page.FormField.toObject(message.formFields[j], options); + } + return object; + }; + + /** + * Converts this Page to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @instance + * @returns {Object.} JSON object + */ + Page.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Page.Dimension = (function() { + + /** + * Properties of a Dimension. + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @interface IDimension + * @property {number|null} [width] Dimension width + * @property {number|null} [height] Dimension height + * @property {string|null} [unit] Dimension unit + */ + + /** + * Constructs a new Dimension. + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @classdesc Represents a Dimension. + * @implements IDimension + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.Page.IDimension=} [properties] Properties to set + */ + function Dimension(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Dimension width. + * @member {number} width + * @memberof google.cloud.documentai.v1beta2.Document.Page.Dimension + * @instance + */ + Dimension.prototype.width = 0; + + /** + * Dimension height. + * @member {number} height + * @memberof google.cloud.documentai.v1beta2.Document.Page.Dimension + * @instance + */ + Dimension.prototype.height = 0; + + /** + * Dimension unit. + * @member {string} unit + * @memberof google.cloud.documentai.v1beta2.Document.Page.Dimension + * @instance + */ + Dimension.prototype.unit = ""; + + /** + * Creates a new Dimension instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.Page.Dimension + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IDimension=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.Page.Dimension} Dimension instance + */ + Dimension.create = function create(properties) { + return new Dimension(properties); + }; + + /** + * Encodes the specified Dimension message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Dimension.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.Page.Dimension + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IDimension} message Dimension message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Dimension.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.width != null && message.hasOwnProperty("width")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.width); + if (message.height != null && message.hasOwnProperty("height")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.height); + if (message.unit != null && message.hasOwnProperty("unit")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unit); + return writer; + }; + + /** + * Encodes the specified Dimension message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Dimension.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.Dimension + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IDimension} message Dimension message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Dimension.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Dimension message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.Page.Dimension + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.Page.Dimension} Dimension + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Dimension.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.Page.Dimension(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.width = reader.float(); + break; + case 2: + message.height = reader.float(); + break; + case 3: + message.unit = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Dimension message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.Dimension + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.Page.Dimension} Dimension + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Dimension.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Dimension message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.Page.Dimension + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Dimension.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (typeof message.width !== "number") + return "width: number expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height !== "number") + return "height: number expected"; + if (message.unit != null && message.hasOwnProperty("unit")) + if (!$util.isString(message.unit)) + return "unit: string expected"; + return null; + }; + + /** + * Creates a Dimension message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.Dimension + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.Page.Dimension} Dimension + */ + Dimension.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.Page.Dimension) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.Page.Dimension(); + if (object.width != null) + message.width = Number(object.width); + if (object.height != null) + message.height = Number(object.height); + if (object.unit != null) + message.unit = String(object.unit); + return message; + }; + + /** + * Creates a plain object from a Dimension message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.Dimension + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.Dimension} message Dimension + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Dimension.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.width = 0; + object.height = 0; + object.unit = ""; + } + if (message.width != null && message.hasOwnProperty("width")) + object.width = options.json && !isFinite(message.width) ? String(message.width) : message.width; + if (message.height != null && message.hasOwnProperty("height")) + object.height = options.json && !isFinite(message.height) ? String(message.height) : message.height; + if (message.unit != null && message.hasOwnProperty("unit")) + object.unit = message.unit; + return object; + }; + + /** + * Converts this Dimension to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.Page.Dimension + * @instance + * @returns {Object.} JSON object + */ + Dimension.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Dimension; + })(); + + Page.Layout = (function() { + + /** + * Properties of a Layout. + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @interface ILayout + * @property {google.cloud.documentai.v1beta2.Document.ITextAnchor|null} [textAnchor] Layout textAnchor + * @property {number|null} [confidence] Layout confidence + * @property {google.cloud.documentai.v1beta2.IBoundingPoly|null} [boundingPoly] Layout boundingPoly + * @property {google.cloud.documentai.v1beta2.Document.Page.Layout.Orientation|null} [orientation] Layout orientation + * @property {string|null} [id] Layout id + */ + + /** + * Constructs a new Layout. + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @classdesc Represents a Layout. + * @implements ILayout + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.Page.ILayout=} [properties] Properties to set + */ + function Layout(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Layout textAnchor. + * @member {google.cloud.documentai.v1beta2.Document.ITextAnchor|null|undefined} textAnchor + * @memberof google.cloud.documentai.v1beta2.Document.Page.Layout + * @instance + */ + Layout.prototype.textAnchor = null; + + /** + * Layout confidence. + * @member {number} confidence + * @memberof google.cloud.documentai.v1beta2.Document.Page.Layout + * @instance + */ + Layout.prototype.confidence = 0; + + /** + * Layout boundingPoly. + * @member {google.cloud.documentai.v1beta2.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.documentai.v1beta2.Document.Page.Layout + * @instance + */ + Layout.prototype.boundingPoly = null; + + /** + * Layout orientation. + * @member {google.cloud.documentai.v1beta2.Document.Page.Layout.Orientation} orientation + * @memberof google.cloud.documentai.v1beta2.Document.Page.Layout + * @instance + */ + Layout.prototype.orientation = 0; + + /** + * Layout id. + * @member {string} id + * @memberof google.cloud.documentai.v1beta2.Document.Page.Layout + * @instance + */ + Layout.prototype.id = ""; + + /** + * Creates a new Layout instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.Page.Layout + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.ILayout=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.Page.Layout} Layout instance + */ + Layout.create = function create(properties) { + return new Layout(properties); + }; + + /** + * Encodes the specified Layout message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Layout.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.Page.Layout + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.ILayout} message Layout message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Layout.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + $root.google.cloud.documentai.v1beta2.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.confidence != null && message.hasOwnProperty("confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + $root.google.cloud.documentai.v1beta2.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.orientation != null && message.hasOwnProperty("orientation")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.orientation); + if (message.id != null && message.hasOwnProperty("id")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.id); + return writer; + }; + + /** + * Encodes the specified Layout message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Layout.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.Layout + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.ILayout} message Layout message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Layout.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Layout message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.Page.Layout + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.Page.Layout} Layout + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Layout.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.Page.Layout(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.textAnchor = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.decode(reader, reader.uint32()); + break; + case 2: + message.confidence = reader.float(); + break; + case 3: + message.boundingPoly = $root.google.cloud.documentai.v1beta2.BoundingPoly.decode(reader, reader.uint32()); + break; + case 4: + message.orientation = reader.int32(); + break; + case 5: + message.id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Layout message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.Layout + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.Page.Layout} Layout + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Layout.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Layout message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.Page.Layout + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Layout.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) { + var error = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.verify(message.textAnchor); + if (error) + return "textAnchor." + error; + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { + var error = $root.google.cloud.documentai.v1beta2.BoundingPoly.verify(message.boundingPoly); + if (error) + return "boundingPoly." + error; + } + if (message.orientation != null && message.hasOwnProperty("orientation")) + switch (message.orientation) { + default: + return "orientation: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + return null; + }; + + /** + * Creates a Layout message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.Layout + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.Page.Layout} Layout + */ + Layout.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.Page.Layout) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.Page.Layout(); + if (object.textAnchor != null) { + if (typeof object.textAnchor !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Layout.textAnchor: object expected"); + message.textAnchor = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.fromObject(object.textAnchor); + } + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Layout.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.documentai.v1beta2.BoundingPoly.fromObject(object.boundingPoly); + } + switch (object.orientation) { + case "ORIENTATION_UNSPECIFIED": + case 0: + message.orientation = 0; + break; + case "PAGE_UP": + case 1: + message.orientation = 1; + break; + case "PAGE_RIGHT": + case 2: + message.orientation = 2; + break; + case "PAGE_DOWN": + case 3: + message.orientation = 3; + break; + case "PAGE_LEFT": + case 4: + message.orientation = 4; + break; + } + if (object.id != null) + message.id = String(object.id); + return message; + }; + + /** + * Creates a plain object from a Layout message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.Layout + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.Layout} message Layout + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Layout.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.textAnchor = null; + object.confidence = 0; + object.boundingPoly = null; + object.orientation = options.enums === String ? "ORIENTATION_UNSPECIFIED" : 0; + object.id = ""; + } + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + object.textAnchor = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.toObject(message.textAnchor, options); + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.documentai.v1beta2.BoundingPoly.toObject(message.boundingPoly, options); + if (message.orientation != null && message.hasOwnProperty("orientation")) + object.orientation = options.enums === String ? $root.google.cloud.documentai.v1beta2.Document.Page.Layout.Orientation[message.orientation] : message.orientation; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + return object; + }; + + /** + * Converts this Layout to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.Page.Layout + * @instance + * @returns {Object.} JSON object + */ + Layout.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Orientation enum. + * @name google.cloud.documentai.v1beta2.Document.Page.Layout.Orientation + * @enum {string} + * @property {number} ORIENTATION_UNSPECIFIED=0 ORIENTATION_UNSPECIFIED value + * @property {number} PAGE_UP=1 PAGE_UP value + * @property {number} PAGE_RIGHT=2 PAGE_RIGHT value + * @property {number} PAGE_DOWN=3 PAGE_DOWN value + * @property {number} PAGE_LEFT=4 PAGE_LEFT value + */ + Layout.Orientation = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ORIENTATION_UNSPECIFIED"] = 0; + values[valuesById[1] = "PAGE_UP"] = 1; + values[valuesById[2] = "PAGE_RIGHT"] = 2; + values[valuesById[3] = "PAGE_DOWN"] = 3; + values[valuesById[4] = "PAGE_LEFT"] = 4; + return values; + })(); + + return Layout; + })(); + + Page.Block = (function() { + + /** + * Properties of a Block. + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @interface IBlock + * @property {google.cloud.documentai.v1beta2.Document.Page.ILayout|null} [layout] Block layout + * @property {Array.|null} [detectedLanguages] Block detectedLanguages + */ + + /** + * Constructs a new Block. + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @classdesc Represents a Block. + * @implements IBlock + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.Page.IBlock=} [properties] Properties to set + */ + function Block(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Block layout. + * @member {google.cloud.documentai.v1beta2.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta2.Document.Page.Block + * @instance + */ + Block.prototype.layout = null; + + /** + * Block detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta2.Document.Page.Block + * @instance + */ + Block.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new Block instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.Page.Block + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IBlock=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.Page.Block} Block instance + */ + Block.create = function create(properties) { + return new Block(properties); + }; + + /** + * Encodes the specified Block message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Block.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.Page.Block + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IBlock} message Block message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Block.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && message.hasOwnProperty("layout")) + $root.google.cloud.documentai.v1beta2.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Block message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Block.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.Block + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IBlock} message Block message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Block.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Block message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.Page.Block + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.Page.Block} Block + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Block.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.Page.Block(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Block message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.Block + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.Page.Block} Block + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Block.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Block message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.Page.Block + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Block.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a Block message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.Block + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.Page.Block} Block + */ + Block.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.Page.Block) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.Page.Block(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Block.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Block.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Block.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Block message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.Block + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.Block} message Block + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Block.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) + object.layout = null; + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this Block to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.Page.Block + * @instance + * @returns {Object.} JSON object + */ + Block.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Block; + })(); + + Page.Paragraph = (function() { + + /** + * Properties of a Paragraph. + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @interface IParagraph + * @property {google.cloud.documentai.v1beta2.Document.Page.ILayout|null} [layout] Paragraph layout + * @property {Array.|null} [detectedLanguages] Paragraph detectedLanguages + */ + + /** + * Constructs a new Paragraph. + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @classdesc Represents a Paragraph. + * @implements IParagraph + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.Page.IParagraph=} [properties] Properties to set + */ + function Paragraph(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Paragraph layout. + * @member {google.cloud.documentai.v1beta2.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta2.Document.Page.Paragraph + * @instance + */ + Paragraph.prototype.layout = null; + + /** + * Paragraph detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta2.Document.Page.Paragraph + * @instance + */ + Paragraph.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new Paragraph instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.Page.Paragraph + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IParagraph=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.Page.Paragraph} Paragraph instance + */ + Paragraph.create = function create(properties) { + return new Paragraph(properties); + }; + + /** + * Encodes the specified Paragraph message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Paragraph.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.Page.Paragraph + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IParagraph} message Paragraph message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Paragraph.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && message.hasOwnProperty("layout")) + $root.google.cloud.documentai.v1beta2.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Paragraph message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Paragraph.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.Paragraph + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IParagraph} message Paragraph message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Paragraph.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Paragraph message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.Page.Paragraph + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.Page.Paragraph} Paragraph + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Paragraph.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.Page.Paragraph(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Paragraph message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.Paragraph + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.Page.Paragraph} Paragraph + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Paragraph.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Paragraph message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.Page.Paragraph + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Paragraph.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a Paragraph message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.Paragraph + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.Page.Paragraph} Paragraph + */ + Paragraph.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.Page.Paragraph) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.Page.Paragraph(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Paragraph.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Paragraph.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Paragraph.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Paragraph message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.Paragraph + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.Paragraph} message Paragraph + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Paragraph.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) + object.layout = null; + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this Paragraph to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.Page.Paragraph + * @instance + * @returns {Object.} JSON object + */ + Paragraph.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Paragraph; + })(); + + Page.Line = (function() { + + /** + * Properties of a Line. + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @interface ILine + * @property {google.cloud.documentai.v1beta2.Document.Page.ILayout|null} [layout] Line layout + * @property {Array.|null} [detectedLanguages] Line detectedLanguages + */ + + /** + * Constructs a new Line. + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @classdesc Represents a Line. + * @implements ILine + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.Page.ILine=} [properties] Properties to set + */ + function Line(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Line layout. + * @member {google.cloud.documentai.v1beta2.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta2.Document.Page.Line + * @instance + */ + Line.prototype.layout = null; + + /** + * Line detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta2.Document.Page.Line + * @instance + */ + Line.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new Line instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.Page.Line + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.ILine=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.Page.Line} Line instance + */ + Line.create = function create(properties) { + return new Line(properties); + }; + + /** + * Encodes the specified Line message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Line.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.Page.Line + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.ILine} message Line message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Line.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && message.hasOwnProperty("layout")) + $root.google.cloud.documentai.v1beta2.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Line message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Line.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.Line + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.ILine} message Line message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Line.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Line message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.Page.Line + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.Page.Line} Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Line.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.Page.Line(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Line message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.Line + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.Page.Line} Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Line.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Line message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.Page.Line + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Line.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a Line message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.Line + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.Page.Line} Line + */ + Line.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.Page.Line) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.Page.Line(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Line.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Line.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Line.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Line message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.Line + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.Line} message Line + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Line.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) + object.layout = null; + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this Line to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.Page.Line + * @instance + * @returns {Object.} JSON object + */ + Line.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Line; + })(); + + Page.Token = (function() { + + /** + * Properties of a Token. + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @interface IToken + * @property {google.cloud.documentai.v1beta2.Document.Page.ILayout|null} [layout] Token layout + * @property {google.cloud.documentai.v1beta2.Document.Page.Token.IDetectedBreak|null} [detectedBreak] Token detectedBreak + * @property {Array.|null} [detectedLanguages] Token detectedLanguages + */ + + /** + * Constructs a new Token. + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @classdesc Represents a Token. + * @implements IToken + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.Page.IToken=} [properties] Properties to set + */ + function Token(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Token layout. + * @member {google.cloud.documentai.v1beta2.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token + * @instance + */ + Token.prototype.layout = null; + + /** + * Token detectedBreak. + * @member {google.cloud.documentai.v1beta2.Document.Page.Token.IDetectedBreak|null|undefined} detectedBreak + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token + * @instance + */ + Token.prototype.detectedBreak = null; + + /** + * Token detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token + * @instance + */ + Token.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new Token instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IToken=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.Page.Token} Token instance + */ + Token.create = function create(properties) { + return new Token(properties); + }; + + /** + * Encodes the specified Token message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Token.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IToken} message Token message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Token.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && message.hasOwnProperty("layout")) + $root.google.cloud.documentai.v1beta2.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) + $root.google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.encode(message.detectedBreak, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Token message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Token.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IToken} message Token message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Token.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Token message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.Page.Token} Token + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Token.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.Page.Token(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + message.detectedBreak = $root.google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.decode(reader, reader.uint32()); + break; + case 3: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Token message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.Page.Token} Token + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Token.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Token message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Token.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.verify(message.detectedBreak); + if (error) + return "detectedBreak." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a Token message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.Page.Token} Token + */ + Token.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.Page.Token) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.Page.Token(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Token.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedBreak != null) { + if (typeof object.detectedBreak !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Token.detectedBreak: object expected"); + message.detectedBreak = $root.google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.fromObject(object.detectedBreak); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Token.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Token.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Token message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.Token} message Token + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Token.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) { + object.layout = null; + object.detectedBreak = null; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) + object.detectedBreak = $root.google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.toObject(message.detectedBreak, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this Token to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token + * @instance + * @returns {Object.} JSON object + */ + Token.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Token.DetectedBreak = (function() { + + /** + * Properties of a DetectedBreak. + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token + * @interface IDetectedBreak + * @property {google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.Type|null} [type] DetectedBreak type + */ + + /** + * Constructs a new DetectedBreak. + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token + * @classdesc Represents a DetectedBreak. + * @implements IDetectedBreak + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.Page.Token.IDetectedBreak=} [properties] Properties to set + */ + function DetectedBreak(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DetectedBreak type. + * @member {google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.Type} type + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak + * @instance + */ + DetectedBreak.prototype.type = 0; + + /** + * Creates a new DetectedBreak instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.Token.IDetectedBreak=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak} DetectedBreak instance + */ + DetectedBreak.create = function create(properties) { + return new DetectedBreak(properties); + }; + + /** + * Encodes the specified DetectedBreak message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.Token.IDetectedBreak} message DetectedBreak message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedBreak.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); + return writer; + }; + + /** + * Encodes the specified DetectedBreak message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.Token.IDetectedBreak} message DetectedBreak message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedBreak.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectedBreak message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak} DetectedBreak + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedBreak.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectedBreak message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak} DetectedBreak + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedBreak.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectedBreak message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectedBreak.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object 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; + } + return null; + }; + + /** + * Creates a DetectedBreak message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak} DetectedBreak + */ + DetectedBreak.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak(); + switch (object.type) { + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "SPACE": + case 1: + message.type = 1; + break; + case "WIDE_SPACE": + case 2: + message.type = 2; + break; + case "HYPHEN": + case 3: + message.type = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a DetectedBreak message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak} message DetectedBreak + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectedBreak.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.Type[message.type] : message.type; + return object; + }; + + /** + * Converts this DetectedBreak to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak + * @instance + * @returns {Object.} JSON object + */ + DetectedBreak.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Type enum. + * @name google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.Type + * @enum {string} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} SPACE=1 SPACE value + * @property {number} WIDE_SPACE=2 WIDE_SPACE value + * @property {number} HYPHEN=3 HYPHEN value + */ + DetectedBreak.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SPACE"] = 1; + values[valuesById[2] = "WIDE_SPACE"] = 2; + values[valuesById[3] = "HYPHEN"] = 3; + return values; + })(); + + return DetectedBreak; + })(); + + return Token; + })(); + + Page.VisualElement = (function() { + + /** + * Properties of a VisualElement. + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @interface IVisualElement + * @property {google.cloud.documentai.v1beta2.Document.Page.ILayout|null} [layout] VisualElement layout + * @property {string|null} [type] VisualElement type + * @property {Array.|null} [detectedLanguages] VisualElement detectedLanguages + */ + + /** + * Constructs a new VisualElement. + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @classdesc Represents a VisualElement. + * @implements IVisualElement + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.Page.IVisualElement=} [properties] Properties to set + */ + function VisualElement(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * VisualElement layout. + * @member {google.cloud.documentai.v1beta2.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta2.Document.Page.VisualElement + * @instance + */ + VisualElement.prototype.layout = null; + + /** + * VisualElement type. + * @member {string} type + * @memberof google.cloud.documentai.v1beta2.Document.Page.VisualElement + * @instance + */ + VisualElement.prototype.type = ""; + + /** + * VisualElement detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta2.Document.Page.VisualElement + * @instance + */ + VisualElement.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new VisualElement instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.Page.VisualElement + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IVisualElement=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.Page.VisualElement} VisualElement instance + */ + VisualElement.create = function create(properties) { + return new VisualElement(properties); + }; + + /** + * Encodes the specified VisualElement message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.VisualElement.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.Page.VisualElement + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IVisualElement} message VisualElement message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisualElement.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && message.hasOwnProperty("layout")) + $root.google.cloud.documentai.v1beta2.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified VisualElement message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.VisualElement.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.VisualElement + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IVisualElement} message VisualElement message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisualElement.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VisualElement message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.Page.VisualElement + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.Page.VisualElement} VisualElement + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisualElement.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.Page.VisualElement(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + message.type = reader.string(); + break; + case 3: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VisualElement message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.VisualElement + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.Page.VisualElement} VisualElement + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisualElement.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VisualElement message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.Page.VisualElement + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VisualElement.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a VisualElement message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.VisualElement + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.Page.VisualElement} VisualElement + */ + VisualElement.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.Page.VisualElement) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.Page.VisualElement(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.VisualElement.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.fromObject(object.layout); + } + if (object.type != null) + message.type = String(object.type); + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.VisualElement.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.VisualElement.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a VisualElement message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.VisualElement + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.VisualElement} message VisualElement + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VisualElement.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) { + object.layout = null; + object.type = ""; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.toObject(message.layout, options); + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this VisualElement to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.Page.VisualElement + * @instance + * @returns {Object.} JSON object + */ + VisualElement.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return VisualElement; + })(); + + Page.Table = (function() { + + /** + * Properties of a Table. + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @interface ITable + * @property {google.cloud.documentai.v1beta2.Document.Page.ILayout|null} [layout] Table layout + * @property {Array.|null} [headerRows] Table headerRows + * @property {Array.|null} [bodyRows] Table bodyRows + * @property {Array.|null} [detectedLanguages] Table detectedLanguages + */ + + /** + * Constructs a new Table. + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @classdesc Represents a Table. + * @implements ITable + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.Page.ITable=} [properties] Properties to set + */ + function Table(properties) { + this.headerRows = []; + this.bodyRows = []; + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Table layout. + * @member {google.cloud.documentai.v1beta2.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table + * @instance + */ + Table.prototype.layout = null; + + /** + * Table headerRows. + * @member {Array.} headerRows + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table + * @instance + */ + Table.prototype.headerRows = $util.emptyArray; + + /** + * Table bodyRows. + * @member {Array.} bodyRows + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table + * @instance + */ + Table.prototype.bodyRows = $util.emptyArray; + + /** + * Table detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table + * @instance + */ + Table.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new Table instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.ITable=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.Page.Table} Table instance + */ + Table.create = function create(properties) { + return new Table(properties); + }; + + /** + * Encodes the specified Table message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Table.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.ITable} message Table message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Table.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && message.hasOwnProperty("layout")) + $root.google.cloud.documentai.v1beta2.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.headerRows != null && message.headerRows.length) + for (var i = 0; i < message.headerRows.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.Table.TableRow.encode(message.headerRows[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bodyRows != null && message.bodyRows.length) + for (var i = 0; i < message.bodyRows.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.Table.TableRow.encode(message.bodyRows[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Table message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Table.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.ITable} message Table message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Table.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Table message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.Page.Table} Table + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Table.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.Page.Table(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.headerRows && message.headerRows.length)) + message.headerRows = []; + message.headerRows.push($root.google.cloud.documentai.v1beta2.Document.Page.Table.TableRow.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.bodyRows && message.bodyRows.length)) + message.bodyRows = []; + message.bodyRows.push($root.google.cloud.documentai.v1beta2.Document.Page.Table.TableRow.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Table message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.Page.Table} Table + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Table.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Table message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Table.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.headerRows != null && message.hasOwnProperty("headerRows")) { + if (!Array.isArray(message.headerRows)) + return "headerRows: array expected"; + for (var i = 0; i < message.headerRows.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.Table.TableRow.verify(message.headerRows[i]); + if (error) + return "headerRows." + error; + } + } + if (message.bodyRows != null && message.hasOwnProperty("bodyRows")) { + if (!Array.isArray(message.bodyRows)) + return "bodyRows: array expected"; + for (var i = 0; i < message.bodyRows.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.Table.TableRow.verify(message.bodyRows[i]); + if (error) + return "bodyRows." + error; + } + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a Table message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.Page.Table} Table + */ + Table.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.Page.Table) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.Page.Table(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Table.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.fromObject(object.layout); + } + if (object.headerRows) { + if (!Array.isArray(object.headerRows)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Table.headerRows: array expected"); + message.headerRows = []; + for (var i = 0; i < object.headerRows.length; ++i) { + if (typeof object.headerRows[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Table.headerRows: object expected"); + message.headerRows[i] = $root.google.cloud.documentai.v1beta2.Document.Page.Table.TableRow.fromObject(object.headerRows[i]); + } + } + if (object.bodyRows) { + if (!Array.isArray(object.bodyRows)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Table.bodyRows: array expected"); + message.bodyRows = []; + for (var i = 0; i < object.bodyRows.length; ++i) { + if (typeof object.bodyRows[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Table.bodyRows: object expected"); + message.bodyRows[i] = $root.google.cloud.documentai.v1beta2.Document.Page.Table.TableRow.fromObject(object.bodyRows[i]); + } + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Table.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Table.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Table message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.Table} message Table + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Table.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.headerRows = []; + object.bodyRows = []; + object.detectedLanguages = []; + } + if (options.defaults) + object.layout = null; + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.toObject(message.layout, options); + if (message.headerRows && message.headerRows.length) { + object.headerRows = []; + for (var j = 0; j < message.headerRows.length; ++j) + object.headerRows[j] = $root.google.cloud.documentai.v1beta2.Document.Page.Table.TableRow.toObject(message.headerRows[j], options); + } + if (message.bodyRows && message.bodyRows.length) { + object.bodyRows = []; + for (var j = 0; j < message.bodyRows.length; ++j) + object.bodyRows[j] = $root.google.cloud.documentai.v1beta2.Document.Page.Table.TableRow.toObject(message.bodyRows[j], options); + } + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this Table to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table + * @instance + * @returns {Object.} JSON object + */ + Table.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Table.TableRow = (function() { + + /** + * Properties of a TableRow. + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table + * @interface ITableRow + * @property {Array.|null} [cells] TableRow cells + */ + + /** + * Constructs a new TableRow. + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table + * @classdesc Represents a TableRow. + * @implements ITableRow + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.Page.Table.ITableRow=} [properties] Properties to set + */ + function TableRow(properties) { + this.cells = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TableRow cells. + * @member {Array.} cells + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableRow + * @instance + */ + TableRow.prototype.cells = $util.emptyArray; + + /** + * Creates a new TableRow instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableRow + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.Table.ITableRow=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.Page.Table.TableRow} TableRow instance + */ + TableRow.create = function create(properties) { + return new TableRow(properties); + }; + + /** + * Encodes the specified TableRow message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Table.TableRow.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableRow + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.Table.ITableRow} message TableRow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableRow.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cells != null && message.cells.length) + for (var i = 0; i < message.cells.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.Table.TableCell.encode(message.cells[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TableRow message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Table.TableRow.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableRow + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.Table.ITableRow} message TableRow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableRow.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableRow message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableRow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.Page.Table.TableRow} TableRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableRow.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.Page.Table.TableRow(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.cells && message.cells.length)) + message.cells = []; + message.cells.push($root.google.cloud.documentai.v1beta2.Document.Page.Table.TableCell.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableRow message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableRow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.Page.Table.TableRow} TableRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableRow.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableRow message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableRow + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableRow.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cells != null && message.hasOwnProperty("cells")) { + if (!Array.isArray(message.cells)) + return "cells: array expected"; + for (var i = 0; i < message.cells.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.Table.TableCell.verify(message.cells[i]); + if (error) + return "cells." + error; + } + } + return null; + }; + + /** + * Creates a TableRow message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableRow + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.Page.Table.TableRow} TableRow + */ + TableRow.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.Page.Table.TableRow) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.Page.Table.TableRow(); + if (object.cells) { + if (!Array.isArray(object.cells)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Table.TableRow.cells: array expected"); + message.cells = []; + for (var i = 0; i < object.cells.length; ++i) { + if (typeof object.cells[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Table.TableRow.cells: object expected"); + message.cells[i] = $root.google.cloud.documentai.v1beta2.Document.Page.Table.TableCell.fromObject(object.cells[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TableRow message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableRow + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.Table.TableRow} message TableRow + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableRow.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.cells = []; + if (message.cells && message.cells.length) { + object.cells = []; + for (var j = 0; j < message.cells.length; ++j) + object.cells[j] = $root.google.cloud.documentai.v1beta2.Document.Page.Table.TableCell.toObject(message.cells[j], options); + } + return object; + }; + + /** + * Converts this TableRow to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableRow + * @instance + * @returns {Object.} JSON object + */ + TableRow.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TableRow; + })(); + + Table.TableCell = (function() { + + /** + * Properties of a TableCell. + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table + * @interface ITableCell + * @property {google.cloud.documentai.v1beta2.Document.Page.ILayout|null} [layout] TableCell layout + * @property {number|null} [rowSpan] TableCell rowSpan + * @property {number|null} [colSpan] TableCell colSpan + * @property {Array.|null} [detectedLanguages] TableCell detectedLanguages + */ + + /** + * Constructs a new TableCell. + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table + * @classdesc Represents a TableCell. + * @implements ITableCell + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.Page.Table.ITableCell=} [properties] Properties to set + */ + function TableCell(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TableCell layout. + * @member {google.cloud.documentai.v1beta2.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableCell + * @instance + */ + TableCell.prototype.layout = null; + + /** + * TableCell rowSpan. + * @member {number} rowSpan + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableCell + * @instance + */ + TableCell.prototype.rowSpan = 0; + + /** + * TableCell colSpan. + * @member {number} colSpan + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableCell + * @instance + */ + TableCell.prototype.colSpan = 0; + + /** + * TableCell detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableCell + * @instance + */ + TableCell.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new TableCell instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableCell + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.Table.ITableCell=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.Page.Table.TableCell} TableCell instance + */ + TableCell.create = function create(properties) { + return new TableCell(properties); + }; + + /** + * Encodes the specified TableCell message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Table.TableCell.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableCell + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.Table.ITableCell} message TableCell message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableCell.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && message.hasOwnProperty("layout")) + $root.google.cloud.documentai.v1beta2.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.rowSpan != null && message.hasOwnProperty("rowSpan")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.rowSpan); + if (message.colSpan != null && message.hasOwnProperty("colSpan")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.colSpan); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TableCell message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.Table.TableCell.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableCell + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.Table.ITableCell} message TableCell message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableCell.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableCell message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableCell + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.Page.Table.TableCell} TableCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableCell.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.Page.Table.TableCell(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + message.rowSpan = reader.int32(); + break; + case 3: + message.colSpan = reader.int32(); + break; + case 4: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableCell message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableCell + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.Page.Table.TableCell} TableCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableCell.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableCell message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableCell + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableCell.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.rowSpan != null && message.hasOwnProperty("rowSpan")) + if (!$util.isInteger(message.rowSpan)) + return "rowSpan: integer expected"; + if (message.colSpan != null && message.hasOwnProperty("colSpan")) + if (!$util.isInteger(message.colSpan)) + return "colSpan: integer expected"; + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a TableCell message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableCell + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.Page.Table.TableCell} TableCell + */ + TableCell.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.Page.Table.TableCell) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.Page.Table.TableCell(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Table.TableCell.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.fromObject(object.layout); + } + if (object.rowSpan != null) + message.rowSpan = object.rowSpan | 0; + if (object.colSpan != null) + message.colSpan = object.colSpan | 0; + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Table.TableCell.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.Table.TableCell.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TableCell message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableCell + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.Table.TableCell} message TableCell + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableCell.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) { + object.layout = null; + object.rowSpan = 0; + object.colSpan = 0; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.toObject(message.layout, options); + if (message.rowSpan != null && message.hasOwnProperty("rowSpan")) + object.rowSpan = message.rowSpan; + if (message.colSpan != null && message.hasOwnProperty("colSpan")) + object.colSpan = message.colSpan; + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this TableCell to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableCell + * @instance + * @returns {Object.} JSON object + */ + TableCell.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TableCell; + })(); + + return Table; + })(); + + Page.FormField = (function() { + + /** + * Properties of a FormField. + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @interface IFormField + * @property {google.cloud.documentai.v1beta2.Document.Page.ILayout|null} [fieldName] FormField fieldName + * @property {google.cloud.documentai.v1beta2.Document.Page.ILayout|null} [fieldValue] FormField fieldValue + * @property {Array.|null} [nameDetectedLanguages] FormField nameDetectedLanguages + * @property {Array.|null} [valueDetectedLanguages] FormField valueDetectedLanguages + * @property {string|null} [valueType] FormField valueType + * @property {string|null} [correctedKeyText] FormField correctedKeyText + * @property {string|null} [correctedValueText] FormField correctedValueText + */ + + /** + * Constructs a new FormField. + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @classdesc Represents a FormField. + * @implements IFormField + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.Page.IFormField=} [properties] Properties to set + */ + function FormField(properties) { + this.nameDetectedLanguages = []; + this.valueDetectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FormField fieldName. + * @member {google.cloud.documentai.v1beta2.Document.Page.ILayout|null|undefined} fieldName + * @memberof google.cloud.documentai.v1beta2.Document.Page.FormField + * @instance + */ + FormField.prototype.fieldName = null; + + /** + * FormField fieldValue. + * @member {google.cloud.documentai.v1beta2.Document.Page.ILayout|null|undefined} fieldValue + * @memberof google.cloud.documentai.v1beta2.Document.Page.FormField + * @instance + */ + FormField.prototype.fieldValue = null; + + /** + * FormField nameDetectedLanguages. + * @member {Array.} nameDetectedLanguages + * @memberof google.cloud.documentai.v1beta2.Document.Page.FormField + * @instance + */ + FormField.prototype.nameDetectedLanguages = $util.emptyArray; + + /** + * FormField valueDetectedLanguages. + * @member {Array.} valueDetectedLanguages + * @memberof google.cloud.documentai.v1beta2.Document.Page.FormField + * @instance + */ + FormField.prototype.valueDetectedLanguages = $util.emptyArray; + + /** + * FormField valueType. + * @member {string} valueType + * @memberof google.cloud.documentai.v1beta2.Document.Page.FormField + * @instance + */ + FormField.prototype.valueType = ""; + + /** + * FormField correctedKeyText. + * @member {string} correctedKeyText + * @memberof google.cloud.documentai.v1beta2.Document.Page.FormField + * @instance + */ + FormField.prototype.correctedKeyText = ""; + + /** + * FormField correctedValueText. + * @member {string} correctedValueText + * @memberof google.cloud.documentai.v1beta2.Document.Page.FormField + * @instance + */ + FormField.prototype.correctedValueText = ""; + + /** + * Creates a new FormField instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.Page.FormField + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IFormField=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.Page.FormField} FormField instance + */ + FormField.create = function create(properties) { + return new FormField(properties); + }; + + /** + * Encodes the specified FormField message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.FormField.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.Page.FormField + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IFormField} message FormField message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FormField.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fieldName != null && message.hasOwnProperty("fieldName")) + $root.google.cloud.documentai.v1beta2.Document.Page.Layout.encode(message.fieldName, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fieldValue != null && message.hasOwnProperty("fieldValue")) + $root.google.cloud.documentai.v1beta2.Document.Page.Layout.encode(message.fieldValue, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nameDetectedLanguages != null && message.nameDetectedLanguages.length) + for (var i = 0; i < message.nameDetectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.encode(message.nameDetectedLanguages[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.valueDetectedLanguages != null && message.valueDetectedLanguages.length) + for (var i = 0; i < message.valueDetectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.encode(message.valueDetectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.valueType != null && message.hasOwnProperty("valueType")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.valueType); + if (message.correctedKeyText != null && message.hasOwnProperty("correctedKeyText")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.correctedKeyText); + if (message.correctedValueText != null && message.hasOwnProperty("correctedValueText")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.correctedValueText); + return writer; + }; + + /** + * Encodes the specified FormField message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.FormField.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.FormField + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IFormField} message FormField message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FormField.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FormField message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.Page.FormField + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.Page.FormField} FormField + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FormField.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.Page.FormField(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fieldName = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + message.fieldValue = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 3: + if (!(message.nameDetectedLanguages && message.nameDetectedLanguages.length)) + message.nameDetectedLanguages = []; + message.nameDetectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.valueDetectedLanguages && message.valueDetectedLanguages.length)) + message.valueDetectedLanguages = []; + message.valueDetectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + case 5: + message.valueType = reader.string(); + break; + case 6: + message.correctedKeyText = reader.string(); + break; + case 7: + message.correctedValueText = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FormField message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.FormField + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.Page.FormField} FormField + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FormField.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FormField message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.Page.FormField + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FormField.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fieldName != null && message.hasOwnProperty("fieldName")) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.verify(message.fieldName); + if (error) + return "fieldName." + error; + } + if (message.fieldValue != null && message.hasOwnProperty("fieldValue")) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.verify(message.fieldValue); + if (error) + return "fieldValue." + error; + } + if (message.nameDetectedLanguages != null && message.hasOwnProperty("nameDetectedLanguages")) { + if (!Array.isArray(message.nameDetectedLanguages)) + return "nameDetectedLanguages: array expected"; + for (var i = 0; i < message.nameDetectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.verify(message.nameDetectedLanguages[i]); + if (error) + return "nameDetectedLanguages." + error; + } + } + if (message.valueDetectedLanguages != null && message.hasOwnProperty("valueDetectedLanguages")) { + if (!Array.isArray(message.valueDetectedLanguages)) + return "valueDetectedLanguages: array expected"; + for (var i = 0; i < message.valueDetectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.verify(message.valueDetectedLanguages[i]); + if (error) + return "valueDetectedLanguages." + error; + } + } + if (message.valueType != null && message.hasOwnProperty("valueType")) + if (!$util.isString(message.valueType)) + return "valueType: string expected"; + if (message.correctedKeyText != null && message.hasOwnProperty("correctedKeyText")) + if (!$util.isString(message.correctedKeyText)) + return "correctedKeyText: string expected"; + if (message.correctedValueText != null && message.hasOwnProperty("correctedValueText")) + if (!$util.isString(message.correctedValueText)) + return "correctedValueText: string expected"; + return null; + }; + + /** + * Creates a FormField message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.FormField + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.Page.FormField} FormField + */ + FormField.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.Page.FormField) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.Page.FormField(); + if (object.fieldName != null) { + if (typeof object.fieldName !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.FormField.fieldName: object expected"); + message.fieldName = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.fromObject(object.fieldName); + } + if (object.fieldValue != null) { + if (typeof object.fieldValue !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.FormField.fieldValue: object expected"); + message.fieldValue = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.fromObject(object.fieldValue); + } + if (object.nameDetectedLanguages) { + if (!Array.isArray(object.nameDetectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.FormField.nameDetectedLanguages: array expected"); + message.nameDetectedLanguages = []; + for (var i = 0; i < object.nameDetectedLanguages.length; ++i) { + if (typeof object.nameDetectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.FormField.nameDetectedLanguages: object expected"); + message.nameDetectedLanguages[i] = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.fromObject(object.nameDetectedLanguages[i]); + } + } + if (object.valueDetectedLanguages) { + if (!Array.isArray(object.valueDetectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.FormField.valueDetectedLanguages: array expected"); + message.valueDetectedLanguages = []; + for (var i = 0; i < object.valueDetectedLanguages.length; ++i) { + if (typeof object.valueDetectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Page.FormField.valueDetectedLanguages: object expected"); + message.valueDetectedLanguages[i] = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.fromObject(object.valueDetectedLanguages[i]); + } + } + if (object.valueType != null) + message.valueType = String(object.valueType); + if (object.correctedKeyText != null) + message.correctedKeyText = String(object.correctedKeyText); + if (object.correctedValueText != null) + message.correctedValueText = String(object.correctedValueText); + return message; + }; + + /** + * Creates a plain object from a FormField message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.FormField + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.FormField} message FormField + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FormField.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.nameDetectedLanguages = []; + object.valueDetectedLanguages = []; + } + if (options.defaults) { + object.fieldName = null; + object.fieldValue = null; + object.valueType = ""; + object.correctedKeyText = ""; + object.correctedValueText = ""; + } + if (message.fieldName != null && message.hasOwnProperty("fieldName")) + object.fieldName = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.toObject(message.fieldName, options); + if (message.fieldValue != null && message.hasOwnProperty("fieldValue")) + object.fieldValue = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.toObject(message.fieldValue, options); + if (message.nameDetectedLanguages && message.nameDetectedLanguages.length) { + object.nameDetectedLanguages = []; + for (var j = 0; j < message.nameDetectedLanguages.length; ++j) + object.nameDetectedLanguages[j] = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.toObject(message.nameDetectedLanguages[j], options); + } + if (message.valueDetectedLanguages && message.valueDetectedLanguages.length) { + object.valueDetectedLanguages = []; + for (var j = 0; j < message.valueDetectedLanguages.length; ++j) + object.valueDetectedLanguages[j] = $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.toObject(message.valueDetectedLanguages[j], options); + } + if (message.valueType != null && message.hasOwnProperty("valueType")) + object.valueType = message.valueType; + if (message.correctedKeyText != null && message.hasOwnProperty("correctedKeyText")) + object.correctedKeyText = message.correctedKeyText; + if (message.correctedValueText != null && message.hasOwnProperty("correctedValueText")) + object.correctedValueText = message.correctedValueText; + return object; + }; + + /** + * Converts this FormField to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.Page.FormField + * @instance + * @returns {Object.} JSON object + */ + FormField.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FormField; + })(); + + Page.DetectedLanguage = (function() { + + /** + * Properties of a DetectedLanguage. + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @interface IDetectedLanguage + * @property {string|null} [languageCode] DetectedLanguage languageCode + * @property {number|null} [confidence] DetectedLanguage confidence + */ + + /** + * Constructs a new DetectedLanguage. + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @classdesc Represents a DetectedLanguage. + * @implements IDetectedLanguage + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage=} [properties] Properties to set + */ + function DetectedLanguage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DetectedLanguage languageCode. + * @member {string} languageCode + * @memberof google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage + * @instance + */ + DetectedLanguage.prototype.languageCode = ""; + + /** + * DetectedLanguage confidence. + * @member {number} confidence + * @memberof google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage + * @instance + */ + DetectedLanguage.prototype.confidence = 0; + + /** + * Creates a new DetectedLanguage instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage} DetectedLanguage instance + */ + DetectedLanguage.create = function create(properties) { + return new DetectedLanguage(properties); + }; + + /** + * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage} message DetectedLanguage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedLanguage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.languageCode); + if (message.confidence != null && message.hasOwnProperty("confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + return writer; + }; + + /** + * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.IDetectedLanguage} message DetectedLanguage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedLanguage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectedLanguage message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage} DetectedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedLanguage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.languageCode = reader.string(); + break; + case 2: + message.confidence = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectedLanguage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage} DetectedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedLanguage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectedLanguage message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectedLanguage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + return null; + }; + + /** + * Creates a DetectedLanguage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage} DetectedLanguage + */ + DetectedLanguage.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage(); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.confidence != null) + message.confidence = Number(object.confidence); + return message; + }; + + /** + * Creates a plain object from a DetectedLanguage message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage + * @static + * @param {google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage} message DetectedLanguage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectedLanguage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.languageCode = ""; + object.confidence = 0; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + return object; + }; + + /** + * Converts this DetectedLanguage to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage + * @instance + * @returns {Object.} JSON object + */ + DetectedLanguage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DetectedLanguage; + })(); + + return Page; + })(); + + Document.Entity = (function() { + + /** + * Properties of an Entity. + * @memberof google.cloud.documentai.v1beta2.Document + * @interface IEntity + * @property {google.cloud.documentai.v1beta2.Document.ITextAnchor|null} [textAnchor] Entity textAnchor + * @property {string|null} [type] Entity type + * @property {string|null} [mentionText] Entity mentionText + * @property {string|null} [mentionId] Entity mentionId + * @property {number|null} [confidence] Entity confidence + * @property {google.cloud.documentai.v1beta2.Document.IPageAnchor|null} [pageAnchor] Entity pageAnchor + * @property {string|null} [id] Entity id + * @property {google.cloud.documentai.v1beta2.IBoundingPoly|null} [boundingPolyForDemoFrontend] Entity boundingPolyForDemoFrontend + */ + + /** + * Constructs a new Entity. + * @memberof google.cloud.documentai.v1beta2.Document + * @classdesc Represents an Entity. + * @implements IEntity + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.IEntity=} [properties] Properties to set + */ + function Entity(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Entity textAnchor. + * @member {google.cloud.documentai.v1beta2.Document.ITextAnchor|null|undefined} textAnchor + * @memberof google.cloud.documentai.v1beta2.Document.Entity + * @instance + */ + Entity.prototype.textAnchor = null; + + /** + * Entity type. + * @member {string} type + * @memberof google.cloud.documentai.v1beta2.Document.Entity + * @instance + */ + Entity.prototype.type = ""; + + /** + * Entity mentionText. + * @member {string} mentionText + * @memberof google.cloud.documentai.v1beta2.Document.Entity + * @instance + */ + Entity.prototype.mentionText = ""; + + /** + * Entity mentionId. + * @member {string} mentionId + * @memberof google.cloud.documentai.v1beta2.Document.Entity + * @instance + */ + Entity.prototype.mentionId = ""; + + /** + * Entity confidence. + * @member {number} confidence + * @memberof google.cloud.documentai.v1beta2.Document.Entity + * @instance + */ + Entity.prototype.confidence = 0; + + /** + * Entity pageAnchor. + * @member {google.cloud.documentai.v1beta2.Document.IPageAnchor|null|undefined} pageAnchor + * @memberof google.cloud.documentai.v1beta2.Document.Entity + * @instance + */ + Entity.prototype.pageAnchor = null; + + /** + * Entity id. + * @member {string} id + * @memberof google.cloud.documentai.v1beta2.Document.Entity + * @instance + */ + Entity.prototype.id = ""; + + /** + * Entity boundingPolyForDemoFrontend. + * @member {google.cloud.documentai.v1beta2.IBoundingPoly|null|undefined} boundingPolyForDemoFrontend + * @memberof google.cloud.documentai.v1beta2.Document.Entity + * @instance + */ + Entity.prototype.boundingPolyForDemoFrontend = null; + + /** + * Creates a new Entity instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.Entity + * @static + * @param {google.cloud.documentai.v1beta2.Document.IEntity=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.Entity} Entity instance + */ + Entity.create = function create(properties) { + return new Entity(properties); + }; + + /** + * Encodes the specified Entity message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Entity.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.Entity + * @static + * @param {google.cloud.documentai.v1beta2.Document.IEntity} message Entity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entity.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + $root.google.cloud.documentai.v1beta2.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.mentionText != null && message.hasOwnProperty("mentionText")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.mentionText); + if (message.mentionId != null && message.hasOwnProperty("mentionId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.mentionId); + if (message.confidence != null && message.hasOwnProperty("confidence")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); + if (message.pageAnchor != null && message.hasOwnProperty("pageAnchor")) + $root.google.cloud.documentai.v1beta2.Document.PageAnchor.encode(message.pageAnchor, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.id != null && message.hasOwnProperty("id")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.id); + if (message.boundingPolyForDemoFrontend != null && message.hasOwnProperty("boundingPolyForDemoFrontend")) + $root.google.cloud.documentai.v1beta2.BoundingPoly.encode(message.boundingPolyForDemoFrontend, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Entity message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.Entity.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Entity + * @static + * @param {google.cloud.documentai.v1beta2.Document.IEntity} message Entity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entity.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Entity message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.Entity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.Entity} Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entity.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.Entity(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.textAnchor = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.decode(reader, reader.uint32()); + break; + case 2: + message.type = reader.string(); + break; + case 3: + message.mentionText = reader.string(); + break; + case 4: + message.mentionId = reader.string(); + break; + case 5: + message.confidence = reader.float(); + break; + case 6: + message.pageAnchor = $root.google.cloud.documentai.v1beta2.Document.PageAnchor.decode(reader, reader.uint32()); + break; + case 7: + message.id = reader.string(); + break; + case 8: + message.boundingPolyForDemoFrontend = $root.google.cloud.documentai.v1beta2.BoundingPoly.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Entity message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.Entity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.Entity} Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entity.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Entity message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.Entity + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Entity.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) { + var error = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.verify(message.textAnchor); + if (error) + return "textAnchor." + error; + } + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.mentionText != null && message.hasOwnProperty("mentionText")) + if (!$util.isString(message.mentionText)) + return "mentionText: string expected"; + if (message.mentionId != null && message.hasOwnProperty("mentionId")) + if (!$util.isString(message.mentionId)) + return "mentionId: string expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.pageAnchor != null && message.hasOwnProperty("pageAnchor")) { + var error = $root.google.cloud.documentai.v1beta2.Document.PageAnchor.verify(message.pageAnchor); + if (error) + return "pageAnchor." + error; + } + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.boundingPolyForDemoFrontend != null && message.hasOwnProperty("boundingPolyForDemoFrontend")) { + var error = $root.google.cloud.documentai.v1beta2.BoundingPoly.verify(message.boundingPolyForDemoFrontend); + if (error) + return "boundingPolyForDemoFrontend." + error; + } + return null; + }; + + /** + * Creates an Entity message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.Entity + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.Entity} Entity + */ + Entity.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.Entity) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.Entity(); + if (object.textAnchor != null) { + if (typeof object.textAnchor !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Entity.textAnchor: object expected"); + message.textAnchor = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.fromObject(object.textAnchor); + } + if (object.type != null) + message.type = String(object.type); + if (object.mentionText != null) + message.mentionText = String(object.mentionText); + if (object.mentionId != null) + message.mentionId = String(object.mentionId); + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.pageAnchor != null) { + if (typeof object.pageAnchor !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Entity.pageAnchor: object expected"); + message.pageAnchor = $root.google.cloud.documentai.v1beta2.Document.PageAnchor.fromObject(object.pageAnchor); + } + if (object.id != null) + message.id = String(object.id); + if (object.boundingPolyForDemoFrontend != null) { + if (typeof object.boundingPolyForDemoFrontend !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.Entity.boundingPolyForDemoFrontend: object expected"); + message.boundingPolyForDemoFrontend = $root.google.cloud.documentai.v1beta2.BoundingPoly.fromObject(object.boundingPolyForDemoFrontend); + } + return message; + }; + + /** + * Creates a plain object from an Entity message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.Entity + * @static + * @param {google.cloud.documentai.v1beta2.Document.Entity} message Entity + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Entity.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.textAnchor = null; + object.type = ""; + object.mentionText = ""; + object.mentionId = ""; + object.confidence = 0; + object.pageAnchor = null; + object.id = ""; + object.boundingPolyForDemoFrontend = null; + } + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + object.textAnchor = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.toObject(message.textAnchor, options); + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.mentionText != null && message.hasOwnProperty("mentionText")) + object.mentionText = message.mentionText; + if (message.mentionId != null && message.hasOwnProperty("mentionId")) + object.mentionId = message.mentionId; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.pageAnchor != null && message.hasOwnProperty("pageAnchor")) + object.pageAnchor = $root.google.cloud.documentai.v1beta2.Document.PageAnchor.toObject(message.pageAnchor, options); + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.boundingPolyForDemoFrontend != null && message.hasOwnProperty("boundingPolyForDemoFrontend")) + object.boundingPolyForDemoFrontend = $root.google.cloud.documentai.v1beta2.BoundingPoly.toObject(message.boundingPolyForDemoFrontend, options); + return object; + }; + + /** + * Converts this Entity to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.Entity + * @instance + * @returns {Object.} JSON object + */ + Entity.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Entity; + })(); + + Document.EntityRelation = (function() { + + /** + * Properties of an EntityRelation. + * @memberof google.cloud.documentai.v1beta2.Document + * @interface IEntityRelation + * @property {string|null} [subjectId] EntityRelation subjectId + * @property {string|null} [objectId] EntityRelation objectId + * @property {string|null} [relation] EntityRelation relation + */ + + /** + * Constructs a new EntityRelation. + * @memberof google.cloud.documentai.v1beta2.Document + * @classdesc Represents an EntityRelation. + * @implements IEntityRelation + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.IEntityRelation=} [properties] Properties to set + */ + function EntityRelation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EntityRelation subjectId. + * @member {string} subjectId + * @memberof google.cloud.documentai.v1beta2.Document.EntityRelation + * @instance + */ + EntityRelation.prototype.subjectId = ""; + + /** + * EntityRelation objectId. + * @member {string} objectId + * @memberof google.cloud.documentai.v1beta2.Document.EntityRelation + * @instance + */ + EntityRelation.prototype.objectId = ""; + + /** + * EntityRelation relation. + * @member {string} relation + * @memberof google.cloud.documentai.v1beta2.Document.EntityRelation + * @instance + */ + EntityRelation.prototype.relation = ""; + + /** + * Creates a new EntityRelation instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.EntityRelation + * @static + * @param {google.cloud.documentai.v1beta2.Document.IEntityRelation=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.EntityRelation} EntityRelation instance + */ + EntityRelation.create = function create(properties) { + return new EntityRelation(properties); + }; + + /** + * Encodes the specified EntityRelation message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.EntityRelation.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.EntityRelation + * @static + * @param {google.cloud.documentai.v1beta2.Document.IEntityRelation} message EntityRelation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityRelation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.subjectId != null && message.hasOwnProperty("subjectId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.subjectId); + if (message.objectId != null && message.hasOwnProperty("objectId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.objectId); + if (message.relation != null && message.hasOwnProperty("relation")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.relation); + return writer; + }; + + /** + * Encodes the specified EntityRelation message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.EntityRelation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.EntityRelation + * @static + * @param {google.cloud.documentai.v1beta2.Document.IEntityRelation} message EntityRelation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityRelation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EntityRelation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.EntityRelation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.EntityRelation} EntityRelation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityRelation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.EntityRelation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subjectId = reader.string(); + break; + case 2: + message.objectId = reader.string(); + break; + case 3: + message.relation = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EntityRelation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.EntityRelation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.EntityRelation} EntityRelation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityRelation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EntityRelation message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.EntityRelation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EntityRelation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.subjectId != null && message.hasOwnProperty("subjectId")) + if (!$util.isString(message.subjectId)) + return "subjectId: string expected"; + if (message.objectId != null && message.hasOwnProperty("objectId")) + if (!$util.isString(message.objectId)) + return "objectId: string expected"; + if (message.relation != null && message.hasOwnProperty("relation")) + if (!$util.isString(message.relation)) + return "relation: string expected"; + return null; + }; + + /** + * Creates an EntityRelation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.EntityRelation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.EntityRelation} EntityRelation + */ + EntityRelation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.EntityRelation) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.EntityRelation(); + if (object.subjectId != null) + message.subjectId = String(object.subjectId); + if (object.objectId != null) + message.objectId = String(object.objectId); + if (object.relation != null) + message.relation = String(object.relation); + return message; + }; + + /** + * Creates a plain object from an EntityRelation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.EntityRelation + * @static + * @param {google.cloud.documentai.v1beta2.Document.EntityRelation} message EntityRelation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EntityRelation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.subjectId = ""; + object.objectId = ""; + object.relation = ""; + } + if (message.subjectId != null && message.hasOwnProperty("subjectId")) + object.subjectId = message.subjectId; + if (message.objectId != null && message.hasOwnProperty("objectId")) + object.objectId = message.objectId; + if (message.relation != null && message.hasOwnProperty("relation")) + object.relation = message.relation; + return object; + }; + + /** + * Converts this EntityRelation to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.EntityRelation + * @instance + * @returns {Object.} JSON object + */ + EntityRelation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EntityRelation; + })(); + + Document.TextAnchor = (function() { + + /** + * Properties of a TextAnchor. + * @memberof google.cloud.documentai.v1beta2.Document + * @interface ITextAnchor + * @property {Array.|null} [textSegments] TextAnchor textSegments + */ + + /** + * Constructs a new TextAnchor. + * @memberof google.cloud.documentai.v1beta2.Document + * @classdesc Represents a TextAnchor. + * @implements ITextAnchor + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.ITextAnchor=} [properties] Properties to set + */ + function TextAnchor(properties) { + this.textSegments = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TextAnchor textSegments. + * @member {Array.} textSegments + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor + * @instance + */ + TextAnchor.prototype.textSegments = $util.emptyArray; + + /** + * Creates a new TextAnchor instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor + * @static + * @param {google.cloud.documentai.v1beta2.Document.ITextAnchor=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.TextAnchor} TextAnchor instance + */ + TextAnchor.create = function create(properties) { + return new TextAnchor(properties); + }; + + /** + * Encodes the specified TextAnchor message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.TextAnchor.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor + * @static + * @param {google.cloud.documentai.v1beta2.Document.ITextAnchor} message TextAnchor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextAnchor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textSegments != null && message.textSegments.length) + for (var i = 0; i < message.textSegments.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment.encode(message.textSegments[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TextAnchor message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.TextAnchor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor + * @static + * @param {google.cloud.documentai.v1beta2.Document.ITextAnchor} message TextAnchor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextAnchor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextAnchor message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.TextAnchor} TextAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextAnchor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.TextAnchor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.textSegments && message.textSegments.length)) + message.textSegments = []; + message.textSegments.push($root.google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TextAnchor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.TextAnchor} TextAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextAnchor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextAnchor message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextAnchor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textSegments != null && message.hasOwnProperty("textSegments")) { + if (!Array.isArray(message.textSegments)) + return "textSegments: array expected"; + for (var i = 0; i < message.textSegments.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment.verify(message.textSegments[i]); + if (error) + return "textSegments." + error; + } + } + return null; + }; + + /** + * Creates a TextAnchor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.TextAnchor} TextAnchor + */ + TextAnchor.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.TextAnchor) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.TextAnchor(); + if (object.textSegments) { + if (!Array.isArray(object.textSegments)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.TextAnchor.textSegments: array expected"); + message.textSegments = []; + for (var i = 0; i < object.textSegments.length; ++i) { + if (typeof object.textSegments[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.TextAnchor.textSegments: object expected"); + message.textSegments[i] = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment.fromObject(object.textSegments[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TextAnchor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor + * @static + * @param {google.cloud.documentai.v1beta2.Document.TextAnchor} message TextAnchor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TextAnchor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.textSegments = []; + if (message.textSegments && message.textSegments.length) { + object.textSegments = []; + for (var j = 0; j < message.textSegments.length; ++j) + object.textSegments[j] = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment.toObject(message.textSegments[j], options); + } + return object; + }; + + /** + * Converts this TextAnchor to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor + * @instance + * @returns {Object.} JSON object + */ + TextAnchor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + TextAnchor.TextSegment = (function() { + + /** + * Properties of a TextSegment. + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor + * @interface ITextSegment + * @property {number|Long|null} [startIndex] TextSegment startIndex + * @property {number|Long|null} [endIndex] TextSegment endIndex + */ + + /** + * Constructs a new TextSegment. + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor + * @classdesc Represents a TextSegment. + * @implements ITextSegment + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.TextAnchor.ITextSegment=} [properties] Properties to set + */ + function TextSegment(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TextSegment startIndex. + * @member {number|Long} startIndex + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment + * @instance + */ + TextSegment.prototype.startIndex = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * TextSegment endIndex. + * @member {number|Long} endIndex + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment + * @instance + */ + TextSegment.prototype.endIndex = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new TextSegment instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment + * @static + * @param {google.cloud.documentai.v1beta2.Document.TextAnchor.ITextSegment=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment} TextSegment instance + */ + TextSegment.create = function create(properties) { + return new TextSegment(properties); + }; + + /** + * Encodes the specified TextSegment message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment + * @static + * @param {google.cloud.documentai.v1beta2.Document.TextAnchor.ITextSegment} message TextSegment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextSegment.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startIndex != null && message.hasOwnProperty("startIndex")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.startIndex); + if (message.endIndex != null && message.hasOwnProperty("endIndex")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.endIndex); + return writer; + }; + + /** + * Encodes the specified TextSegment message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment + * @static + * @param {google.cloud.documentai.v1beta2.Document.TextAnchor.ITextSegment} message TextSegment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextSegment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextSegment message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment} TextSegment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextSegment.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.startIndex = reader.int64(); + break; + case 2: + message.endIndex = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TextSegment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment} TextSegment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextSegment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextSegment message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextSegment.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startIndex != null && message.hasOwnProperty("startIndex")) + if (!$util.isInteger(message.startIndex) && !(message.startIndex && $util.isInteger(message.startIndex.low) && $util.isInteger(message.startIndex.high))) + return "startIndex: integer|Long expected"; + if (message.endIndex != null && message.hasOwnProperty("endIndex")) + if (!$util.isInteger(message.endIndex) && !(message.endIndex && $util.isInteger(message.endIndex.low) && $util.isInteger(message.endIndex.high))) + return "endIndex: integer|Long expected"; + return null; + }; + + /** + * Creates a TextSegment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment} TextSegment + */ + TextSegment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment(); + if (object.startIndex != null) + if ($util.Long) + (message.startIndex = $util.Long.fromValue(object.startIndex)).unsigned = false; + else if (typeof object.startIndex === "string") + message.startIndex = parseInt(object.startIndex, 10); + else if (typeof object.startIndex === "number") + message.startIndex = object.startIndex; + else if (typeof object.startIndex === "object") + message.startIndex = new $util.LongBits(object.startIndex.low >>> 0, object.startIndex.high >>> 0).toNumber(); + if (object.endIndex != null) + if ($util.Long) + (message.endIndex = $util.Long.fromValue(object.endIndex)).unsigned = false; + else if (typeof object.endIndex === "string") + message.endIndex = parseInt(object.endIndex, 10); + else if (typeof object.endIndex === "number") + message.endIndex = object.endIndex; + else if (typeof object.endIndex === "object") + message.endIndex = new $util.LongBits(object.endIndex.low >>> 0, object.endIndex.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a TextSegment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment + * @static + * @param {google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment} message TextSegment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TextSegment.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.startIndex = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.startIndex = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.endIndex = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.endIndex = options.longs === String ? "0" : 0; + } + if (message.startIndex != null && message.hasOwnProperty("startIndex")) + if (typeof message.startIndex === "number") + object.startIndex = options.longs === String ? String(message.startIndex) : message.startIndex; + else + object.startIndex = options.longs === String ? $util.Long.prototype.toString.call(message.startIndex) : options.longs === Number ? new $util.LongBits(message.startIndex.low >>> 0, message.startIndex.high >>> 0).toNumber() : message.startIndex; + if (message.endIndex != null && message.hasOwnProperty("endIndex")) + if (typeof message.endIndex === "number") + object.endIndex = options.longs === String ? String(message.endIndex) : message.endIndex; + else + object.endIndex = options.longs === String ? $util.Long.prototype.toString.call(message.endIndex) : options.longs === Number ? new $util.LongBits(message.endIndex.low >>> 0, message.endIndex.high >>> 0).toNumber() : message.endIndex; + return object; + }; + + /** + * Converts this TextSegment to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment + * @instance + * @returns {Object.} JSON object + */ + TextSegment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TextSegment; + })(); + + return TextAnchor; + })(); + + Document.PageAnchor = (function() { + + /** + * Properties of a PageAnchor. + * @memberof google.cloud.documentai.v1beta2.Document + * @interface IPageAnchor + * @property {Array.|null} [pageRefs] PageAnchor pageRefs + */ + + /** + * Constructs a new PageAnchor. + * @memberof google.cloud.documentai.v1beta2.Document + * @classdesc Represents a PageAnchor. + * @implements IPageAnchor + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.IPageAnchor=} [properties] Properties to set + */ + function PageAnchor(properties) { + this.pageRefs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PageAnchor pageRefs. + * @member {Array.} pageRefs + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor + * @instance + */ + PageAnchor.prototype.pageRefs = $util.emptyArray; + + /** + * Creates a new PageAnchor instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor + * @static + * @param {google.cloud.documentai.v1beta2.Document.IPageAnchor=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.PageAnchor} PageAnchor instance + */ + PageAnchor.create = function create(properties) { + return new PageAnchor(properties); + }; + + /** + * Encodes the specified PageAnchor message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.PageAnchor.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor + * @static + * @param {google.cloud.documentai.v1beta2.Document.IPageAnchor} message PageAnchor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PageAnchor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageRefs != null && message.pageRefs.length) + for (var i = 0; i < message.pageRefs.length; ++i) + $root.google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.encode(message.pageRefs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PageAnchor message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.PageAnchor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor + * @static + * @param {google.cloud.documentai.v1beta2.Document.IPageAnchor} message PageAnchor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PageAnchor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PageAnchor message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.PageAnchor} PageAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PageAnchor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.PageAnchor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.pageRefs && message.pageRefs.length)) + message.pageRefs = []; + message.pageRefs.push($root.google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PageAnchor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.PageAnchor} PageAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PageAnchor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PageAnchor message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PageAnchor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pageRefs != null && message.hasOwnProperty("pageRefs")) { + if (!Array.isArray(message.pageRefs)) + return "pageRefs: array expected"; + for (var i = 0; i < message.pageRefs.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.verify(message.pageRefs[i]); + if (error) + return "pageRefs." + error; + } + } + return null; + }; + + /** + * Creates a PageAnchor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.PageAnchor} PageAnchor + */ + PageAnchor.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.PageAnchor) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.PageAnchor(); + if (object.pageRefs) { + if (!Array.isArray(object.pageRefs)) + throw TypeError(".google.cloud.documentai.v1beta2.Document.PageAnchor.pageRefs: array expected"); + message.pageRefs = []; + for (var i = 0; i < object.pageRefs.length; ++i) { + if (typeof object.pageRefs[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.Document.PageAnchor.pageRefs: object expected"); + message.pageRefs[i] = $root.google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.fromObject(object.pageRefs[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a PageAnchor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor + * @static + * @param {google.cloud.documentai.v1beta2.Document.PageAnchor} message PageAnchor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PageAnchor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.pageRefs = []; + if (message.pageRefs && message.pageRefs.length) { + object.pageRefs = []; + for (var j = 0; j < message.pageRefs.length; ++j) + object.pageRefs[j] = $root.google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.toObject(message.pageRefs[j], options); + } + return object; + }; + + /** + * Converts this PageAnchor to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor + * @instance + * @returns {Object.} JSON object + */ + PageAnchor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + PageAnchor.PageRef = (function() { + + /** + * Properties of a PageRef. + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor + * @interface IPageRef + * @property {number|Long|null} [page] PageRef page + * @property {google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.LayoutType|null} [layoutType] PageRef layoutType + * @property {string|null} [layoutId] PageRef layoutId + */ + + /** + * Constructs a new PageRef. + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor + * @classdesc Represents a PageRef. + * @implements IPageRef + * @constructor + * @param {google.cloud.documentai.v1beta2.Document.PageAnchor.IPageRef=} [properties] Properties to set + */ + function PageRef(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PageRef page. + * @member {number|Long} page + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef + * @instance + */ + PageRef.prototype.page = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * PageRef layoutType. + * @member {google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.LayoutType} layoutType + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef + * @instance + */ + PageRef.prototype.layoutType = 0; + + /** + * PageRef layoutId. + * @member {string} layoutId + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef + * @instance + */ + PageRef.prototype.layoutId = ""; + + /** + * Creates a new PageRef instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef + * @static + * @param {google.cloud.documentai.v1beta2.Document.PageAnchor.IPageRef=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef} PageRef instance + */ + PageRef.create = function create(properties) { + return new PageRef(properties); + }; + + /** + * Encodes the specified PageRef message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef + * @static + * @param {google.cloud.documentai.v1beta2.Document.PageAnchor.IPageRef} message PageRef message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PageRef.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.page != null && message.hasOwnProperty("page")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.page); + if (message.layoutType != null && message.hasOwnProperty("layoutType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.layoutType); + if (message.layoutId != null && message.hasOwnProperty("layoutId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.layoutId); + return writer; + }; + + /** + * Encodes the specified PageRef message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef + * @static + * @param {google.cloud.documentai.v1beta2.Document.PageAnchor.IPageRef} message PageRef message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PageRef.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PageRef message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef} PageRef + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PageRef.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.page = reader.int64(); + break; + case 2: + message.layoutType = reader.int32(); + break; + case 3: + message.layoutId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PageRef message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef} PageRef + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PageRef.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PageRef message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PageRef.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.page != null && message.hasOwnProperty("page")) + if (!$util.isInteger(message.page) && !(message.page && $util.isInteger(message.page.low) && $util.isInteger(message.page.high))) + return "page: integer|Long expected"; + if (message.layoutType != null && message.hasOwnProperty("layoutType")) + switch (message.layoutType) { + default: + return "layoutType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.layoutId != null && message.hasOwnProperty("layoutId")) + if (!$util.isString(message.layoutId)) + return "layoutId: string expected"; + return null; + }; + + /** + * Creates a PageRef message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef} PageRef + */ + PageRef.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef) + return object; + var message = new $root.google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef(); + if (object.page != null) + if ($util.Long) + (message.page = $util.Long.fromValue(object.page)).unsigned = false; + else if (typeof object.page === "string") + message.page = parseInt(object.page, 10); + else if (typeof object.page === "number") + message.page = object.page; + else if (typeof object.page === "object") + message.page = new $util.LongBits(object.page.low >>> 0, object.page.high >>> 0).toNumber(); + switch (object.layoutType) { + case "LAYOUT_TYPE_UNSPECIFIED": + case 0: + message.layoutType = 0; + break; + case "BLOCK": + case 1: + message.layoutType = 1; + break; + case "PARAGRAPH": + case 2: + message.layoutType = 2; + break; + case "LINE": + case 3: + message.layoutType = 3; + break; + case "TOKEN": + case 4: + message.layoutType = 4; + break; + case "VISUAL_ELEMENT": + case 5: + message.layoutType = 5; + break; + case "TABLE": + case 6: + message.layoutType = 6; + break; + case "FORM_FIELD": + case 7: + message.layoutType = 7; + break; + } + if (object.layoutId != null) + message.layoutId = String(object.layoutId); + return message; + }; + + /** + * Creates a plain object from a PageRef message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef + * @static + * @param {google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef} message PageRef + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PageRef.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.page = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.page = options.longs === String ? "0" : 0; + object.layoutType = options.enums === String ? "LAYOUT_TYPE_UNSPECIFIED" : 0; + object.layoutId = ""; + } + if (message.page != null && message.hasOwnProperty("page")) + if (typeof message.page === "number") + object.page = options.longs === String ? String(message.page) : message.page; + else + object.page = options.longs === String ? $util.Long.prototype.toString.call(message.page) : options.longs === Number ? new $util.LongBits(message.page.low >>> 0, message.page.high >>> 0).toNumber() : message.page; + if (message.layoutType != null && message.hasOwnProperty("layoutType")) + object.layoutType = options.enums === String ? $root.google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.LayoutType[message.layoutType] : message.layoutType; + if (message.layoutId != null && message.hasOwnProperty("layoutId")) + object.layoutId = message.layoutId; + return object; + }; + + /** + * Converts this PageRef to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef + * @instance + * @returns {Object.} JSON object + */ + PageRef.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * LayoutType enum. + * @name google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.LayoutType + * @enum {string} + * @property {number} LAYOUT_TYPE_UNSPECIFIED=0 LAYOUT_TYPE_UNSPECIFIED value + * @property {number} BLOCK=1 BLOCK value + * @property {number} PARAGRAPH=2 PARAGRAPH value + * @property {number} LINE=3 LINE value + * @property {number} TOKEN=4 TOKEN value + * @property {number} VISUAL_ELEMENT=5 VISUAL_ELEMENT value + * @property {number} TABLE=6 TABLE value + * @property {number} FORM_FIELD=7 FORM_FIELD value + */ + PageRef.LayoutType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LAYOUT_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "BLOCK"] = 1; + values[valuesById[2] = "PARAGRAPH"] = 2; + values[valuesById[3] = "LINE"] = 3; + values[valuesById[4] = "TOKEN"] = 4; + values[valuesById[5] = "VISUAL_ELEMENT"] = 5; + values[valuesById[6] = "TABLE"] = 6; + values[valuesById[7] = "FORM_FIELD"] = 7; + return values; + })(); + + return PageRef; + })(); + + return PageAnchor; + })(); + + return Document; + })(); + + v1beta2.Vertex = (function() { /** - * ProcessDocumentRequest tableExtractionParams. - * @member {google.cloud.documentai.v1beta1.ITableExtractionParams|null|undefined} tableExtractionParams - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest - * @instance + * Properties of a Vertex. + * @memberof google.cloud.documentai.v1beta2 + * @interface IVertex + * @property {number|null} [x] Vertex x + * @property {number|null} [y] Vertex y */ - ProcessDocumentRequest.prototype.tableExtractionParams = null; /** - * ProcessDocumentRequest formExtractionParams. - * @member {google.cloud.documentai.v1beta1.IFormExtractionParams|null|undefined} formExtractionParams - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest - * @instance + * Constructs a new Vertex. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a Vertex. + * @implements IVertex + * @constructor + * @param {google.cloud.documentai.v1beta2.IVertex=} [properties] Properties to set */ - ProcessDocumentRequest.prototype.formExtractionParams = null; + function Vertex(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * ProcessDocumentRequest entityExtractionParams. - * @member {google.cloud.documentai.v1beta1.IEntityExtractionParams|null|undefined} entityExtractionParams - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * Vertex x. + * @member {number} x + * @memberof google.cloud.documentai.v1beta2.Vertex * @instance */ - ProcessDocumentRequest.prototype.entityExtractionParams = null; + Vertex.prototype.x = 0; /** - * ProcessDocumentRequest ocrParams. - * @member {google.cloud.documentai.v1beta1.IOcrParams|null|undefined} ocrParams - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * Vertex y. + * @member {number} y + * @memberof google.cloud.documentai.v1beta2.Vertex * @instance */ - ProcessDocumentRequest.prototype.ocrParams = null; + Vertex.prototype.y = 0; /** - * Creates a new ProcessDocumentRequest instance using the specified properties. + * Creates a new Vertex instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @memberof google.cloud.documentai.v1beta2.Vertex * @static - * @param {google.cloud.documentai.v1beta1.IProcessDocumentRequest=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta1.ProcessDocumentRequest} ProcessDocumentRequest instance + * @param {google.cloud.documentai.v1beta2.IVertex=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Vertex} Vertex instance */ - ProcessDocumentRequest.create = function create(properties) { - return new ProcessDocumentRequest(properties); + Vertex.create = function create(properties) { + return new Vertex(properties); }; /** - * Encodes the specified ProcessDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentRequest.verify|verify} messages. + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.documentai.v1beta2.Vertex.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @memberof google.cloud.documentai.v1beta2.Vertex * @static - * @param {google.cloud.documentai.v1beta1.IProcessDocumentRequest} message ProcessDocumentRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IVertex} message Vertex message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProcessDocumentRequest.encode = function encode(message, writer) { + Vertex.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - $root.google.cloud.documentai.v1beta1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - $root.google.cloud.documentai.v1beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.documentType != null && message.hasOwnProperty("documentType")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.documentType); - if (message.tableExtractionParams != null && message.hasOwnProperty("tableExtractionParams")) - $root.google.cloud.documentai.v1beta1.TableExtractionParams.encode(message.tableExtractionParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.formExtractionParams != null && message.hasOwnProperty("formExtractionParams")) - $root.google.cloud.documentai.v1beta1.FormExtractionParams.encode(message.formExtractionParams, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.entityExtractionParams != null && message.hasOwnProperty("entityExtractionParams")) - $root.google.cloud.documentai.v1beta1.EntityExtractionParams.encode(message.entityExtractionParams, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.ocrParams != null && message.hasOwnProperty("ocrParams")) - $root.google.cloud.documentai.v1beta1.OcrParams.encode(message.ocrParams, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.x != null && message.hasOwnProperty("x")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); + if (message.y != null && message.hasOwnProperty("y")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); return writer; }; /** - * Encodes the specified ProcessDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentRequest.verify|verify} messages. + * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Vertex.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @memberof google.cloud.documentai.v1beta2.Vertex * @static - * @param {google.cloud.documentai.v1beta1.IProcessDocumentRequest} message ProcessDocumentRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IVertex} message Vertex message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProcessDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + Vertex.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProcessDocumentRequest message from the specified reader or buffer. + * Decodes a Vertex message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @memberof google.cloud.documentai.v1beta2.Vertex * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta1.ProcessDocumentRequest} ProcessDocumentRequest + * @returns {google.cloud.documentai.v1beta2.Vertex} Vertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProcessDocumentRequest.decode = function decode(reader, length) { + Vertex.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.Vertex(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.decode(reader, reader.uint32()); + message.x = reader.int32(); break; case 2: - message.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.documentType = reader.string(); - break; - case 4: - message.tableExtractionParams = $root.google.cloud.documentai.v1beta1.TableExtractionParams.decode(reader, reader.uint32()); - break; - case 5: - message.formExtractionParams = $root.google.cloud.documentai.v1beta1.FormExtractionParams.decode(reader, reader.uint32()); - break; - case 6: - message.entityExtractionParams = $root.google.cloud.documentai.v1beta1.EntityExtractionParams.decode(reader, reader.uint32()); - break; - case 7: - message.ocrParams = $root.google.cloud.documentai.v1beta1.OcrParams.decode(reader, reader.uint32()); + message.y = reader.int32(); break; default: reader.skipType(tag & 7); @@ -539,187 +7379,117 @@ }; /** - * Decodes a ProcessDocumentRequest message from the specified reader or buffer, length delimited. + * Decodes a Vertex message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @memberof google.cloud.documentai.v1beta2.Vertex * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta1.ProcessDocumentRequest} ProcessDocumentRequest + * @returns {google.cloud.documentai.v1beta2.Vertex} Vertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProcessDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + Vertex.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ProcessDocumentRequest message. + * Verifies a Vertex message. * @function verify - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @memberof google.cloud.documentai.v1beta2.Vertex * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ProcessDocumentRequest.verify = function verify(message) { + Vertex.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.documentai.v1beta1.InputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { - var error = $root.google.cloud.documentai.v1beta1.OutputConfig.verify(message.outputConfig); - if (error) - return "outputConfig." + error; - } - if (message.documentType != null && message.hasOwnProperty("documentType")) - if (!$util.isString(message.documentType)) - return "documentType: string expected"; - if (message.tableExtractionParams != null && message.hasOwnProperty("tableExtractionParams")) { - var error = $root.google.cloud.documentai.v1beta1.TableExtractionParams.verify(message.tableExtractionParams); - if (error) - return "tableExtractionParams." + error; - } - if (message.formExtractionParams != null && message.hasOwnProperty("formExtractionParams")) { - var error = $root.google.cloud.documentai.v1beta1.FormExtractionParams.verify(message.formExtractionParams); - if (error) - return "formExtractionParams." + error; - } - if (message.entityExtractionParams != null && message.hasOwnProperty("entityExtractionParams")) { - var error = $root.google.cloud.documentai.v1beta1.EntityExtractionParams.verify(message.entityExtractionParams); - if (error) - return "entityExtractionParams." + error; - } - if (message.ocrParams != null && message.hasOwnProperty("ocrParams")) { - var error = $root.google.cloud.documentai.v1beta1.OcrParams.verify(message.ocrParams); - if (error) - return "ocrParams." + error; - } + if (message.x != null && message.hasOwnProperty("x")) + if (!$util.isInteger(message.x)) + return "x: integer expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (!$util.isInteger(message.y)) + return "y: integer expected"; return null; }; /** - * Creates a ProcessDocumentRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Vertex message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @memberof google.cloud.documentai.v1beta2.Vertex * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta1.ProcessDocumentRequest} ProcessDocumentRequest + * @returns {google.cloud.documentai.v1beta2.Vertex} Vertex */ - ProcessDocumentRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest) + Vertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Vertex) return object; - var message = new $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest(); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.fromObject(object.inputConfig); - } - if (object.outputConfig != null) { - if (typeof object.outputConfig !== "object") - throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentRequest.outputConfig: object expected"); - message.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.fromObject(object.outputConfig); - } - if (object.documentType != null) - message.documentType = String(object.documentType); - if (object.tableExtractionParams != null) { - if (typeof object.tableExtractionParams !== "object") - throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentRequest.tableExtractionParams: object expected"); - message.tableExtractionParams = $root.google.cloud.documentai.v1beta1.TableExtractionParams.fromObject(object.tableExtractionParams); - } - if (object.formExtractionParams != null) { - if (typeof object.formExtractionParams !== "object") - throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentRequest.formExtractionParams: object expected"); - message.formExtractionParams = $root.google.cloud.documentai.v1beta1.FormExtractionParams.fromObject(object.formExtractionParams); - } - if (object.entityExtractionParams != null) { - if (typeof object.entityExtractionParams !== "object") - throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentRequest.entityExtractionParams: object expected"); - message.entityExtractionParams = $root.google.cloud.documentai.v1beta1.EntityExtractionParams.fromObject(object.entityExtractionParams); - } - if (object.ocrParams != null) { - if (typeof object.ocrParams !== "object") - throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentRequest.ocrParams: object expected"); - message.ocrParams = $root.google.cloud.documentai.v1beta1.OcrParams.fromObject(object.ocrParams); - } + var message = new $root.google.cloud.documentai.v1beta2.Vertex(); + if (object.x != null) + message.x = object.x | 0; + if (object.y != null) + message.y = object.y | 0; return message; }; /** - * Creates a plain object from a ProcessDocumentRequest message. Also converts values to other types if specified. + * Creates a plain object from a Vertex message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @memberof google.cloud.documentai.v1beta2.Vertex * @static - * @param {google.cloud.documentai.v1beta1.ProcessDocumentRequest} message ProcessDocumentRequest + * @param {google.cloud.documentai.v1beta2.Vertex} message Vertex * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ProcessDocumentRequest.toObject = function toObject(message, options) { + Vertex.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.inputConfig = null; - object.outputConfig = null; - object.documentType = ""; - object.tableExtractionParams = null; - object.formExtractionParams = null; - object.entityExtractionParams = null; - object.ocrParams = null; + object.x = 0; + object.y = 0; } - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.toObject(message.inputConfig, options); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - object.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.toObject(message.outputConfig, options); - if (message.documentType != null && message.hasOwnProperty("documentType")) - object.documentType = message.documentType; - if (message.tableExtractionParams != null && message.hasOwnProperty("tableExtractionParams")) - object.tableExtractionParams = $root.google.cloud.documentai.v1beta1.TableExtractionParams.toObject(message.tableExtractionParams, options); - if (message.formExtractionParams != null && message.hasOwnProperty("formExtractionParams")) - object.formExtractionParams = $root.google.cloud.documentai.v1beta1.FormExtractionParams.toObject(message.formExtractionParams, options); - if (message.entityExtractionParams != null && message.hasOwnProperty("entityExtractionParams")) - object.entityExtractionParams = $root.google.cloud.documentai.v1beta1.EntityExtractionParams.toObject(message.entityExtractionParams, options); - if (message.ocrParams != null && message.hasOwnProperty("ocrParams")) - object.ocrParams = $root.google.cloud.documentai.v1beta1.OcrParams.toObject(message.ocrParams, options); + if (message.x != null && message.hasOwnProperty("x")) + object.x = message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = message.y; return object; }; /** - * Converts this ProcessDocumentRequest to JSON. + * Converts this Vertex to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @memberof google.cloud.documentai.v1beta2.Vertex * @instance * @returns {Object.} JSON object */ - ProcessDocumentRequest.prototype.toJSON = function toJSON() { + Vertex.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ProcessDocumentRequest; + return Vertex; })(); - v1beta1.BatchProcessDocumentsResponse = (function() { + v1beta2.NormalizedVertex = (function() { /** - * Properties of a BatchProcessDocumentsResponse. - * @memberof google.cloud.documentai.v1beta1 - * @interface IBatchProcessDocumentsResponse - * @property {Array.|null} [responses] BatchProcessDocumentsResponse responses + * Properties of a NormalizedVertex. + * @memberof google.cloud.documentai.v1beta2 + * @interface INormalizedVertex + * @property {number|null} [x] NormalizedVertex x + * @property {number|null} [y] NormalizedVertex y */ /** - * Constructs a new BatchProcessDocumentsResponse. - * @memberof google.cloud.documentai.v1beta1 - * @classdesc Represents a BatchProcessDocumentsResponse. - * @implements IBatchProcessDocumentsResponse + * Constructs a new NormalizedVertex. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a NormalizedVertex. + * @implements INormalizedVertex * @constructor - * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta2.INormalizedVertex=} [properties] Properties to set */ - function BatchProcessDocumentsResponse(properties) { - this.responses = []; + function NormalizedVertex(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -727,78 +7497,88 @@ } /** - * BatchProcessDocumentsResponse responses. - * @member {Array.} responses - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * NormalizedVertex x. + * @member {number} x + * @memberof google.cloud.documentai.v1beta2.NormalizedVertex * @instance */ - BatchProcessDocumentsResponse.prototype.responses = $util.emptyArray; + NormalizedVertex.prototype.x = 0; /** - * Creates a new BatchProcessDocumentsResponse instance using the specified properties. + * NormalizedVertex y. + * @member {number} y + * @memberof google.cloud.documentai.v1beta2.NormalizedVertex + * @instance + */ + NormalizedVertex.prototype.y = 0; + + /** + * Creates a new NormalizedVertex instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @memberof google.cloud.documentai.v1beta2.NormalizedVertex * @static - * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse} BatchProcessDocumentsResponse instance + * @param {google.cloud.documentai.v1beta2.INormalizedVertex=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.NormalizedVertex} NormalizedVertex instance */ - BatchProcessDocumentsResponse.create = function create(properties) { - return new BatchProcessDocumentsResponse(properties); + NormalizedVertex.create = function create(properties) { + return new NormalizedVertex(properties); }; /** - * Encodes the specified BatchProcessDocumentsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.verify|verify} messages. + * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.documentai.v1beta2.NormalizedVertex.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @memberof google.cloud.documentai.v1beta2.NormalizedVertex * @static - * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse} message BatchProcessDocumentsResponse message or plain object to encode + * @param {google.cloud.documentai.v1beta2.INormalizedVertex} message NormalizedVertex message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchProcessDocumentsResponse.encode = function encode(message, writer) { + NormalizedVertex.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.responses != null && message.responses.length) - for (var i = 0; i < message.responses.length; ++i) - $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.x != null && message.hasOwnProperty("x")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); + if (message.y != null && message.hasOwnProperty("y")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); return writer; }; /** - * Encodes the specified BatchProcessDocumentsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.verify|verify} messages. + * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.NormalizedVertex.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @memberof google.cloud.documentai.v1beta2.NormalizedVertex * @static - * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse} message BatchProcessDocumentsResponse message or plain object to encode + * @param {google.cloud.documentai.v1beta2.INormalizedVertex} message NormalizedVertex message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchProcessDocumentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + NormalizedVertex.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BatchProcessDocumentsResponse message from the specified reader or buffer. + * Decodes a NormalizedVertex message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @memberof google.cloud.documentai.v1beta2.NormalizedVertex * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse} BatchProcessDocumentsResponse + * @returns {google.cloud.documentai.v1beta2.NormalizedVertex} NormalizedVertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchProcessDocumentsResponse.decode = function decode(reader, length) { + NormalizedVertex.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.NormalizedVertex(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.responses && message.responses.length)) - message.responses = []; - message.responses.push($root.google.cloud.documentai.v1beta1.ProcessDocumentResponse.decode(reader, reader.uint32())); + message.x = reader.float(); + break; + case 2: + message.y = reader.float(); break; default: reader.skipType(tag & 7); @@ -809,125 +7589,119 @@ }; /** - * Decodes a BatchProcessDocumentsResponse message from the specified reader or buffer, length delimited. + * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @memberof google.cloud.documentai.v1beta2.NormalizedVertex * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse} BatchProcessDocumentsResponse + * @returns {google.cloud.documentai.v1beta2.NormalizedVertex} NormalizedVertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchProcessDocumentsResponse.decodeDelimited = function decodeDelimited(reader) { + NormalizedVertex.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BatchProcessDocumentsResponse message. + * Verifies a NormalizedVertex message. * @function verify - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @memberof google.cloud.documentai.v1beta2.NormalizedVertex * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BatchProcessDocumentsResponse.verify = function verify(message) { + NormalizedVertex.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.responses != null && message.hasOwnProperty("responses")) { - if (!Array.isArray(message.responses)) - return "responses: array expected"; - for (var i = 0; i < message.responses.length; ++i) { - var error = $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse.verify(message.responses[i]); - if (error) - return "responses." + error; - } - } + if (message.x != null && message.hasOwnProperty("x")) + if (typeof message.x !== "number") + return "x: number expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (typeof message.y !== "number") + return "y: number expected"; return null; }; /** - * Creates a BatchProcessDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @memberof google.cloud.documentai.v1beta2.NormalizedVertex * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse} BatchProcessDocumentsResponse + * @returns {google.cloud.documentai.v1beta2.NormalizedVertex} NormalizedVertex */ - BatchProcessDocumentsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse) + NormalizedVertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.NormalizedVertex) return object; - var message = new $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse(); - if (object.responses) { - if (!Array.isArray(object.responses)) - throw TypeError(".google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.responses: array expected"); - message.responses = []; - for (var i = 0; i < object.responses.length; ++i) { - if (typeof object.responses[i] !== "object") - throw TypeError(".google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.responses: object expected"); - message.responses[i] = $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse.fromObject(object.responses[i]); - } - } + var message = new $root.google.cloud.documentai.v1beta2.NormalizedVertex(); + if (object.x != null) + message.x = Number(object.x); + if (object.y != null) + message.y = Number(object.y); return message; }; /** - * Creates a plain object from a BatchProcessDocumentsResponse message. Also converts values to other types if specified. + * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @memberof google.cloud.documentai.v1beta2.NormalizedVertex * @static - * @param {google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse} message BatchProcessDocumentsResponse + * @param {google.cloud.documentai.v1beta2.NormalizedVertex} message NormalizedVertex * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BatchProcessDocumentsResponse.toObject = function toObject(message, options) { + NormalizedVertex.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.responses = []; - if (message.responses && message.responses.length) { - object.responses = []; - for (var j = 0; j < message.responses.length; ++j) - object.responses[j] = $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse.toObject(message.responses[j], options); + if (options.defaults) { + object.x = 0; + object.y = 0; } + if (message.x != null && message.hasOwnProperty("x")) + object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; return object; }; /** - * Converts this BatchProcessDocumentsResponse to JSON. + * Converts this NormalizedVertex to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @memberof google.cloud.documentai.v1beta2.NormalizedVertex * @instance * @returns {Object.} JSON object */ - BatchProcessDocumentsResponse.prototype.toJSON = function toJSON() { + NormalizedVertex.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BatchProcessDocumentsResponse; + return NormalizedVertex; })(); - v1beta1.ProcessDocumentResponse = (function() { + v1beta2.BoundingPoly = (function() { /** - * Properties of a ProcessDocumentResponse. - * @memberof google.cloud.documentai.v1beta1 - * @interface IProcessDocumentResponse - * @property {google.cloud.documentai.v1beta1.IInputConfig|null} [inputConfig] ProcessDocumentResponse inputConfig - * @property {google.cloud.documentai.v1beta1.IOutputConfig|null} [outputConfig] ProcessDocumentResponse outputConfig + * Properties of a BoundingPoly. + * @memberof google.cloud.documentai.v1beta2 + * @interface IBoundingPoly + * @property {Array.|null} [vertices] BoundingPoly vertices + * @property {Array.|null} [normalizedVertices] BoundingPoly normalizedVertices */ /** - * Constructs a new ProcessDocumentResponse. - * @memberof google.cloud.documentai.v1beta1 - * @classdesc Represents a ProcessDocumentResponse. - * @implements IProcessDocumentResponse + * Constructs a new BoundingPoly. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a BoundingPoly. + * @implements IBoundingPoly * @constructor - * @param {google.cloud.documentai.v1beta1.IProcessDocumentResponse=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta2.IBoundingPoly=} [properties] Properties to set */ - function ProcessDocumentResponse(properties) { + function BoundingPoly(properties) { + this.vertices = []; + this.normalizedVertices = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -935,88 +7709,94 @@ } /** - * ProcessDocumentResponse inputConfig. - * @member {google.cloud.documentai.v1beta1.IInputConfig|null|undefined} inputConfig - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * BoundingPoly vertices. + * @member {Array.} vertices + * @memberof google.cloud.documentai.v1beta2.BoundingPoly * @instance */ - ProcessDocumentResponse.prototype.inputConfig = null; + BoundingPoly.prototype.vertices = $util.emptyArray; /** - * ProcessDocumentResponse outputConfig. - * @member {google.cloud.documentai.v1beta1.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * BoundingPoly normalizedVertices. + * @member {Array.} normalizedVertices + * @memberof google.cloud.documentai.v1beta2.BoundingPoly * @instance */ - ProcessDocumentResponse.prototype.outputConfig = null; + BoundingPoly.prototype.normalizedVertices = $util.emptyArray; /** - * Creates a new ProcessDocumentResponse instance using the specified properties. + * Creates a new BoundingPoly instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @memberof google.cloud.documentai.v1beta2.BoundingPoly * @static - * @param {google.cloud.documentai.v1beta1.IProcessDocumentResponse=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta1.ProcessDocumentResponse} ProcessDocumentResponse instance + * @param {google.cloud.documentai.v1beta2.IBoundingPoly=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.BoundingPoly} BoundingPoly instance */ - ProcessDocumentResponse.create = function create(properties) { - return new ProcessDocumentResponse(properties); + BoundingPoly.create = function create(properties) { + return new BoundingPoly(properties); }; /** - * Encodes the specified ProcessDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentResponse.verify|verify} messages. + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.documentai.v1beta2.BoundingPoly.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @memberof google.cloud.documentai.v1beta2.BoundingPoly * @static - * @param {google.cloud.documentai.v1beta1.IProcessDocumentResponse} message ProcessDocumentResponse message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IBoundingPoly} message BoundingPoly message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProcessDocumentResponse.encode = function encode(message, writer) { + BoundingPoly.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - $root.google.cloud.documentai.v1beta1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - $root.google.cloud.documentai.v1beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.vertices != null && message.vertices.length) + for (var i = 0; i < message.vertices.length; ++i) + $root.google.cloud.documentai.v1beta2.Vertex.encode(message.vertices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.normalizedVertices != null && message.normalizedVertices.length) + for (var i = 0; i < message.normalizedVertices.length; ++i) + $root.google.cloud.documentai.v1beta2.NormalizedVertex.encode(message.normalizedVertices[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified ProcessDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentResponse.verify|verify} messages. + * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.BoundingPoly.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @memberof google.cloud.documentai.v1beta2.BoundingPoly * @static - * @param {google.cloud.documentai.v1beta1.IProcessDocumentResponse} message ProcessDocumentResponse message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IBoundingPoly} message BoundingPoly message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProcessDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { + BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProcessDocumentResponse message from the specified reader or buffer. + * Decodes a BoundingPoly message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @memberof google.cloud.documentai.v1beta2.BoundingPoly * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta1.ProcessDocumentResponse} ProcessDocumentResponse + * @returns {google.cloud.documentai.v1beta2.BoundingPoly} BoundingPoly * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProcessDocumentResponse.decode = function decode(reader, length) { + BoundingPoly.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.BoundingPoly(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.decode(reader, reader.uint32()); + if (!(message.vertices && message.vertices.length)) + message.vertices = []; + message.vertices.push($root.google.cloud.documentai.v1beta2.Vertex.decode(reader, reader.uint32())); break; case 2: - message.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.decode(reader, reader.uint32()); + if (!(message.normalizedVertices && message.normalizedVertices.length)) + message.normalizedVertices = []; + message.normalizedVertices.push($root.google.cloud.documentai.v1beta2.NormalizedVertex.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -1027,127 +7807,253 @@ }; /** - * Decodes a ProcessDocumentResponse message from the specified reader or buffer, length delimited. + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @memberof google.cloud.documentai.v1beta2.BoundingPoly * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta1.ProcessDocumentResponse} ProcessDocumentResponse + * @returns {google.cloud.documentai.v1beta2.BoundingPoly} BoundingPoly * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProcessDocumentResponse.decodeDelimited = function decodeDelimited(reader) { + BoundingPoly.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ProcessDocumentResponse message. + * Verifies a BoundingPoly message. * @function verify - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @memberof google.cloud.documentai.v1beta2.BoundingPoly * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ProcessDocumentResponse.verify = function verify(message) { + BoundingPoly.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.documentai.v1beta1.InputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; + if (message.vertices != null && message.hasOwnProperty("vertices")) { + if (!Array.isArray(message.vertices)) + return "vertices: array expected"; + for (var i = 0; i < message.vertices.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.Vertex.verify(message.vertices[i]); + if (error) + return "vertices." + error; + } } - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { - var error = $root.google.cloud.documentai.v1beta1.OutputConfig.verify(message.outputConfig); - if (error) - return "outputConfig." + error; + if (message.normalizedVertices != null && message.hasOwnProperty("normalizedVertices")) { + if (!Array.isArray(message.normalizedVertices)) + return "normalizedVertices: array expected"; + for (var i = 0; i < message.normalizedVertices.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.NormalizedVertex.verify(message.normalizedVertices[i]); + if (error) + return "normalizedVertices." + error; + } } return null; }; /** - * Creates a ProcessDocumentResponse message from a plain object. Also converts values to their respective internal types. + * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @memberof google.cloud.documentai.v1beta2.BoundingPoly * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta1.ProcessDocumentResponse} ProcessDocumentResponse + * @returns {google.cloud.documentai.v1beta2.BoundingPoly} BoundingPoly */ - ProcessDocumentResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse) + BoundingPoly.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.BoundingPoly) return object; - var message = new $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse(); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentResponse.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.fromObject(object.inputConfig); + var message = new $root.google.cloud.documentai.v1beta2.BoundingPoly(); + if (object.vertices) { + if (!Array.isArray(object.vertices)) + throw TypeError(".google.cloud.documentai.v1beta2.BoundingPoly.vertices: array expected"); + message.vertices = []; + for (var i = 0; i < object.vertices.length; ++i) { + if (typeof object.vertices[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.BoundingPoly.vertices: object expected"); + message.vertices[i] = $root.google.cloud.documentai.v1beta2.Vertex.fromObject(object.vertices[i]); + } } - if (object.outputConfig != null) { - if (typeof object.outputConfig !== "object") - throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentResponse.outputConfig: object expected"); - message.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.fromObject(object.outputConfig); + if (object.normalizedVertices) { + if (!Array.isArray(object.normalizedVertices)) + throw TypeError(".google.cloud.documentai.v1beta2.BoundingPoly.normalizedVertices: array expected"); + message.normalizedVertices = []; + for (var i = 0; i < object.normalizedVertices.length; ++i) { + if (typeof object.normalizedVertices[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.BoundingPoly.normalizedVertices: object expected"); + message.normalizedVertices[i] = $root.google.cloud.documentai.v1beta2.NormalizedVertex.fromObject(object.normalizedVertices[i]); + } } return message; }; /** - * Creates a plain object from a ProcessDocumentResponse message. Also converts values to other types if specified. + * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @memberof google.cloud.documentai.v1beta2.BoundingPoly * @static - * @param {google.cloud.documentai.v1beta1.ProcessDocumentResponse} message ProcessDocumentResponse + * @param {google.cloud.documentai.v1beta2.BoundingPoly} message BoundingPoly * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ProcessDocumentResponse.toObject = function toObject(message, options) { + BoundingPoly.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.inputConfig = null; - object.outputConfig = null; + if (options.arrays || options.defaults) { + object.vertices = []; + object.normalizedVertices = []; + } + if (message.vertices && message.vertices.length) { + object.vertices = []; + for (var j = 0; j < message.vertices.length; ++j) + object.vertices[j] = $root.google.cloud.documentai.v1beta2.Vertex.toObject(message.vertices[j], options); + } + if (message.normalizedVertices && message.normalizedVertices.length) { + object.normalizedVertices = []; + for (var j = 0; j < message.normalizedVertices.length; ++j) + object.normalizedVertices[j] = $root.google.cloud.documentai.v1beta2.NormalizedVertex.toObject(message.normalizedVertices[j], options); } - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.toObject(message.inputConfig, options); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - object.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.toObject(message.outputConfig, options); return object; }; /** - * Converts this ProcessDocumentResponse to JSON. + * Converts this BoundingPoly to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @memberof google.cloud.documentai.v1beta2.BoundingPoly * @instance * @returns {Object.} JSON object */ - ProcessDocumentResponse.prototype.toJSON = function toJSON() { + BoundingPoly.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ProcessDocumentResponse; + return BoundingPoly; })(); - v1beta1.OcrParams = (function() { + v1beta2.DocumentUnderstandingService = (function() { /** - * Properties of an OcrParams. - * @memberof google.cloud.documentai.v1beta1 - * @interface IOcrParams - * @property {Array.|null} [languageHints] OcrParams languageHints + * Constructs a new DocumentUnderstandingService service. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a DocumentUnderstandingService + * @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 DocumentUnderstandingService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (DocumentUnderstandingService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = DocumentUnderstandingService; /** - * Constructs a new OcrParams. - * @memberof google.cloud.documentai.v1beta1 - * @classdesc Represents an OcrParams. - * @implements IOcrParams + * Creates new DocumentUnderstandingService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.documentai.v1beta2.DocumentUnderstandingService + * @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 {DocumentUnderstandingService} RPC service. Useful where requests and/or responses are streamed. + */ + DocumentUnderstandingService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.documentai.v1beta2.DocumentUnderstandingService#batchProcessDocuments}. + * @memberof google.cloud.documentai.v1beta2.DocumentUnderstandingService + * @typedef BatchProcessDocumentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchProcessDocuments. + * @function batchProcessDocuments + * @memberof google.cloud.documentai.v1beta2.DocumentUnderstandingService + * @instance + * @param {google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest} request BatchProcessDocumentsRequest message or plain object + * @param {google.cloud.documentai.v1beta2.DocumentUnderstandingService.BatchProcessDocumentsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentUnderstandingService.prototype.batchProcessDocuments = function batchProcessDocuments(request, callback) { + return this.rpcCall(batchProcessDocuments, $root.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchProcessDocuments" }); + + /** + * Calls BatchProcessDocuments. + * @function batchProcessDocuments + * @memberof google.cloud.documentai.v1beta2.DocumentUnderstandingService + * @instance + * @param {google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest} request BatchProcessDocumentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1beta2.DocumentUnderstandingService#processDocument}. + * @memberof google.cloud.documentai.v1beta2.DocumentUnderstandingService + * @typedef ProcessDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1beta2.Document} [response] Document + */ + + /** + * Calls ProcessDocument. + * @function processDocument + * @memberof google.cloud.documentai.v1beta2.DocumentUnderstandingService + * @instance + * @param {google.cloud.documentai.v1beta2.IProcessDocumentRequest} request ProcessDocumentRequest message or plain object + * @param {google.cloud.documentai.v1beta2.DocumentUnderstandingService.ProcessDocumentCallback} callback Node-style callback called with the error, if any, and Document + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentUnderstandingService.prototype.processDocument = function processDocument(request, callback) { + return this.rpcCall(processDocument, $root.google.cloud.documentai.v1beta2.ProcessDocumentRequest, $root.google.cloud.documentai.v1beta2.Document, request, callback); + }, "name", { value: "ProcessDocument" }); + + /** + * Calls ProcessDocument. + * @function processDocument + * @memberof google.cloud.documentai.v1beta2.DocumentUnderstandingService + * @instance + * @param {google.cloud.documentai.v1beta2.IProcessDocumentRequest} request ProcessDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return DocumentUnderstandingService; + })(); + + v1beta2.BatchProcessDocumentsRequest = (function() { + + /** + * Properties of a BatchProcessDocumentsRequest. + * @memberof google.cloud.documentai.v1beta2 + * @interface IBatchProcessDocumentsRequest + * @property {Array.|null} [requests] BatchProcessDocumentsRequest requests + * @property {string|null} [parent] BatchProcessDocumentsRequest parent + */ + + /** + * Constructs a new BatchProcessDocumentsRequest. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a BatchProcessDocumentsRequest. + * @implements IBatchProcessDocumentsRequest * @constructor - * @param {google.cloud.documentai.v1beta1.IOcrParams=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest=} [properties] Properties to set */ - function OcrParams(properties) { - this.languageHints = []; + function BatchProcessDocumentsRequest(properties) { + this.requests = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1155,78 +8061,91 @@ } /** - * OcrParams languageHints. - * @member {Array.} languageHints - * @memberof google.cloud.documentai.v1beta1.OcrParams + * BatchProcessDocumentsRequest requests. + * @member {Array.} requests + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest * @instance */ - OcrParams.prototype.languageHints = $util.emptyArray; + BatchProcessDocumentsRequest.prototype.requests = $util.emptyArray; /** - * Creates a new OcrParams instance using the specified properties. + * BatchProcessDocumentsRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest + * @instance + */ + BatchProcessDocumentsRequest.prototype.parent = ""; + + /** + * Creates a new BatchProcessDocumentsRequest instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta1.OcrParams + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest * @static - * @param {google.cloud.documentai.v1beta1.IOcrParams=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta1.OcrParams} OcrParams instance + * @param {google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest} BatchProcessDocumentsRequest instance */ - OcrParams.create = function create(properties) { - return new OcrParams(properties); + BatchProcessDocumentsRequest.create = function create(properties) { + return new BatchProcessDocumentsRequest(properties); }; /** - * Encodes the specified OcrParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.OcrParams.verify|verify} messages. + * Encodes the specified BatchProcessDocumentsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta1.OcrParams + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest * @static - * @param {google.cloud.documentai.v1beta1.IOcrParams} message OcrParams message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest} message BatchProcessDocumentsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OcrParams.encode = function encode(message, writer) { + BatchProcessDocumentsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.languageHints != null && message.languageHints.length) - for (var i = 0; i < message.languageHints.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.languageHints[i]); + if (message.requests != null && message.requests.length) + for (var i = 0; i < message.requests.length; ++i) + $root.google.cloud.documentai.v1beta2.ProcessDocumentRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.parent != null && message.hasOwnProperty("parent")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.parent); return writer; }; /** - * Encodes the specified OcrParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.OcrParams.verify|verify} messages. + * Encodes the specified BatchProcessDocumentsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta1.OcrParams + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest * @static - * @param {google.cloud.documentai.v1beta1.IOcrParams} message OcrParams message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest} message BatchProcessDocumentsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OcrParams.encodeDelimited = function encodeDelimited(message, writer) { + BatchProcessDocumentsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an OcrParams message from the specified reader or buffer. + * Decodes a BatchProcessDocumentsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta1.OcrParams + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta1.OcrParams} OcrParams + * @returns {google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest} BatchProcessDocumentsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OcrParams.decode = function decode(reader, length) { + BatchProcessDocumentsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.OcrParams(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.languageHints && message.languageHints.length)) - message.languageHints = []; - message.languageHints.push(reader.string()); + if (!(message.requests && message.requests.length)) + message.requests = []; + message.requests.push($root.google.cloud.documentai.v1beta2.ProcessDocumentRequest.decode(reader, reader.uint32())); + break; + case 2: + message.parent = reader.string(); break; default: reader.skipType(tag & 7); @@ -1237,124 +8156,141 @@ }; /** - * Decodes an OcrParams message from the specified reader or buffer, length delimited. + * Decodes a BatchProcessDocumentsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta1.OcrParams + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta1.OcrParams} OcrParams + * @returns {google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest} BatchProcessDocumentsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OcrParams.decodeDelimited = function decodeDelimited(reader) { + BatchProcessDocumentsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an OcrParams message. + * Verifies a BatchProcessDocumentsRequest message. * @function verify - * @memberof google.cloud.documentai.v1beta1.OcrParams + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - OcrParams.verify = function verify(message) { + BatchProcessDocumentsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.languageHints != null && message.hasOwnProperty("languageHints")) { - if (!Array.isArray(message.languageHints)) - return "languageHints: array expected"; - for (var i = 0; i < message.languageHints.length; ++i) - if (!$util.isString(message.languageHints[i])) - return "languageHints: string[] expected"; + if (message.requests != null && message.hasOwnProperty("requests")) { + if (!Array.isArray(message.requests)) + return "requests: array expected"; + for (var i = 0; i < message.requests.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.ProcessDocumentRequest.verify(message.requests[i]); + if (error) + return "requests." + error; + } } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; return null; }; /** - * Creates an OcrParams message from a plain object. Also converts values to their respective internal types. + * Creates a BatchProcessDocumentsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta1.OcrParams + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta1.OcrParams} OcrParams + * @returns {google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest} BatchProcessDocumentsRequest */ - OcrParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta1.OcrParams) + BatchProcessDocumentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest) return object; - var message = new $root.google.cloud.documentai.v1beta1.OcrParams(); - if (object.languageHints) { - if (!Array.isArray(object.languageHints)) - throw TypeError(".google.cloud.documentai.v1beta1.OcrParams.languageHints: array expected"); - message.languageHints = []; - for (var i = 0; i < object.languageHints.length; ++i) - message.languageHints[i] = String(object.languageHints[i]); + var message = new $root.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest(); + if (object.requests) { + if (!Array.isArray(object.requests)) + throw TypeError(".google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest.requests: array expected"); + message.requests = []; + for (var i = 0; i < object.requests.length; ++i) { + if (typeof object.requests[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest.requests: object expected"); + message.requests[i] = $root.google.cloud.documentai.v1beta2.ProcessDocumentRequest.fromObject(object.requests[i]); + } } + if (object.parent != null) + message.parent = String(object.parent); return message; }; /** - * Creates a plain object from an OcrParams message. Also converts values to other types if specified. + * Creates a plain object from a BatchProcessDocumentsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta1.OcrParams + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest * @static - * @param {google.cloud.documentai.v1beta1.OcrParams} message OcrParams + * @param {google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest} message BatchProcessDocumentsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - OcrParams.toObject = function toObject(message, options) { + BatchProcessDocumentsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.languageHints = []; - if (message.languageHints && message.languageHints.length) { - object.languageHints = []; - for (var j = 0; j < message.languageHints.length; ++j) - object.languageHints[j] = message.languageHints[j]; + object.requests = []; + if (options.defaults) + object.parent = ""; + if (message.requests && message.requests.length) { + object.requests = []; + for (var j = 0; j < message.requests.length; ++j) + object.requests[j] = $root.google.cloud.documentai.v1beta2.ProcessDocumentRequest.toObject(message.requests[j], options); } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; return object; }; /** - * Converts this OcrParams to JSON. + * Converts this BatchProcessDocumentsRequest to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta1.OcrParams + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest * @instance * @returns {Object.} JSON object */ - OcrParams.prototype.toJSON = function toJSON() { + BatchProcessDocumentsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return OcrParams; + return BatchProcessDocumentsRequest; })(); - v1beta1.TableExtractionParams = (function() { + v1beta2.ProcessDocumentRequest = (function() { /** - * Properties of a TableExtractionParams. - * @memberof google.cloud.documentai.v1beta1 - * @interface ITableExtractionParams - * @property {boolean|null} [enabled] TableExtractionParams enabled - * @property {Array.|null} [tableBoundHints] TableExtractionParams tableBoundHints - * @property {Array.|null} [headerHints] TableExtractionParams headerHints - * @property {string|null} [modelVersion] TableExtractionParams modelVersion + * Properties of a ProcessDocumentRequest. + * @memberof google.cloud.documentai.v1beta2 + * @interface IProcessDocumentRequest + * @property {string|null} [parent] ProcessDocumentRequest parent + * @property {google.cloud.documentai.v1beta2.IInputConfig|null} [inputConfig] ProcessDocumentRequest inputConfig + * @property {google.cloud.documentai.v1beta2.IOutputConfig|null} [outputConfig] ProcessDocumentRequest outputConfig + * @property {string|null} [documentType] ProcessDocumentRequest documentType + * @property {google.cloud.documentai.v1beta2.ITableExtractionParams|null} [tableExtractionParams] ProcessDocumentRequest tableExtractionParams + * @property {google.cloud.documentai.v1beta2.IFormExtractionParams|null} [formExtractionParams] ProcessDocumentRequest formExtractionParams + * @property {google.cloud.documentai.v1beta2.IEntityExtractionParams|null} [entityExtractionParams] ProcessDocumentRequest entityExtractionParams + * @property {google.cloud.documentai.v1beta2.IOcrParams|null} [ocrParams] ProcessDocumentRequest ocrParams + * @property {google.cloud.documentai.v1beta2.IAutoMlParams|null} [automlParams] ProcessDocumentRequest automlParams */ /** - * Constructs a new TableExtractionParams. - * @memberof google.cloud.documentai.v1beta1 - * @classdesc Represents a TableExtractionParams. - * @implements ITableExtractionParams + * Constructs a new ProcessDocumentRequest. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a ProcessDocumentRequest. + * @implements IProcessDocumentRequest * @constructor - * @param {google.cloud.documentai.v1beta1.ITableExtractionParams=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta2.IProcessDocumentRequest=} [properties] Properties to set */ - function TableExtractionParams(properties) { - this.tableBoundHints = []; - this.headerHints = []; + function ProcessDocumentRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1362,120 +8298,179 @@ } /** - * TableExtractionParams enabled. - * @member {boolean} enabled - * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * ProcessDocumentRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest * @instance */ - TableExtractionParams.prototype.enabled = false; + ProcessDocumentRequest.prototype.parent = ""; /** - * TableExtractionParams tableBoundHints. - * @member {Array.} tableBoundHints - * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * ProcessDocumentRequest inputConfig. + * @member {google.cloud.documentai.v1beta2.IInputConfig|null|undefined} inputConfig + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest * @instance */ - TableExtractionParams.prototype.tableBoundHints = $util.emptyArray; + ProcessDocumentRequest.prototype.inputConfig = null; /** - * TableExtractionParams headerHints. - * @member {Array.} headerHints - * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * ProcessDocumentRequest outputConfig. + * @member {google.cloud.documentai.v1beta2.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest * @instance */ - TableExtractionParams.prototype.headerHints = $util.emptyArray; + ProcessDocumentRequest.prototype.outputConfig = null; /** - * TableExtractionParams modelVersion. - * @member {string} modelVersion - * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * ProcessDocumentRequest documentType. + * @member {string} documentType + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest * @instance */ - TableExtractionParams.prototype.modelVersion = ""; + ProcessDocumentRequest.prototype.documentType = ""; /** - * Creates a new TableExtractionParams instance using the specified properties. - * @function create - * @memberof google.cloud.documentai.v1beta1.TableExtractionParams - * @static - * @param {google.cloud.documentai.v1beta1.ITableExtractionParams=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta1.TableExtractionParams} TableExtractionParams instance + * ProcessDocumentRequest tableExtractionParams. + * @member {google.cloud.documentai.v1beta2.ITableExtractionParams|null|undefined} tableExtractionParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest + * @instance */ - TableExtractionParams.create = function create(properties) { - return new TableExtractionParams(properties); - }; + ProcessDocumentRequest.prototype.tableExtractionParams = null; /** - * Encodes the specified TableExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.TableExtractionParams.verify|verify} messages. - * @function encode - * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * ProcessDocumentRequest formExtractionParams. + * @member {google.cloud.documentai.v1beta2.IFormExtractionParams|null|undefined} formExtractionParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.formExtractionParams = null; + + /** + * ProcessDocumentRequest entityExtractionParams. + * @member {google.cloud.documentai.v1beta2.IEntityExtractionParams|null|undefined} entityExtractionParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.entityExtractionParams = null; + + /** + * ProcessDocumentRequest ocrParams. + * @member {google.cloud.documentai.v1beta2.IOcrParams|null|undefined} ocrParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.ocrParams = null; + + /** + * ProcessDocumentRequest automlParams. + * @member {google.cloud.documentai.v1beta2.IAutoMlParams|null|undefined} automlParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.automlParams = null; + + /** + * Creates a new ProcessDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta2.IProcessDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.ProcessDocumentRequest} ProcessDocumentRequest instance + */ + ProcessDocumentRequest.create = function create(properties) { + return new ProcessDocumentRequest(properties); + }; + + /** + * Encodes the specified ProcessDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta2.ProcessDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest * @static - * @param {google.cloud.documentai.v1beta1.ITableExtractionParams} message TableExtractionParams message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IProcessDocumentRequest} message ProcessDocumentRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - TableExtractionParams.encode = function encode(message, writer) { + ProcessDocumentRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.enabled != null && message.hasOwnProperty("enabled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); - if (message.tableBoundHints != null && message.tableBoundHints.length) - for (var i = 0; i < message.tableBoundHints.length; ++i) - $root.google.cloud.documentai.v1beta1.TableBoundHint.encode(message.tableBoundHints[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.headerHints != null && message.headerHints.length) - for (var i = 0; i < message.headerHints.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.headerHints[i]); - if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.modelVersion); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + $root.google.cloud.documentai.v1beta2.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + $root.google.cloud.documentai.v1beta2.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.documentType != null && message.hasOwnProperty("documentType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.documentType); + if (message.tableExtractionParams != null && message.hasOwnProperty("tableExtractionParams")) + $root.google.cloud.documentai.v1beta2.TableExtractionParams.encode(message.tableExtractionParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.formExtractionParams != null && message.hasOwnProperty("formExtractionParams")) + $root.google.cloud.documentai.v1beta2.FormExtractionParams.encode(message.formExtractionParams, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.entityExtractionParams != null && message.hasOwnProperty("entityExtractionParams")) + $root.google.cloud.documentai.v1beta2.EntityExtractionParams.encode(message.entityExtractionParams, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.ocrParams != null && message.hasOwnProperty("ocrParams")) + $root.google.cloud.documentai.v1beta2.OcrParams.encode(message.ocrParams, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.automlParams != null && message.hasOwnProperty("automlParams")) + $root.google.cloud.documentai.v1beta2.AutoMlParams.encode(message.automlParams, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.parent != null && message.hasOwnProperty("parent")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.parent); return writer; }; /** - * Encodes the specified TableExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.TableExtractionParams.verify|verify} messages. + * Encodes the specified ProcessDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.ProcessDocumentRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest * @static - * @param {google.cloud.documentai.v1beta1.ITableExtractionParams} message TableExtractionParams message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IProcessDocumentRequest} message ProcessDocumentRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - TableExtractionParams.encodeDelimited = function encodeDelimited(message, writer) { + ProcessDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a TableExtractionParams message from the specified reader or buffer. + * Decodes a ProcessDocumentRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta1.TableExtractionParams} TableExtractionParams + * @returns {google.cloud.documentai.v1beta2.ProcessDocumentRequest} ProcessDocumentRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TableExtractionParams.decode = function decode(reader, length) { + ProcessDocumentRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.TableExtractionParams(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.ProcessDocumentRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 9: + message.parent = reader.string(); + break; case 1: - message.enabled = reader.bool(); + message.inputConfig = $root.google.cloud.documentai.v1beta2.InputConfig.decode(reader, reader.uint32()); break; case 2: - if (!(message.tableBoundHints && message.tableBoundHints.length)) - message.tableBoundHints = []; - message.tableBoundHints.push($root.google.cloud.documentai.v1beta1.TableBoundHint.decode(reader, reader.uint32())); + message.outputConfig = $root.google.cloud.documentai.v1beta2.OutputConfig.decode(reader, reader.uint32()); break; case 3: - if (!(message.headerHints && message.headerHints.length)) - message.headerHints = []; - message.headerHints.push(reader.string()); + message.documentType = reader.string(); break; case 4: - message.modelVersion = reader.string(); + message.tableExtractionParams = $root.google.cloud.documentai.v1beta2.TableExtractionParams.decode(reader, reader.uint32()); + break; + case 5: + message.formExtractionParams = $root.google.cloud.documentai.v1beta2.FormExtractionParams.decode(reader, reader.uint32()); + break; + case 6: + message.entityExtractionParams = $root.google.cloud.documentai.v1beta2.EntityExtractionParams.decode(reader, reader.uint32()); + break; + case 7: + message.ocrParams = $root.google.cloud.documentai.v1beta2.OcrParams.decode(reader, reader.uint32()); + break; + case 8: + message.automlParams = $root.google.cloud.documentai.v1beta2.AutoMlParams.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -1486,164 +8481,208 @@ }; /** - * Decodes a TableExtractionParams message from the specified reader or buffer, length delimited. + * Decodes a ProcessDocumentRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta1.TableExtractionParams} TableExtractionParams + * @returns {google.cloud.documentai.v1beta2.ProcessDocumentRequest} ProcessDocumentRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TableExtractionParams.decodeDelimited = function decodeDelimited(reader) { + ProcessDocumentRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a TableExtractionParams message. + * Verifies a ProcessDocumentRequest message. * @function verify - * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - TableExtractionParams.verify = function verify(message) { + ProcessDocumentRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.enabled != null && message.hasOwnProperty("enabled")) - if (typeof message.enabled !== "boolean") - return "enabled: boolean expected"; - if (message.tableBoundHints != null && message.hasOwnProperty("tableBoundHints")) { - if (!Array.isArray(message.tableBoundHints)) - return "tableBoundHints: array expected"; - for (var i = 0; i < message.tableBoundHints.length; ++i) { - var error = $root.google.cloud.documentai.v1beta1.TableBoundHint.verify(message.tableBoundHints[i]); - if (error) - return "tableBoundHints." + 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.documentai.v1beta2.InputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; } - if (message.headerHints != null && message.hasOwnProperty("headerHints")) { - if (!Array.isArray(message.headerHints)) - return "headerHints: array expected"; - for (var i = 0; i < message.headerHints.length; ++i) - if (!$util.isString(message.headerHints[i])) - return "headerHints: string[] expected"; + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.documentai.v1beta2.OutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } + if (message.documentType != null && message.hasOwnProperty("documentType")) + if (!$util.isString(message.documentType)) + return "documentType: string expected"; + if (message.tableExtractionParams != null && message.hasOwnProperty("tableExtractionParams")) { + var error = $root.google.cloud.documentai.v1beta2.TableExtractionParams.verify(message.tableExtractionParams); + if (error) + return "tableExtractionParams." + error; + } + if (message.formExtractionParams != null && message.hasOwnProperty("formExtractionParams")) { + var error = $root.google.cloud.documentai.v1beta2.FormExtractionParams.verify(message.formExtractionParams); + if (error) + return "formExtractionParams." + error; + } + if (message.entityExtractionParams != null && message.hasOwnProperty("entityExtractionParams")) { + var error = $root.google.cloud.documentai.v1beta2.EntityExtractionParams.verify(message.entityExtractionParams); + if (error) + return "entityExtractionParams." + error; + } + if (message.ocrParams != null && message.hasOwnProperty("ocrParams")) { + var error = $root.google.cloud.documentai.v1beta2.OcrParams.verify(message.ocrParams); + if (error) + return "ocrParams." + error; + } + if (message.automlParams != null && message.hasOwnProperty("automlParams")) { + var error = $root.google.cloud.documentai.v1beta2.AutoMlParams.verify(message.automlParams); + if (error) + return "automlParams." + error; } - if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) - if (!$util.isString(message.modelVersion)) - return "modelVersion: string expected"; return null; }; /** - * Creates a TableExtractionParams message from a plain object. Also converts values to their respective internal types. + * Creates a ProcessDocumentRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta1.TableExtractionParams} TableExtractionParams + * @returns {google.cloud.documentai.v1beta2.ProcessDocumentRequest} ProcessDocumentRequest */ - TableExtractionParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta1.TableExtractionParams) + ProcessDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.ProcessDocumentRequest) return object; - var message = new $root.google.cloud.documentai.v1beta1.TableExtractionParams(); - if (object.enabled != null) - message.enabled = Boolean(object.enabled); - if (object.tableBoundHints) { - if (!Array.isArray(object.tableBoundHints)) - throw TypeError(".google.cloud.documentai.v1beta1.TableExtractionParams.tableBoundHints: array expected"); - message.tableBoundHints = []; - for (var i = 0; i < object.tableBoundHints.length; ++i) { - if (typeof object.tableBoundHints[i] !== "object") - throw TypeError(".google.cloud.documentai.v1beta1.TableExtractionParams.tableBoundHints: object expected"); - message.tableBoundHints[i] = $root.google.cloud.documentai.v1beta1.TableBoundHint.fromObject(object.tableBoundHints[i]); - } + var message = new $root.google.cloud.documentai.v1beta2.ProcessDocumentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.ProcessDocumentRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.documentai.v1beta2.InputConfig.fromObject(object.inputConfig); } - if (object.headerHints) { - if (!Array.isArray(object.headerHints)) - throw TypeError(".google.cloud.documentai.v1beta1.TableExtractionParams.headerHints: array expected"); - message.headerHints = []; - for (var i = 0; i < object.headerHints.length; ++i) - message.headerHints[i] = String(object.headerHints[i]); + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.ProcessDocumentRequest.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.documentai.v1beta2.OutputConfig.fromObject(object.outputConfig); + } + if (object.documentType != null) + message.documentType = String(object.documentType); + if (object.tableExtractionParams != null) { + if (typeof object.tableExtractionParams !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.ProcessDocumentRequest.tableExtractionParams: object expected"); + message.tableExtractionParams = $root.google.cloud.documentai.v1beta2.TableExtractionParams.fromObject(object.tableExtractionParams); + } + if (object.formExtractionParams != null) { + if (typeof object.formExtractionParams !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.ProcessDocumentRequest.formExtractionParams: object expected"); + message.formExtractionParams = $root.google.cloud.documentai.v1beta2.FormExtractionParams.fromObject(object.formExtractionParams); + } + if (object.entityExtractionParams != null) { + if (typeof object.entityExtractionParams !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.ProcessDocumentRequest.entityExtractionParams: object expected"); + message.entityExtractionParams = $root.google.cloud.documentai.v1beta2.EntityExtractionParams.fromObject(object.entityExtractionParams); + } + if (object.ocrParams != null) { + if (typeof object.ocrParams !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.ProcessDocumentRequest.ocrParams: object expected"); + message.ocrParams = $root.google.cloud.documentai.v1beta2.OcrParams.fromObject(object.ocrParams); + } + if (object.automlParams != null) { + if (typeof object.automlParams !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.ProcessDocumentRequest.automlParams: object expected"); + message.automlParams = $root.google.cloud.documentai.v1beta2.AutoMlParams.fromObject(object.automlParams); } - if (object.modelVersion != null) - message.modelVersion = String(object.modelVersion); return message; }; /** - * Creates a plain object from a TableExtractionParams message. Also converts values to other types if specified. + * Creates a plain object from a ProcessDocumentRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest * @static - * @param {google.cloud.documentai.v1beta1.TableExtractionParams} message TableExtractionParams + * @param {google.cloud.documentai.v1beta2.ProcessDocumentRequest} message ProcessDocumentRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - TableExtractionParams.toObject = function toObject(message, options) { + ProcessDocumentRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.tableBoundHints = []; - object.headerHints = []; - } if (options.defaults) { - object.enabled = false; - object.modelVersion = ""; - } - if (message.enabled != null && message.hasOwnProperty("enabled")) - object.enabled = message.enabled; - if (message.tableBoundHints && message.tableBoundHints.length) { - object.tableBoundHints = []; - for (var j = 0; j < message.tableBoundHints.length; ++j) - object.tableBoundHints[j] = $root.google.cloud.documentai.v1beta1.TableBoundHint.toObject(message.tableBoundHints[j], options); - } - if (message.headerHints && message.headerHints.length) { - object.headerHints = []; - for (var j = 0; j < message.headerHints.length; ++j) - object.headerHints[j] = message.headerHints[j]; + object.inputConfig = null; + object.outputConfig = null; + object.documentType = ""; + object.tableExtractionParams = null; + object.formExtractionParams = null; + object.entityExtractionParams = null; + object.ocrParams = null; + object.automlParams = null; + object.parent = ""; } - if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) - object.modelVersion = message.modelVersion; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.documentai.v1beta2.InputConfig.toObject(message.inputConfig, options); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.documentai.v1beta2.OutputConfig.toObject(message.outputConfig, options); + if (message.documentType != null && message.hasOwnProperty("documentType")) + object.documentType = message.documentType; + if (message.tableExtractionParams != null && message.hasOwnProperty("tableExtractionParams")) + object.tableExtractionParams = $root.google.cloud.documentai.v1beta2.TableExtractionParams.toObject(message.tableExtractionParams, options); + if (message.formExtractionParams != null && message.hasOwnProperty("formExtractionParams")) + object.formExtractionParams = $root.google.cloud.documentai.v1beta2.FormExtractionParams.toObject(message.formExtractionParams, options); + if (message.entityExtractionParams != null && message.hasOwnProperty("entityExtractionParams")) + object.entityExtractionParams = $root.google.cloud.documentai.v1beta2.EntityExtractionParams.toObject(message.entityExtractionParams, options); + if (message.ocrParams != null && message.hasOwnProperty("ocrParams")) + object.ocrParams = $root.google.cloud.documentai.v1beta2.OcrParams.toObject(message.ocrParams, options); + if (message.automlParams != null && message.hasOwnProperty("automlParams")) + object.automlParams = $root.google.cloud.documentai.v1beta2.AutoMlParams.toObject(message.automlParams, options); + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; return object; }; /** - * Converts this TableExtractionParams to JSON. + * Converts this ProcessDocumentRequest to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest * @instance * @returns {Object.} JSON object */ - TableExtractionParams.prototype.toJSON = function toJSON() { + ProcessDocumentRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return TableExtractionParams; + return ProcessDocumentRequest; })(); - v1beta1.TableBoundHint = (function() { + v1beta2.BatchProcessDocumentsResponse = (function() { /** - * Properties of a TableBoundHint. - * @memberof google.cloud.documentai.v1beta1 - * @interface ITableBoundHint - * @property {number|null} [pageNumber] TableBoundHint pageNumber - * @property {google.cloud.documentai.v1beta1.IBoundingPoly|null} [boundingBox] TableBoundHint boundingBox + * Properties of a BatchProcessDocumentsResponse. + * @memberof google.cloud.documentai.v1beta2 + * @interface IBatchProcessDocumentsResponse + * @property {Array.|null} [responses] BatchProcessDocumentsResponse responses */ /** - * Constructs a new TableBoundHint. - * @memberof google.cloud.documentai.v1beta1 - * @classdesc Represents a TableBoundHint. - * @implements ITableBoundHint + * Constructs a new BatchProcessDocumentsResponse. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a BatchProcessDocumentsResponse. + * @implements IBatchProcessDocumentsResponse * @constructor - * @param {google.cloud.documentai.v1beta1.ITableBoundHint=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse=} [properties] Properties to set */ - function TableBoundHint(properties) { + function BatchProcessDocumentsResponse(properties) { + this.responses = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1651,88 +8690,78 @@ } /** - * TableBoundHint pageNumber. - * @member {number} pageNumber - * @memberof google.cloud.documentai.v1beta1.TableBoundHint - * @instance - */ - TableBoundHint.prototype.pageNumber = 0; - - /** - * TableBoundHint boundingBox. - * @member {google.cloud.documentai.v1beta1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * BatchProcessDocumentsResponse responses. + * @member {Array.} responses + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse * @instance */ - TableBoundHint.prototype.boundingBox = null; + BatchProcessDocumentsResponse.prototype.responses = $util.emptyArray; /** - * Creates a new TableBoundHint instance using the specified properties. + * Creates a new BatchProcessDocumentsResponse instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse * @static - * @param {google.cloud.documentai.v1beta1.ITableBoundHint=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta1.TableBoundHint} TableBoundHint instance + * @param {google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse} BatchProcessDocumentsResponse instance */ - TableBoundHint.create = function create(properties) { - return new TableBoundHint(properties); + BatchProcessDocumentsResponse.create = function create(properties) { + return new BatchProcessDocumentsResponse(properties); }; /** - * Encodes the specified TableBoundHint message. Does not implicitly {@link google.cloud.documentai.v1beta1.TableBoundHint.verify|verify} messages. + * Encodes the specified BatchProcessDocumentsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse * @static - * @param {google.cloud.documentai.v1beta1.ITableBoundHint} message TableBoundHint message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse} message BatchProcessDocumentsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - TableBoundHint.encode = function encode(message, writer) { + BatchProcessDocumentsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.pageNumber); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - $root.google.cloud.documentai.v1beta1.BoundingPoly.encode(message.boundingBox, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; + if (message.responses != null && message.responses.length) + for (var i = 0; i < message.responses.length; ++i) + $root.google.cloud.documentai.v1beta2.ProcessDocumentResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; }; /** - * Encodes the specified TableBoundHint message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.TableBoundHint.verify|verify} messages. + * Encodes the specified BatchProcessDocumentsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse * @static - * @param {google.cloud.documentai.v1beta1.ITableBoundHint} message TableBoundHint message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse} message BatchProcessDocumentsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - TableBoundHint.encodeDelimited = function encodeDelimited(message, writer) { + BatchProcessDocumentsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a TableBoundHint message from the specified reader or buffer. + * Decodes a BatchProcessDocumentsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta1.TableBoundHint} TableBoundHint + * @returns {google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse} BatchProcessDocumentsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TableBoundHint.decode = function decode(reader, length) { + BatchProcessDocumentsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.TableBoundHint(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.pageNumber = reader.int32(); - break; - case 2: - message.boundingBox = $root.google.cloud.documentai.v1beta1.BoundingPoly.decode(reader, reader.uint32()); + if (!(message.responses && message.responses.length)) + message.responses = []; + message.responses.push($root.google.cloud.documentai.v1beta2.ProcessDocumentResponse.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -1743,124 +8772,125 @@ }; /** - * Decodes a TableBoundHint message from the specified reader or buffer, length delimited. + * Decodes a BatchProcessDocumentsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta1.TableBoundHint} TableBoundHint + * @returns {google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse} BatchProcessDocumentsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TableBoundHint.decodeDelimited = function decodeDelimited(reader) { + BatchProcessDocumentsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a TableBoundHint message. + * Verifies a BatchProcessDocumentsResponse message. * @function verify - * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - TableBoundHint.verify = function verify(message) { + BatchProcessDocumentsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) - if (!$util.isInteger(message.pageNumber)) - return "pageNumber: integer expected"; - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.documentai.v1beta1.BoundingPoly.verify(message.boundingBox); - if (error) - return "boundingBox." + error; + if (message.responses != null && message.hasOwnProperty("responses")) { + if (!Array.isArray(message.responses)) + return "responses: array expected"; + for (var i = 0; i < message.responses.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.ProcessDocumentResponse.verify(message.responses[i]); + if (error) + return "responses." + error; + } } return null; }; /** - * Creates a TableBoundHint message from a plain object. Also converts values to their respective internal types. + * Creates a BatchProcessDocumentsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta1.TableBoundHint} TableBoundHint + * @returns {google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse} BatchProcessDocumentsResponse */ - TableBoundHint.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta1.TableBoundHint) + BatchProcessDocumentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse) return object; - var message = new $root.google.cloud.documentai.v1beta1.TableBoundHint(); - if (object.pageNumber != null) - message.pageNumber = object.pageNumber | 0; - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.documentai.v1beta1.TableBoundHint.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.documentai.v1beta1.BoundingPoly.fromObject(object.boundingBox); + var message = new $root.google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse(); + if (object.responses) { + if (!Array.isArray(object.responses)) + throw TypeError(".google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse.responses: array expected"); + message.responses = []; + for (var i = 0; i < object.responses.length; ++i) { + if (typeof object.responses[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse.responses: object expected"); + message.responses[i] = $root.google.cloud.documentai.v1beta2.ProcessDocumentResponse.fromObject(object.responses[i]); + } } return message; }; /** - * Creates a plain object from a TableBoundHint message. Also converts values to other types if specified. + * Creates a plain object from a BatchProcessDocumentsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse * @static - * @param {google.cloud.documentai.v1beta1.TableBoundHint} message TableBoundHint + * @param {google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse} message BatchProcessDocumentsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - TableBoundHint.toObject = function toObject(message, options) { + BatchProcessDocumentsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.pageNumber = 0; - object.boundingBox = null; + if (options.arrays || options.defaults) + object.responses = []; + if (message.responses && message.responses.length) { + object.responses = []; + for (var j = 0; j < message.responses.length; ++j) + object.responses[j] = $root.google.cloud.documentai.v1beta2.ProcessDocumentResponse.toObject(message.responses[j], options); } - if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) - object.pageNumber = message.pageNumber; - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.documentai.v1beta1.BoundingPoly.toObject(message.boundingBox, options); return object; }; /** - * Converts this TableBoundHint to JSON. + * Converts this BatchProcessDocumentsResponse to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse * @instance * @returns {Object.} JSON object */ - TableBoundHint.prototype.toJSON = function toJSON() { + BatchProcessDocumentsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return TableBoundHint; + return BatchProcessDocumentsResponse; })(); - v1beta1.FormExtractionParams = (function() { + v1beta2.ProcessDocumentResponse = (function() { /** - * Properties of a FormExtractionParams. - * @memberof google.cloud.documentai.v1beta1 - * @interface IFormExtractionParams - * @property {boolean|null} [enabled] FormExtractionParams enabled - * @property {Array.|null} [keyValuePairHints] FormExtractionParams keyValuePairHints - * @property {string|null} [modelVersion] FormExtractionParams modelVersion + * Properties of a ProcessDocumentResponse. + * @memberof google.cloud.documentai.v1beta2 + * @interface IProcessDocumentResponse + * @property {google.cloud.documentai.v1beta2.IInputConfig|null} [inputConfig] ProcessDocumentResponse inputConfig + * @property {google.cloud.documentai.v1beta2.IOutputConfig|null} [outputConfig] ProcessDocumentResponse outputConfig */ /** - * Constructs a new FormExtractionParams. - * @memberof google.cloud.documentai.v1beta1 - * @classdesc Represents a FormExtractionParams. - * @implements IFormExtractionParams + * Constructs a new ProcessDocumentResponse. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a ProcessDocumentResponse. + * @implements IProcessDocumentResponse * @constructor - * @param {google.cloud.documentai.v1beta1.IFormExtractionParams=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta2.IProcessDocumentResponse=} [properties] Properties to set */ - function FormExtractionParams(properties) { - this.keyValuePairHints = []; + function ProcessDocumentResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1868,104 +8898,88 @@ } /** - * FormExtractionParams enabled. - * @member {boolean} enabled - * @memberof google.cloud.documentai.v1beta1.FormExtractionParams - * @instance - */ - FormExtractionParams.prototype.enabled = false; - - /** - * FormExtractionParams keyValuePairHints. - * @member {Array.} keyValuePairHints - * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * ProcessDocumentResponse inputConfig. + * @member {google.cloud.documentai.v1beta2.IInputConfig|null|undefined} inputConfig + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentResponse * @instance */ - FormExtractionParams.prototype.keyValuePairHints = $util.emptyArray; + ProcessDocumentResponse.prototype.inputConfig = null; /** - * FormExtractionParams modelVersion. - * @member {string} modelVersion - * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * ProcessDocumentResponse outputConfig. + * @member {google.cloud.documentai.v1beta2.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentResponse * @instance */ - FormExtractionParams.prototype.modelVersion = ""; + ProcessDocumentResponse.prototype.outputConfig = null; /** - * Creates a new FormExtractionParams instance using the specified properties. + * Creates a new ProcessDocumentResponse instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentResponse * @static - * @param {google.cloud.documentai.v1beta1.IFormExtractionParams=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta1.FormExtractionParams} FormExtractionParams instance + * @param {google.cloud.documentai.v1beta2.IProcessDocumentResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.ProcessDocumentResponse} ProcessDocumentResponse instance */ - FormExtractionParams.create = function create(properties) { - return new FormExtractionParams(properties); + ProcessDocumentResponse.create = function create(properties) { + return new ProcessDocumentResponse(properties); }; /** - * Encodes the specified FormExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.FormExtractionParams.verify|verify} messages. + * Encodes the specified ProcessDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta2.ProcessDocumentResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentResponse * @static - * @param {google.cloud.documentai.v1beta1.IFormExtractionParams} message FormExtractionParams message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IProcessDocumentResponse} message ProcessDocumentResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FormExtractionParams.encode = function encode(message, writer) { + ProcessDocumentResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.enabled != null && message.hasOwnProperty("enabled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); - if (message.keyValuePairHints != null && message.keyValuePairHints.length) - for (var i = 0; i < message.keyValuePairHints.length; ++i) - $root.google.cloud.documentai.v1beta1.KeyValuePairHint.encode(message.keyValuePairHints[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.modelVersion); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + $root.google.cloud.documentai.v1beta2.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + $root.google.cloud.documentai.v1beta2.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified FormExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.FormExtractionParams.verify|verify} messages. + * Encodes the specified ProcessDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.ProcessDocumentResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentResponse * @static - * @param {google.cloud.documentai.v1beta1.IFormExtractionParams} message FormExtractionParams message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IProcessDocumentResponse} message ProcessDocumentResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FormExtractionParams.encodeDelimited = function encodeDelimited(message, writer) { + ProcessDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FormExtractionParams message from the specified reader or buffer. + * Decodes a ProcessDocumentResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta1.FormExtractionParams} FormExtractionParams + * @returns {google.cloud.documentai.v1beta2.ProcessDocumentResponse} ProcessDocumentResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FormExtractionParams.decode = function decode(reader, length) { + ProcessDocumentResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.FormExtractionParams(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.ProcessDocumentResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.enabled = reader.bool(); + message.inputConfig = $root.google.cloud.documentai.v1beta2.InputConfig.decode(reader, reader.uint32()); break; case 2: - if (!(message.keyValuePairHints && message.keyValuePairHints.length)) - message.keyValuePairHints = []; - message.keyValuePairHints.push($root.google.cloud.documentai.v1beta1.KeyValuePairHint.decode(reader, reader.uint32())); - break; - case 3: - message.modelVersion = reader.string(); + message.outputConfig = $root.google.cloud.documentai.v1beta2.OutputConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -1976,144 +8990,127 @@ }; /** - * Decodes a FormExtractionParams message from the specified reader or buffer, length delimited. + * Decodes a ProcessDocumentResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta1.FormExtractionParams} FormExtractionParams + * @returns {google.cloud.documentai.v1beta2.ProcessDocumentResponse} ProcessDocumentResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FormExtractionParams.decodeDelimited = function decodeDelimited(reader) { + ProcessDocumentResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FormExtractionParams message. + * Verifies a ProcessDocumentResponse message. * @function verify - * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FormExtractionParams.verify = function verify(message) { + ProcessDocumentResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.enabled != null && message.hasOwnProperty("enabled")) - if (typeof message.enabled !== "boolean") - return "enabled: boolean expected"; - if (message.keyValuePairHints != null && message.hasOwnProperty("keyValuePairHints")) { - if (!Array.isArray(message.keyValuePairHints)) - return "keyValuePairHints: array expected"; - for (var i = 0; i < message.keyValuePairHints.length; ++i) { - var error = $root.google.cloud.documentai.v1beta1.KeyValuePairHint.verify(message.keyValuePairHints[i]); - if (error) - return "keyValuePairHints." + error; - } + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.documentai.v1beta2.InputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.documentai.v1beta2.OutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; } - if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) - if (!$util.isString(message.modelVersion)) - return "modelVersion: string expected"; return null; }; /** - * Creates a FormExtractionParams message from a plain object. Also converts values to their respective internal types. + * Creates a ProcessDocumentResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta1.FormExtractionParams} FormExtractionParams + * @returns {google.cloud.documentai.v1beta2.ProcessDocumentResponse} ProcessDocumentResponse */ - FormExtractionParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta1.FormExtractionParams) + ProcessDocumentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.ProcessDocumentResponse) return object; - var message = new $root.google.cloud.documentai.v1beta1.FormExtractionParams(); - if (object.enabled != null) - message.enabled = Boolean(object.enabled); - if (object.keyValuePairHints) { - if (!Array.isArray(object.keyValuePairHints)) - throw TypeError(".google.cloud.documentai.v1beta1.FormExtractionParams.keyValuePairHints: array expected"); - message.keyValuePairHints = []; - for (var i = 0; i < object.keyValuePairHints.length; ++i) { - if (typeof object.keyValuePairHints[i] !== "object") - throw TypeError(".google.cloud.documentai.v1beta1.FormExtractionParams.keyValuePairHints: object expected"); - message.keyValuePairHints[i] = $root.google.cloud.documentai.v1beta1.KeyValuePairHint.fromObject(object.keyValuePairHints[i]); - } + var message = new $root.google.cloud.documentai.v1beta2.ProcessDocumentResponse(); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.ProcessDocumentResponse.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.documentai.v1beta2.InputConfig.fromObject(object.inputConfig); + } + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.ProcessDocumentResponse.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.documentai.v1beta2.OutputConfig.fromObject(object.outputConfig); } - if (object.modelVersion != null) - message.modelVersion = String(object.modelVersion); return message; }; /** - * Creates a plain object from a FormExtractionParams message. Also converts values to other types if specified. + * Creates a plain object from a ProcessDocumentResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentResponse * @static - * @param {google.cloud.documentai.v1beta1.FormExtractionParams} message FormExtractionParams + * @param {google.cloud.documentai.v1beta2.ProcessDocumentResponse} message ProcessDocumentResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FormExtractionParams.toObject = function toObject(message, options) { + ProcessDocumentResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.keyValuePairHints = []; if (options.defaults) { - object.enabled = false; - object.modelVersion = ""; - } - if (message.enabled != null && message.hasOwnProperty("enabled")) - object.enabled = message.enabled; - if (message.keyValuePairHints && message.keyValuePairHints.length) { - object.keyValuePairHints = []; - for (var j = 0; j < message.keyValuePairHints.length; ++j) - object.keyValuePairHints[j] = $root.google.cloud.documentai.v1beta1.KeyValuePairHint.toObject(message.keyValuePairHints[j], options); + object.inputConfig = null; + object.outputConfig = null; } - if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) - object.modelVersion = message.modelVersion; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.documentai.v1beta2.InputConfig.toObject(message.inputConfig, options); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.documentai.v1beta2.OutputConfig.toObject(message.outputConfig, options); return object; }; /** - * Converts this FormExtractionParams to JSON. + * Converts this ProcessDocumentResponse to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentResponse * @instance * @returns {Object.} JSON object */ - FormExtractionParams.prototype.toJSON = function toJSON() { + ProcessDocumentResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return FormExtractionParams; + return ProcessDocumentResponse; })(); - v1beta1.KeyValuePairHint = (function() { + v1beta2.OcrParams = (function() { /** - * Properties of a KeyValuePairHint. - * @memberof google.cloud.documentai.v1beta1 - * @interface IKeyValuePairHint - * @property {string|null} [key] KeyValuePairHint key - * @property {Array.|null} [valueTypes] KeyValuePairHint valueTypes + * Properties of an OcrParams. + * @memberof google.cloud.documentai.v1beta2 + * @interface IOcrParams + * @property {Array.|null} [languageHints] OcrParams languageHints */ /** - * Constructs a new KeyValuePairHint. - * @memberof google.cloud.documentai.v1beta1 - * @classdesc Represents a KeyValuePairHint. - * @implements IKeyValuePairHint + * Constructs a new OcrParams. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents an OcrParams. + * @implements IOcrParams * @constructor - * @param {google.cloud.documentai.v1beta1.IKeyValuePairHint=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta2.IOcrParams=} [properties] Properties to set */ - function KeyValuePairHint(properties) { - this.valueTypes = []; + function OcrParams(properties) { + this.languageHints = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2121,91 +9118,78 @@ } /** - * KeyValuePairHint key. - * @member {string} key - * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint - * @instance - */ - KeyValuePairHint.prototype.key = ""; - - /** - * KeyValuePairHint valueTypes. - * @member {Array.} valueTypes - * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * OcrParams languageHints. + * @member {Array.} languageHints + * @memberof google.cloud.documentai.v1beta2.OcrParams * @instance */ - KeyValuePairHint.prototype.valueTypes = $util.emptyArray; + OcrParams.prototype.languageHints = $util.emptyArray; /** - * Creates a new KeyValuePairHint instance using the specified properties. + * Creates a new OcrParams instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @memberof google.cloud.documentai.v1beta2.OcrParams * @static - * @param {google.cloud.documentai.v1beta1.IKeyValuePairHint=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta1.KeyValuePairHint} KeyValuePairHint instance + * @param {google.cloud.documentai.v1beta2.IOcrParams=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.OcrParams} OcrParams instance */ - KeyValuePairHint.create = function create(properties) { - return new KeyValuePairHint(properties); + OcrParams.create = function create(properties) { + return new OcrParams(properties); }; /** - * Encodes the specified KeyValuePairHint message. Does not implicitly {@link google.cloud.documentai.v1beta1.KeyValuePairHint.verify|verify} messages. + * Encodes the specified OcrParams message. Does not implicitly {@link google.cloud.documentai.v1beta2.OcrParams.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @memberof google.cloud.documentai.v1beta2.OcrParams * @static - * @param {google.cloud.documentai.v1beta1.IKeyValuePairHint} message KeyValuePairHint message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IOcrParams} message OcrParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - KeyValuePairHint.encode = function encode(message, writer) { + OcrParams.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.key != null && message.hasOwnProperty("key")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); - if (message.valueTypes != null && message.valueTypes.length) - for (var i = 0; i < message.valueTypes.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.valueTypes[i]); + if (message.languageHints != null && message.languageHints.length) + for (var i = 0; i < message.languageHints.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.languageHints[i]); return writer; }; /** - * Encodes the specified KeyValuePairHint message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.KeyValuePairHint.verify|verify} messages. + * Encodes the specified OcrParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.OcrParams.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @memberof google.cloud.documentai.v1beta2.OcrParams * @static - * @param {google.cloud.documentai.v1beta1.IKeyValuePairHint} message KeyValuePairHint message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IOcrParams} message OcrParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - KeyValuePairHint.encodeDelimited = function encodeDelimited(message, writer) { + OcrParams.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a KeyValuePairHint message from the specified reader or buffer. + * Decodes an OcrParams message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @memberof google.cloud.documentai.v1beta2.OcrParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta1.KeyValuePairHint} KeyValuePairHint + * @returns {google.cloud.documentai.v1beta2.OcrParams} OcrParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - KeyValuePairHint.decode = function decode(reader, length) { + OcrParams.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.KeyValuePairHint(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.OcrParams(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.key = reader.string(); - break; - case 2: - if (!(message.valueTypes && message.valueTypes.length)) - message.valueTypes = []; - message.valueTypes.push(reader.string()); + if (!(message.languageHints && message.languageHints.length)) + message.languageHints = []; + message.languageHints.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -2216,129 +9200,124 @@ }; /** - * Decodes a KeyValuePairHint message from the specified reader or buffer, length delimited. + * Decodes an OcrParams message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @memberof google.cloud.documentai.v1beta2.OcrParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta1.KeyValuePairHint} KeyValuePairHint + * @returns {google.cloud.documentai.v1beta2.OcrParams} OcrParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - KeyValuePairHint.decodeDelimited = function decodeDelimited(reader) { + OcrParams.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a KeyValuePairHint message. + * Verifies an OcrParams message. * @function verify - * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @memberof google.cloud.documentai.v1beta2.OcrParams * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - KeyValuePairHint.verify = function verify(message) { + OcrParams.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.valueTypes != null && message.hasOwnProperty("valueTypes")) { - if (!Array.isArray(message.valueTypes)) - return "valueTypes: array expected"; - for (var i = 0; i < message.valueTypes.length; ++i) - if (!$util.isString(message.valueTypes[i])) - return "valueTypes: string[] expected"; + if (message.languageHints != null && message.hasOwnProperty("languageHints")) { + if (!Array.isArray(message.languageHints)) + return "languageHints: array expected"; + for (var i = 0; i < message.languageHints.length; ++i) + if (!$util.isString(message.languageHints[i])) + return "languageHints: string[] expected"; } return null; }; /** - * Creates a KeyValuePairHint message from a plain object. Also converts values to their respective internal types. + * Creates an OcrParams message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @memberof google.cloud.documentai.v1beta2.OcrParams * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta1.KeyValuePairHint} KeyValuePairHint + * @returns {google.cloud.documentai.v1beta2.OcrParams} OcrParams */ - KeyValuePairHint.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta1.KeyValuePairHint) + OcrParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.OcrParams) return object; - var message = new $root.google.cloud.documentai.v1beta1.KeyValuePairHint(); - if (object.key != null) - message.key = String(object.key); - if (object.valueTypes) { - if (!Array.isArray(object.valueTypes)) - throw TypeError(".google.cloud.documentai.v1beta1.KeyValuePairHint.valueTypes: array expected"); - message.valueTypes = []; - for (var i = 0; i < object.valueTypes.length; ++i) - message.valueTypes[i] = String(object.valueTypes[i]); + var message = new $root.google.cloud.documentai.v1beta2.OcrParams(); + if (object.languageHints) { + if (!Array.isArray(object.languageHints)) + throw TypeError(".google.cloud.documentai.v1beta2.OcrParams.languageHints: array expected"); + message.languageHints = []; + for (var i = 0; i < object.languageHints.length; ++i) + message.languageHints[i] = String(object.languageHints[i]); } return message; }; /** - * Creates a plain object from a KeyValuePairHint message. Also converts values to other types if specified. + * Creates a plain object from an OcrParams message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @memberof google.cloud.documentai.v1beta2.OcrParams * @static - * @param {google.cloud.documentai.v1beta1.KeyValuePairHint} message KeyValuePairHint + * @param {google.cloud.documentai.v1beta2.OcrParams} message OcrParams * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - KeyValuePairHint.toObject = function toObject(message, options) { + OcrParams.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.valueTypes = []; - if (options.defaults) - object.key = ""; - if (message.key != null && message.hasOwnProperty("key")) - object.key = message.key; - if (message.valueTypes && message.valueTypes.length) { - object.valueTypes = []; - for (var j = 0; j < message.valueTypes.length; ++j) - object.valueTypes[j] = message.valueTypes[j]; + object.languageHints = []; + if (message.languageHints && message.languageHints.length) { + object.languageHints = []; + for (var j = 0; j < message.languageHints.length; ++j) + object.languageHints[j] = message.languageHints[j]; } return object; }; /** - * Converts this KeyValuePairHint to JSON. + * Converts this OcrParams to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @memberof google.cloud.documentai.v1beta2.OcrParams * @instance * @returns {Object.} JSON object */ - KeyValuePairHint.prototype.toJSON = function toJSON() { + OcrParams.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return KeyValuePairHint; + return OcrParams; })(); - v1beta1.EntityExtractionParams = (function() { + v1beta2.TableExtractionParams = (function() { /** - * Properties of an EntityExtractionParams. - * @memberof google.cloud.documentai.v1beta1 - * @interface IEntityExtractionParams - * @property {boolean|null} [enabled] EntityExtractionParams enabled - * @property {string|null} [modelVersion] EntityExtractionParams modelVersion + * Properties of a TableExtractionParams. + * @memberof google.cloud.documentai.v1beta2 + * @interface ITableExtractionParams + * @property {boolean|null} [enabled] TableExtractionParams enabled + * @property {Array.|null} [tableBoundHints] TableExtractionParams tableBoundHints + * @property {Array.|null} [headerHints] TableExtractionParams headerHints + * @property {string|null} [modelVersion] TableExtractionParams modelVersion */ /** - * Constructs a new EntityExtractionParams. - * @memberof google.cloud.documentai.v1beta1 - * @classdesc Represents an EntityExtractionParams. - * @implements IEntityExtractionParams + * Constructs a new TableExtractionParams. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a TableExtractionParams. + * @implements ITableExtractionParams * @constructor - * @param {google.cloud.documentai.v1beta1.IEntityExtractionParams=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta2.ITableExtractionParams=} [properties] Properties to set */ - function EntityExtractionParams(properties) { + function TableExtractionParams(properties) { + this.tableBoundHints = []; + this.headerHints = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2346,80 +9325,102 @@ } /** - * EntityExtractionParams enabled. + * TableExtractionParams enabled. * @member {boolean} enabled - * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams * @instance */ - EntityExtractionParams.prototype.enabled = false; + TableExtractionParams.prototype.enabled = false; /** - * EntityExtractionParams modelVersion. + * TableExtractionParams tableBoundHints. + * @member {Array.} tableBoundHints + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams + * @instance + */ + TableExtractionParams.prototype.tableBoundHints = $util.emptyArray; + + /** + * TableExtractionParams headerHints. + * @member {Array.} headerHints + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams + * @instance + */ + TableExtractionParams.prototype.headerHints = $util.emptyArray; + + /** + * TableExtractionParams modelVersion. * @member {string} modelVersion - * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams * @instance */ - EntityExtractionParams.prototype.modelVersion = ""; + TableExtractionParams.prototype.modelVersion = ""; /** - * Creates a new EntityExtractionParams instance using the specified properties. + * Creates a new TableExtractionParams instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams * @static - * @param {google.cloud.documentai.v1beta1.IEntityExtractionParams=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta1.EntityExtractionParams} EntityExtractionParams instance + * @param {google.cloud.documentai.v1beta2.ITableExtractionParams=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.TableExtractionParams} TableExtractionParams instance */ - EntityExtractionParams.create = function create(properties) { - return new EntityExtractionParams(properties); + TableExtractionParams.create = function create(properties) { + return new TableExtractionParams(properties); }; /** - * Encodes the specified EntityExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.EntityExtractionParams.verify|verify} messages. + * Encodes the specified TableExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta2.TableExtractionParams.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams * @static - * @param {google.cloud.documentai.v1beta1.IEntityExtractionParams} message EntityExtractionParams message or plain object to encode + * @param {google.cloud.documentai.v1beta2.ITableExtractionParams} message TableExtractionParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EntityExtractionParams.encode = function encode(message, writer) { + TableExtractionParams.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.enabled != null && message.hasOwnProperty("enabled")) writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); + if (message.tableBoundHints != null && message.tableBoundHints.length) + for (var i = 0; i < message.tableBoundHints.length; ++i) + $root.google.cloud.documentai.v1beta2.TableBoundHint.encode(message.tableBoundHints[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.headerHints != null && message.headerHints.length) + for (var i = 0; i < message.headerHints.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.headerHints[i]); if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.modelVersion); + writer.uint32(/* id 4, wireType 2 =*/34).string(message.modelVersion); return writer; }; /** - * Encodes the specified EntityExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.EntityExtractionParams.verify|verify} messages. + * Encodes the specified TableExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.TableExtractionParams.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams * @static - * @param {google.cloud.documentai.v1beta1.IEntityExtractionParams} message EntityExtractionParams message or plain object to encode + * @param {google.cloud.documentai.v1beta2.ITableExtractionParams} message TableExtractionParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EntityExtractionParams.encodeDelimited = function encodeDelimited(message, writer) { + TableExtractionParams.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EntityExtractionParams message from the specified reader or buffer. + * Decodes a TableExtractionParams message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta1.EntityExtractionParams} EntityExtractionParams + * @returns {google.cloud.documentai.v1beta2.TableExtractionParams} TableExtractionParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EntityExtractionParams.decode = function decode(reader, length) { + TableExtractionParams.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.EntityExtractionParams(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.TableExtractionParams(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -2427,6 +9428,16 @@ message.enabled = reader.bool(); break; case 2: + if (!(message.tableBoundHints && message.tableBoundHints.length)) + message.tableBoundHints = []; + message.tableBoundHints.push($root.google.cloud.documentai.v1beta2.TableBoundHint.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.headerHints && message.headerHints.length)) + message.headerHints = []; + message.headerHints.push(reader.string()); + break; + case 4: message.modelVersion = reader.string(); break; default: @@ -2438,35 +9449,51 @@ }; /** - * Decodes an EntityExtractionParams message from the specified reader or buffer, length delimited. + * Decodes a TableExtractionParams message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta1.EntityExtractionParams} EntityExtractionParams + * @returns {google.cloud.documentai.v1beta2.TableExtractionParams} TableExtractionParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EntityExtractionParams.decodeDelimited = function decodeDelimited(reader) { + TableExtractionParams.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EntityExtractionParams message. + * Verifies a TableExtractionParams message. * @function verify - * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EntityExtractionParams.verify = function verify(message) { + TableExtractionParams.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.enabled != null && message.hasOwnProperty("enabled")) if (typeof message.enabled !== "boolean") return "enabled: boolean expected"; + if (message.tableBoundHints != null && message.hasOwnProperty("tableBoundHints")) { + if (!Array.isArray(message.tableBoundHints)) + return "tableBoundHints: array expected"; + for (var i = 0; i < message.tableBoundHints.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.TableBoundHint.verify(message.tableBoundHints[i]); + if (error) + return "tableBoundHints." + error; + } + } + if (message.headerHints != null && message.hasOwnProperty("headerHints")) { + if (!Array.isArray(message.headerHints)) + return "headerHints: array expected"; + for (var i = 0; i < message.headerHints.length; ++i) + if (!$util.isString(message.headerHints[i])) + return "headerHints: string[] expected"; + } if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) if (!$util.isString(message.modelVersion)) return "modelVersion: string expected"; @@ -2474,81 +9501,112 @@ }; /** - * Creates an EntityExtractionParams message from a plain object. Also converts values to their respective internal types. + * Creates a TableExtractionParams message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta1.EntityExtractionParams} EntityExtractionParams + * @returns {google.cloud.documentai.v1beta2.TableExtractionParams} TableExtractionParams */ - EntityExtractionParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta1.EntityExtractionParams) + TableExtractionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.TableExtractionParams) return object; - var message = new $root.google.cloud.documentai.v1beta1.EntityExtractionParams(); + var message = new $root.google.cloud.documentai.v1beta2.TableExtractionParams(); if (object.enabled != null) message.enabled = Boolean(object.enabled); + if (object.tableBoundHints) { + if (!Array.isArray(object.tableBoundHints)) + throw TypeError(".google.cloud.documentai.v1beta2.TableExtractionParams.tableBoundHints: array expected"); + message.tableBoundHints = []; + for (var i = 0; i < object.tableBoundHints.length; ++i) { + if (typeof object.tableBoundHints[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.TableExtractionParams.tableBoundHints: object expected"); + message.tableBoundHints[i] = $root.google.cloud.documentai.v1beta2.TableBoundHint.fromObject(object.tableBoundHints[i]); + } + } + if (object.headerHints) { + if (!Array.isArray(object.headerHints)) + throw TypeError(".google.cloud.documentai.v1beta2.TableExtractionParams.headerHints: array expected"); + message.headerHints = []; + for (var i = 0; i < object.headerHints.length; ++i) + message.headerHints[i] = String(object.headerHints[i]); + } if (object.modelVersion != null) message.modelVersion = String(object.modelVersion); return message; }; /** - * Creates a plain object from an EntityExtractionParams message. Also converts values to other types if specified. + * Creates a plain object from a TableExtractionParams message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams * @static - * @param {google.cloud.documentai.v1beta1.EntityExtractionParams} message EntityExtractionParams + * @param {google.cloud.documentai.v1beta2.TableExtractionParams} message TableExtractionParams * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EntityExtractionParams.toObject = function toObject(message, options) { + TableExtractionParams.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.tableBoundHints = []; + object.headerHints = []; + } if (options.defaults) { object.enabled = false; object.modelVersion = ""; } if (message.enabled != null && message.hasOwnProperty("enabled")) object.enabled = message.enabled; + if (message.tableBoundHints && message.tableBoundHints.length) { + object.tableBoundHints = []; + for (var j = 0; j < message.tableBoundHints.length; ++j) + object.tableBoundHints[j] = $root.google.cloud.documentai.v1beta2.TableBoundHint.toObject(message.tableBoundHints[j], options); + } + if (message.headerHints && message.headerHints.length) { + object.headerHints = []; + for (var j = 0; j < message.headerHints.length; ++j) + object.headerHints[j] = message.headerHints[j]; + } if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) object.modelVersion = message.modelVersion; return object; }; /** - * Converts this EntityExtractionParams to JSON. + * Converts this TableExtractionParams to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams * @instance * @returns {Object.} JSON object */ - EntityExtractionParams.prototype.toJSON = function toJSON() { + TableExtractionParams.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return EntityExtractionParams; + return TableExtractionParams; })(); - v1beta1.InputConfig = (function() { + v1beta2.TableBoundHint = (function() { /** - * Properties of an InputConfig. - * @memberof google.cloud.documentai.v1beta1 - * @interface IInputConfig - * @property {google.cloud.documentai.v1beta1.IGcsSource|null} [gcsSource] InputConfig gcsSource - * @property {string|null} [mimeType] InputConfig mimeType + * Properties of a TableBoundHint. + * @memberof google.cloud.documentai.v1beta2 + * @interface ITableBoundHint + * @property {number|null} [pageNumber] TableBoundHint pageNumber + * @property {google.cloud.documentai.v1beta2.IBoundingPoly|null} [boundingBox] TableBoundHint boundingBox */ /** - * Constructs a new InputConfig. - * @memberof google.cloud.documentai.v1beta1 - * @classdesc Represents an InputConfig. - * @implements IInputConfig + * Constructs a new TableBoundHint. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a TableBoundHint. + * @implements ITableBoundHint * @constructor - * @param {google.cloud.documentai.v1beta1.IInputConfig=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta2.ITableBoundHint=} [properties] Properties to set */ - function InputConfig(properties) { + function TableBoundHint(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2556,102 +9614,88 @@ } /** - * InputConfig gcsSource. - * @member {google.cloud.documentai.v1beta1.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.documentai.v1beta1.InputConfig - * @instance - */ - InputConfig.prototype.gcsSource = null; - - /** - * InputConfig mimeType. - * @member {string} mimeType - * @memberof google.cloud.documentai.v1beta1.InputConfig + * TableBoundHint pageNumber. + * @member {number} pageNumber + * @memberof google.cloud.documentai.v1beta2.TableBoundHint * @instance */ - InputConfig.prototype.mimeType = ""; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + TableBoundHint.prototype.pageNumber = 0; /** - * InputConfig source. - * @member {"gcsSource"|undefined} source - * @memberof google.cloud.documentai.v1beta1.InputConfig + * TableBoundHint boundingBox. + * @member {google.cloud.documentai.v1beta2.IBoundingPoly|null|undefined} boundingBox + * @memberof google.cloud.documentai.v1beta2.TableBoundHint * @instance */ - Object.defineProperty(InputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["gcsSource"]), - set: $util.oneOfSetter($oneOfFields) - }); + TableBoundHint.prototype.boundingBox = null; /** - * Creates a new InputConfig instance using the specified properties. + * Creates a new TableBoundHint instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta1.InputConfig + * @memberof google.cloud.documentai.v1beta2.TableBoundHint * @static - * @param {google.cloud.documentai.v1beta1.IInputConfig=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta1.InputConfig} InputConfig instance + * @param {google.cloud.documentai.v1beta2.ITableBoundHint=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.TableBoundHint} TableBoundHint instance */ - InputConfig.create = function create(properties) { - return new InputConfig(properties); + TableBoundHint.create = function create(properties) { + return new TableBoundHint(properties); }; /** - * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta1.InputConfig.verify|verify} messages. + * Encodes the specified TableBoundHint message. Does not implicitly {@link google.cloud.documentai.v1beta2.TableBoundHint.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta1.InputConfig + * @memberof google.cloud.documentai.v1beta2.TableBoundHint * @static - * @param {google.cloud.documentai.v1beta1.IInputConfig} message InputConfig message or plain object to encode + * @param {google.cloud.documentai.v1beta2.ITableBoundHint} message TableBoundHint message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - InputConfig.encode = function encode(message, writer) { + TableBoundHint.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) - $root.google.cloud.documentai.v1beta1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.mimeType != null && message.hasOwnProperty("mimeType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.pageNumber); + if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) + $root.google.cloud.documentai.v1beta2.BoundingPoly.encode(message.boundingBox, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.InputConfig.verify|verify} messages. + * Encodes the specified TableBoundHint message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.TableBoundHint.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta1.InputConfig + * @memberof google.cloud.documentai.v1beta2.TableBoundHint * @static - * @param {google.cloud.documentai.v1beta1.IInputConfig} message InputConfig message or plain object to encode + * @param {google.cloud.documentai.v1beta2.ITableBoundHint} message TableBoundHint message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - InputConfig.encodeDelimited = function encodeDelimited(message, writer) { + TableBoundHint.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an InputConfig message from the specified reader or buffer. + * Decodes a TableBoundHint message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta1.InputConfig + * @memberof google.cloud.documentai.v1beta2.TableBoundHint * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta1.InputConfig} InputConfig + * @returns {google.cloud.documentai.v1beta2.TableBoundHint} TableBoundHint * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - InputConfig.decode = function decode(reader, length) { + TableBoundHint.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.InputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.TableBoundHint(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsSource = $root.google.cloud.documentai.v1beta1.GcsSource.decode(reader, reader.uint32()); + message.pageNumber = reader.int32(); break; case 2: - message.mimeType = reader.string(); + message.boundingBox = $root.google.cloud.documentai.v1beta2.BoundingPoly.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -2662,127 +9706,124 @@ }; /** - * Decodes an InputConfig message from the specified reader or buffer, length delimited. + * Decodes a TableBoundHint message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta1.InputConfig + * @memberof google.cloud.documentai.v1beta2.TableBoundHint * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta1.InputConfig} InputConfig + * @returns {google.cloud.documentai.v1beta2.TableBoundHint} TableBoundHint * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - InputConfig.decodeDelimited = function decodeDelimited(reader) { + TableBoundHint.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an InputConfig message. + * Verifies a TableBoundHint message. * @function verify - * @memberof google.cloud.documentai.v1beta1.InputConfig + * @memberof google.cloud.documentai.v1beta2.TableBoundHint * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - InputConfig.verify = function verify(message) { + TableBoundHint.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - properties.source = 1; - { - var error = $root.google.cloud.documentai.v1beta1.GcsSource.verify(message.gcsSource); - if (error) - return "gcsSource." + error; - } + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + if (!$util.isInteger(message.pageNumber)) + return "pageNumber: integer expected"; + if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { + var error = $root.google.cloud.documentai.v1beta2.BoundingPoly.verify(message.boundingBox); + if (error) + return "boundingBox." + error; } - if (message.mimeType != null && message.hasOwnProperty("mimeType")) - if (!$util.isString(message.mimeType)) - return "mimeType: string expected"; return null; }; /** - * Creates an InputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a TableBoundHint message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta1.InputConfig + * @memberof google.cloud.documentai.v1beta2.TableBoundHint * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta1.InputConfig} InputConfig + * @returns {google.cloud.documentai.v1beta2.TableBoundHint} TableBoundHint */ - InputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta1.InputConfig) + TableBoundHint.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.TableBoundHint) return object; - var message = new $root.google.cloud.documentai.v1beta1.InputConfig(); - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.documentai.v1beta1.InputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.documentai.v1beta1.GcsSource.fromObject(object.gcsSource); + var message = new $root.google.cloud.documentai.v1beta2.TableBoundHint(); + if (object.pageNumber != null) + message.pageNumber = object.pageNumber | 0; + if (object.boundingBox != null) { + if (typeof object.boundingBox !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.TableBoundHint.boundingBox: object expected"); + message.boundingBox = $root.google.cloud.documentai.v1beta2.BoundingPoly.fromObject(object.boundingBox); } - if (object.mimeType != null) - message.mimeType = String(object.mimeType); return message; }; /** - * Creates a plain object from an InputConfig message. Also converts values to other types if specified. + * Creates a plain object from a TableBoundHint message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta1.InputConfig + * @memberof google.cloud.documentai.v1beta2.TableBoundHint * @static - * @param {google.cloud.documentai.v1beta1.InputConfig} message InputConfig + * @param {google.cloud.documentai.v1beta2.TableBoundHint} message TableBoundHint * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - InputConfig.toObject = function toObject(message, options) { + TableBoundHint.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.mimeType = ""; - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - object.gcsSource = $root.google.cloud.documentai.v1beta1.GcsSource.toObject(message.gcsSource, options); - if (options.oneofs) - object.source = "gcsSource"; + if (options.defaults) { + object.pageNumber = 0; + object.boundingBox = null; } - if (message.mimeType != null && message.hasOwnProperty("mimeType")) - object.mimeType = message.mimeType; + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + object.pageNumber = message.pageNumber; + if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) + object.boundingBox = $root.google.cloud.documentai.v1beta2.BoundingPoly.toObject(message.boundingBox, options); return object; }; /** - * Converts this InputConfig to JSON. + * Converts this TableBoundHint to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta1.InputConfig + * @memberof google.cloud.documentai.v1beta2.TableBoundHint * @instance * @returns {Object.} JSON object */ - InputConfig.prototype.toJSON = function toJSON() { + TableBoundHint.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return InputConfig; + return TableBoundHint; })(); - v1beta1.OutputConfig = (function() { + v1beta2.FormExtractionParams = (function() { /** - * Properties of an OutputConfig. - * @memberof google.cloud.documentai.v1beta1 - * @interface IOutputConfig - * @property {google.cloud.documentai.v1beta1.IGcsDestination|null} [gcsDestination] OutputConfig gcsDestination - * @property {number|null} [pagesPerShard] OutputConfig pagesPerShard + * Properties of a FormExtractionParams. + * @memberof google.cloud.documentai.v1beta2 + * @interface IFormExtractionParams + * @property {boolean|null} [enabled] FormExtractionParams enabled + * @property {Array.|null} [keyValuePairHints] FormExtractionParams keyValuePairHints + * @property {string|null} [modelVersion] FormExtractionParams modelVersion */ /** - * Constructs a new OutputConfig. - * @memberof google.cloud.documentai.v1beta1 - * @classdesc Represents an OutputConfig. - * @implements IOutputConfig + * Constructs a new FormExtractionParams. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a FormExtractionParams. + * @implements IFormExtractionParams * @constructor - * @param {google.cloud.documentai.v1beta1.IOutputConfig=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta2.IFormExtractionParams=} [properties] Properties to set */ - function OutputConfig(properties) { + function FormExtractionParams(properties) { + this.keyValuePairHints = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2790,102 +9831,104 @@ } /** - * OutputConfig gcsDestination. - * @member {google.cloud.documentai.v1beta1.IGcsDestination|null|undefined} gcsDestination - * @memberof google.cloud.documentai.v1beta1.OutputConfig + * FormExtractionParams enabled. + * @member {boolean} enabled + * @memberof google.cloud.documentai.v1beta2.FormExtractionParams * @instance */ - OutputConfig.prototype.gcsDestination = null; + FormExtractionParams.prototype.enabled = false; /** - * OutputConfig pagesPerShard. - * @member {number} pagesPerShard - * @memberof google.cloud.documentai.v1beta1.OutputConfig + * FormExtractionParams keyValuePairHints. + * @member {Array.} keyValuePairHints + * @memberof google.cloud.documentai.v1beta2.FormExtractionParams * @instance */ - OutputConfig.prototype.pagesPerShard = 0; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + FormExtractionParams.prototype.keyValuePairHints = $util.emptyArray; /** - * OutputConfig destination. - * @member {"gcsDestination"|undefined} destination - * @memberof google.cloud.documentai.v1beta1.OutputConfig + * FormExtractionParams modelVersion. + * @member {string} modelVersion + * @memberof google.cloud.documentai.v1beta2.FormExtractionParams * @instance */ - Object.defineProperty(OutputConfig.prototype, "destination", { - get: $util.oneOfGetter($oneOfFields = ["gcsDestination"]), - set: $util.oneOfSetter($oneOfFields) - }); + FormExtractionParams.prototype.modelVersion = ""; /** - * Creates a new OutputConfig instance using the specified properties. + * Creates a new FormExtractionParams instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @memberof google.cloud.documentai.v1beta2.FormExtractionParams * @static - * @param {google.cloud.documentai.v1beta1.IOutputConfig=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta1.OutputConfig} OutputConfig instance + * @param {google.cloud.documentai.v1beta2.IFormExtractionParams=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.FormExtractionParams} FormExtractionParams instance */ - OutputConfig.create = function create(properties) { - return new OutputConfig(properties); + FormExtractionParams.create = function create(properties) { + return new FormExtractionParams(properties); }; /** - * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta1.OutputConfig.verify|verify} messages. + * Encodes the specified FormExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta2.FormExtractionParams.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @memberof google.cloud.documentai.v1beta2.FormExtractionParams * @static - * @param {google.cloud.documentai.v1beta1.IOutputConfig} message OutputConfig message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IFormExtractionParams} message FormExtractionParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OutputConfig.encode = function encode(message, writer) { + FormExtractionParams.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) - $root.google.cloud.documentai.v1beta1.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagesPerShard != null && message.hasOwnProperty("pagesPerShard")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pagesPerShard); + if (message.enabled != null && message.hasOwnProperty("enabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); + if (message.keyValuePairHints != null && message.keyValuePairHints.length) + for (var i = 0; i < message.keyValuePairHints.length; ++i) + $root.google.cloud.documentai.v1beta2.KeyValuePairHint.encode(message.keyValuePairHints[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.modelVersion); return writer; }; /** - * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.OutputConfig.verify|verify} messages. + * Encodes the specified FormExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.FormExtractionParams.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @memberof google.cloud.documentai.v1beta2.FormExtractionParams * @static - * @param {google.cloud.documentai.v1beta1.IOutputConfig} message OutputConfig message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IFormExtractionParams} message FormExtractionParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OutputConfig.encodeDelimited = function encodeDelimited(message, writer) { + FormExtractionParams.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an OutputConfig message from the specified reader or buffer. + * Decodes a FormExtractionParams message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @memberof google.cloud.documentai.v1beta2.FormExtractionParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta1.OutputConfig} OutputConfig + * @returns {google.cloud.documentai.v1beta2.FormExtractionParams} FormExtractionParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OutputConfig.decode = function decode(reader, length) { + FormExtractionParams.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.OutputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.FormExtractionParams(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsDestination = $root.google.cloud.documentai.v1beta1.GcsDestination.decode(reader, reader.uint32()); + message.enabled = reader.bool(); break; case 2: - message.pagesPerShard = reader.int32(); + if (!(message.keyValuePairHints && message.keyValuePairHints.length)) + message.keyValuePairHints = []; + message.keyValuePairHints.push($root.google.cloud.documentai.v1beta2.KeyValuePairHint.decode(reader, reader.uint32())); + break; + case 3: + message.modelVersion = reader.string(); break; default: reader.skipType(tag & 7); @@ -2896,126 +9939,144 @@ }; /** - * Decodes an OutputConfig message from the specified reader or buffer, length delimited. + * Decodes a FormExtractionParams message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @memberof google.cloud.documentai.v1beta2.FormExtractionParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta1.OutputConfig} OutputConfig + * @returns {google.cloud.documentai.v1beta2.FormExtractionParams} FormExtractionParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OutputConfig.decodeDelimited = function decodeDelimited(reader) { + FormExtractionParams.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an OutputConfig message. + * Verifies a FormExtractionParams message. * @function verify - * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @memberof google.cloud.documentai.v1beta2.FormExtractionParams * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - OutputConfig.verify = function verify(message) { + FormExtractionParams.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { - properties.destination = 1; - { - var error = $root.google.cloud.documentai.v1beta1.GcsDestination.verify(message.gcsDestination); + if (message.enabled != null && message.hasOwnProperty("enabled")) + if (typeof message.enabled !== "boolean") + return "enabled: boolean expected"; + if (message.keyValuePairHints != null && message.hasOwnProperty("keyValuePairHints")) { + if (!Array.isArray(message.keyValuePairHints)) + return "keyValuePairHints: array expected"; + for (var i = 0; i < message.keyValuePairHints.length; ++i) { + var error = $root.google.cloud.documentai.v1beta2.KeyValuePairHint.verify(message.keyValuePairHints[i]); if (error) - return "gcsDestination." + error; + return "keyValuePairHints." + error; } } - if (message.pagesPerShard != null && message.hasOwnProperty("pagesPerShard")) - if (!$util.isInteger(message.pagesPerShard)) - return "pagesPerShard: integer expected"; + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + if (!$util.isString(message.modelVersion)) + return "modelVersion: string expected"; return null; }; /** - * Creates an OutputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a FormExtractionParams message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @memberof google.cloud.documentai.v1beta2.FormExtractionParams * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta1.OutputConfig} OutputConfig + * @returns {google.cloud.documentai.v1beta2.FormExtractionParams} FormExtractionParams */ - OutputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta1.OutputConfig) + FormExtractionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.FormExtractionParams) return object; - var message = new $root.google.cloud.documentai.v1beta1.OutputConfig(); - if (object.gcsDestination != null) { - if (typeof object.gcsDestination !== "object") - throw TypeError(".google.cloud.documentai.v1beta1.OutputConfig.gcsDestination: object expected"); - message.gcsDestination = $root.google.cloud.documentai.v1beta1.GcsDestination.fromObject(object.gcsDestination); + var message = new $root.google.cloud.documentai.v1beta2.FormExtractionParams(); + if (object.enabled != null) + message.enabled = Boolean(object.enabled); + if (object.keyValuePairHints) { + if (!Array.isArray(object.keyValuePairHints)) + throw TypeError(".google.cloud.documentai.v1beta2.FormExtractionParams.keyValuePairHints: array expected"); + message.keyValuePairHints = []; + for (var i = 0; i < object.keyValuePairHints.length; ++i) { + if (typeof object.keyValuePairHints[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.FormExtractionParams.keyValuePairHints: object expected"); + message.keyValuePairHints[i] = $root.google.cloud.documentai.v1beta2.KeyValuePairHint.fromObject(object.keyValuePairHints[i]); + } } - if (object.pagesPerShard != null) - message.pagesPerShard = object.pagesPerShard | 0; + if (object.modelVersion != null) + message.modelVersion = String(object.modelVersion); return message; }; /** - * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. + * Creates a plain object from a FormExtractionParams message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @memberof google.cloud.documentai.v1beta2.FormExtractionParams * @static - * @param {google.cloud.documentai.v1beta1.OutputConfig} message OutputConfig + * @param {google.cloud.documentai.v1beta2.FormExtractionParams} message FormExtractionParams * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - OutputConfig.toObject = function toObject(message, options) { + FormExtractionParams.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.pagesPerShard = 0; - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { - object.gcsDestination = $root.google.cloud.documentai.v1beta1.GcsDestination.toObject(message.gcsDestination, options); - if (options.oneofs) - object.destination = "gcsDestination"; + if (options.arrays || options.defaults) + object.keyValuePairHints = []; + if (options.defaults) { + object.enabled = false; + object.modelVersion = ""; } - if (message.pagesPerShard != null && message.hasOwnProperty("pagesPerShard")) - object.pagesPerShard = message.pagesPerShard; + if (message.enabled != null && message.hasOwnProperty("enabled")) + object.enabled = message.enabled; + if (message.keyValuePairHints && message.keyValuePairHints.length) { + object.keyValuePairHints = []; + for (var j = 0; j < message.keyValuePairHints.length; ++j) + object.keyValuePairHints[j] = $root.google.cloud.documentai.v1beta2.KeyValuePairHint.toObject(message.keyValuePairHints[j], options); + } + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + object.modelVersion = message.modelVersion; return object; }; /** - * Converts this OutputConfig to JSON. + * Converts this FormExtractionParams to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @memberof google.cloud.documentai.v1beta2.FormExtractionParams * @instance * @returns {Object.} JSON object */ - OutputConfig.prototype.toJSON = function toJSON() { + FormExtractionParams.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return OutputConfig; + return FormExtractionParams; })(); - v1beta1.GcsSource = (function() { + v1beta2.KeyValuePairHint = (function() { /** - * Properties of a GcsSource. - * @memberof google.cloud.documentai.v1beta1 - * @interface IGcsSource - * @property {string|null} [uri] GcsSource uri + * Properties of a KeyValuePairHint. + * @memberof google.cloud.documentai.v1beta2 + * @interface IKeyValuePairHint + * @property {string|null} [key] KeyValuePairHint key + * @property {Array.|null} [valueTypes] KeyValuePairHint valueTypes */ /** - * Constructs a new GcsSource. - * @memberof google.cloud.documentai.v1beta1 - * @classdesc Represents a GcsSource. - * @implements IGcsSource + * Constructs a new KeyValuePairHint. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a KeyValuePairHint. + * @implements IKeyValuePairHint * @constructor - * @param {google.cloud.documentai.v1beta1.IGcsSource=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta2.IKeyValuePairHint=} [properties] Properties to set */ - function GcsSource(properties) { + function KeyValuePairHint(properties) { + this.valueTypes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3023,75 +10084,91 @@ } /** - * GcsSource uri. - * @member {string} uri - * @memberof google.cloud.documentai.v1beta1.GcsSource + * KeyValuePairHint key. + * @member {string} key + * @memberof google.cloud.documentai.v1beta2.KeyValuePairHint * @instance */ - GcsSource.prototype.uri = ""; + KeyValuePairHint.prototype.key = ""; /** - * Creates a new GcsSource instance using the specified properties. + * KeyValuePairHint valueTypes. + * @member {Array.} valueTypes + * @memberof google.cloud.documentai.v1beta2.KeyValuePairHint + * @instance + */ + KeyValuePairHint.prototype.valueTypes = $util.emptyArray; + + /** + * Creates a new KeyValuePairHint instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta1.GcsSource + * @memberof google.cloud.documentai.v1beta2.KeyValuePairHint * @static - * @param {google.cloud.documentai.v1beta1.IGcsSource=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta1.GcsSource} GcsSource instance + * @param {google.cloud.documentai.v1beta2.IKeyValuePairHint=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.KeyValuePairHint} KeyValuePairHint instance */ - GcsSource.create = function create(properties) { - return new GcsSource(properties); + KeyValuePairHint.create = function create(properties) { + return new KeyValuePairHint(properties); }; /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.documentai.v1beta1.GcsSource.verify|verify} messages. + * Encodes the specified KeyValuePairHint message. Does not implicitly {@link google.cloud.documentai.v1beta2.KeyValuePairHint.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta1.GcsSource + * @memberof google.cloud.documentai.v1beta2.KeyValuePairHint * @static - * @param {google.cloud.documentai.v1beta1.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IKeyValuePairHint} message KeyValuePairHint message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encode = function encode(message, writer) { + KeyValuePairHint.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && message.hasOwnProperty("uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.key != null && message.hasOwnProperty("key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.valueTypes != null && message.valueTypes.length) + for (var i = 0; i < message.valueTypes.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.valueTypes[i]); return writer; }; /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.GcsSource.verify|verify} messages. + * Encodes the specified KeyValuePairHint message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.KeyValuePairHint.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta1.GcsSource + * @memberof google.cloud.documentai.v1beta2.KeyValuePairHint * @static - * @param {google.cloud.documentai.v1beta1.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IKeyValuePairHint} message KeyValuePairHint message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encodeDelimited = function encodeDelimited(message, writer) { + KeyValuePairHint.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes a KeyValuePairHint message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta1.GcsSource + * @memberof google.cloud.documentai.v1beta2.KeyValuePairHint * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta1.GcsSource} GcsSource + * @returns {google.cloud.documentai.v1beta2.KeyValuePairHint} KeyValuePairHint * @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) { + KeyValuePairHint.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.GcsSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.KeyValuePairHint(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.uri = reader.string(); + message.key = reader.string(); + break; + case 2: + if (!(message.valueTypes && message.valueTypes.length)) + message.valueTypes = []; + message.valueTypes.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -3102,107 +10179,129 @@ }; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes a KeyValuePairHint message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta1.GcsSource + * @memberof google.cloud.documentai.v1beta2.KeyValuePairHint * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta1.GcsSource} GcsSource + * @returns {google.cloud.documentai.v1beta2.KeyValuePairHint} KeyValuePairHint * @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) { + KeyValuePairHint.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GcsSource message. + * Verifies a KeyValuePairHint message. * @function verify - * @memberof google.cloud.documentai.v1beta1.GcsSource + * @memberof google.cloud.documentai.v1beta2.KeyValuePairHint * @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) { + KeyValuePairHint.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.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.valueTypes != null && message.hasOwnProperty("valueTypes")) { + if (!Array.isArray(message.valueTypes)) + return "valueTypes: array expected"; + for (var i = 0; i < message.valueTypes.length; ++i) + if (!$util.isString(message.valueTypes[i])) + return "valueTypes: string[] expected"; + } return null; }; /** - * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * Creates a KeyValuePairHint message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta1.GcsSource + * @memberof google.cloud.documentai.v1beta2.KeyValuePairHint * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta1.GcsSource} GcsSource + * @returns {google.cloud.documentai.v1beta2.KeyValuePairHint} KeyValuePairHint */ - GcsSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta1.GcsSource) + KeyValuePairHint.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.KeyValuePairHint) return object; - var message = new $root.google.cloud.documentai.v1beta1.GcsSource(); - if (object.uri != null) - message.uri = String(object.uri); + var message = new $root.google.cloud.documentai.v1beta2.KeyValuePairHint(); + if (object.key != null) + message.key = String(object.key); + if (object.valueTypes) { + if (!Array.isArray(object.valueTypes)) + throw TypeError(".google.cloud.documentai.v1beta2.KeyValuePairHint.valueTypes: array expected"); + message.valueTypes = []; + for (var i = 0; i < object.valueTypes.length; ++i) + message.valueTypes[i] = String(object.valueTypes[i]); + } return message; }; /** - * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * Creates a plain object from a KeyValuePairHint message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta1.GcsSource + * @memberof google.cloud.documentai.v1beta2.KeyValuePairHint * @static - * @param {google.cloud.documentai.v1beta1.GcsSource} message GcsSource + * @param {google.cloud.documentai.v1beta2.KeyValuePairHint} message KeyValuePairHint * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GcsSource.toObject = function toObject(message, options) { + KeyValuePairHint.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.valueTypes = []; if (options.defaults) - object.uri = ""; - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; + object.key = ""; + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.valueTypes && message.valueTypes.length) { + object.valueTypes = []; + for (var j = 0; j < message.valueTypes.length; ++j) + object.valueTypes[j] = message.valueTypes[j]; + } return object; }; /** - * Converts this GcsSource to JSON. + * Converts this KeyValuePairHint to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta1.GcsSource + * @memberof google.cloud.documentai.v1beta2.KeyValuePairHint * @instance * @returns {Object.} JSON object */ - GcsSource.prototype.toJSON = function toJSON() { + KeyValuePairHint.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GcsSource; + return KeyValuePairHint; })(); - v1beta1.GcsDestination = (function() { + v1beta2.EntityExtractionParams = (function() { /** - * Properties of a GcsDestination. - * @memberof google.cloud.documentai.v1beta1 - * @interface IGcsDestination - * @property {string|null} [uri] GcsDestination uri + * Properties of an EntityExtractionParams. + * @memberof google.cloud.documentai.v1beta2 + * @interface IEntityExtractionParams + * @property {boolean|null} [enabled] EntityExtractionParams enabled + * @property {string|null} [modelVersion] EntityExtractionParams modelVersion */ /** - * Constructs a new GcsDestination. - * @memberof google.cloud.documentai.v1beta1 - * @classdesc Represents a GcsDestination. - * @implements IGcsDestination + * Constructs a new EntityExtractionParams. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents an EntityExtractionParams. + * @implements IEntityExtractionParams * @constructor - * @param {google.cloud.documentai.v1beta1.IGcsDestination=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta2.IEntityExtractionParams=} [properties] Properties to set */ - function GcsDestination(properties) { + function EntityExtractionParams(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3210,75 +10309,88 @@ } /** - * GcsDestination uri. - * @member {string} uri - * @memberof google.cloud.documentai.v1beta1.GcsDestination + * EntityExtractionParams enabled. + * @member {boolean} enabled + * @memberof google.cloud.documentai.v1beta2.EntityExtractionParams * @instance */ - GcsDestination.prototype.uri = ""; + EntityExtractionParams.prototype.enabled = false; /** - * Creates a new GcsDestination instance using the specified properties. + * EntityExtractionParams modelVersion. + * @member {string} modelVersion + * @memberof google.cloud.documentai.v1beta2.EntityExtractionParams + * @instance + */ + EntityExtractionParams.prototype.modelVersion = ""; + + /** + * Creates a new EntityExtractionParams instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @memberof google.cloud.documentai.v1beta2.EntityExtractionParams * @static - * @param {google.cloud.documentai.v1beta1.IGcsDestination=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta1.GcsDestination} GcsDestination instance + * @param {google.cloud.documentai.v1beta2.IEntityExtractionParams=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.EntityExtractionParams} EntityExtractionParams instance */ - GcsDestination.create = function create(properties) { - return new GcsDestination(properties); + EntityExtractionParams.create = function create(properties) { + return new EntityExtractionParams(properties); }; /** - * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.documentai.v1beta1.GcsDestination.verify|verify} messages. + * Encodes the specified EntityExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta2.EntityExtractionParams.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @memberof google.cloud.documentai.v1beta2.EntityExtractionParams * @static - * @param {google.cloud.documentai.v1beta1.IGcsDestination} message GcsDestination message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IEntityExtractionParams} message EntityExtractionParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsDestination.encode = function encode(message, writer) { + EntityExtractionParams.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && message.hasOwnProperty("uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.enabled != null && message.hasOwnProperty("enabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.modelVersion); return writer; }; /** - * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.GcsDestination.verify|verify} messages. + * Encodes the specified EntityExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.EntityExtractionParams.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @memberof google.cloud.documentai.v1beta2.EntityExtractionParams * @static - * @param {google.cloud.documentai.v1beta1.IGcsDestination} message GcsDestination message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IEntityExtractionParams} message EntityExtractionParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsDestination.encodeDelimited = function encodeDelimited(message, writer) { + EntityExtractionParams.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GcsDestination message from the specified reader or buffer. + * Decodes an EntityExtractionParams message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @memberof google.cloud.documentai.v1beta2.EntityExtractionParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta1.GcsDestination} GcsDestination + * @returns {google.cloud.documentai.v1beta2.EntityExtractionParams} EntityExtractionParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsDestination.decode = function decode(reader, length) { + EntityExtractionParams.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.GcsDestination(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.EntityExtractionParams(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.uri = reader.string(); + message.enabled = reader.bool(); + break; + case 2: + message.modelVersion = reader.string(); break; default: reader.skipType(tag & 7); @@ -3289,110 +10401,116 @@ }; /** - * Decodes a GcsDestination message from the specified reader or buffer, length delimited. + * Decodes an EntityExtractionParams message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @memberof google.cloud.documentai.v1beta2.EntityExtractionParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta1.GcsDestination} GcsDestination + * @returns {google.cloud.documentai.v1beta2.EntityExtractionParams} EntityExtractionParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsDestination.decodeDelimited = function decodeDelimited(reader) { + EntityExtractionParams.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GcsDestination message. + * Verifies an EntityExtractionParams message. * @function verify - * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @memberof google.cloud.documentai.v1beta2.EntityExtractionParams * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GcsDestination.verify = function verify(message) { + EntityExtractionParams.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.enabled != null && message.hasOwnProperty("enabled")) + if (typeof message.enabled !== "boolean") + return "enabled: boolean expected"; + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + if (!$util.isString(message.modelVersion)) + return "modelVersion: string expected"; return null; }; /** - * Creates a GcsDestination message from a plain object. Also converts values to their respective internal types. + * Creates an EntityExtractionParams message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @memberof google.cloud.documentai.v1beta2.EntityExtractionParams * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta1.GcsDestination} GcsDestination + * @returns {google.cloud.documentai.v1beta2.EntityExtractionParams} EntityExtractionParams */ - GcsDestination.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta1.GcsDestination) + EntityExtractionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.EntityExtractionParams) return object; - var message = new $root.google.cloud.documentai.v1beta1.GcsDestination(); - if (object.uri != null) - message.uri = String(object.uri); + var message = new $root.google.cloud.documentai.v1beta2.EntityExtractionParams(); + if (object.enabled != null) + message.enabled = Boolean(object.enabled); + if (object.modelVersion != null) + message.modelVersion = String(object.modelVersion); return message; }; /** - * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. + * Creates a plain object from an EntityExtractionParams message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @memberof google.cloud.documentai.v1beta2.EntityExtractionParams * @static - * @param {google.cloud.documentai.v1beta1.GcsDestination} message GcsDestination + * @param {google.cloud.documentai.v1beta2.EntityExtractionParams} message EntityExtractionParams * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GcsDestination.toObject = function toObject(message, options) { + EntityExtractionParams.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.uri = ""; - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; + if (options.defaults) { + object.enabled = false; + object.modelVersion = ""; + } + if (message.enabled != null && message.hasOwnProperty("enabled")) + object.enabled = message.enabled; + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + object.modelVersion = message.modelVersion; return object; }; /** - * Converts this GcsDestination to JSON. + * Converts this EntityExtractionParams to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @memberof google.cloud.documentai.v1beta2.EntityExtractionParams * @instance * @returns {Object.} JSON object */ - GcsDestination.prototype.toJSON = function toJSON() { + EntityExtractionParams.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GcsDestination; + return EntityExtractionParams; })(); - v1beta1.OperationMetadata = (function() { + v1beta2.AutoMlParams = (function() { /** - * Properties of an OperationMetadata. - * @memberof google.cloud.documentai.v1beta1 - * @interface IOperationMetadata - * @property {google.cloud.documentai.v1beta1.OperationMetadata.State|null} [state] OperationMetadata state - * @property {string|null} [stateMessage] OperationMetadata stateMessage - * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] OperationMetadata updateTime + * Properties of an AutoMlParams. + * @memberof google.cloud.documentai.v1beta2 + * @interface IAutoMlParams + * @property {string|null} [model] AutoMlParams model */ /** - * Constructs a new OperationMetadata. - * @memberof google.cloud.documentai.v1beta1 - * @classdesc Represents an OperationMetadata. - * @implements IOperationMetadata + * Constructs a new AutoMlParams. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents an AutoMlParams. + * @implements IAutoMlParams * @constructor - * @param {google.cloud.documentai.v1beta1.IOperationMetadata=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta2.IAutoMlParams=} [properties] Properties to set */ - function OperationMetadata(properties) { + function AutoMlParams(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3400,114 +10518,75 @@ } /** - * OperationMetadata state. - * @member {google.cloud.documentai.v1beta1.OperationMetadata.State} state - * @memberof google.cloud.documentai.v1beta1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.state = 0; - - /** - * OperationMetadata stateMessage. - * @member {string} stateMessage - * @memberof google.cloud.documentai.v1beta1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.stateMessage = ""; - - /** - * OperationMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.documentai.v1beta1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.createTime = null; - - /** - * OperationMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * AutoMlParams model. + * @member {string} model + * @memberof google.cloud.documentai.v1beta2.AutoMlParams * @instance */ - OperationMetadata.prototype.updateTime = null; + AutoMlParams.prototype.model = ""; /** - * Creates a new OperationMetadata instance using the specified properties. + * Creates a new AutoMlParams instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @memberof google.cloud.documentai.v1beta2.AutoMlParams * @static - * @param {google.cloud.documentai.v1beta1.IOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta1.OperationMetadata} OperationMetadata instance + * @param {google.cloud.documentai.v1beta2.IAutoMlParams=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.AutoMlParams} AutoMlParams instance */ - OperationMetadata.create = function create(properties) { - return new OperationMetadata(properties); + AutoMlParams.create = function create(properties) { + return new AutoMlParams(properties); }; /** - * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta1.OperationMetadata.verify|verify} messages. + * Encodes the specified AutoMlParams message. Does not implicitly {@link google.cloud.documentai.v1beta2.AutoMlParams.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @memberof google.cloud.documentai.v1beta2.AutoMlParams * @static - * @param {google.cloud.documentai.v1beta1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IAutoMlParams} message AutoMlParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OperationMetadata.encode = function encode(message, writer) { + AutoMlParams.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.state != null && message.hasOwnProperty("state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); - if (message.createTime != null && message.hasOwnProperty("createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.model != null && message.hasOwnProperty("model")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.model); return writer; }; /** - * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.OperationMetadata.verify|verify} messages. + * Encodes the specified AutoMlParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.AutoMlParams.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @memberof google.cloud.documentai.v1beta2.AutoMlParams * @static - * @param {google.cloud.documentai.v1beta1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IAutoMlParams} message AutoMlParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + AutoMlParams.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an OperationMetadata message from the specified reader or buffer. + * Decodes an AutoMlParams message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @memberof google.cloud.documentai.v1beta2.AutoMlParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta1.OperationMetadata} OperationMetadata + * @returns {google.cloud.documentai.v1beta2.AutoMlParams} AutoMlParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OperationMetadata.decode = function decode(reader, length) { + AutoMlParams.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.OperationMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.AutoMlParams(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.state = reader.int32(); - break; - case 2: - message.stateMessage = reader.string(); - break; - case 3: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.model = reader.string(); break; default: reader.skipType(tag & 7); @@ -3518,205 +10597,109 @@ }; /** - * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * Decodes an AutoMlParams message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @memberof google.cloud.documentai.v1beta2.AutoMlParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta1.OperationMetadata} OperationMetadata + * @returns {google.cloud.documentai.v1beta2.AutoMlParams} AutoMlParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OperationMetadata.decodeDelimited = function decodeDelimited(reader) { + AutoMlParams.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an OperationMetadata message. + * Verifies an AutoMlParams message. * @function verify - * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @memberof google.cloud.documentai.v1beta2.AutoMlParams * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - OperationMetadata.verify = function verify(message) { + AutoMlParams.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - break; - } - if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) - if (!$util.isString(message.stateMessage)) - return "stateMessage: string 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 OperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an AutoMlParams message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @memberof google.cloud.documentai.v1beta2.AutoMlParams * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta1.OperationMetadata} OperationMetadata + * @returns {google.cloud.documentai.v1beta2.AutoMlParams} AutoMlParams */ - OperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta1.OperationMetadata) + AutoMlParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.AutoMlParams) return object; - var message = new $root.google.cloud.documentai.v1beta1.OperationMetadata(); - switch (object.state) { - case "STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "ACCEPTED": - case 1: - message.state = 1; - break; - case "WAITING": - case 2: - message.state = 2; - break; - case "RUNNING": - case 3: - message.state = 3; - break; - case "SUCCEEDED": - case 4: - message.state = 4; - break; - case "CANCELLED": - case 5: - message.state = 5; - break; - case "FAILED": - case 6: - message.state = 6; - break; - } - if (object.stateMessage != null) - message.stateMessage = String(object.stateMessage); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.documentai.v1beta1.OperationMetadata.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.documentai.v1beta1.OperationMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); - } + var message = new $root.google.cloud.documentai.v1beta2.AutoMlParams(); + if (object.model != null) + message.model = String(object.model); return message; }; /** - * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * Creates a plain object from an AutoMlParams message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @memberof google.cloud.documentai.v1beta2.AutoMlParams * @static - * @param {google.cloud.documentai.v1beta1.OperationMetadata} message OperationMetadata + * @param {google.cloud.documentai.v1beta2.AutoMlParams} message AutoMlParams * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - OperationMetadata.toObject = function toObject(message, options) { + AutoMlParams.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; - object.stateMessage = ""; - object.createTime = null; - object.updateTime = null; - } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1beta1.OperationMetadata.State[message.state] : message.state; - if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) - object.stateMessage = message.stateMessage; - 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 OperationMetadata to JSON. + * Converts this AutoMlParams to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @memberof google.cloud.documentai.v1beta2.AutoMlParams * @instance * @returns {Object.} JSON object */ - OperationMetadata.prototype.toJSON = function toJSON() { + AutoMlParams.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * State enum. - * @name google.cloud.documentai.v1beta1.OperationMetadata.State - * @enum {string} - * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} ACCEPTED=1 ACCEPTED value - * @property {number} WAITING=2 WAITING value - * @property {number} RUNNING=3 RUNNING value - * @property {number} SUCCEEDED=4 SUCCEEDED value - * @property {number} CANCELLED=5 CANCELLED value - * @property {number} FAILED=6 FAILED value - */ - OperationMetadata.State = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "ACCEPTED"] = 1; - values[valuesById[2] = "WAITING"] = 2; - values[valuesById[3] = "RUNNING"] = 3; - values[valuesById[4] = "SUCCEEDED"] = 4; - values[valuesById[5] = "CANCELLED"] = 5; - values[valuesById[6] = "FAILED"] = 6; - return values; - })(); - - return OperationMetadata; + return AutoMlParams; })(); - v1beta1.Vertex = (function() { + v1beta2.InputConfig = (function() { /** - * Properties of a Vertex. - * @memberof google.cloud.documentai.v1beta1 - * @interface IVertex - * @property {number|null} [x] Vertex x - * @property {number|null} [y] Vertex y + * Properties of an InputConfig. + * @memberof google.cloud.documentai.v1beta2 + * @interface IInputConfig + * @property {google.cloud.documentai.v1beta2.IGcsSource|null} [gcsSource] InputConfig gcsSource + * @property {Uint8Array|null} [contents] InputConfig contents + * @property {string|null} [mimeType] InputConfig mimeType */ /** - * Constructs a new Vertex. - * @memberof google.cloud.documentai.v1beta1 - * @classdesc Represents a Vertex. - * @implements IVertex + * Constructs a new InputConfig. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents an InputConfig. + * @implements IInputConfig * @constructor - * @param {google.cloud.documentai.v1beta1.IVertex=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta2.IInputConfig=} [properties] Properties to set */ - function Vertex(properties) { + function InputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3724,88 +10707,115 @@ } /** - * Vertex x. - * @member {number} x - * @memberof google.cloud.documentai.v1beta1.Vertex + * InputConfig gcsSource. + * @member {google.cloud.documentai.v1beta2.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.documentai.v1beta2.InputConfig * @instance */ - Vertex.prototype.x = 0; + InputConfig.prototype.gcsSource = null; /** - * Vertex y. - * @member {number} y - * @memberof google.cloud.documentai.v1beta1.Vertex + * InputConfig contents. + * @member {Uint8Array} contents + * @memberof google.cloud.documentai.v1beta2.InputConfig * @instance */ - Vertex.prototype.y = 0; + InputConfig.prototype.contents = $util.newBuffer([]); /** - * Creates a new Vertex instance using the specified properties. + * InputConfig mimeType. + * @member {string} mimeType + * @memberof google.cloud.documentai.v1beta2.InputConfig + * @instance + */ + InputConfig.prototype.mimeType = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * InputConfig source. + * @member {"gcsSource"|"contents"|undefined} source + * @memberof google.cloud.documentai.v1beta2.InputConfig + * @instance + */ + Object.defineProperty(InputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["gcsSource", "contents"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new InputConfig instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta1.Vertex + * @memberof google.cloud.documentai.v1beta2.InputConfig * @static - * @param {google.cloud.documentai.v1beta1.IVertex=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta1.Vertex} Vertex instance + * @param {google.cloud.documentai.v1beta2.IInputConfig=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.InputConfig} InputConfig instance */ - Vertex.create = function create(properties) { - return new Vertex(properties); + InputConfig.create = function create(properties) { + return new InputConfig(properties); }; /** - * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.documentai.v1beta1.Vertex.verify|verify} messages. + * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta2.InputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta1.Vertex + * @memberof google.cloud.documentai.v1beta2.InputConfig * @static - * @param {google.cloud.documentai.v1beta1.IVertex} message Vertex message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IInputConfig} message InputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Vertex.encode = function encode(message, writer) { + InputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.x != null && message.hasOwnProperty("x")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); - if (message.y != null && message.hasOwnProperty("y")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) + $root.google.cloud.documentai.v1beta2.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); + if (message.contents != null && message.hasOwnProperty("contents")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.contents); return writer; }; /** - * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Vertex.verify|verify} messages. + * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.InputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta1.Vertex + * @memberof google.cloud.documentai.v1beta2.InputConfig * @static - * @param {google.cloud.documentai.v1beta1.IVertex} message Vertex message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IInputConfig} message InputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Vertex.encodeDelimited = function encodeDelimited(message, writer) { + InputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Vertex message from the specified reader or buffer. + * Decodes an InputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta1.Vertex + * @memberof google.cloud.documentai.v1beta2.InputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta1.Vertex} Vertex + * @returns {google.cloud.documentai.v1beta2.InputConfig} InputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Vertex.decode = function decode(reader, length) { + InputConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Vertex(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.InputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.x = reader.int32(); + message.gcsSource = $root.google.cloud.documentai.v1beta2.GcsSource.decode(reader, reader.uint32()); + break; + case 3: + message.contents = reader.bytes(); break; case 2: - message.y = reader.int32(); + message.mimeType = reader.string(); break; default: reader.skipType(tag & 7); @@ -3816,117 +10826,144 @@ }; /** - * Decodes a Vertex message from the specified reader or buffer, length delimited. + * Decodes an InputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta1.Vertex + * @memberof google.cloud.documentai.v1beta2.InputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta1.Vertex} Vertex + * @returns {google.cloud.documentai.v1beta2.InputConfig} InputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Vertex.decodeDelimited = function decodeDelimited(reader) { + InputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Vertex message. + * Verifies an InputConfig message. * @function verify - * @memberof google.cloud.documentai.v1beta1.Vertex + * @memberof google.cloud.documentai.v1beta2.InputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Vertex.verify = function verify(message) { + InputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.x != null && message.hasOwnProperty("x")) - if (!$util.isInteger(message.x)) - return "x: integer expected"; - if (message.y != null && message.hasOwnProperty("y")) - if (!$util.isInteger(message.y)) - return "y: integer expected"; + var properties = {}; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + properties.source = 1; + { + var error = $root.google.cloud.documentai.v1beta2.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.contents != null && message.hasOwnProperty("contents")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + if (!(message.contents && typeof message.contents.length === "number" || $util.isString(message.contents))) + return "contents: buffer expected"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; return null; }; /** - * Creates a Vertex message from a plain object. Also converts values to their respective internal types. + * Creates an InputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta1.Vertex + * @memberof google.cloud.documentai.v1beta2.InputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta1.Vertex} Vertex + * @returns {google.cloud.documentai.v1beta2.InputConfig} InputConfig */ - Vertex.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta1.Vertex) + InputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.InputConfig) return object; - var message = new $root.google.cloud.documentai.v1beta1.Vertex(); - if (object.x != null) - message.x = object.x | 0; - if (object.y != null) - message.y = object.y | 0; + var message = new $root.google.cloud.documentai.v1beta2.InputConfig(); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.InputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.documentai.v1beta2.GcsSource.fromObject(object.gcsSource); + } + if (object.contents != null) + if (typeof object.contents === "string") + $util.base64.decode(object.contents, message.contents = $util.newBuffer($util.base64.length(object.contents)), 0); + else if (object.contents.length) + message.contents = object.contents; + if (object.mimeType != null) + message.mimeType = String(object.mimeType); return message; }; /** - * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * Creates a plain object from an InputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta1.Vertex + * @memberof google.cloud.documentai.v1beta2.InputConfig * @static - * @param {google.cloud.documentai.v1beta1.Vertex} message Vertex + * @param {google.cloud.documentai.v1beta2.InputConfig} message InputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Vertex.toObject = function toObject(message, options) { + InputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.x = 0; - object.y = 0; + if (options.defaults) + object.mimeType = ""; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.documentai.v1beta2.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.contents != null && message.hasOwnProperty("contents")) { + object.contents = options.bytes === String ? $util.base64.encode(message.contents, 0, message.contents.length) : options.bytes === Array ? Array.prototype.slice.call(message.contents) : message.contents; + if (options.oneofs) + object.source = "contents"; } - if (message.x != null && message.hasOwnProperty("x")) - object.x = message.x; - if (message.y != null && message.hasOwnProperty("y")) - object.y = message.y; return object; }; /** - * Converts this Vertex to JSON. + * Converts this InputConfig to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta1.Vertex + * @memberof google.cloud.documentai.v1beta2.InputConfig * @instance * @returns {Object.} JSON object */ - Vertex.prototype.toJSON = function toJSON() { + InputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Vertex; + return InputConfig; })(); - v1beta1.NormalizedVertex = (function() { + v1beta2.OutputConfig = (function() { /** - * Properties of a NormalizedVertex. - * @memberof google.cloud.documentai.v1beta1 - * @interface INormalizedVertex - * @property {number|null} [x] NormalizedVertex x - * @property {number|null} [y] NormalizedVertex y + * Properties of an OutputConfig. + * @memberof google.cloud.documentai.v1beta2 + * @interface IOutputConfig + * @property {google.cloud.documentai.v1beta2.IGcsDestination|null} [gcsDestination] OutputConfig gcsDestination + * @property {number|null} [pagesPerShard] OutputConfig pagesPerShard */ /** - * Constructs a new NormalizedVertex. - * @memberof google.cloud.documentai.v1beta1 - * @classdesc Represents a NormalizedVertex. - * @implements INormalizedVertex + * Constructs a new OutputConfig. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents an OutputConfig. + * @implements IOutputConfig * @constructor - * @param {google.cloud.documentai.v1beta1.INormalizedVertex=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta2.IOutputConfig=} [properties] Properties to set */ - function NormalizedVertex(properties) { + function OutputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3934,88 +10971,102 @@ } /** - * NormalizedVertex x. - * @member {number} x - * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * OutputConfig gcsDestination. + * @member {google.cloud.documentai.v1beta2.IGcsDestination|null|undefined} gcsDestination + * @memberof google.cloud.documentai.v1beta2.OutputConfig * @instance */ - NormalizedVertex.prototype.x = 0; + OutputConfig.prototype.gcsDestination = null; /** - * NormalizedVertex y. - * @member {number} y - * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * OutputConfig pagesPerShard. + * @member {number} pagesPerShard + * @memberof google.cloud.documentai.v1beta2.OutputConfig * @instance */ - NormalizedVertex.prototype.y = 0; + OutputConfig.prototype.pagesPerShard = 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * Creates a new NormalizedVertex instance using the specified properties. + * OutputConfig destination. + * @member {"gcsDestination"|undefined} destination + * @memberof google.cloud.documentai.v1beta2.OutputConfig + * @instance + */ + Object.defineProperty(OutputConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsDestination"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new OutputConfig instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @memberof google.cloud.documentai.v1beta2.OutputConfig * @static - * @param {google.cloud.documentai.v1beta1.INormalizedVertex=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta1.NormalizedVertex} NormalizedVertex instance + * @param {google.cloud.documentai.v1beta2.IOutputConfig=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.OutputConfig} OutputConfig instance */ - NormalizedVertex.create = function create(properties) { - return new NormalizedVertex(properties); + OutputConfig.create = function create(properties) { + return new OutputConfig(properties); }; /** - * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.documentai.v1beta1.NormalizedVertex.verify|verify} messages. + * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta2.OutputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @memberof google.cloud.documentai.v1beta2.OutputConfig * @static - * @param {google.cloud.documentai.v1beta1.INormalizedVertex} message NormalizedVertex message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IOutputConfig} message OutputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - NormalizedVertex.encode = function encode(message, writer) { + OutputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.x != null && message.hasOwnProperty("x")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); - if (message.y != null && message.hasOwnProperty("y")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + $root.google.cloud.documentai.v1beta2.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagesPerShard != null && message.hasOwnProperty("pagesPerShard")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pagesPerShard); return writer; }; /** - * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.NormalizedVertex.verify|verify} messages. + * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.OutputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @memberof google.cloud.documentai.v1beta2.OutputConfig * @static - * @param {google.cloud.documentai.v1beta1.INormalizedVertex} message NormalizedVertex message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IOutputConfig} message OutputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - NormalizedVertex.encodeDelimited = function encodeDelimited(message, writer) { + OutputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a NormalizedVertex message from the specified reader or buffer. + * Decodes an OutputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @memberof google.cloud.documentai.v1beta2.OutputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta1.NormalizedVertex} NormalizedVertex + * @returns {google.cloud.documentai.v1beta2.OutputConfig} OutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NormalizedVertex.decode = function decode(reader, length) { + OutputConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.NormalizedVertex(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.OutputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.x = reader.float(); + message.gcsDestination = $root.google.cloud.documentai.v1beta2.GcsDestination.decode(reader, reader.uint32()); break; case 2: - message.y = reader.float(); + message.pagesPerShard = reader.int32(); break; default: reader.skipType(tag & 7); @@ -4026,119 +11077,126 @@ }; /** - * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. + * Decodes an OutputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @memberof google.cloud.documentai.v1beta2.OutputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta1.NormalizedVertex} NormalizedVertex + * @returns {google.cloud.documentai.v1beta2.OutputConfig} OutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NormalizedVertex.decodeDelimited = function decodeDelimited(reader) { + OutputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a NormalizedVertex message. + * Verifies an OutputConfig message. * @function verify - * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @memberof google.cloud.documentai.v1beta2.OutputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - NormalizedVertex.verify = function verify(message) { + OutputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.x != null && message.hasOwnProperty("x")) - if (typeof message.x !== "number") - return "x: number expected"; - if (message.y != null && message.hasOwnProperty("y")) - if (typeof message.y !== "number") - return "y: number expected"; + var properties = {}; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + properties.destination = 1; + { + var error = $root.google.cloud.documentai.v1beta2.GcsDestination.verify(message.gcsDestination); + if (error) + return "gcsDestination." + error; + } + } + if (message.pagesPerShard != null && message.hasOwnProperty("pagesPerShard")) + if (!$util.isInteger(message.pagesPerShard)) + return "pagesPerShard: integer expected"; return null; }; /** - * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. + * Creates an OutputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @memberof google.cloud.documentai.v1beta2.OutputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta1.NormalizedVertex} NormalizedVertex + * @returns {google.cloud.documentai.v1beta2.OutputConfig} OutputConfig */ - NormalizedVertex.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta1.NormalizedVertex) + OutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.OutputConfig) return object; - var message = new $root.google.cloud.documentai.v1beta1.NormalizedVertex(); - if (object.x != null) - message.x = Number(object.x); - if (object.y != null) - message.y = Number(object.y); + var message = new $root.google.cloud.documentai.v1beta2.OutputConfig(); + if (object.gcsDestination != null) { + if (typeof object.gcsDestination !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.OutputConfig.gcsDestination: object expected"); + message.gcsDestination = $root.google.cloud.documentai.v1beta2.GcsDestination.fromObject(object.gcsDestination); + } + if (object.pagesPerShard != null) + message.pagesPerShard = object.pagesPerShard | 0; return message; }; /** - * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. + * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @memberof google.cloud.documentai.v1beta2.OutputConfig * @static - * @param {google.cloud.documentai.v1beta1.NormalizedVertex} message NormalizedVertex + * @param {google.cloud.documentai.v1beta2.OutputConfig} message OutputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - NormalizedVertex.toObject = function toObject(message, options) { + OutputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.x = 0; - object.y = 0; + if (options.defaults) + object.pagesPerShard = 0; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + object.gcsDestination = $root.google.cloud.documentai.v1beta2.GcsDestination.toObject(message.gcsDestination, options); + if (options.oneofs) + object.destination = "gcsDestination"; } - if (message.x != null && message.hasOwnProperty("x")) - object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; - if (message.y != null && message.hasOwnProperty("y")) - object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; + if (message.pagesPerShard != null && message.hasOwnProperty("pagesPerShard")) + object.pagesPerShard = message.pagesPerShard; return object; }; /** - * Converts this NormalizedVertex to JSON. + * Converts this OutputConfig to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @memberof google.cloud.documentai.v1beta2.OutputConfig * @instance * @returns {Object.} JSON object */ - NormalizedVertex.prototype.toJSON = function toJSON() { + OutputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return NormalizedVertex; + return OutputConfig; })(); - v1beta1.BoundingPoly = (function() { + v1beta2.GcsSource = (function() { /** - * Properties of a BoundingPoly. - * @memberof google.cloud.documentai.v1beta1 - * @interface IBoundingPoly - * @property {Array.|null} [vertices] BoundingPoly vertices - * @property {Array.|null} [normalizedVertices] BoundingPoly normalizedVertices + * Properties of a GcsSource. + * @memberof google.cloud.documentai.v1beta2 + * @interface IGcsSource + * @property {string|null} [uri] GcsSource uri */ /** - * Constructs a new BoundingPoly. - * @memberof google.cloud.documentai.v1beta1 - * @classdesc Represents a BoundingPoly. - * @implements IBoundingPoly + * Constructs a new GcsSource. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a GcsSource. + * @implements IGcsSource * @constructor - * @param {google.cloud.documentai.v1beta1.IBoundingPoly=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta2.IGcsSource=} [properties] Properties to set */ - function BoundingPoly(properties) { - this.vertices = []; - this.normalizedVertices = []; + function GcsSource(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4146,94 +11204,75 @@ } /** - * BoundingPoly vertices. - * @member {Array.} vertices - * @memberof google.cloud.documentai.v1beta1.BoundingPoly - * @instance - */ - BoundingPoly.prototype.vertices = $util.emptyArray; - - /** - * BoundingPoly normalizedVertices. - * @member {Array.} normalizedVertices - * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * GcsSource uri. + * @member {string} uri + * @memberof google.cloud.documentai.v1beta2.GcsSource * @instance */ - BoundingPoly.prototype.normalizedVertices = $util.emptyArray; + GcsSource.prototype.uri = ""; /** - * Creates a new BoundingPoly instance using the specified properties. + * Creates a new GcsSource instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @memberof google.cloud.documentai.v1beta2.GcsSource * @static - * @param {google.cloud.documentai.v1beta1.IBoundingPoly=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta1.BoundingPoly} BoundingPoly instance + * @param {google.cloud.documentai.v1beta2.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.GcsSource} GcsSource instance */ - BoundingPoly.create = function create(properties) { - return new BoundingPoly(properties); + GcsSource.create = function create(properties) { + return new GcsSource(properties); }; /** - * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.documentai.v1beta1.BoundingPoly.verify|verify} messages. + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.documentai.v1beta2.GcsSource.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @memberof google.cloud.documentai.v1beta2.GcsSource * @static - * @param {google.cloud.documentai.v1beta1.IBoundingPoly} message BoundingPoly message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IGcsSource} message GcsSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BoundingPoly.encode = function encode(message, writer) { + GcsSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.vertices != null && message.vertices.length) - for (var i = 0; i < message.vertices.length; ++i) - $root.google.cloud.documentai.v1beta1.Vertex.encode(message.vertices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.normalizedVertices != null && message.normalizedVertices.length) - for (var i = 0; i < message.normalizedVertices.length; ++i) - $root.google.cloud.documentai.v1beta1.NormalizedVertex.encode(message.normalizedVertices[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.uri != null && message.hasOwnProperty("uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); return writer; }; /** - * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.BoundingPoly.verify|verify} messages. + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.GcsSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @memberof google.cloud.documentai.v1beta2.GcsSource * @static - * @param {google.cloud.documentai.v1beta1.IBoundingPoly} message BoundingPoly message or plain object to encode + * @param {google.cloud.documentai.v1beta2.IGcsSource} message GcsSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { + GcsSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BoundingPoly message from the specified reader or buffer. + * Decodes a GcsSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @memberof google.cloud.documentai.v1beta2.GcsSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta1.BoundingPoly} BoundingPoly + * @returns {google.cloud.documentai.v1beta2.GcsSource} GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BoundingPoly.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.documentai.v1beta1.BoundingPoly(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.GcsSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.vertices && message.vertices.length)) - message.vertices = []; - message.vertices.push($root.google.cloud.documentai.v1beta1.Vertex.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.normalizedVertices && message.normalizedVertices.length)) - message.normalizedVertices = []; - message.normalizedVertices.push($root.google.cloud.documentai.v1beta1.NormalizedVertex.decode(reader, reader.uint32())); + message.uri = reader.string(); break; default: reader.skipType(tag & 7); @@ -4244,619 +11283,754 @@ }; /** - * Decodes a BoundingPoly 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.documentai.v1beta1.BoundingPoly + * @memberof google.cloud.documentai.v1beta2.GcsSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta1.BoundingPoly} BoundingPoly + * @returns {google.cloud.documentai.v1beta2.GcsSource} GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BoundingPoly.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 BoundingPoly message. + * Verifies a GcsSource message. * @function verify - * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @memberof google.cloud.documentai.v1beta2.GcsSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BoundingPoly.verify = function verify(message) { + GcsSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.vertices != null && message.hasOwnProperty("vertices")) { - if (!Array.isArray(message.vertices)) - return "vertices: array expected"; - for (var i = 0; i < message.vertices.length; ++i) { - var error = $root.google.cloud.documentai.v1beta1.Vertex.verify(message.vertices[i]); - if (error) - return "vertices." + error; - } - } - if (message.normalizedVertices != null && message.hasOwnProperty("normalizedVertices")) { - if (!Array.isArray(message.normalizedVertices)) - return "normalizedVertices: array expected"; - for (var i = 0; i < message.normalizedVertices.length; ++i) { - var error = $root.google.cloud.documentai.v1beta1.NormalizedVertex.verify(message.normalizedVertices[i]); - if (error) - return "normalizedVertices." + error; - } - } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; return null; }; /** - * Creates a BoundingPoly 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.documentai.v1beta1.BoundingPoly + * @memberof google.cloud.documentai.v1beta2.GcsSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta1.BoundingPoly} BoundingPoly + * @returns {google.cloud.documentai.v1beta2.GcsSource} GcsSource */ - BoundingPoly.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta1.BoundingPoly) + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.GcsSource) return object; - var message = new $root.google.cloud.documentai.v1beta1.BoundingPoly(); - if (object.vertices) { - if (!Array.isArray(object.vertices)) - throw TypeError(".google.cloud.documentai.v1beta1.BoundingPoly.vertices: array expected"); - message.vertices = []; - for (var i = 0; i < object.vertices.length; ++i) { - if (typeof object.vertices[i] !== "object") - throw TypeError(".google.cloud.documentai.v1beta1.BoundingPoly.vertices: object expected"); - message.vertices[i] = $root.google.cloud.documentai.v1beta1.Vertex.fromObject(object.vertices[i]); - } - } - if (object.normalizedVertices) { - if (!Array.isArray(object.normalizedVertices)) - throw TypeError(".google.cloud.documentai.v1beta1.BoundingPoly.normalizedVertices: array expected"); - message.normalizedVertices = []; - for (var i = 0; i < object.normalizedVertices.length; ++i) { - if (typeof object.normalizedVertices[i] !== "object") - throw TypeError(".google.cloud.documentai.v1beta1.BoundingPoly.normalizedVertices: object expected"); - message.normalizedVertices[i] = $root.google.cloud.documentai.v1beta1.NormalizedVertex.fromObject(object.normalizedVertices[i]); - } - } + var message = new $root.google.cloud.documentai.v1beta2.GcsSource(); + if (object.uri != null) + message.uri = String(object.uri); return message; }; /** - * Creates a plain object from a BoundingPoly 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.documentai.v1beta1.BoundingPoly + * @memberof google.cloud.documentai.v1beta2.GcsSource * @static - * @param {google.cloud.documentai.v1beta1.BoundingPoly} message BoundingPoly + * @param {google.cloud.documentai.v1beta2.GcsSource} message GcsSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BoundingPoly.toObject = function toObject(message, options) { + GcsSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.vertices = []; - object.normalizedVertices = []; - } - if (message.vertices && message.vertices.length) { - object.vertices = []; - for (var j = 0; j < message.vertices.length; ++j) - object.vertices[j] = $root.google.cloud.documentai.v1beta1.Vertex.toObject(message.vertices[j], options); - } - if (message.normalizedVertices && message.normalizedVertices.length) { - object.normalizedVertices = []; - for (var j = 0; j < message.normalizedVertices.length; ++j) - object.normalizedVertices[j] = $root.google.cloud.documentai.v1beta1.NormalizedVertex.toObject(message.normalizedVertices[j], options); - } + if (options.defaults) + object.uri = ""; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; return object; }; /** - * Converts this BoundingPoly to JSON. + * Converts this GcsSource to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @memberof google.cloud.documentai.v1beta2.GcsSource * @instance * @returns {Object.} JSON object */ - BoundingPoly.prototype.toJSON = function toJSON() { + GcsSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BoundingPoly; + return GcsSource; })(); - return v1beta1; - })(); - - return documentai; - })(); + v1beta2.GcsDestination = (function() { - return cloud; - })(); + /** + * Properties of a GcsDestination. + * @memberof google.cloud.documentai.v1beta2 + * @interface IGcsDestination + * @property {string|null} [uri] GcsDestination uri + */ - google.api = (function() { + /** + * Constructs a new GcsDestination. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a GcsDestination. + * @implements IGcsDestination + * @constructor + * @param {google.cloud.documentai.v1beta2.IGcsDestination=} [properties] Properties to set + */ + function GcsDestination(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Namespace api. - * @memberof google - * @namespace - */ - var api = {}; + /** + * GcsDestination uri. + * @member {string} uri + * @memberof google.cloud.documentai.v1beta2.GcsDestination + * @instance + */ + GcsDestination.prototype.uri = ""; - api.Http = (function() { + /** + * Creates a new GcsDestination instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.GcsDestination + * @static + * @param {google.cloud.documentai.v1beta2.IGcsDestination=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.GcsDestination} GcsDestination instance + */ + GcsDestination.create = function create(properties) { + return new GcsDestination(properties); + }; - /** - * Properties of a Http. - * @memberof google.api - * @interface IHttp - * @property {Array.|null} [rules] Http rules - * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion - */ + /** + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.documentai.v1beta2.GcsDestination.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.GcsDestination + * @static + * @param {google.cloud.documentai.v1beta2.IGcsDestination} message GcsDestination message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsDestination.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uri != null && message.hasOwnProperty("uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + return writer; + }; - /** - * 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]]; - } + /** + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.GcsDestination.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.GcsDestination + * @static + * @param {google.cloud.documentai.v1beta2.IGcsDestination} message GcsDestination message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsDestination.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Http rules. - * @member {Array.} rules - * @memberof google.api.Http - * @instance - */ - Http.prototype.rules = $util.emptyArray; + /** + * Decodes a GcsDestination message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.GcsDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.GcsDestination} GcsDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsDestination.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.GcsDestination(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uri = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Http fullyDecodeReservedExpansion. - * @member {boolean} fullyDecodeReservedExpansion - * @memberof google.api.Http - * @instance - */ - Http.prototype.fullyDecodeReservedExpansion = false; + /** + * Decodes a GcsDestination message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.GcsDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.GcsDestination} GcsDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsDestination.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * 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); - }; + /** + * Verifies a GcsDestination message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.GcsDestination + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsDestination.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"; + return null; + }; - /** - * 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 && message.hasOwnProperty("fullyDecodeReservedExpansion")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); - return writer; - }; + /** + * Creates a GcsDestination message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.GcsDestination + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.GcsDestination} GcsDestination + */ + GcsDestination.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.GcsDestination) + return object; + var message = new $root.google.cloud.documentai.v1beta2.GcsDestination(); + if (object.uri != null) + message.uri = String(object.uri); + return message; + }; - /** - * 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(); - }; + /** + * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.GcsDestination + * @static + * @param {google.cloud.documentai.v1beta2.GcsDestination} message GcsDestination + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsDestination.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.uri = ""; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + return object; + }; - /** - * 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; - }; + /** + * Converts this GcsDestination to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.GcsDestination + * @instance + * @returns {Object.} JSON object + */ + GcsDestination.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * 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()); - }; + return GcsDestination; + })(); - /** - * 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; - }; + v1beta2.OperationMetadata = (function() { - /** - * 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]); + /** + * Properties of an OperationMetadata. + * @memberof google.cloud.documentai.v1beta2 + * @interface IOperationMetadata + * @property {google.cloud.documentai.v1beta2.OperationMetadata.State|null} [state] OperationMetadata state + * @property {string|null} [stateMessage] OperationMetadata stateMessage + * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] OperationMetadata updateTime + */ + + /** + * Constructs a new OperationMetadata. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents an OperationMetadata. + * @implements IOperationMetadata + * @constructor + * @param {google.cloud.documentai.v1beta2.IOperationMetadata=} [properties] Properties to set + */ + function OperationMetadata(properties) { + if (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 (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; - }; + /** + * OperationMetadata state. + * @member {google.cloud.documentai.v1beta2.OperationMetadata.State} state + * @memberof google.cloud.documentai.v1beta2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.state = 0; - /** - * 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); - }; + /** + * OperationMetadata stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1beta2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.stateMessage = ""; - return Http; - })(); + /** + * OperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1beta2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.createTime = null; - api.HttpRule = (function() { + /** + * OperationMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.documentai.v1beta2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.updateTime = null; - /** - * 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 - */ + /** + * Creates a new OperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.OperationMetadata + * @static + * @param {google.cloud.documentai.v1beta2.IOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.OperationMetadata} OperationMetadata instance + */ + OperationMetadata.create = function create(properties) { + return new OperationMetadata(properties); + }; - /** - * 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]]; - } + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta2.OperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.OperationMetadata + * @static + * @param {google.cloud.documentai.v1beta2.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && message.hasOwnProperty("state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); + if (message.createTime != null && message.hasOwnProperty("createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; - /** - * HttpRule selector. - * @member {string} selector - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.selector = ""; + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.OperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.OperationMetadata + * @static + * @param {google.cloud.documentai.v1beta2.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * HttpRule get. - * @member {string} get - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.get = ""; + /** + * Decodes an OperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta2.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta2.OperationMetadata} OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta2.OperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.int32(); + break; + case 2: + message.stateMessage = reader.string(); + break; + case 3: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * HttpRule put. - * @member {string} put - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.put = ""; + /** + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta2.OperationMetadata} OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * HttpRule post. - * @member {string} post - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.post = ""; + /** + * Verifies an OperationMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1beta2.OperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + if (!$util.isString(message.stateMessage)) + return "stateMessage: string 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 OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.OperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.OperationMetadata} OperationMetadata + */ + OperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.OperationMetadata) + return object; + var message = new $root.google.cloud.documentai.v1beta2.OperationMetadata(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "ACCEPTED": + case 1: + message.state = 1; + break; + case "WAITING": + case 2: + message.state = 2; + break; + case "RUNNING": + case 3: + message.state = 3; + break; + case "SUCCEEDED": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + case "FAILED": + case 6: + message.state = 6; + break; + } + if (object.stateMessage != null) + message.stateMessage = String(object.stateMessage); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1beta2.OperationMetadata.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.documentai.v1beta2.OperationMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + return message; + }; + + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.OperationMetadata + * @static + * @param {google.cloud.documentai.v1beta2.OperationMetadata} message OperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.stateMessage = ""; + object.createTime = null; + object.updateTime = null; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta2.OperationMetadata.State[message.state] : message.state; + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + object.stateMessage = message.stateMessage; + 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 OperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.OperationMetadata + * @instance + * @returns {Object.} JSON object + */ + OperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.documentai.v1beta2.OperationMetadata.State + * @enum {string} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} ACCEPTED=1 ACCEPTED value + * @property {number} WAITING=2 WAITING value + * @property {number} RUNNING=3 RUNNING value + * @property {number} SUCCEEDED=4 SUCCEEDED value + * @property {number} CANCELLED=5 CANCELLED value + * @property {number} FAILED=6 FAILED value + */ + OperationMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ACCEPTED"] = 1; + values[valuesById[2] = "WAITING"] = 2; + values[valuesById[3] = "RUNNING"] = 3; + values[valuesById[4] = "SUCCEEDED"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + values[valuesById[6] = "FAILED"] = 6; + return values; + })(); + + return OperationMetadata; + })(); + + return v1beta2; + })(); + + return documentai; + })(); + + return cloud; + })(); + + google.api = (function() { + + /** + * Namespace api. + * @memberof google + * @namespace + */ + var api = {}; + + /** + * FieldBehavior enum. + * @name google.api.FieldBehavior + * @enum {string} + * @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.Http = (function() { /** - * HttpRule delete. - * @member {string} delete - * @memberof google.api.HttpRule - * @instance + * Properties of a Http. + * @memberof google.api + * @interface IHttp + * @property {Array.|null} [rules] Http rules + * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion */ - HttpRule.prototype["delete"] = ""; /** - * HttpRule patch. - * @member {string} patch - * @memberof google.api.HttpRule - * @instance + * Constructs a new Http. + * @memberof google.api + * @classdesc Represents a Http. + * @implements IHttp + * @constructor + * @param {google.api.IHttp=} [properties] Properties to set */ - HttpRule.prototype.patch = ""; + 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]]; + } /** - * HttpRule custom. - * @member {google.api.ICustomHttpPattern|null|undefined} custom - * @memberof google.api.HttpRule + * Http rules. + * @member {Array.} rules + * @memberof google.api.Http * @instance */ - HttpRule.prototype.custom = null; + Http.prototype.rules = $util.emptyArray; /** - * HttpRule body. - * @member {string} body - * @memberof google.api.HttpRule + * Http fullyDecodeReservedExpansion. + * @member {boolean} fullyDecodeReservedExpansion + * @memberof google.api.Http * @instance */ - HttpRule.prototype.body = ""; + Http.prototype.fullyDecodeReservedExpansion = false; /** - * HttpRule responseBody. - * @member {string} responseBody - * @memberof google.api.HttpRule - * @instance + * 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 */ - HttpRule.prototype.responseBody = ""; + Http.create = function create(properties) { + return new Http(properties); + }; /** - * 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. + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. * @function encode - * @memberof google.api.HttpRule + * @memberof google.api.Http * @static - * @param {google.api.IHttpRule} message HttpRule 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 */ - HttpRule.encode = function encode(message, writer) { + Http.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.selector != null && message.hasOwnProperty("selector")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); - if (message.get != null && message.hasOwnProperty("get")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); - if (message.put != null && message.hasOwnProperty("put")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); - if (message.post != null && message.hasOwnProperty("post")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); - if (message["delete"] != null && message.hasOwnProperty("delete")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); - if (message.patch != null && message.hasOwnProperty("patch")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); - if (message.body != null && message.hasOwnProperty("body")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); - if (message.custom != null && message.hasOwnProperty("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 && message.hasOwnProperty("responseBody")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); + 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 && message.hasOwnProperty("fullyDecodeReservedExpansion")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); return writer; }; /** - * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.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.HttpRule + * @memberof google.api.Http * @static - * @param {google.api.IHttpRule} message HttpRule 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 */ - HttpRule.encodeDelimited = function encodeDelimited(message, writer) { + Http.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a HttpRule message from the specified reader or buffer. + * Decodes a Http message from the specified reader or buffer. * @function decode - * @memberof google.api.HttpRule + * @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.HttpRule} HttpRule + * @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 */ - HttpRule.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.HttpRule(); + 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.selector = 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.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.fullyDecodeReservedExpansion = reader.bool(); break; default: reader.skipType(tag & 7); @@ -4867,240 +12041,143 @@ }; /** - * Decodes a HttpRule 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.HttpRule + * @memberof google.api.Http * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.HttpRule} HttpRule + * @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 */ - HttpRule.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 HttpRule message. + * Verifies a Http message. * @function verify - * @memberof google.api.HttpRule + * @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 */ - HttpRule.verify = function verify(message) { + Http.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 (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 "additionalBindings." + error; + return "rules." + error; } } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + if (typeof message.fullyDecodeReservedExpansion !== "boolean") + return "fullyDecodeReservedExpansion: boolean expected"; return null; }; /** - * Creates a HttpRule 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.HttpRule + * @memberof google.api.Http * @static * @param {Object.} object Plain object - * @returns {google.api.HttpRule} HttpRule + * @returns {google.api.Http} Http */ - HttpRule.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.HttpRule) + Http.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Http) 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]); + 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 HttpRule 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.HttpRule + * @memberof google.api.Http * @static - * @param {google.api.HttpRule} message HttpRule + * @param {google.api.Http} message Http * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - HttpRule.toObject = function toObject(message, options) { + Http.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.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.responseBody != null && message.hasOwnProperty("responseBody")) - object.responseBody = message.responseBody; + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; return object; }; /** - * Converts this HttpRule to JSON. + * Converts this Http to JSON. * @function toJSON - * @memberof google.api.HttpRule + * @memberof google.api.Http * @instance * @returns {Object.} JSON object */ - HttpRule.prototype.toJSON = function toJSON() { + Http.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return HttpRule; + return Http; })(); - api.CustomHttpPattern = (function() { + api.HttpRule = (function() { /** - * Properties of a CustomHttpPattern. + * Properties of a HttpRule. * @memberof google.api - * @interface ICustomHttpPattern - * @property {string|null} [kind] CustomHttpPattern kind - * @property {string|null} [path] CustomHttpPattern path + * @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 CustomHttpPattern. + * Constructs a new HttpRule. * @memberof google.api - * @classdesc Represents a CustomHttpPattern. - * @implements ICustomHttpPattern + * @classdesc Represents a HttpRule. + * @implements IHttpRule * @constructor - * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + * @param {google.api.IHttpRule=} [properties] Properties to set */ - function CustomHttpPattern(properties) { + function HttpRule(properties) { + this.additionalBindings = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5108,216 +12185,648 @@ } /** - * CustomHttpPattern kind. - * @member {string} kind - * @memberof google.api.CustomHttpPattern + * HttpRule selector. + * @member {string} selector + * @memberof google.api.HttpRule * @instance */ - CustomHttpPattern.prototype.kind = ""; + HttpRule.prototype.selector = ""; /** - * CustomHttpPattern path. - * @member {string} path - * @memberof google.api.CustomHttpPattern + * HttpRule get. + * @member {string} get + * @memberof google.api.HttpRule * @instance */ - CustomHttpPattern.prototype.path = ""; + HttpRule.prototype.get = ""; /** - * Creates a new CustomHttpPattern instance using the specified properties. + * 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.CustomHttpPattern + * @memberof google.api.HttpRule * @static - * @param {google.api.ICustomHttpPattern=} [properties] Properties to set - * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance + * @param {google.api.IHttpRule=} [properties] Properties to set + * @returns {google.api.HttpRule} HttpRule instance */ - CustomHttpPattern.create = function create(properties) { - return new CustomHttpPattern(properties); + HttpRule.create = function create(properties) { + return new HttpRule(properties); }; /** - * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. * @function encode - * @memberof google.api.CustomHttpPattern + * @memberof google.api.HttpRule * @static - * @param {google.api.ICustomHttpPattern} message CustomHttpPattern 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 */ - CustomHttpPattern.encode = function encode(message, writer) { + HttpRule.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.kind != null && message.hasOwnProperty("kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.path != null && message.hasOwnProperty("path")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + if (message.selector != null && message.hasOwnProperty("selector")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); + if (message.get != null && message.hasOwnProperty("get")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); + if (message.put != null && message.hasOwnProperty("put")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); + if (message.post != null && message.hasOwnProperty("post")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); + if (message["delete"] != null && message.hasOwnProperty("delete")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); + if (message.patch != null && message.hasOwnProperty("patch")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); + if (message.body != null && message.hasOwnProperty("body")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); + if (message.custom != null && message.hasOwnProperty("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 && message.hasOwnProperty("responseBody")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); return writer; }; /** - * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.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.CustomHttpPattern + * @memberof google.api.HttpRule * @static - * @param {google.api.ICustomHttpPattern} message CustomHttpPattern 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 */ - CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { + HttpRule.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CustomHttpPattern message from the specified reader or buffer. + * Decodes a HttpRule message from the specified reader or buffer. * @function decode - * @memberof google.api.CustomHttpPattern + * @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.CustomHttpPattern} CustomHttpPattern + * @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 */ - CustomHttpPattern.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.CustomHttpPattern(); + 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.kind = reader.string(); + message.selector = reader.string(); break; case 2: - message.path = reader.string(); + message.get = reader.string(); break; - default: - reader.skipType(tag & 7); + 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 CustomHttpPattern 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.CustomHttpPattern + * @memberof google.api.HttpRule * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @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 */ - CustomHttpPattern.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 CustomHttpPattern message. + * Verifies a HttpRule message. * @function verify - * @memberof google.api.CustomHttpPattern + * @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 */ - CustomHttpPattern.verify = function verify(message) { + HttpRule.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"; + 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 CustomHttpPattern 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.CustomHttpPattern + * @memberof google.api.HttpRule * @static * @param {Object.} object Plain object - * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @returns {google.api.HttpRule} HttpRule */ - CustomHttpPattern.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.CustomHttpPattern) + HttpRule.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.HttpRule) 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.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 CustomHttpPattern 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.CustomHttpPattern + * @memberof google.api.HttpRule * @static - * @param {google.api.CustomHttpPattern} message CustomHttpPattern + * @param {google.api.HttpRule} message HttpRule * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CustomHttpPattern.toObject = function toObject(message, options) { + HttpRule.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.additionalBindings = []; if (options.defaults) { - object.kind = ""; - object.path = ""; + object.selector = ""; + object.body = ""; + object.responseBody = ""; } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.path != null && message.hasOwnProperty("path")) - object.path = message.path; + 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 CustomHttpPattern to JSON. + * Converts this HttpRule to JSON. * @function toJSON - * @memberof google.api.CustomHttpPattern + * @memberof google.api.HttpRule * @instance * @returns {Object.} JSON object */ - CustomHttpPattern.prototype.toJSON = function toJSON() { + HttpRule.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CustomHttpPattern; + return HttpRule; })(); - /** - * FieldBehavior enum. - * @name google.api.FieldBehavior - * @enum {string} - * @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.CustomHttpPattern = (function() { - return api; - })(); + /** + * Properties of a CustomHttpPattern. + * @memberof google.api + * @interface ICustomHttpPattern + * @property {string|null} [kind] CustomHttpPattern kind + * @property {string|null} [path] CustomHttpPattern path + */ - google.protobuf = (function() { + /** + * 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 && message.hasOwnProperty("kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.path != null && message.hasOwnProperty("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; + })(); + + return api; + })(); + + google.protobuf = (function() { /** * Namespace protobuf. @@ -13905,28 +21414,1967 @@ return Annotation; })(); - return GeneratedCodeInfo; + return GeneratedCodeInfo; + })(); + + 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 && message.hasOwnProperty("type_url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type_url); + if (message.value != null && message.hasOwnProperty("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.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 && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty("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 && message.hasOwnProperty("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() { + protobuf.Duration = (function() { /** - * Properties of an Any. + * Properties of a Duration. * @memberof google.protobuf - * @interface IAny - * @property {string|null} [type_url] Any type_url - * @property {Uint8Array|null} [value] Any value + * @interface IDuration + * @property {number|Long|null} [seconds] Duration seconds + * @property {number|null} [nanos] Duration nanos */ /** - * Constructs a new Any. + * Constructs a new Duration. * @memberof google.protobuf - * @classdesc Represents an Any. - * @implements IAny + * @classdesc Represents a Duration. + * @implements IDuration * @constructor - * @param {google.protobuf.IAny=} [properties] Properties to set + * @param {google.protobuf.IDuration=} [properties] Properties to set */ - function Any(properties) { + function Duration(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -13934,89 +23382,285 @@ } /** - * Any type_url. - * @member {string} type_url - * @memberof google.protobuf.Any + * Duration seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Duration * @instance */ - Any.prototype.type_url = ""; + Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Any value. - * @member {Uint8Array} value - * @memberof google.protobuf.Any + * Duration nanos. + * @member {number} nanos + * @memberof google.protobuf.Duration * @instance */ - Any.prototype.value = $util.newBuffer([]); + Duration.prototype.nanos = 0; /** - * Creates a new Any instance using the specified properties. + * Creates a new Duration instance using the specified properties. * @function create - * @memberof google.protobuf.Any + * @memberof google.protobuf.Duration * @static - * @param {google.protobuf.IAny=} [properties] Properties to set - * @returns {google.protobuf.Any} Any instance + * @param {google.protobuf.IDuration=} [properties] Properties to set + * @returns {google.protobuf.Duration} Duration instance */ - Any.create = function create(properties) { - return new Any(properties); + 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 && message.hasOwnProperty("seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && message.hasOwnProperty("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.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 Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. * @function encode - * @memberof google.protobuf.Any + * @memberof google.protobuf.Empty * @static - * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Any.encode = function encode(message, writer) { + Empty.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.type_url != null && message.hasOwnProperty("type_url")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type_url); - if (message.value != null && message.hasOwnProperty("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. + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.Any + * @memberof google.protobuf.Empty * @static - * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Any.encodeDelimited = function encodeDelimited(message, writer) { + Empty.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Any message from the specified reader or buffer. + * Decodes an Empty message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.Any + * @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.Any} Any + * @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 */ - Any.decode = function decode(reader, length) { + 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.Any(); + 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) { - case 1: - message.type_url = reader.string(); - break; - case 2: - message.value = reader.bytes(); - break; default: reader.skipType(tag & 7); break; @@ -14026,126 +23670,95 @@ }; /** - * Decodes an Any message from the specified reader or buffer, length delimited. + * Decodes an Empty message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.Any + * @memberof google.protobuf.Empty * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Any} Any + * @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 */ - Any.decodeDelimited = function decodeDelimited(reader) { + Empty.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Any message. + * Verifies an Empty message. * @function verify - * @memberof google.protobuf.Any + * @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 */ - Any.verify = function verify(message) { + Empty.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. + * Creates an Empty message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.Any + * @memberof google.protobuf.Empty * @static * @param {Object.} object Plain object - * @returns {google.protobuf.Any} Any + * @returns {google.protobuf.Empty} Empty */ - Any.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Any) + Empty.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Empty) 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; + return new $root.google.protobuf.Empty(); }; /** - * Creates a plain object from an Any message. Also converts values to other types if specified. + * Creates a plain object from an Empty message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.Any + * @memberof google.protobuf.Empty * @static - * @param {google.protobuf.Any} message Any + * @param {google.protobuf.Empty} message Empty * @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; + Empty.toObject = function toObject() { + return {}; }; /** - * Converts this Any to JSON. + * Converts this Empty to JSON. * @function toJSON - * @memberof google.protobuf.Any + * @memberof google.protobuf.Empty * @instance * @returns {Object.} JSON object */ - Any.prototype.toJSON = function toJSON() { + Empty.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Any; + return Empty; })(); - 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) @@ -14153,43 +23766,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 && message.hasOwnProperty("seconds")) @@ -14200,33 +23813,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) { @@ -14245,30 +23858,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")) @@ -14281,17 +23894,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; @@ -14307,15 +23920,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 = {}; @@ -14338,36 +23951,52 @@ }; /** - * 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.Empty = (function() { + return protobuf; + })(); + + google.rpc = (function() { + + /** + * Namespace rpc. + * @memberof google + * @namespace + */ + var rpc = {}; + + rpc.Status = (function() { /** - * Properties of an Empty. - * @memberof google.protobuf - * @interface IEmpty + * 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 Empty. - * @memberof google.protobuf - * @classdesc Represents an Empty. - * @implements IEmpty + * Constructs a new Status. + * @memberof google.rpc + * @classdesc Represents a Status. + * @implements IStatus * @constructor - * @param {google.protobuf.IEmpty=} [properties] Properties to set + * @param {google.rpc.IStatus=} [properties] Properties to set */ - function Empty(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) @@ -14375,63 +24004,105 @@ } /** - * Creates a new Empty instance using the specified properties. + * 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.protobuf.Empty + * @memberof google.rpc.Status * @static - * @param {google.protobuf.IEmpty=} [properties] Properties to set - * @returns {google.protobuf.Empty} Empty instance + * @param {google.rpc.IStatus=} [properties] Properties to set + * @returns {google.rpc.Status} Status instance */ - Empty.create = function create(properties) { - return new Empty(properties); + Status.create = function create(properties) { + return new Status(properties); }; /** - * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. * @function encode - * @memberof google.protobuf.Empty + * @memberof google.rpc.Status * @static - * @param {google.protobuf.IEmpty} message Empty 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 */ - Empty.encode = function encode(message, writer) { + Status.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.code != null && message.hasOwnProperty("code")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); + if (message.message != null && message.hasOwnProperty("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 Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.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.Empty + * @memberof google.rpc.Status * @static - * @param {google.protobuf.IEmpty} message Empty 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 */ - Empty.encodeDelimited = function encodeDelimited(message, writer) { + Status.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Empty message from the specified reader or buffer. + * Decodes a Status message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.Empty + * @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.Empty} Empty + * @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 */ - Empty.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.Empty(); + 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; @@ -14441,95 +24112,157 @@ }; /** - * Decodes an Empty 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.Empty + * @memberof google.rpc.Status * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Empty} Empty + * @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 */ - Empty.decodeDelimited = function decodeDelimited(reader) { + Status.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Empty message. + * Verifies a Status message. * @function verify - * @memberof google.protobuf.Empty + * @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 */ - Empty.verify = function verify(message) { + 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 an Empty 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.Empty + * @memberof google.rpc.Status * @static * @param {Object.} object Plain object - * @returns {google.protobuf.Empty} Empty + * @returns {google.rpc.Status} Status */ - Empty.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Empty) + Status.fromObject = function fromObject(object) { + if (object instanceof $root.google.rpc.Status) return object; - return new $root.google.protobuf.Empty(); + 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 an Empty 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.Empty + * @memberof google.rpc.Status * @static - * @param {google.protobuf.Empty} message Empty + * @param {google.rpc.Status} message Status * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Empty.toObject = function toObject() { - return {}; + 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 Empty to JSON. + * Converts this Status to JSON. * @function toJSON - * @memberof google.protobuf.Empty + * @memberof google.rpc.Status * @instance * @returns {Object.} JSON object */ - Empty.prototype.toJSON = function toJSON() { + Status.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Empty; + return Status; })(); - protobuf.Timestamp = (function() { + return rpc; + })(); + + google.type = (function() { + + /** + * Namespace type. + * @memberof google + * @namespace + */ + var type = {}; + + type.Color = (function() { /** - * Properties of a Timestamp. - * @memberof google.protobuf - * @interface ITimestamp - * @property {number|Long|null} [seconds] Timestamp seconds - * @property {number|null} [nanos] Timestamp nanos + * Properties of a Color. + * @memberof google.type + * @interface IColor + * @property {number|null} [red] Color red + * @property {number|null} [green] Color green + * @property {number|null} [blue] Color blue + * @property {google.protobuf.IFloatValue|null} [alpha] Color alpha */ /** - * Constructs a new Timestamp. - * @memberof google.protobuf - * @classdesc Represents a Timestamp. - * @implements ITimestamp + * Constructs a new Color. + * @memberof google.type + * @classdesc Represents a Color. + * @implements IColor * @constructor - * @param {google.protobuf.ITimestamp=} [properties] Properties to set + * @param {google.type.IColor=} [properties] Properties to set */ - function Timestamp(properties) { + function Color(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14537,88 +24270,114 @@ } /** - * Timestamp seconds. - * @member {number|Long} seconds - * @memberof google.protobuf.Timestamp + * Color red. + * @member {number} red + * @memberof google.type.Color * @instance */ - Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + Color.prototype.red = 0; /** - * Timestamp nanos. - * @member {number} nanos - * @memberof google.protobuf.Timestamp + * Color green. + * @member {number} green + * @memberof google.type.Color * @instance */ - Timestamp.prototype.nanos = 0; + Color.prototype.green = 0; /** - * Creates a new Timestamp instance using the specified properties. + * Color blue. + * @member {number} blue + * @memberof google.type.Color + * @instance + */ + Color.prototype.blue = 0; + + /** + * Color alpha. + * @member {google.protobuf.IFloatValue|null|undefined} alpha + * @memberof google.type.Color + * @instance + */ + Color.prototype.alpha = null; + + /** + * Creates a new Color instance using the specified properties. * @function create - * @memberof google.protobuf.Timestamp + * @memberof google.type.Color * @static - * @param {google.protobuf.ITimestamp=} [properties] Properties to set - * @returns {google.protobuf.Timestamp} Timestamp instance + * @param {google.type.IColor=} [properties] Properties to set + * @returns {google.type.Color} Color instance */ - Timestamp.create = function create(properties) { - return new Timestamp(properties); + Color.create = function create(properties) { + return new Color(properties); }; /** - * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * Encodes the specified Color message. Does not implicitly {@link google.type.Color.verify|verify} messages. * @function encode - * @memberof google.protobuf.Timestamp + * @memberof google.type.Color * @static - * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {google.type.IColor} message Color message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Timestamp.encode = function encode(message, writer) { + Color.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.seconds != null && message.hasOwnProperty("seconds")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); - if (message.nanos != null && message.hasOwnProperty("nanos")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + if (message.red != null && message.hasOwnProperty("red")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.red); + if (message.green != null && message.hasOwnProperty("green")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.green); + if (message.blue != null && message.hasOwnProperty("blue")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.blue); + if (message.alpha != null && message.hasOwnProperty("alpha")) + $root.google.protobuf.FloatValue.encode(message.alpha, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; /** - * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * Encodes the specified Color message, length delimited. Does not implicitly {@link google.type.Color.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.Timestamp + * @memberof google.type.Color * @static - * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {google.type.IColor} message Color message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Timestamp.encodeDelimited = function encodeDelimited(message, writer) { + Color.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Timestamp message from the specified reader or buffer. + * Decodes a Color message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.Timestamp + * @memberof google.type.Color * @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.type.Color} Color * @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) { + Color.decode = function 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.type.Color(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.seconds = reader.int64(); + message.red = reader.float(); break; case 2: - message.nanos = reader.int32(); + message.green = reader.float(); + break; + case 3: + message.blue = reader.float(); + break; + case 4: + message.alpha = $root.google.protobuf.FloatValue.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -14629,113 +24388,120 @@ }; /** - * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * Decodes a Color message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.Timestamp + * @memberof google.type.Color * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Timestamp} Timestamp + * @returns {google.type.Color} Color * @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) { + Color.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Timestamp message. + * Verifies a Color message. * @function verify - * @memberof google.protobuf.Timestamp + * @memberof google.type.Color * @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) { + Color.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.red != null && message.hasOwnProperty("red")) + if (typeof message.red !== "number") + return "red: number expected"; + if (message.green != null && message.hasOwnProperty("green")) + if (typeof message.green !== "number") + return "green: number expected"; + if (message.blue != null && message.hasOwnProperty("blue")) + if (typeof message.blue !== "number") + return "blue: number expected"; + if (message.alpha != null && message.hasOwnProperty("alpha")) { + var error = $root.google.protobuf.FloatValue.verify(message.alpha); + if (error) + return "alpha." + error; + } return null; }; /** - * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * Creates a Color message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.Timestamp + * @memberof google.type.Color * @static * @param {Object.} object Plain object - * @returns {google.protobuf.Timestamp} Timestamp + * @returns {google.type.Color} Color */ - Timestamp.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Timestamp) + Color.fromObject = function fromObject(object) { + if (object instanceof $root.google.type.Color) 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.type.Color(); + if (object.red != null) + message.red = Number(object.red); + if (object.green != null) + message.green = Number(object.green); + if (object.blue != null) + message.blue = Number(object.blue); + if (object.alpha != null) { + if (typeof object.alpha !== "object") + throw TypeError(".google.type.Color.alpha: object expected"); + message.alpha = $root.google.protobuf.FloatValue.fromObject(object.alpha); + } return message; }; /** - * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * Creates a plain object from a Color message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.Timestamp + * @memberof google.type.Color * @static - * @param {google.protobuf.Timestamp} message Timestamp + * @param {google.type.Color} message Color * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Timestamp.toObject = function toObject(message, options) { + Color.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; + object.red = 0; + object.green = 0; + object.blue = 0; + object.alpha = null; } - 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; + if (message.red != null && message.hasOwnProperty("red")) + object.red = options.json && !isFinite(message.red) ? String(message.red) : message.red; + if (message.green != null && message.hasOwnProperty("green")) + object.green = options.json && !isFinite(message.green) ? String(message.green) : message.green; + if (message.blue != null && message.hasOwnProperty("blue")) + object.blue = options.json && !isFinite(message.blue) ? String(message.blue) : message.blue; + if (message.alpha != null && message.hasOwnProperty("alpha")) + object.alpha = $root.google.protobuf.FloatValue.toObject(message.alpha, options); return object; }; /** - * Converts this Timestamp to JSON. + * Converts this Color to JSON. * @function toJSON - * @memberof google.protobuf.Timestamp + * @memberof google.type.Color * @instance * @returns {Object.} JSON object */ - Timestamp.prototype.toJSON = function toJSON() { + Color.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Timestamp; + return Color; })(); - return protobuf; + return type; })(); google.longrunning = (function() { @@ -16479,296 +26245,72 @@ 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 && message.hasOwnProperty("responseType")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.responseType); - if (message.metadataType != null && message.hasOwnProperty("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); + 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 an OperationInfo message. Also converts values to other types if specified. + * Creates a plain object from a WaitOperationRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.longrunning.OperationInfo + * @memberof google.longrunning.WaitOperationRequest * @static - * @param {google.longrunning.OperationInfo} message OperationInfo + * @param {google.longrunning.WaitOperationRequest} message WaitOperationRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - OperationInfo.toObject = function toObject(message, options) { + WaitOperationRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.responseType = ""; - object.metadataType = ""; + object.name = ""; + object.timeout = null; } - if (message.responseType != null && message.hasOwnProperty("responseType")) - object.responseType = message.responseType; - if (message.metadataType != null && message.hasOwnProperty("metadataType")) - object.metadataType = message.metadataType; + 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 OperationInfo to JSON. + * Converts this WaitOperationRequest to JSON. * @function toJSON - * @memberof google.longrunning.OperationInfo + * @memberof google.longrunning.WaitOperationRequest * @instance * @returns {Object.} JSON object */ - OperationInfo.prototype.toJSON = function toJSON() { + WaitOperationRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return OperationInfo; + return WaitOperationRequest; })(); - return longrunning; - })(); - - google.rpc = (function() { - - /** - * Namespace rpc. - * @memberof google - * @namespace - */ - var rpc = {}; - - rpc.Status = (function() { + longrunning.OperationInfo = (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 an OperationInfo. + * @memberof google.longrunning + * @interface IOperationInfo + * @property {string|null} [responseType] OperationInfo responseType + * @property {string|null} [metadataType] OperationInfo metadataType */ /** - * Constructs a new Status. - * @memberof google.rpc - * @classdesc Represents a Status. - * @implements IStatus + * Constructs a new OperationInfo. + * @memberof google.longrunning + * @classdesc Represents an OperationInfo. + * @implements IOperationInfo * @constructor - * @param {google.rpc.IStatus=} [properties] Properties to set + * @param {google.longrunning.IOperationInfo=} [properties] Properties to set */ - function Status(properties) { - this.details = []; + function OperationInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16776,104 +26318,88 @@ } /** - * Status code. - * @member {number} code - * @memberof google.rpc.Status - * @instance - */ - Status.prototype.code = 0; - - /** - * Status message. - * @member {string} message - * @memberof google.rpc.Status + * OperationInfo responseType. + * @member {string} responseType + * @memberof google.longrunning.OperationInfo * @instance */ - Status.prototype.message = ""; + OperationInfo.prototype.responseType = ""; /** - * Status details. - * @member {Array.} details - * @memberof google.rpc.Status + * OperationInfo metadataType. + * @member {string} metadataType + * @memberof google.longrunning.OperationInfo * @instance */ - Status.prototype.details = $util.emptyArray; + OperationInfo.prototype.metadataType = ""; /** - * Creates a new Status instance using the specified properties. + * Creates a new OperationInfo instance using the specified properties. * @function create - * @memberof google.rpc.Status + * @memberof google.longrunning.OperationInfo * @static - * @param {google.rpc.IStatus=} [properties] Properties to set - * @returns {google.rpc.Status} Status instance + * @param {google.longrunning.IOperationInfo=} [properties] Properties to set + * @returns {google.longrunning.OperationInfo} OperationInfo instance */ - Status.create = function create(properties) { - return new Status(properties); + OperationInfo.create = function create(properties) { + return new OperationInfo(properties); }; /** - * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * Encodes the specified OperationInfo message. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. * @function encode - * @memberof google.rpc.Status + * @memberof google.longrunning.OperationInfo * @static - * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {google.longrunning.IOperationInfo} message OperationInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Status.encode = function encode(message, writer) { + OperationInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.code != null && message.hasOwnProperty("code")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); - if (message.message != null && message.hasOwnProperty("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.responseType != null && message.hasOwnProperty("responseType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.responseType); + if (message.metadataType != null && message.hasOwnProperty("metadataType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.metadataType); return writer; }; /** - * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * Encodes the specified OperationInfo message, length delimited. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.rpc.Status + * @memberof google.longrunning.OperationInfo * @static - * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {google.longrunning.IOperationInfo} message OperationInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Status.encodeDelimited = function encodeDelimited(message, writer) { + OperationInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Status message from the specified reader or buffer. + * Decodes an OperationInfo message from the specified reader or buffer. * @function decode - * @memberof google.rpc.Status + * @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.rpc.Status} Status + * @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 */ - Status.decode = function decode(reader, length) { + 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.rpc.Status(); + 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.code = reader.int32(); + message.responseType = reader.string(); 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())); + message.metadataType = reader.string(); break; default: reader.skipType(tag & 7); @@ -16884,125 +26410,99 @@ }; /** - * Decodes a Status message from the specified reader or buffer, length delimited. + * Decodes an OperationInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.rpc.Status + * @memberof google.longrunning.OperationInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.rpc.Status} Status + * @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 */ - Status.decodeDelimited = function decodeDelimited(reader) { + OperationInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Status message. + * Verifies an OperationInfo message. * @function verify - * @memberof google.rpc.Status + * @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 */ - Status.verify = function verify(message) { + OperationInfo.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.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 a Status message from a plain object. Also converts values to their respective internal types. + * Creates an OperationInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.rpc.Status + * @memberof google.longrunning.OperationInfo * @static * @param {Object.} object Plain object - * @returns {google.rpc.Status} Status + * @returns {google.longrunning.OperationInfo} OperationInfo */ - Status.fromObject = function fromObject(object) { - if (object instanceof $root.google.rpc.Status) + OperationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.OperationInfo) 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.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 a Status message. Also converts values to other types if specified. + * Creates a plain object from an OperationInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.rpc.Status + * @memberof google.longrunning.OperationInfo * @static - * @param {google.rpc.Status} message Status + * @param {google.longrunning.OperationInfo} message OperationInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Status.toObject = function toObject(message, options) { + OperationInfo.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.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 Status to JSON. + * Converts this OperationInfo to JSON. * @function toJSON - * @memberof google.rpc.Status + * @memberof google.longrunning.OperationInfo * @instance * @returns {Object.} JSON object */ - Status.prototype.toJSON = function toJSON() { + OperationInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Status; + return OperationInfo; })(); - return rpc; + return longrunning; })(); return google; diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 0ea87517fe3..91015992eab 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -6,17 +6,646 @@ "nested": { "documentai": { "nested": { - "v1beta1": { + "v1beta2": { "options": { - "go_package": "google.golang.org/genproto/googleapis/cloud/documentai/v1beta1;documentai", + "go_package": "google.golang.org/genproto/googleapis/cloud/documentai/v1beta2;documentai", "java_multiple_files": true, - "java_outer_classname": "GeometryProto", - "java_package": "com.google.cloud.documentai.v1beta1" + "java_outer_classname": "DocumentAiProto", + "java_package": "com.google.cloud.documentai.v1beta2" }, "nested": { + "Document": { + "oneofs": { + "source": { + "oneof": [ + "uri", + "content" + ] + } + }, + "fields": { + "uri": { + "type": "string", + "id": 1 + }, + "content": { + "type": "bytes", + "id": 2 + }, + "mimeType": { + "type": "string", + "id": 3 + }, + "text": { + "type": "string", + "id": 4 + }, + "textStyles": { + "rule": "repeated", + "type": "Style", + "id": 5 + }, + "pages": { + "rule": "repeated", + "type": "Page", + "id": 6 + }, + "entities": { + "rule": "repeated", + "type": "Entity", + "id": 7 + }, + "entityRelations": { + "rule": "repeated", + "type": "EntityRelation", + "id": 8 + }, + "shardInfo": { + "type": "ShardInfo", + "id": 9 + }, + "labels": { + "rule": "repeated", + "type": "Label", + "id": 11 + }, + "error": { + "type": "google.rpc.Status", + "id": 10 + } + }, + "nested": { + "ShardInfo": { + "fields": { + "shardIndex": { + "type": "int64", + "id": 1 + }, + "shardCount": { + "type": "int64", + "id": 2 + }, + "textOffset": { + "type": "int64", + "id": 3 + } + } + }, + "Label": { + "oneofs": { + "source": { + "oneof": [ + "automlModel" + ] + } + }, + "fields": { + "automlModel": { + "type": "string", + "id": 2 + }, + "name": { + "type": "string", + "id": 1 + }, + "confidence": { + "type": "float", + "id": 3 + } + } + }, + "Style": { + "fields": { + "textAnchor": { + "type": "TextAnchor", + "id": 1 + }, + "color": { + "type": "google.type.Color", + "id": 2 + }, + "backgroundColor": { + "type": "google.type.Color", + "id": 3 + }, + "fontWeight": { + "type": "string", + "id": 4 + }, + "textStyle": { + "type": "string", + "id": 5 + }, + "textDecoration": { + "type": "string", + "id": 6 + }, + "fontSize": { + "type": "FontSize", + "id": 7 + } + }, + "nested": { + "FontSize": { + "fields": { + "size": { + "type": "float", + "id": 1 + }, + "unit": { + "type": "string", + "id": 2 + } + } + } + } + }, + "Page": { + "fields": { + "pageNumber": { + "type": "int32", + "id": 1 + }, + "dimension": { + "type": "Dimension", + "id": 2 + }, + "layout": { + "type": "Layout", + "id": 3 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 4 + }, + "blocks": { + "rule": "repeated", + "type": "Block", + "id": 5 + }, + "paragraphs": { + "rule": "repeated", + "type": "Paragraph", + "id": 6 + }, + "lines": { + "rule": "repeated", + "type": "Line", + "id": 7 + }, + "tokens": { + "rule": "repeated", + "type": "Token", + "id": 8 + }, + "visualElements": { + "rule": "repeated", + "type": "VisualElement", + "id": 9 + }, + "tables": { + "rule": "repeated", + "type": "Table", + "id": 10 + }, + "formFields": { + "rule": "repeated", + "type": "FormField", + "id": 11 + } + }, + "nested": { + "Dimension": { + "fields": { + "width": { + "type": "float", + "id": 1 + }, + "height": { + "type": "float", + "id": 2 + }, + "unit": { + "type": "string", + "id": 3 + } + } + }, + "Layout": { + "fields": { + "textAnchor": { + "type": "TextAnchor", + "id": 1 + }, + "confidence": { + "type": "float", + "id": 2 + }, + "boundingPoly": { + "type": "BoundingPoly", + "id": 3 + }, + "orientation": { + "type": "Orientation", + "id": 4 + }, + "id": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Orientation": { + "values": { + "ORIENTATION_UNSPECIFIED": 0, + "PAGE_UP": 1, + "PAGE_RIGHT": 2, + "PAGE_DOWN": 3, + "PAGE_LEFT": 4 + } + } + } + }, + "Block": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 2 + } + } + }, + "Paragraph": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 2 + } + } + }, + "Line": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 2 + } + } + }, + "Token": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedBreak": { + "type": "DetectedBreak", + "id": 2 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 3 + } + }, + "nested": { + "DetectedBreak": { + "fields": { + "type": { + "type": "Type", + "id": 1 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_UNSPECIFIED": 0, + "SPACE": 1, + "WIDE_SPACE": 2, + "HYPHEN": 3 + } + } + } + } + } + }, + "VisualElement": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "type": { + "type": "string", + "id": 2 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 3 + } + } + }, + "Table": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "headerRows": { + "rule": "repeated", + "type": "TableRow", + "id": 2 + }, + "bodyRows": { + "rule": "repeated", + "type": "TableRow", + "id": 3 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 4 + } + }, + "nested": { + "TableRow": { + "fields": { + "cells": { + "rule": "repeated", + "type": "TableCell", + "id": 1 + } + } + }, + "TableCell": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "rowSpan": { + "type": "int32", + "id": 2 + }, + "colSpan": { + "type": "int32", + "id": 3 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 4 + } + } + } + } + }, + "FormField": { + "fields": { + "fieldName": { + "type": "Layout", + "id": 1 + }, + "fieldValue": { + "type": "Layout", + "id": 2 + }, + "nameDetectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 3 + }, + "valueDetectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 4 + }, + "valueType": { + "type": "string", + "id": 5 + }, + "correctedKeyText": { + "type": "string", + "id": 6 + }, + "correctedValueText": { + "type": "string", + "id": 7 + } + } + }, + "DetectedLanguage": { + "fields": { + "languageCode": { + "type": "string", + "id": 1 + }, + "confidence": { + "type": "float", + "id": 2 + } + } + } + } + }, + "Entity": { + "fields": { + "textAnchor": { + "type": "TextAnchor", + "id": 1 + }, + "type": { + "type": "string", + "id": 2 + }, + "mentionText": { + "type": "string", + "id": 3 + }, + "mentionId": { + "type": "string", + "id": 4 + }, + "confidence": { + "type": "float", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageAnchor": { + "type": "PageAnchor", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "id": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "boundingPolyForDemoFrontend": { + "type": "BoundingPoly", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "EntityRelation": { + "fields": { + "subjectId": { + "type": "string", + "id": 1 + }, + "objectId": { + "type": "string", + "id": 2 + }, + "relation": { + "type": "string", + "id": 3 + } + } + }, + "TextAnchor": { + "fields": { + "textSegments": { + "rule": "repeated", + "type": "TextSegment", + "id": 1 + } + }, + "nested": { + "TextSegment": { + "fields": { + "startIndex": { + "type": "int64", + "id": 1 + }, + "endIndex": { + "type": "int64", + "id": 2 + } + } + } + } + }, + "PageAnchor": { + "fields": { + "pageRefs": { + "rule": "repeated", + "type": "PageRef", + "id": 1 + } + }, + "nested": { + "PageRef": { + "fields": { + "page": { + "type": "int64", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "layoutType": { + "type": "LayoutType", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "layoutId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "LayoutType": { + "values": { + "LAYOUT_TYPE_UNSPECIFIED": 0, + "BLOCK": 1, + "PARAGRAPH": 2, + "LINE": 3, + "TOKEN": 4, + "VISUAL_ELEMENT": 5, + "TABLE": 6, + "FORM_FIELD": 7 + } + } + } + } + } + } + } + }, + "Vertex": { + "fields": { + "x": { + "type": "int32", + "id": 1 + }, + "y": { + "type": "int32", + "id": 2 + } + } + }, + "NormalizedVertex": { + "fields": { + "x": { + "type": "float", + "id": 1 + }, + "y": { + "type": "float", + "id": 2 + } + } + }, + "BoundingPoly": { + "fields": { + "vertices": { + "rule": "repeated", + "type": "Vertex", + "id": 1 + }, + "normalizedVertices": { + "rule": "repeated", + "type": "NormalizedVertex", + "id": 2 + } + } + }, "DocumentUnderstandingService": { "options": { - "(google.api.default_host)": "documentai.googleapis.com", + "(google.api.default_host)": "us-documentai.googleapis.com", "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" }, "methods": { @@ -24,14 +653,24 @@ "requestType": "BatchProcessDocumentsRequest", "responseType": "google.longrunning.Operation", "options": { - "(google.api.http).post": "/v1beta1/{parent=projects/*/locations/*}/documents:batchProcess", + "(google.api.http).post": "/v1beta2/{parent=projects/*/locations/*}/documents:batchProcess", "(google.api.http).body": "*", - "(google.api.http).additional_bindings.post": "/v1beta1/{parent=projects/*}/documents:batchProcess", + "(google.api.http).additional_bindings.post": "/v1beta2/{parent=projects/*}/documents:batchProcess", "(google.api.http).additional_bindings.body": "*", "(google.api.method_signature)": "requests", "(google.longrunning.operation_info).response_type": "BatchProcessDocumentsResponse", "(google.longrunning.operation_info).metadata_type": "OperationMetadata" } + }, + "ProcessDocument": { + "requestType": "ProcessDocumentRequest", + "responseType": "Document", + "options": { + "(google.api.http).post": "/v1beta2/{parent=projects/*/locations/*}/documents:process", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v1beta2/{parent=projects/*}/documents:process", + "(google.api.http).additional_bindings.body": "*" + } } } }, @@ -53,6 +692,10 @@ }, "ProcessDocumentRequest": { "fields": { + "parent": { + "type": "string", + "id": 9 + }, "inputConfig": { "type": "InputConfig", "id": 1, @@ -64,7 +707,7 @@ "type": "OutputConfig", "id": 2, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "OPTIONAL" } }, "documentType": { @@ -86,6 +729,10 @@ "ocrParams": { "type": "OcrParams", "id": 7 + }, + "automlParams": { + "type": "AutoMlParams", + "id": 8 } } }, @@ -204,11 +851,20 @@ } } }, + "AutoMlParams": { + "fields": { + "model": { + "type": "string", + "id": 1 + } + } + }, "InputConfig": { "oneofs": { "source": { "oneof": [ - "gcsSource" + "gcsSource", + "contents" ] } }, @@ -217,6 +873,10 @@ "type": "GcsSource", "id": 1 }, + "contents": { + "type": "bytes", + "id": 3 + }, "mimeType": { "type": "string", "id": 2, @@ -299,44 +959,6 @@ } } } - }, - "Vertex": { - "fields": { - "x": { - "type": "int32", - "id": 1 - }, - "y": { - "type": "int32", - "id": 2 - } - } - }, - "NormalizedVertex": { - "fields": { - "x": { - "type": "float", - "id": 1 - }, - "y": { - "type": "float", - "id": 2 - } - } - }, - "BoundingPoly": { - "fields": { - "vertices": { - "rule": "repeated", - "type": "Vertex", - "id": 1 - }, - "normalizedVertices": { - "rule": "repeated", - "type": "NormalizedVertex", - "id": 2 - } - } } } } @@ -348,12 +970,28 @@ "options": { "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", "java_multiple_files": true, - "java_outer_classname": "FieldBehaviorProto", + "java_outer_classname": "ClientProto", "java_package": "com.google.api", "objc_class_prefix": "GAPI", "cc_enable_arenas": true }, "nested": { + "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 + } + }, "http": { "type": "HttpRule", "id": 72295728, @@ -456,22 +1094,6 @@ "type": "string", "id": 1050, "extend": "google.protobuf.ServiceOptions" - }, - "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 - } } } }, @@ -1378,6 +2000,78 @@ } } }, + "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 + } + } + }, "Duration": { "fields": { "seconds": { @@ -1407,6 +2101,66 @@ } } }, + "rpc": { + "options": { + "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 + } + } + } + } + }, + "type": { + "options": { + "cc_enable_arenas": true, + "go_package": "google.golang.org/genproto/googleapis/type/color;color", + "java_multiple_files": true, + "java_outer_classname": "ColorProto", + "java_package": "com.google.type", + "objc_class_prefix": "GTP" + }, + "nested": { + "Color": { + "fields": { + "red": { + "type": "float", + "id": 1 + }, + "green": { + "type": "float", + "id": 2 + }, + "blue": { + "type": "float", + "id": 3 + }, + "alpha": { + "type": "google.protobuf.FloatValue", + "id": 4 + } + } + } + } + }, "longrunning": { "options": { "cc_enable_arenas": true, @@ -1574,34 +2328,6 @@ } } } - }, - "rpc": { - "options": { - "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 - } - } - } - } } } } diff --git a/packages/google-cloud-documentai/samples/README.md b/packages/google-cloud-documentai/samples/README.md index 2ad143c1e72..3cea9ee87c8 100644 --- a/packages/google-cloud-documentai/samples/README.md +++ b/packages/google-cloud-documentai/samples/README.md @@ -12,6 +12,8 @@ * [Before you begin](#before-you-begin) * [Samples](#samples) + * [Parse Form](#parse-form) + * [Parse Table](#parse-table) * [Quickstart](#quickstart) ## Before you begin @@ -19,10 +21,50 @@ Before running the samples, make sure you've followed the steps outlined in [Using the client library](https://github.com/googleapis/nodejs-document-ai#using-the-client-library). +`cd samples` + +`npm install` + +`cd ..` + ## Samples +### Parse Form + +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parseForm.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parseForm.js,samples/README.md) + +__Usage:__ + + +`node samples/parseForm.js` + + +----- + + + + +### Parse Table + +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parseTable.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parseTable.js,samples/README.md) + +__Usage:__ + + +`node samples/parseTable.js` + + +----- + + + + ### Quickstart View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/quickstart.js). @@ -32,7 +74,7 @@ View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/mas __Usage:__ -`node quickstart.js` +`node samples/quickstart.js` @@ -41,4 +83,4 @@ __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-document-ai&page=editor&open_in_editor=samples/README.md -[product-docs]: https://cloud.google.com/document-understanding/docs/ \ No newline at end of file +[product-docs]: https://cloud.google.com/document-understanding/docs/ diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 7435dab506b..ea52d7dd9c0 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,11 +13,11 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^0.0.1", + "@google-cloud/documentai": "^0.1.0", "@google-cloud/storage": "^4.2.0" }, "devDependencies": { "chai": "^4.2.0", "mocha": "^6.2.0" } -} \ No newline at end of file +} diff --git a/packages/google-cloud-documentai/samples/quickstart.js b/packages/google-cloud-documentai/samples/quickstart.js index f4b6afac5cf..a6bef04db8c 100644 --- a/packages/google-cloud-documentai/samples/quickstart.js +++ b/packages/google-cloud-documentai/samples/quickstart.js @@ -1,5 +1,5 @@ /** - * Copyright 2019, Google, Inc. + * Copyright 2020, Google, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,21 +16,65 @@ 'use strict'; /** - * DESCRIBE WHAT THIS SAMPLE DOES. - * @param {string} LIST EXPECTED ARGUMENTS. + * Process a single PDF. + * @param {string} projectId your Google Cloud project ID + * @param {string} location region to use for this operation + * @param {string} gcsInputUri Cloud Storage URI of the PDF document to parse */ -async function main() { - // [START LIBRARY_NAME_quickstart] - async function batchProcessDocument() { - const { - DocumentUnderstandingServiceClient, - } = require('@google-cloud/documentai'); - const client = new DocumentUnderstandingServiceClient(); - // TODO: write sample here that demonstrates batch processing of documents. - console.info(client); +async function main( + projectId, + location, + gcsInputUri = 'gs://cloud-samples-data/documentai/invoice.pdf' +) { + // [START document_quickstart] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'YOUR_PROJECT_ID'; + // const location = 'YOUR_PROJECT_LOCATION'; + // const gcsInputUri = 'YOUR_SOURCE_PDF'; + + const { + DocumentUnderstandingServiceClient, + } = require('@google-cloud/documentai'); + const client = new DocumentUnderstandingServiceClient(); + + async function quickstart() { + // Configure the request for processing the PDF + const parent = `projects/${projectId}/locations/${location}`; + const request = { + parent, + inputConfig: { + gcsSource: { + uri: gcsInputUri, + }, + mimeType: 'application/pdf', + }, + }; + + // Recognizes text entities in the PDF document + const [result] = await client.processDocument(request); + + // Get all of the document text as one big string + const {text} = result; + + // Extract shards from the text field + function extractText(textAnchor) { + // First shard in document doesn't have startIndex property + const startIndex = textAnchor.textSegments[0].startIndex || 0; + const endIndex = textAnchor.textSegments[0].endIndex; + + return text.substring(startIndex, endIndex); + } + + for (const entity of result.entities) { + console.log(`\nEntity text: ${extractText(entity.textAnchor)}`); + console.log(`Entity type: ${entity.type}`); + console.log(`Entity mention text: ${entity.mentionText}`); + } } - // [END LIBRARY_NAME_quickstart] - await batchProcessDocument(); + // [END document_quickstart] + await quickstart(); } main(...process.argv.slice(2)).catch(err => { diff --git a/packages/google-cloud-documentai/samples/test/quickstart.js b/packages/google-cloud-documentai/samples/test/quickstart.test.js similarity index 80% rename from packages/google-cloud-documentai/samples/test/quickstart.js rename to packages/google-cloud-documentai/samples/test/quickstart.test.js index 0f0bd0d25c7..9a32e02e777 100644 --- a/packages/google-cloud-documentai/samples/test/quickstart.js +++ b/packages/google-cloud-documentai/samples/test/quickstart.test.js @@ -22,10 +22,14 @@ const cp = require('child_process'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const cwd = path.join(__dirname, '..'); +const projectId = process.env.GCLOUD_PROJECT; +const LOCATION = 'us-central1'; describe('Quickstart', () => { it('should run quickstart', async () => { - const stdout = execSync(`node ./quickstart.js`, {cwd}); - assert.ok(stdout); + const stdout = execSync(`node ./quickstart.js ${projectId} ${LOCATION}`, { + cwd, + }); + assert.match(stdout, /Entity/); }); }); diff --git a/packages/google-cloud-documentai/src/index.js b/packages/google-cloud-documentai/src/index.js deleted file mode 100644 index 134b6850bf7..00000000000 --- a/packages/google-cloud-documentai/src/index.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @namespace google - */ -/** - * @namespace google.cloud - */ -/** - * @namespace google.cloud.documentai - */ -/** - * @namespace google.cloud.documentai.v1beta1 - */ - -'use strict'; - -// Import the clients for each version supported by this package. -const gapic = Object.freeze({ - v1beta1: require('./v1beta1'), -}); - -/** - * The `documentai` package has the following named exports: - * - * - `DocumentUnderstandingServiceClient` - Reference to - * {@link v1beta1.DocumentUnderstandingServiceClient} - * - `v1beta1` - This is used for selecting or pinning a - * particular backend service version. It exports: - * - `DocumentUnderstandingServiceClient` - Reference to - * {@link v1beta1.DocumentUnderstandingServiceClient} - * - * @module {object} documentai - * @alias nodejs-documentai - * - * @example Install the client library with npm: - * npm install --save documentai - * - * @example Import the client library: - * const documentai = require('documentai'); - * - * @example Create a client that uses Application Default Credentials (ADC): - * const client = new documentai.DocumentUnderstandingServiceClient(); - * - * @example Create a client with explicit credentials: - * const client = new documentai.DocumentUnderstandingServiceClient({ - * projectId: 'your-project-id', - * keyFilename: '/path/to/keyfile.json', - * }); - */ - -/** - * @type {object} - * @property {constructor} DocumentUnderstandingServiceClient - * Reference to {@link v1beta1.DocumentUnderstandingServiceClient} - */ -module.exports = gapic.v1beta1; - -/** - * @type {object} - * @property {constructor} DocumentUnderstandingServiceClient - * Reference to {@link v1beta1.DocumentUnderstandingServiceClient} - */ -module.exports.v1beta1 = gapic.v1beta1; - -// Alias `module.exports` as `module.exports.default`, for future-proofing. -module.exports.default = Object.assign({}, module.exports); diff --git a/packages/google-cloud-documentai/src/index.ts b/packages/google-cloud-documentai/src/index.ts new file mode 100644 index 00000000000..b4935a21831 --- /dev/null +++ b/packages/google-cloud-documentai/src/index.ts @@ -0,0 +1,27 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 v1beta2 from './v1beta2'; +const DocumentUnderstandingServiceClient = + v1beta2.DocumentUnderstandingServiceClient; +export {v1beta2, DocumentUnderstandingServiceClient}; +// For compatibility with JavaScript libraries we need to provide this default export: +// tslint:disable-next-line no-default-export +export default {v1beta2, DocumentUnderstandingServiceClient}; +import * as protos from '../protos/protos'; +export {protos}; diff --git a/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/document/v1beta1/doc_document_understanding.js b/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/document/v1beta1/doc_document_understanding.js deleted file mode 100644 index 77c9d92fe3f..00000000000 --- a/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/document/v1beta1/doc_document_understanding.js +++ /dev/null @@ -1,420 +0,0 @@ -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Request to batch process documents as an asynchronous operation. - * - * @property {Object[]} requests - * Individual requests for each document. - * - * This object should have the same structure as [ProcessDocumentRequest]{@link google.cloud.document.v1beta1.ProcessDocumentRequest} - * - * @property {string} parent - * Target project and location to make a call. - * - * Format: `projects/{project-id}/locations/{location-id}`. - * - * If no location is specified, a region will be chosen automatically. - * - * @typedef BatchProcessDocumentsRequest - * @memberof google.cloud.document.v1beta1 - * @see [google.cloud.document.v1beta1.BatchProcessDocumentsRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} - */ -const BatchProcessDocumentsRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request to process one document. - * - * @property {Object} inputConfig - * Required. Information about the input file. - * - * This object should have the same structure as [InputConfig]{@link google.cloud.document.v1beta1.InputConfig} - * - * @property {Object} outputConfig - * Required. The desired output location. - * - * This object should have the same structure as [OutputConfig]{@link google.cloud.document.v1beta1.OutputConfig} - * - * @property {string} documentType - * Specifies a known document type for deeper structure detection. Valid - * values are currently "general" and "invoice". If not provided, "general"\ - * is used as default. If any other value is given, the request is rejected. - * - * @property {Object} tableExtractionParams - * Controls table extraction behavior. If not specified, the system will - * decide reasonable defaults. - * - * This object should have the same structure as [TableExtractionParams]{@link google.cloud.document.v1beta1.TableExtractionParams} - * - * @property {Object} formExtractionParams - * Controls form extraction behavior. If not specified, the system will - * decide reasonable defaults. - * - * This object should have the same structure as [FormExtractionParams]{@link google.cloud.document.v1beta1.FormExtractionParams} - * - * @property {Object} entityExtractionParams - * Controls entity extraction behavior. If not specified, the system will - * decide reasonable defaults. - * - * This object should have the same structure as [EntityExtractionParams]{@link google.cloud.document.v1beta1.EntityExtractionParams} - * - * @property {Object} ocrParams - * Controls OCR behavior. If not specified, the system will decide reasonable - * defaults. - * - * This object should have the same structure as [OcrParams]{@link google.cloud.document.v1beta1.OcrParams} - * - * @typedef ProcessDocumentRequest - * @memberof google.cloud.document.v1beta1 - * @see [google.cloud.document.v1beta1.ProcessDocumentRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} - */ -const ProcessDocumentRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to an batch document processing request. This is returned in - * the LRO Operation after the operation is complete. - * - * @property {Object[]} responses - * Responses for each individual document. - * - * This object should have the same structure as [ProcessDocumentResponse]{@link google.cloud.document.v1beta1.ProcessDocumentResponse} - * - * @typedef BatchProcessDocumentsResponse - * @memberof google.cloud.document.v1beta1 - * @see [google.cloud.document.v1beta1.BatchProcessDocumentsResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} - */ -const BatchProcessDocumentsResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to a single document processing request. - * - * @property {Object} inputConfig - * Information about the input file. This is the same as the corresponding - * input config in the request. - * - * This object should have the same structure as [InputConfig]{@link google.cloud.document.v1beta1.InputConfig} - * - * @property {Object} outputConfig - * The output location of the parsed responses. The responses are written to - * this location as JSON-serialized `Document` objects. - * - * This object should have the same structure as [OutputConfig]{@link google.cloud.document.v1beta1.OutputConfig} - * - * @typedef ProcessDocumentResponse - * @memberof google.cloud.document.v1beta1 - * @see [google.cloud.document.v1beta1.ProcessDocumentResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} - */ -const ProcessDocumentResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Parameters to control Optical Character Recognition (OCR) behavior. - * - * @property {string[]} languageHints - * List of languages to use for OCR. In most cases, an empty value - * yields the best results since it enables automatic language detection. For - * languages based on the Latin alphabet, setting `language_hints` is not - * needed. In rare cases, when the language of the text in the image is known, - * setting a hint will help get better results (although it will be a - * significant hindrance if the hint is wrong). Document processing returns an - * error if one or more of the specified languages is not one of the - * supported languages. - * - * @typedef OcrParams - * @memberof google.cloud.document.v1beta1 - * @see [google.cloud.document.v1beta1.OcrParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} - */ -const OcrParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Parameters to control table extraction behavior. - * - * @property {boolean} enabled - * Whether to enable table extraction. - * - * @property {Object[]} tableBoundHints - * Optional. Table bounding box hints that can be provided to complex cases - * which our algorithm cannot locate the table(s) in. - * - * This object should have the same structure as [TableBoundHint]{@link google.cloud.document.v1beta1.TableBoundHint} - * - * @property {string[]} headerHints - * Optional. Table header hints. The extraction will bias towards producing - * these terms as table headers, which may improve accuracy. - * - * @property {string} modelVersion - * Model version of the table extraction system. Default is "builtin/stable". - * Specify "builtin/latest" for the latest model. - * - * @typedef TableExtractionParams - * @memberof google.cloud.document.v1beta1 - * @see [google.cloud.document.v1beta1.TableExtractionParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} - */ -const TableExtractionParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A hint for a table bounding box on the page for table parsing. - * - * @property {number} pageNumber - * Optional page number for multi-paged inputs this hint applies to. If not - * provided, this hint will apply to all pages by default. This value is - * 1-based. - * - * @property {Object} boundingBox - * Bounding box hint for a table on this page. The coordinates must be - * normalized to [0,1] and the bounding box must be an axis-aligned rectangle. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.document.v1beta1.BoundingPoly} - * - * @typedef TableBoundHint - * @memberof google.cloud.document.v1beta1 - * @see [google.cloud.document.v1beta1.TableBoundHint definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} - */ -const TableBoundHint = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Parameters to control form extraction behavior. - * - * @property {boolean} enabled - * Whether to enable form extraction. - * - * @property {Object[]} keyValuePairHints - * User can provide pairs of (key text, value type) to improve the parsing - * result. - * - * For example, if a document has a field called "Date" that holds a date - * value and a field called "Amount" that may hold either a currency value - * (e.g., "$500.00") or a simple number value (e.g., "20"), you could use the - * following hints: [ {"key": "Date", value_types: [ "DATE"]}, {"key": - * "Amount", "value_types": [ "PRICE", "NUMBER" ]} ] - * - * If the value type is unknown, but you want to provide hints for the keys, - * you can leave the value_types field blank. e.g. {"key": "Date", - * "value_types": []} - * - * This object should have the same structure as [KeyValuePairHint]{@link google.cloud.document.v1beta1.KeyValuePairHint} - * - * @property {string} modelVersion - * Model version of the form extraction system. Default is - * "builtin/stable". Specify "builtin/latest" for the latest model. - * - * @typedef FormExtractionParams - * @memberof google.cloud.document.v1beta1 - * @see [google.cloud.document.v1beta1.FormExtractionParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} - */ -const FormExtractionParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * User-provided hint for key value pair. - * - * @property {string} key - * The key text for the hint. - * - * @property {string[]} valueTypes - * Type of the value. This is case-insensitive, and could be one of: - * ADDRESS, LOCATION, ORGANIZATION, PERSON, PHONE_NUMBER, - * ID, NUMBER, EMAIL, PRICE, TERMS, DATE, NAME. Types not in this list will - * be ignored. - * - * @typedef KeyValuePairHint - * @memberof google.cloud.document.v1beta1 - * @see [google.cloud.document.v1beta1.KeyValuePairHint definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} - */ -const KeyValuePairHint = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Parameters to control entity extraction behavior. - * - * @property {boolean} enabled - * Whether to enable entity extraction. - * - * @property {string} modelVersion - * Model version of the entity extraction. Default is - * "builtin/stable". Specify "builtin/latest" for the latest model. - * - * @typedef EntityExtractionParams - * @memberof google.cloud.document.v1beta1 - * @see [google.cloud.document.v1beta1.EntityExtractionParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} - */ -const EntityExtractionParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The desired input location and metadata. - * - * @property {Object} gcsSource - * The Google Cloud Storage location to read the input from. This must be a - * single file. - * - * This object should have the same structure as [GcsSource]{@link google.cloud.document.v1beta1.GcsSource} - * - * @property {string} mimeType - * Mimetype of the input. Current supported mimetypes are application/pdf, - * image/tiff, and image/gif. - * - * @typedef InputConfig - * @memberof google.cloud.document.v1beta1 - * @see [google.cloud.document.v1beta1.InputConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} - */ -const InputConfig = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The desired output location and metadata. - * - * @property {Object} gcsDestination - * The Google Cloud Storage location to write the output to. - * - * This object should have the same structure as [GcsDestination]{@link google.cloud.document.v1beta1.GcsDestination} - * - * @property {number} pagesPerShard - * The max number of pages to include into each output Document shard JSON on - * Google Cloud Storage. - * - * The valid range is [1, 100]. If not specified, the default value is 20. - * - * For example, for one pdf file with 100 pages, 100 parsed pages will be - * produced. If `pages_per_shard` = 20, then 5 Document shard JSON files each - * containing 20 parsed pages will be written under the prefix - * InputConfig.gcs_destination.uri and suffix -pages-x-to-y.json where - * x and y are 1-indexed page numbers. - * - * Example GCS outputs with 157 pages and pages_per_shard = 50: - * - * -pages-001-to-050.json - * -pages-051-to-100.json - * -pages-101-to-150.json - * -pages-151-to-157.json - * - * @typedef OutputConfig - * @memberof google.cloud.document.v1beta1 - * @see [google.cloud.document.v1beta1.OutputConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} - */ -const OutputConfig = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The Google Cloud Storage location where the input file will be read from. - * - * @property {string} uri - * - * @typedef GcsSource - * @memberof google.cloud.document.v1beta1 - * @see [google.cloud.document.v1beta1.GcsSource definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} - */ -const GcsSource = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The Google Cloud Storage location where the output file will be written to. - * - * @property {string} uri - * - * @typedef GcsDestination - * @memberof google.cloud.document.v1beta1 - * @see [google.cloud.document.v1beta1.GcsDestination definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} - */ -const GcsDestination = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Contains metadata for the BatchProcessDocuments operation. - * - * @property {number} state - * The state of the current batch processing. - * - * The number should be among the values of [State]{@link google.cloud.document.v1beta1.State} - * - * @property {string} stateMessage - * A message providing more details about the current state of processing. - * - * @property {Object} createTime - * The creation time of the operation. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @property {Object} updateTime - * The last update time of the operation. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @typedef OperationMetadata - * @memberof google.cloud.document.v1beta1 - * @see [google.cloud.document.v1beta1.OperationMetadata definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/document_understanding.proto} - */ -const OperationMetadata = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * @enum {number} - * @memberof google.cloud.document.v1beta1 - */ - State: { - - /** - * The default value. This value is used if the state is omitted. - */ - STATE_UNSPECIFIED: 0, - - /** - * Request is received. - */ - ACCEPTED: 1, - - /** - * Request operation is waiting for scheduling. - */ - WAITING: 2, - - /** - * Request is being processed. - */ - RUNNING: 3, - - /** - * The batch processing completed successfully. - */ - SUCCEEDED: 4, - - /** - * The batch processing was cancelled. - */ - CANCELLED: 5 - } -}; \ No newline at end of file diff --git a/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/document/v1beta1/doc_geometry.js b/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/document/v1beta1/doc_geometry.js deleted file mode 100644 index e2c49d465f6..00000000000 --- a/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/document/v1beta1/doc_geometry.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * A vertex represents a 2D point in the image. - * NOTE: the vertex coordinates are in the same scale as the original image. - * - * @property {number} x - * X coordinate. - * - * @property {number} y - * Y coordinate. - * - * @typedef Vertex - * @memberof google.cloud.document.v1beta1 - * @see [google.cloud.document.v1beta1.Vertex definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/geometry.proto} - */ -const Vertex = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A vertex represents a 2D point in the image. - * NOTE: the normalized vertex coordinates are relative to the original image - * and range from 0 to 1. - * - * @property {number} x - * X coordinate. - * - * @property {number} y - * Y coordinate. - * - * @typedef NormalizedVertex - * @memberof google.cloud.document.v1beta1 - * @see [google.cloud.document.v1beta1.NormalizedVertex definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/geometry.proto} - */ -const NormalizedVertex = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A bounding polygon for the detected image annotation. - * - * @property {Object[]} vertices - * The bounding polygon vertices. - * - * This object should have the same structure as [Vertex]{@link google.cloud.document.v1beta1.Vertex} - * - * @property {Object[]} normalizedVertices - * The bounding polygon normalized vertices. - * - * This object should have the same structure as [NormalizedVertex]{@link google.cloud.document.v1beta1.NormalizedVertex} - * - * @typedef BoundingPoly - * @memberof google.cloud.document.v1beta1 - * @see [google.cloud.document.v1beta1.BoundingPoly definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/document/v1beta1/geometry.proto} - */ -const BoundingPoly = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/documentai/v1beta1/doc_document_understanding.js b/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/documentai/v1beta1/doc_document_understanding.js deleted file mode 100644 index d430593338a..00000000000 --- a/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/documentai/v1beta1/doc_document_understanding.js +++ /dev/null @@ -1,425 +0,0 @@ -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Request to batch process documents as an asynchronous operation. - * - * @property {Object[]} requests - * Required. Individual requests for each document. - * - * This object should have the same structure as [ProcessDocumentRequest]{@link google.cloud.documentai.v1beta1.ProcessDocumentRequest} - * - * @property {string} parent - * Target project and location to make a call. - * - * Format: `projects/{project-id}/locations/{location-id}`. - * - * If no location is specified, a region will be chosen automatically. - * - * @typedef BatchProcessDocumentsRequest - * @memberof google.cloud.documentai.v1beta1 - * @see [google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} - */ -const BatchProcessDocumentsRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request to process one document. - * - * @property {Object} inputConfig - * Required. Information about the input file. - * - * This object should have the same structure as [InputConfig]{@link google.cloud.documentai.v1beta1.InputConfig} - * - * @property {Object} outputConfig - * Required. The desired output location. - * - * This object should have the same structure as [OutputConfig]{@link google.cloud.documentai.v1beta1.OutputConfig} - * - * @property {string} documentType - * Specifies a known document type for deeper structure detection. Valid - * values are currently "general" and "invoice". If not provided, "general"\ - * is used as default. If any other value is given, the request is rejected. - * - * @property {Object} tableExtractionParams - * Controls table extraction behavior. If not specified, the system will - * decide reasonable defaults. - * - * This object should have the same structure as [TableExtractionParams]{@link google.cloud.documentai.v1beta1.TableExtractionParams} - * - * @property {Object} formExtractionParams - * Controls form extraction behavior. If not specified, the system will - * decide reasonable defaults. - * - * This object should have the same structure as [FormExtractionParams]{@link google.cloud.documentai.v1beta1.FormExtractionParams} - * - * @property {Object} entityExtractionParams - * Controls entity extraction behavior. If not specified, the system will - * decide reasonable defaults. - * - * This object should have the same structure as [EntityExtractionParams]{@link google.cloud.documentai.v1beta1.EntityExtractionParams} - * - * @property {Object} ocrParams - * Controls OCR behavior. If not specified, the system will decide reasonable - * defaults. - * - * This object should have the same structure as [OcrParams]{@link google.cloud.documentai.v1beta1.OcrParams} - * - * @typedef ProcessDocumentRequest - * @memberof google.cloud.documentai.v1beta1 - * @see [google.cloud.documentai.v1beta1.ProcessDocumentRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} - */ -const ProcessDocumentRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to an batch document processing request. This is returned in - * the LRO Operation after the operation is complete. - * - * @property {Object[]} responses - * Responses for each individual document. - * - * This object should have the same structure as [ProcessDocumentResponse]{@link google.cloud.documentai.v1beta1.ProcessDocumentResponse} - * - * @typedef BatchProcessDocumentsResponse - * @memberof google.cloud.documentai.v1beta1 - * @see [google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} - */ -const BatchProcessDocumentsResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to a single document processing request. - * - * @property {Object} inputConfig - * Information about the input file. This is the same as the corresponding - * input config in the request. - * - * This object should have the same structure as [InputConfig]{@link google.cloud.documentai.v1beta1.InputConfig} - * - * @property {Object} outputConfig - * The output location of the parsed responses. The responses are written to - * this location as JSON-serialized `Document` objects. - * - * This object should have the same structure as [OutputConfig]{@link google.cloud.documentai.v1beta1.OutputConfig} - * - * @typedef ProcessDocumentResponse - * @memberof google.cloud.documentai.v1beta1 - * @see [google.cloud.documentai.v1beta1.ProcessDocumentResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} - */ -const ProcessDocumentResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Parameters to control Optical Character Recognition (OCR) behavior. - * - * @property {string[]} languageHints - * List of languages to use for OCR. In most cases, an empty value - * yields the best results since it enables automatic language detection. For - * languages based on the Latin alphabet, setting `language_hints` is not - * needed. In rare cases, when the language of the text in the image is known, - * setting a hint will help get better results (although it will be a - * significant hindrance if the hint is wrong). Document processing returns an - * error if one or more of the specified languages is not one of the - * supported languages. - * - * @typedef OcrParams - * @memberof google.cloud.documentai.v1beta1 - * @see [google.cloud.documentai.v1beta1.OcrParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} - */ -const OcrParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Parameters to control table extraction behavior. - * - * @property {boolean} enabled - * Whether to enable table extraction. - * - * @property {Object[]} tableBoundHints - * Optional. Table bounding box hints that can be provided to complex cases - * which our algorithm cannot locate the table(s) in. - * - * This object should have the same structure as [TableBoundHint]{@link google.cloud.documentai.v1beta1.TableBoundHint} - * - * @property {string[]} headerHints - * Optional. Table header hints. The extraction will bias towards producing - * these terms as table headers, which may improve accuracy. - * - * @property {string} modelVersion - * Model version of the table extraction system. Default is "builtin/stable". - * Specify "builtin/latest" for the latest model. - * - * @typedef TableExtractionParams - * @memberof google.cloud.documentai.v1beta1 - * @see [google.cloud.documentai.v1beta1.TableExtractionParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} - */ -const TableExtractionParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A hint for a table bounding box on the page for table parsing. - * - * @property {number} pageNumber - * Optional. Page number for multi-paged inputs this hint applies to. If not - * provided, this hint will apply to all pages by default. This value is - * 1-based. - * - * @property {Object} boundingBox - * Bounding box hint for a table on this page. The coordinates must be - * normalized to [0,1] and the bounding box must be an axis-aligned rectangle. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.documentai.v1beta1.BoundingPoly} - * - * @typedef TableBoundHint - * @memberof google.cloud.documentai.v1beta1 - * @see [google.cloud.documentai.v1beta1.TableBoundHint definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} - */ -const TableBoundHint = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Parameters to control form extraction behavior. - * - * @property {boolean} enabled - * Whether to enable form extraction. - * - * @property {Object[]} keyValuePairHints - * User can provide pairs of (key text, value type) to improve the parsing - * result. - * - * For example, if a document has a field called "Date" that holds a date - * value and a field called "Amount" that may hold either a currency value - * (e.g., "$500.00") or a simple number value (e.g., "20"), you could use the - * following hints: [ {"key": "Date", value_types: [ "DATE"]}, {"key": - * "Amount", "value_types": [ "PRICE", "NUMBER" ]} ] - * - * If the value type is unknown, but you want to provide hints for the keys, - * you can leave the value_types field blank. e.g. {"key": "Date", - * "value_types": []} - * - * This object should have the same structure as [KeyValuePairHint]{@link google.cloud.documentai.v1beta1.KeyValuePairHint} - * - * @property {string} modelVersion - * Model version of the form extraction system. Default is - * "builtin/stable". Specify "builtin/latest" for the latest model. - * - * @typedef FormExtractionParams - * @memberof google.cloud.documentai.v1beta1 - * @see [google.cloud.documentai.v1beta1.FormExtractionParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} - */ -const FormExtractionParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * User-provided hint for key value pair. - * - * @property {string} key - * The key text for the hint. - * - * @property {string[]} valueTypes - * Type of the value. This is case-insensitive, and could be one of: - * ADDRESS, LOCATION, ORGANIZATION, PERSON, PHONE_NUMBER, - * ID, NUMBER, EMAIL, PRICE, TERMS, DATE, NAME. Types not in this list will - * be ignored. - * - * @typedef KeyValuePairHint - * @memberof google.cloud.documentai.v1beta1 - * @see [google.cloud.documentai.v1beta1.KeyValuePairHint definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} - */ -const KeyValuePairHint = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Parameters to control entity extraction behavior. - * - * @property {boolean} enabled - * Whether to enable entity extraction. - * - * @property {string} modelVersion - * Model version of the entity extraction. Default is - * "builtin/stable". Specify "builtin/latest" for the latest model. - * - * @typedef EntityExtractionParams - * @memberof google.cloud.documentai.v1beta1 - * @see [google.cloud.documentai.v1beta1.EntityExtractionParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} - */ -const EntityExtractionParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The desired input location and metadata. - * - * @property {Object} gcsSource - * The Google Cloud Storage location to read the input from. This must be a - * single file. - * - * This object should have the same structure as [GcsSource]{@link google.cloud.documentai.v1beta1.GcsSource} - * - * @property {string} mimeType - * Required. Mimetype of the input. Current supported mimetypes are - * application/pdf, image/tiff, and image/gif. - * - * @typedef InputConfig - * @memberof google.cloud.documentai.v1beta1 - * @see [google.cloud.documentai.v1beta1.InputConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} - */ -const InputConfig = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The desired output location and metadata. - * - * @property {Object} gcsDestination - * The Google Cloud Storage location to write the output to. - * - * This object should have the same structure as [GcsDestination]{@link google.cloud.documentai.v1beta1.GcsDestination} - * - * @property {number} pagesPerShard - * The max number of pages to include into each output Document shard JSON on - * Google Cloud Storage. - * - * The valid range is [1, 100]. If not specified, the default value is 20. - * - * For example, for one pdf file with 100 pages, 100 parsed pages will be - * produced. If `pages_per_shard` = 20, then 5 Document shard JSON files each - * containing 20 parsed pages will be written under the prefix - * OutputConfig.gcs_destination.uri and suffix pages-x-to-y.json where - * x and y are 1-indexed page numbers. - * - * Example GCS outputs with 157 pages and pages_per_shard = 50: - * - * pages-001-to-050.json - * pages-051-to-100.json - * pages-101-to-150.json - * pages-151-to-157.json - * - * @typedef OutputConfig - * @memberof google.cloud.documentai.v1beta1 - * @see [google.cloud.documentai.v1beta1.OutputConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} - */ -const OutputConfig = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The Google Cloud Storage location where the input file will be read from. - * - * @property {string} uri - * - * @typedef GcsSource - * @memberof google.cloud.documentai.v1beta1 - * @see [google.cloud.documentai.v1beta1.GcsSource definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} - */ -const GcsSource = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The Google Cloud Storage location where the output file will be written to. - * - * @property {string} uri - * - * @typedef GcsDestination - * @memberof google.cloud.documentai.v1beta1 - * @see [google.cloud.documentai.v1beta1.GcsDestination definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} - */ -const GcsDestination = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Contains metadata for the BatchProcessDocuments operation. - * - * @property {number} state - * The state of the current batch processing. - * - * The number should be among the values of [State]{@link google.cloud.documentai.v1beta1.State} - * - * @property {string} stateMessage - * A message providing more details about the current state of processing. - * - * @property {Object} createTime - * The creation time of the operation. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @property {Object} updateTime - * The last update time of the operation. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @typedef OperationMetadata - * @memberof google.cloud.documentai.v1beta1 - * @see [google.cloud.documentai.v1beta1.OperationMetadata definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/document_understanding.proto} - */ -const OperationMetadata = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * @enum {number} - * @memberof google.cloud.documentai.v1beta1 - */ - State: { - - /** - * The default value. This value is used if the state is omitted. - */ - STATE_UNSPECIFIED: 0, - - /** - * Request is received. - */ - ACCEPTED: 1, - - /** - * Request operation is waiting for scheduling. - */ - WAITING: 2, - - /** - * Request is being processed. - */ - RUNNING: 3, - - /** - * The batch processing completed successfully. - */ - SUCCEEDED: 4, - - /** - * The batch processing was cancelled. - */ - CANCELLED: 5, - - /** - * The batch processing has failed. - */ - FAILED: 6 - } -}; \ No newline at end of file diff --git a/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/documentai/v1beta1/doc_geometry.js b/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/documentai/v1beta1/doc_geometry.js deleted file mode 100644 index df07f269c86..00000000000 --- a/packages/google-cloud-documentai/src/v1beta1/doc/google/cloud/documentai/v1beta1/doc_geometry.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * A vertex represents a 2D point in the image. - * NOTE: the vertex coordinates are in the same scale as the original image. - * - * @property {number} x - * X coordinate. - * - * @property {number} y - * Y coordinate. - * - * @typedef Vertex - * @memberof google.cloud.documentai.v1beta1 - * @see [google.cloud.documentai.v1beta1.Vertex definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/geometry.proto} - */ -const Vertex = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A vertex represents a 2D point in the image. - * NOTE: the normalized vertex coordinates are relative to the original image - * and range from 0 to 1. - * - * @property {number} x - * X coordinate. - * - * @property {number} y - * Y coordinate. - * - * @typedef NormalizedVertex - * @memberof google.cloud.documentai.v1beta1 - * @see [google.cloud.documentai.v1beta1.NormalizedVertex definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/geometry.proto} - */ -const NormalizedVertex = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A bounding polygon for the detected image annotation. - * - * @property {Object[]} vertices - * The bounding polygon vertices. - * - * This object should have the same structure as [Vertex]{@link google.cloud.documentai.v1beta1.Vertex} - * - * @property {Object[]} normalizedVertices - * The bounding polygon normalized vertices. - * - * This object should have the same structure as [NormalizedVertex]{@link google.cloud.documentai.v1beta1.NormalizedVertex} - * - * @typedef BoundingPoly - * @memberof google.cloud.documentai.v1beta1 - * @see [google.cloud.documentai.v1beta1.BoundingPoly definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/documentai/v1beta1/geometry.proto} - */ -const BoundingPoly = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-documentai/src/v1beta1/doc/google/longrunning/doc_operations.js b/packages/google-cloud-documentai/src/v1beta1/doc/google/longrunning/doc_operations.js deleted file mode 100644 index 4719aebdc91..00000000000 --- a/packages/google-cloud-documentai/src/v1beta1/doc/google/longrunning/doc_operations.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * This resource represents a long-running operation that is the result of a - * network API call. - * - * @property {string} name - * The server-assigned name, which is only unique within the same service that - * originally returns it. If you use the default HTTP mapping, the - * `name` should have the format of `operations/some/unique/name`. - * - * @property {Object} metadata - * Service-specific metadata associated with the operation. It typically - * contains progress information and common metadata such as create time. - * Some services might not provide such metadata. Any method that returns a - * long-running operation should document the metadata type, if any. - * - * This object should have the same structure as [Any]{@link google.protobuf.Any} - * - * @property {boolean} done - * If the value is `false`, it means the operation is still in progress. - * If `true`, the operation is completed, and either `error` or `response` is - * available. - * - * @property {Object} error - * The error result of the operation in case of failure or cancellation. - * - * This object should have the same structure as [Status]{@link google.rpc.Status} - * - * @property {Object} response - * The normal response of the operation in case of success. If the original - * method returns no data on success, such as `Delete`, the response is - * `google.protobuf.Empty`. If the original method is standard - * `Get`/`Create`/`Update`, the response should be the resource. For other - * methods, the response should have the type `XxxResponse`, where `Xxx` - * is the original method name. For example, if the original method name - * is `TakeSnapshot()`, the inferred response type is - * `TakeSnapshotResponse`. - * - * This object should have the same structure as [Any]{@link google.protobuf.Any} - * - * @typedef Operation - * @memberof google.longrunning - * @see [google.longrunning.Operation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/longrunning/operations.proto} - */ -const Operation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-documentai/src/v1beta1/doc/google/protobuf/doc_any.js b/packages/google-cloud-documentai/src/v1beta1/doc/google/protobuf/doc_any.js deleted file mode 100644 index cdd2fc80e49..00000000000 --- a/packages/google-cloud-documentai/src/v1beta1/doc/google/protobuf/doc_any.js +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * `Any` contains an arbitrary serialized protocol buffer message along with a - * URL that describes the type of the serialized message. - * - * Protobuf library provides support to pack/unpack Any values in the form - * of utility functions or additional generated methods of the Any type. - * - * Example 1: Pack and unpack a message in C++. - * - * Foo foo = ...; - * Any any; - * any.PackFrom(foo); - * ... - * if (any.UnpackTo(&foo)) { - * ... - * } - * - * Example 2: Pack and unpack a message in Java. - * - * Foo foo = ...; - * Any any = Any.pack(foo); - * ... - * if (any.is(Foo.class)) { - * foo = any.unpack(Foo.class); - * } - * - * Example 3: Pack and unpack a message in Python. - * - * foo = Foo(...) - * any = Any() - * any.Pack(foo) - * ... - * if any.Is(Foo.DESCRIPTOR): - * any.Unpack(foo) - * ... - * - * Example 4: Pack and unpack a message in Go - * - * foo := &pb.Foo{...} - * any, err := ptypes.MarshalAny(foo) - * ... - * foo := &pb.Foo{} - * if err := ptypes.UnmarshalAny(any, foo); err != nil { - * ... - * } - * - * The pack methods provided by protobuf library will by default use - * 'type.googleapis.com/full.type.name' as the type URL and the unpack - * methods only use the fully qualified type name after the last '/' - * in the type URL, for example "foo.bar.com/x/y.z" will yield type - * name "y.z". - * - * - * # JSON - * - * The JSON representation of an `Any` value uses the regular - * representation of the deserialized, embedded message, with an - * additional field `@type` which contains the type URL. Example: - * - * package google.profile; - * message Person { - * string first_name = 1; - * string last_name = 2; - * } - * - * { - * "@type": "type.googleapis.com/google.profile.Person", - * "firstName": , - * "lastName": - * } - * - * If the embedded message type is well-known and has a custom JSON - * representation, that representation will be embedded adding a field - * `value` which holds the custom JSON in addition to the `@type` - * field. Example (for message google.protobuf.Duration): - * - * { - * "@type": "type.googleapis.com/google.protobuf.Duration", - * "value": "1.212s" - * } - * - * @property {string} typeUrl - * A URL/resource name that uniquely identifies the type of the serialized - * protocol buffer message. This string must contain at least - * one "/" character. The last segment of the URL's path must represent - * the fully qualified name of the type (as in - * `path/google.protobuf.Duration`). The name should be in a canonical form - * (e.g., leading "." is not accepted). - * - * In practice, teams usually precompile into the binary all types that they - * expect it to use in the context of Any. However, for URLs which use the - * scheme `http`, `https`, or no scheme, one can optionally set up a type - * server that maps type URLs to message definitions as follows: - * - * * If no scheme is provided, `https` is assumed. - * * An HTTP GET on the URL must yield a google.protobuf.Type - * value in binary format, or produce an error. - * * Applications are allowed to cache lookup results based on the - * URL, or have them precompiled into a binary to avoid any - * lookup. Therefore, binary compatibility needs to be preserved - * on changes to types. (Use versioned type names to manage - * breaking changes.) - * - * Note: this functionality is not currently available in the official - * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. - * - * Schemes other than `http`, `https` (or the empty scheme) might be - * used with implementation specific semantics. - * - * @property {Buffer} value - * Must be a valid serialized protocol buffer of the above specified type. - * - * @typedef Any - * @memberof google.protobuf - * @see [google.protobuf.Any definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/any.proto} - */ -const Any = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-documentai/src/v1beta1/doc/google/rpc/doc_status.js b/packages/google-cloud-documentai/src/v1beta1/doc/google/rpc/doc_status.js deleted file mode 100644 index 432ab6bb928..00000000000 --- a/packages/google-cloud-documentai/src/v1beta1/doc/google/rpc/doc_status.js +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * The `Status` type defines a logical error model that is suitable for - * different programming environments, including REST APIs and RPC APIs. It is - * used by [gRPC](https://github.com/grpc). The error model is designed to be: - * - * - Simple to use and understand for most users - * - Flexible enough to meet unexpected needs - * - * # Overview - * - * The `Status` message contains three pieces of data: error code, error - * message, and error details. The error code should be an enum value of - * google.rpc.Code, but it may accept additional error codes - * if needed. The error message should be a developer-facing English message - * that helps developers *understand* and *resolve* the error. If a localized - * user-facing error message is needed, put the localized message in the error - * details or localize it in the client. The optional error details may contain - * arbitrary information about the error. There is a predefined set of error - * detail types in the package `google.rpc` that can be used for common error - * conditions. - * - * # Language mapping - * - * The `Status` message is the logical representation of the error model, but it - * is not necessarily the actual wire format. When the `Status` message is - * exposed in different client libraries and different wire protocols, it can be - * mapped differently. For example, it will likely be mapped to some exceptions - * in Java, but more likely mapped to some error codes in C. - * - * # Other uses - * - * The error model and the `Status` message can be used in a variety of - * environments, either with or without APIs, to provide a - * consistent developer experience across different environments. - * - * Example uses of this error model include: - * - * - Partial errors. If a service needs to return partial errors to the client, - * it may embed the `Status` in the normal response to indicate the partial - * errors. - * - * - Workflow errors. A typical workflow has multiple steps. Each step may - * have a `Status` message for error reporting. - * - * - Batch operations. If a client uses batch request and batch response, the - * `Status` message should be used directly inside batch response, one for - * each error sub-response. - * - * - Asynchronous operations. If an API call embeds asynchronous operation - * results in its response, the status of those operations should be - * represented directly using the `Status` message. - * - * - Logging. If some API errors are stored in logs, the message `Status` could - * be used directly after any stripping needed for security/privacy reasons. - * - * @property {number} code - * The status code, which should be an enum value of - * google.rpc.Code. - * - * @property {string} message - * A developer-facing error message, which should be in English. Any - * user-facing error message should be localized and sent in the - * google.rpc.Status.details field, or localized - * by the client. - * - * @property {Object[]} details - * A list of messages that carry the error details. There is a common set of - * message types for APIs to use. - * - * This object should have the same structure as [Any]{@link google.protobuf.Any} - * - * @typedef Status - * @memberof google.rpc - * @see [google.rpc.Status definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto} - */ -const Status = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.js b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.js deleted file mode 100644 index f20983e54a7..00000000000 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.js +++ /dev/null @@ -1,353 +0,0 @@ -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT 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'; - -const gapicConfig = require('./document_understanding_service_client_config.json'); -const gax = require('google-gax'); -const path = require('path'); - -const VERSION = require('../../package.json').version; - -/** - * Service to parse structured information from unstructured or semi-structured - * documents using state-of-the-art Google AI such as natural language, - * computer vision, and translation. - * - * @class - * @memberof v1beta1 - */ -class DocumentUnderstandingServiceClient { - /** - * Construct an instance of DocumentUnderstandingServiceClient. - * - * @param {object} [options] - The configuration object. See the subsequent - * parameters for more details. - * @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 {function} [options.promise] - Custom promise module to use instead - * of native Promises. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - */ - constructor(opts) { - opts = opts || {}; - this._descriptors = {}; - - if (global.isBrowser) { - // If we're in browser, we use gRPC fallback. - opts.fallback = true; - } - - // If we are in browser, we are already using fallback because of the - // "browser" field in package.json. - // But if we were explicitly requested to use fallback, let's do it now. - const gaxModule = !global.isBrowser && opts.fallback ? gax.fallback : gax; - - const servicePath = - opts.servicePath || opts.apiEndpoint || this.constructor.servicePath; - - // Ensure that options include the service address and port. - opts = Object.assign( - { - clientConfig: {}, - port: this.constructor.port, - servicePath, - }, - opts - ); - - // Create a `gaxGrpc` object, with any grpc-specific options - // sent to the client. - opts.scopes = this.constructor.scopes; - const gaxGrpc = new gaxModule.GrpcClient(opts); - - // Save the auth object to the client, for use by other methods. - this.auth = gaxGrpc.auth; - - // Determine the client header string. - const clientHeader = []; - - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } - clientHeader.push(`gax/${gaxModule.version}`); - if (opts.fallback) { - clientHeader.push(`gl-web/${gaxModule.version}`); - } else { - clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); - } - clientHeader.push(`gapic/${VERSION}`); - 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' - ); - const protos = gaxGrpc.loadProto( - opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath - ); - - const protoFilesRoot = opts.fallback - ? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json')) - : gaxModule.protobuf.loadSync(nodejsProtoPath); - - // 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 = new gaxModule.lro({ - auth: gaxGrpc.auth, - grpc: gaxGrpc.grpc, - }).operationsClient(opts); - - const batchProcessDocumentsResponse = protoFilesRoot.lookup( - 'google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse' - ); - const batchProcessDocumentsMetadata = protoFilesRoot.lookup( - 'google.cloud.documentai.v1beta1.OperationMetadata' - ); - - this._descriptors.longrunning = { - batchProcessDocuments: new gaxModule.LongrunningDescriptor( - this.operationsClient, - batchProcessDocumentsResponse.decode.bind( - batchProcessDocumentsResponse - ), - batchProcessDocumentsMetadata.decode.bind(batchProcessDocumentsMetadata) - ), - }; - - // Put together the default options sent with requests. - const defaults = gaxGrpc.constructSettings( - 'google.cloud.documentai.v1beta1.DocumentUnderstandingService', - gapicConfig, - 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 = {}; - - // Put together the "service stub" for - // google.cloud.documentai.v1beta1.DocumentUnderstandingService. - const documentUnderstandingServiceStub = gaxGrpc.createStub( - opts.fallback - ? protos.lookupService( - 'google.cloud.documentai.v1beta1.DocumentUnderstandingService' - ) - : protos.google.cloud.documentai.v1beta1.DocumentUnderstandingService, - opts - ); - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const documentUnderstandingServiceStubMethods = ['batchProcessDocuments']; - for (const methodName of documentUnderstandingServiceStubMethods) { - const innerCallPromise = documentUnderstandingServiceStub.then( - stub => (...args) => { - return stub[methodName].apply(stub, args); - }, - err => () => { - throw err; - } - ); - this._innerApiCalls[methodName] = gaxModule.createApiCall( - innerCallPromise, - defaults[methodName], - this._descriptors.longrunning[methodName] - ); - } - } - - /** - * The DNS address for this API service. - */ - static get servicePath() { - return 'documentai.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - */ - static get apiEndpoint() { - return 'documentai.googleapis.com'; - } - - /** - * The port for this API service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - */ - static get scopes() { - return ['https://www.googleapis.com/auth/cloud-platform']; - } - - /** - * Return the project ID used by this class. - * @param {function(Error, string)} callback - the callback to - * be called with the current project Id. - */ - getProjectId(callback) { - return this.auth.getProjectId(callback); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * LRO endpoint to batch process many documents. - * - * @param {Object} request - * The request object that will be sent. - * @param {Object[]} request.requests - * Required. Individual requests for each document. - * - * This object should have the same structure as [ProcessDocumentRequest]{@link google.cloud.documentai.v1beta1.ProcessDocumentRequest} - * @param {string} [request.parent] - * Target project and location to make a call. - * - * Format: `projects/{project-id}/locations/{location-id}`. - * - * If no location is specified, a region will be chosen automatically. - * @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/interfaces/CallOptions.html} 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 a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const documentai = require('documentai.v1beta1'); - * - * const client = new documentai.v1beta1.DocumentUnderstandingServiceClient({ - * // optional auth parameters. - * }); - * - * const requests = []; - * - * // Handle the operation using the promise pattern. - * client.batchProcessDocuments({requests: requests}) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Operation#promise starts polling for the completion of the LRO. - * return operation.promise(); - * }) - * .then(responses => { - * const result = responses[0]; - * const metadata = responses[1]; - * const finalApiResponse = responses[2]; - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const requests = []; - * - * // Handle the operation using the event emitter pattern. - * client.batchProcessDocuments({requests: requests}) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Adding a listener for the "complete" event starts polling for the - * // completion of the operation. - * operation.on('complete', (result, metadata, finalApiResponse) => { - * // doSomethingWith(result); - * }); - * - * // Adding a listener for the "progress" event causes the callback to be - * // called on any change in metadata when the operation is polled. - * operation.on('progress', (metadata, apiResponse) => { - * // doSomethingWith(metadata) - * }); - * - * // Adding a listener for the "error" event handles any errors found during polling. - * operation.on('error', err => { - * // throw(err); - * }); - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const requests = []; - * - * // Handle the operation using the await pattern. - * const [operation] = await client.batchProcessDocuments({requests: requests}); - * - * const [response] = await operation.promise(); - */ - batchProcessDocuments(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - 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, - }); - - return this._innerApiCalls.batchProcessDocuments( - request, - options, - callback - ); - } -} - -module.exports = DocumentUnderstandingServiceClient; diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_proto_list.json b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_proto_list.json deleted file mode 100644 index 248bdec2d31..00000000000 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/documentai/v1beta1/document_understanding.proto" -] diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts new file mode 100644 index 00000000000..12d292ce779 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -0,0 +1,540 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 gax from 'google-gax'; +import { + APICallback, + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, +} from 'google-gax'; +import * as path from 'path'; + +import * as protosTypes from '../../protos/protos'; +import * as gapicConfig from './document_understanding_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service to parse structured information from unstructured or semi-structured + * documents using state-of-the-art Google AI such as natural language, + * computer vision, and translation. + * @class + * @memberof v1beta2 + */ +export class DocumentUnderstandingServiceClient { + private _descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}}; + private _innerApiCalls: {[name: string]: Function}; + 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; + operationsClient: gax.OperationsClient; + documentUnderstandingServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DocumentUnderstandingServiceClient. + * + * @param {object} [options] - The configuration object. See the subsequent + * parameters for more details. + * @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. + */ + + constructor(opts?: ClientOptions) { + // Ensure that options include the service address and port. + const staticMembers = this + .constructor as typeof DocumentUnderstandingServiceClient; + const servicePath = + opts && opts.servicePath + ? opts.servicePath + : opts && opts.apiEndpoint + ? opts.apiEndpoint + : staticMembers.servicePath; + const port = opts && opts.port ? opts.port : staticMembers.port; + + if (!opts) { + opts = {servicePath, port}; + } + opts.servicePath = opts.servicePath || servicePath; + opts.port = opts.port || port; + opts.clientConfig = opts.clientConfig || {}; + + const isBrowser = typeof window !== 'undefined'; + if (isBrowser) { + opts.fallback = true; + } + // If we are in browser, we are already using fallback because of the + // "browser" field in package.json. + // But if we were explicitly requested to use fallback, let's do it now. + this._gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options + // sent to the client. + opts.scopes = (this + .constructor as typeof DocumentUnderstandingServiceClient).scopes; + 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; + + // 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 ? require('../../protos/protos.json') : nodejsProtoPath + ); + + // 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( + 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 batchProcessDocumentsResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse' + ) as gax.protobuf.Type; + const batchProcessDocumentsMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta2.OperationMetadata' + ) as gax.protobuf.Type; + + this._descriptors.longrunning = { + batchProcessDocuments: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchProcessDocumentsResponse.decode.bind( + batchProcessDocumentsResponse + ), + batchProcessDocumentsMetadata.decode.bind(batchProcessDocumentsMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.documentai.v1beta2.DocumentUnderstandingService', + 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.documentUnderstandingServiceStub) { + return this.documentUnderstandingServiceStub; + } + + // Put together the "service stub" for + // google.cloud.documentai.v1beta2.DocumentUnderstandingService. + this.documentUnderstandingServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.documentai.v1beta2.DocumentUnderstandingService' + ) + : // tslint:disable-next-line no-any + (this._protos as any).google.cloud.documentai.v1beta2 + .DocumentUnderstandingService, + 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 documentUnderstandingServiceStubMethods = [ + 'batchProcessDocuments', + 'processDocument', + ]; + + for (const methodName of documentUnderstandingServiceStubMethods) { + const innerCallPromise = this.documentUnderstandingServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + return stub[methodName].apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const apiCall = this._gaxModule.createApiCall( + innerCallPromise, + this._defaults[methodName], + this._descriptors.page[methodName] || + this._descriptors.stream[methodName] || + this._descriptors.longrunning[methodName] + ); + + this._innerApiCalls[methodName] = ( + argument: {}, + callOptions?: CallOptions, + callback?: APICallback + ) => { + return apiCall(argument, callOptions, callback); + }; + } + + return this.documentUnderstandingServiceStub; + } + + /** + * The DNS address for this API service. + */ + static get servicePath() { + return 'us-documentai.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'us-documentai.googleapis.com'; + } + + /** + * The port for this API service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + */ + 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. + * @param {function(Error, string)} callback - the callback to + * be called with the current project Id. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + processDocument( + request: protosTypes.google.cloud.documentai.v1beta2.IProcessDocumentRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.documentai.v1beta2.IDocument, + ( + | protosTypes.google.cloud.documentai.v1beta2.IProcessDocumentRequest + | undefined + ), + {} | undefined + ] + >; + processDocument( + request: protosTypes.google.cloud.documentai.v1beta2.IProcessDocumentRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.documentai.v1beta2.IDocument, + | protosTypes.google.cloud.documentai.v1beta2.IProcessDocumentRequest + | undefined, + {} | undefined + > + ): void; + /** + * Processes a single document. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no location is specified, a region will be chosen automatically. + * This field is only populated when used in ProcessDocument method. + * @param {google.cloud.documentai.v1beta2.InputConfig} request.inputConfig + * Required. Information about the input file. + * @param {google.cloud.documentai.v1beta2.OutputConfig} [request.outputConfig] + * Optional. The desired output location. This field is only needed in + * BatchProcessDocumentsRequest. + * @param {string} request.documentType + * Specifies a known document type for deeper structure detection. Valid + * values are currently "general" and "invoice". If not provided, "general"\ + * is used as default. If any other value is given, the request is rejected. + * @param {google.cloud.documentai.v1beta2.TableExtractionParams} request.tableExtractionParams + * Controls table extraction behavior. If not specified, the system will + * decide reasonable defaults. + * @param {google.cloud.documentai.v1beta2.FormExtractionParams} request.formExtractionParams + * Controls form extraction behavior. If not specified, the system will + * decide reasonable defaults. + * @param {google.cloud.documentai.v1beta2.EntityExtractionParams} request.entityExtractionParams + * Controls entity extraction behavior. If not specified, the system will + * decide reasonable defaults. + * @param {google.cloud.documentai.v1beta2.OcrParams} request.ocrParams + * Controls OCR behavior. If not specified, the system will decide reasonable + * defaults. + * @param {google.cloud.documentai.v1beta2.AutoMlParams} request.automlParams + * Controls AutoML model prediction behavior. AutoMlParams cannot be used + * together with other Params. + * @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 [Document]{@link google.cloud.documentai.v1beta2.Document}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + processDocument( + request: protosTypes.google.cloud.documentai.v1beta2.IProcessDocumentRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.documentai.v1beta2.IDocument, + | protosTypes.google.cloud.documentai.v1beta2.IProcessDocumentRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.documentai.v1beta2.IDocument, + | protosTypes.google.cloud.documentai.v1beta2.IProcessDocumentRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.documentai.v1beta2.IDocument, + ( + | protosTypes.google.cloud.documentai.v1beta2.IProcessDocumentRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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.processDocument(request, options, callback); + } + + batchProcessDocuments( + request: protosTypes.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, + options?: gax.CallOptions + ): Promise< + [ + LROperation< + protosTypes.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, + protosTypes.google.cloud.documentai.v1beta2.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchProcessDocuments( + request: protosTypes.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, + options: gax.CallOptions, + callback: Callback< + LROperation< + protosTypes.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, + protosTypes.google.cloud.documentai.v1beta2.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): void; + /** + * LRO endpoint to batch process many documents. The output is written + * to Cloud Storage as JSON in the [Document] format. + * + * @param {Object} request + * The request object that will be sent. + * @param {number[]} request.requests + * Required. Individual requests for each document. + * @param {string} request.parent + * Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no location is specified, a region will be chosen automatically. + * @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 [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + batchProcessDocuments( + request: protosTypes.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + LROperation< + protosTypes.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, + protosTypes.google.cloud.documentai.v1beta2.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + >, + callback?: Callback< + LROperation< + protosTypes.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, + protosTypes.google.cloud.documentai.v1beta2.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): Promise< + [ + LROperation< + protosTypes.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, + protosTypes.google.cloud.documentai.v1beta2.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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.batchProcessDocuments( + request, + options, + callback + ); + } + + /** + * Terminate the GRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.documentUnderstandingServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client_config.json b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client_config.json similarity index 54% rename from packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client_config.json rename to packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client_config.json index 49040593fe2..c6a58bac521 100644 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client_config.json +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client_config.json @@ -1,28 +1,31 @@ { "interfaces": { - "google.cloud.documentai.v1beta1.DocumentUnderstandingService": { + "google.cloud.documentai.v1beta2.DocumentUnderstandingService": { "retry_codes": { + "non_idempotent": [], "idempotent": [ "DEADLINE_EXCEEDED", "UNAVAILABLE" - ], - "non_idempotent": [] + ] }, "retry_params": { "default": { "initial_retry_delay_millis": 100, "retry_delay_multiplier": 1.3, "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 20000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 20000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 } }, "methods": { "BatchProcessDocuments": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ProcessDocument": { + "retry_codes_name": "non_idempotent", "retry_params_name": "default" } } diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_proto_list.json b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_proto_list.json new file mode 100644 index 00000000000..ee1f3779a2c --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_proto_list.json @@ -0,0 +1,5 @@ +[ + "../../protos/google/cloud/documentai/v1beta2/document.proto", + "../../protos/google/cloud/documentai/v1beta2/document_understanding.proto", + "../../protos/google/cloud/documentai/v1beta2/geometry.proto" +] diff --git a/packages/google-cloud-documentai/src/browser.js b/packages/google-cloud-documentai/src/v1beta2/index.ts similarity index 66% rename from packages/google-cloud-documentai/src/browser.js rename to packages/google-cloud-documentai/src/v1beta2/index.ts index ddbcd7ecb9a..507b5f8f347 100644 --- a/packages/google-cloud-documentai/src/browser.js +++ b/packages/google-cloud-documentai/src/v1beta2/index.ts @@ -11,11 +11,9 @@ // WITHOUT 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'; - -// Set a flag that we are running in a browser bundle. -global.isBrowser = true; - -// Re-export all exports from ./index.js. -module.exports = require('./index'); +export {DocumentUnderstandingServiceClient} from './document_understanding_service_client'; diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index ddb41d473ba..8d260eda9b2 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -1,26 +1,13 @@ { - "updateTime": "2019-11-06T17:52:39.407684Z", + "updateTime": "2020-03-18T21:20:42.050992Z", "sources": [ - { - "generator": { - "name": "artman", - "version": "0.41.0", - "dockerImage": "googleapis/artman@sha256:75b38a3b073a7b243545f2332463096624c802bb1e56b8cb6f22ba1ecd325fa9" - } - }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "5691fcb7c1a926b52577aa1834f31d9c50efda54", - "internalRef": "278731899" - } - }, - { - "template": { - "name": "node_library", - "origin": "synthtool.gcp", - "version": "2019.10.17" + "sha": "275fbcce2c900278d487c33293a3c7e1fbcd3a34", + "internalRef": "301661567", + "log": "275fbcce2c900278d487c33293a3c7e1fbcd3a34\nfeat: pubsub/v1 add an experimental filter field to Subscription\n\nPiperOrigin-RevId: 301661567\n\nf2b18cec51d27c999ad30011dba17f3965677e9c\nFix: UpdateBackupRequest.backup is a resource, not a resource reference - remove annotation.\n\nPiperOrigin-RevId: 301636171\n\n800384063ac93a0cac3a510d41726fa4b2cd4a83\nCloud Billing Budget API v1beta1\nModified api documentation to include warnings about the new filter field.\n\nPiperOrigin-RevId: 301634389\n\n0cc6c146b660db21f04056c3d58a4b752ee445e3\nCloud Billing Budget API v1alpha1\nModified api documentation to include warnings about the new filter field.\n\nPiperOrigin-RevId: 301630018\n\nff2ea00f69065585c3ac0993c8b582af3b6fc215\nFix: Add resource definition for a parent of InspectTemplate which was otherwise missing.\n\nPiperOrigin-RevId: 301623052\n\n55fa441c9daf03173910760191646399338f2b7c\nAdd proto definition for AccessLevel, AccessPolicy, and ServicePerimeter.\n\nPiperOrigin-RevId: 301620844\n\ne7b10591c5408a67cf14ffafa267556f3290e262\nCloud Bigtable Managed Backup service and message proto files.\n\nPiperOrigin-RevId: 301585144\n\nd8e226f702f8ddf92915128c9f4693b63fb8685d\nfeat: Add time-to-live in a queue for builds\n\nPiperOrigin-RevId: 301579876\n\n430375af011f8c7a5174884f0d0e539c6ffa7675\ndocs: add missing closing backtick\n\nPiperOrigin-RevId: 301538851\n\n0e9f1f60ded9ad1c2e725e37719112f5b487ab65\nbazel: Use latest release of gax_java\n\nPiperOrigin-RevId: 301480457\n\n5058c1c96d0ece7f5301a154cf5a07b2ad03a571\nUpdate GAPIC v2 with batching parameters for Logging API\n\nPiperOrigin-RevId: 301443847\n\n" } } ], @@ -29,10 +16,9 @@ "client": { "source": "googleapis", "apiName": "documentai", - "apiVersion": "v1beta1", - "language": "nodejs", - "generator": "gapic", - "config": "google/cloud/documentai/artman_documentai_v1beta1.yaml" + "apiVersion": "v1beta2", + "language": "typescript", + "generator": "gapic-generator-typescript" } } ] diff --git a/packages/google-cloud-documentai/synth.py b/packages/google-cloud-documentai/synth.py index 7bdfb4fe258..e52139887fb 100644 --- a/packages/google-cloud-documentai/synth.py +++ b/packages/google-cloud-documentai/synth.py @@ -1,4 +1,4 @@ -# Copyright 2019 Google LLC +# 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. @@ -21,19 +21,26 @@ logging.basicConfig(level=logging.DEBUG) # run the gapic generator -gapic = gcp.GAPICGenerator() -versions = ['v1beta1'] +gapic = gcp.GAPICMicrogenerator() +versions = ['v1beta2'] +name = 'documentai' for version in versions: - library = gapic.node_library( - 'documentai', - version) + library = gapic.typescript_library( + name, + generator_args={ + "package-name": "@google-cloud/documentai" + }, + extra_proto_files=['google/cloud/common_resources.proto'], + proto_path=f'/google/cloud/{name}/{version}', + version=version) s.copy(library, excludes=['README.md', 'package.json']) # Copy common templates common_templates = gcp.CommonTemplates() -templates = common_templates.node_library() +templates = common_templates.node_library(source_location='build/src') s.copy(templates, excludes=[]) # Node.js specific cleanup subprocess.run(['npm', 'install']) subprocess.run(['npm', 'run', 'fix']) +subprocess.run(['npx', 'compileProtos', 'src']) diff --git a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..2b32d5b2a84 --- /dev/null +++ b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 documentai = require('@google-cloud/documentai'); + +function main() { + const documentUnderstandingServiceClient = new documentai.DocumentUnderstandingServiceClient(); +} + +main(); diff --git a/packages/google-cloud-documentai/src/v1beta1/index.js b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts similarity index 60% rename from packages/google-cloud-documentai/src/v1beta1/index.js rename to packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts index faf0aeae1ae..0e2b753d952 100644 --- a/packages/google-cloud-documentai/src/v1beta1/index.js +++ b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts @@ -11,9 +11,15 @@ // WITHOUT 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'; +import {DocumentUnderstandingServiceClient} from '@google-cloud/documentai'; -const DocumentUnderstandingServiceClient = require('./document_understanding_service_client'); +function main() { + const documentUnderstandingServiceClient = new DocumentUnderstandingServiceClient(); +} -module.exports.DocumentUnderstandingServiceClient = DocumentUnderstandingServiceClient; +main(); diff --git a/packages/google-cloud-documentai/system-test/install.ts b/packages/google-cloud-documentai/system-test/install.ts new file mode 100644 index 00000000000..c9aa74ec221 --- /dev/null +++ b/packages/google-cloud-documentai/system-test/install.ts @@ -0,0 +1,51 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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('typescript consumer tests', () => { + it('should have correct type signature for typescript users', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), // path to your module. + sample: { + description: 'typescript based user can use the type definitions', + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts' + ).toString(), + }, + }; + await packNTest(options); // will throw upon error. + }); + + it('should have correct type signature for javascript users', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), // path to your module. + sample: { + description: 'typescript based user can use the type definitions', + ts: readFileSync( + './system-test/fixtures/sample/src/index.js' + ).toString(), + }, + }; + await packNTest(options); // will throw upon error. + }); +}); diff --git a/packages/google-cloud-documentai/test/.eslintrc.yml b/packages/google-cloud-documentai/test/.eslintrc.yml deleted file mode 100644 index 8568e39cdbe..00000000000 --- a/packages/google-cloud-documentai/test/.eslintrc.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -env: - mocha: true -rules: - no-unused-vars: off \ No newline at end of file diff --git a/packages/google-cloud-documentai/test/gapic-document_understanding_service-v1beta2.ts b/packages/google-cloud-documentai/test/gapic-document_understanding_service-v1beta2.ts new file mode 100644 index 00000000000..3327181d61f --- /dev/null +++ b/packages/google-cloud-documentai/test/gapic-document_understanding_service-v1beta2.ts @@ -0,0 +1,260 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 protosTypes from '../protos/protos'; +import * as assert from 'assert'; +import {describe, it} from 'mocha'; +const documentunderstandingserviceModule = require('../src'); + +const FAKE_STATUS_CODE = 1; +class FakeError { + name: string; + message: string; + code: number; + constructor(n: number) { + this.name = 'fakeName'; + this.message = 'fake message'; + this.code = n; + } +} +const error = new FakeError(FAKE_STATUS_CODE); +export interface Callback { + (err: FakeError | null, response?: {} | null): void; +} + +export class Operation { + constructor() {} + promise() {} +} +function mockSimpleGrpcMethod( + expectedRequest: {}, + response: {} | null, + error: FakeError | null +) { + return (actualRequest: {}, options: {}, callback: Callback) => { + assert.deepStrictEqual(actualRequest, expectedRequest); + if (error) { + callback(error); + } else if (response) { + callback(null, response); + } else { + callback(null); + } + }; +} +function mockLongRunningGrpcMethod( + expectedRequest: {}, + response: {} | null, + error?: {} | null +) { + return (request: {}) => { + assert.deepStrictEqual(request, expectedRequest); + const mockOperation = { + promise() { + return new Promise((resolve, reject) => { + if (error) { + reject(error); + } else { + resolve([response]); + } + }); + }, + }; + return Promise.resolve([mockOperation]); + }; +} +describe('v1beta2.DocumentUnderstandingServiceClient', () => { + it('has servicePath', () => { + const servicePath = + documentunderstandingserviceModule.v1beta2 + .DocumentUnderstandingServiceClient.servicePath; + assert(servicePath); + }); + it('has apiEndpoint', () => { + const apiEndpoint = + documentunderstandingserviceModule.v1beta2 + .DocumentUnderstandingServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + it('has port', () => { + const port = + documentunderstandingserviceModule.v1beta2 + .DocumentUnderstandingServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + it('should create a client with no option', () => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient(); + assert(client); + }); + it('should create a client with gRPC fallback', () => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + fallback: true, + } + ); + assert(client); + }); + it('has initialize method and supports deferred initialization', async () => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.documentUnderstandingServiceStub, undefined); + await client.initialize(); + assert(client.documentUnderstandingServiceStub); + }); + it('has close method', () => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.close(); + }); + describe('processDocument', () => { + it('invokes processDocument without error', done => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + // Initialize client before mocking + client.initialize(); + // Mock request + const request: protosTypes.google.cloud.documentai.v1beta2.IProcessDocumentRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.processDocument = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.processDocument(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes processDocument with error', done => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + // Initialize client before mocking + client.initialize(); + // Mock request + const request: protosTypes.google.cloud.documentai.v1beta2.IProcessDocumentRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.processDocument = mockSimpleGrpcMethod( + request, + null, + error + ); + client.processDocument(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('batchProcessDocuments', () => { + it('invokes batchProcessDocuments without error', done => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + // Initialize client before mocking + client.initialize(); + // Mock request + const request: protosTypes.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.batchProcessDocuments = mockLongRunningGrpcMethod( + request, + expectedResponse + ); + client + .batchProcessDocuments(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then((responses: [Operation]) => { + assert.deepStrictEqual(responses[0], expectedResponse); + done(); + }) + .catch((err: {}) => { + done(err); + }); + }); + + it('invokes batchProcessDocuments with error', done => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + // Initialize client before mocking + client.initialize(); + // Mock request + const request: protosTypes.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.batchProcessDocuments = mockLongRunningGrpcMethod( + request, + null, + error + ); + client + .batchProcessDocuments(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then(() => { + assert.fail(); + }) + .catch((err: FakeError) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + done(); + }); + }); + }); +}); diff --git a/packages/google-cloud-documentai/test/gapic-v1beta1.js b/packages/google-cloud-documentai/test/gapic-v1beta1.js deleted file mode 100644 index 412f8c20e6e..00000000000 --- a/packages/google-cloud-documentai/test/gapic-v1beta1.js +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT 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'; - -const assert = require('assert'); - -const documentaiModule = require('../src'); - -const FAKE_STATUS_CODE = 1; -const error = new Error(); -error.code = FAKE_STATUS_CODE; - -describe('DocumentUnderstandingServiceClient', () => { - it('has servicePath', () => { - const servicePath = - documentaiModule.v1beta1.DocumentUnderstandingServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - documentaiModule.v1beta1.DocumentUnderstandingServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = - documentaiModule.v1beta1.DocumentUnderstandingServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no options', () => { - const client = new documentaiModule.v1beta1.DocumentUnderstandingServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new documentaiModule.v1beta1.DocumentUnderstandingServiceClient( - {fallback: true} - ); - assert(client); - }); - - describe('batchProcessDocuments', function() { - it('invokes batchProcessDocuments without error', done => { - const client = new documentaiModule.v1beta1.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock response - const expectedResponse = {}; - - // Mock Grpc layer - client._innerApiCalls.batchProcessDocuments = mockLongRunningGrpcMethod( - request, - expectedResponse - ); - - client - .batchProcessDocuments(request) - .then(responses => { - const operation = responses[0]; - return operation.promise(); - }) - .then(responses => { - assert.deepStrictEqual(responses[0], expectedResponse); - done(); - }) - .catch(err => { - done(err); - }); - }); - - it('invokes batchProcessDocuments with error', done => { - const client = new documentaiModule.v1beta1.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock Grpc layer - client._innerApiCalls.batchProcessDocuments = mockLongRunningGrpcMethod( - request, - null, - error - ); - - client - .batchProcessDocuments(request) - .then(responses => { - const operation = responses[0]; - return operation.promise(); - }) - .then(() => { - assert.fail(); - }) - .catch(err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - - it('has longrunning decoder functions', () => { - const client = new documentaiModule.v1beta1.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - assert( - client._descriptors.longrunning.batchProcessDocuments - .responseDecoder instanceof Function - ); - assert( - client._descriptors.longrunning.batchProcessDocuments - .metadataDecoder instanceof Function - ); - }); - }); -}); - -function mockSimpleGrpcMethod(expectedRequest, response, error) { - return function(actualRequest, options, callback) { - assert.deepStrictEqual(actualRequest, expectedRequest); - if (error) { - callback(error); - } else if (response) { - callback(null, response); - } else { - callback(null); - } - }; -} - -function mockLongRunningGrpcMethod(expectedRequest, response, error) { - return request => { - assert.deepStrictEqual(request, expectedRequest); - const mockOperation = { - promise: function() { - return new Promise((resolve, reject) => { - if (error) { - reject(error); - } else { - resolve([response]); - } - }); - }, - }; - return Promise.resolve([mockOperation]); - }; -} diff --git a/packages/google-cloud-documentai/tsconfig.json b/packages/google-cloud-documentai/tsconfig.json new file mode 100644 index 00000000000..613d35597b5 --- /dev/null +++ b/packages/google-cloud-documentai/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2016", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/packages/google-cloud-documentai/tslint.json b/packages/google-cloud-documentai/tslint.json new file mode 100644 index 00000000000..617dc975bae --- /dev/null +++ b/packages/google-cloud-documentai/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "gts/tslint.json" +} diff --git a/packages/google-cloud-documentai/webpack.config.js b/packages/google-cloud-documentai/webpack.config.js index 284673f2c57..af2ed925ced 100644 --- a/packages/google-cloud-documentai/webpack.config.js +++ b/packages/google-cloud-documentai/webpack.config.js @@ -12,11 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +const path = require('path'); + module.exports = { - entry: './src/browser.js', + entry: './src/index.ts', output: { - library: 'documentai', - filename: './documentai.js', + library: 'DocumentUnderstandingService', + filename: './document-understanding-service.js', }, node: { child_process: 'empty', @@ -24,21 +26,37 @@ module.exports = { crypto: 'empty', }, resolve: { - extensions: ['.js', '.json'], + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], }, module: { rules: [ { - test: /node_modules[\\/]retry-request[\\/]/, - use: 'null-loader', + 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[\\/]https?-proxy-agent/, + use: 'null-loader' }, { - test: /node_modules[\\/]gtoken[\\/]/, - use: 'null-loader', + test: /node_modules[\\/]gtoken/, + use: 'null-loader' }, ], }, From 5eaa4153c2f9cc3193b241bb9f1c438421ba7d27 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Wed, 18 Mar 2020 16:25:20 -0700 Subject: [PATCH 006/213] build: we are dropping Node 10 very soon (#15) --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index a49364fc36a..5c76f8c4fa2 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -51,6 +51,6 @@ "webpack-cli": "^3.3.11" }, "engines": { - "node": ">=8.13.0" + "node": ">=10" } } From fca87384d2a502d9e2588f9f8ec8edc74e0c4379 Mon Sep 17 00:00:00 2001 From: Jeff Ching Date: Thu, 19 Mar 2020 09:06:12 -0700 Subject: [PATCH 007/213] chore: remove snippet leading whitespace (#17) --- packages/google-cloud-documentai/README.md | 78 +++++++++++----------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index 1b75b024b68..11484f2d10e 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -55,52 +55,52 @@ npm install @google-cloud/documentai ### Using the client library ```javascript - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - // const projectId = 'YOUR_PROJECT_ID'; - // const location = 'YOUR_PROJECT_LOCATION'; - // const gcsInputUri = 'YOUR_SOURCE_PDF'; - - const { - DocumentUnderstandingServiceClient, - } = require('@google-cloud/documentai'); - const client = new DocumentUnderstandingServiceClient(); - - async function quickstart() { - // Configure the request for processing the PDF - const parent = `projects/${projectId}/locations/${location}`; - const request = { - parent, - inputConfig: { - gcsSource: { - uri: gcsInputUri, - }, - mimeType: 'application/pdf', +/** + * TODO(developer): Uncomment these variables before running the sample. + */ +// const projectId = 'YOUR_PROJECT_ID'; +// const location = 'YOUR_PROJECT_LOCATION'; +// const gcsInputUri = 'YOUR_SOURCE_PDF'; + +const { + DocumentUnderstandingServiceClient, +} = require('@google-cloud/documentai'); +const client = new DocumentUnderstandingServiceClient(); + +async function quickstart() { + // Configure the request for processing the PDF + const parent = `projects/${projectId}/locations/${location}`; + const request = { + parent, + inputConfig: { + gcsSource: { + uri: gcsInputUri, }, - }; + mimeType: 'application/pdf', + }, + }; - // Recognizes text entities in the PDF document - const [result] = await client.processDocument(request); + // Recognizes text entities in the PDF document + const [result] = await client.processDocument(request); - // Get all of the document text as one big string - const {text} = result; + // Get all of the document text as one big string + const {text} = result; - // Extract shards from the text field - function extractText(textAnchor) { - // First shard in document doesn't have startIndex property - const startIndex = textAnchor.textSegments[0].startIndex || 0; - const endIndex = textAnchor.textSegments[0].endIndex; + // Extract shards from the text field + function extractText(textAnchor) { + // First shard in document doesn't have startIndex property + const startIndex = textAnchor.textSegments[0].startIndex || 0; + const endIndex = textAnchor.textSegments[0].endIndex; - return text.substring(startIndex, endIndex); - } + return text.substring(startIndex, endIndex); + } - for (const entity of result.entities) { - console.log(`\nEntity text: ${extractText(entity.textAnchor)}`); - console.log(`Entity type: ${entity.type}`); - console.log(`Entity mention text: ${entity.mentionText}`); - } + for (const entity of result.entities) { + console.log(`\nEntity text: ${extractText(entity.textAnchor)}`); + console.log(`Entity type: ${entity.type}`); + console.log(`Entity mention text: ${entity.mentionText}`); } +} ``` From 0612eb043058043be8058811ce97051a68a83ace Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Fri, 20 Mar 2020 12:38:19 -0700 Subject: [PATCH 008/213] feat: adds beta samples * feat: adds remaining samples (parse form synchronous, parse table synchronous, parse from with NL model, set endpoint) * fix: adds AutoML NL model to tests * fix: removes forEach() constructions --- packages/google-cloud-documentai/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/google-cloud-documentai/.gitignore b/packages/google-cloud-documentai/.gitignore index 5d32b23782f..f9f5d80fc7c 100644 --- a/packages/google-cloud-documentai/.gitignore +++ b/packages/google-cloud-documentai/.gitignore @@ -12,3 +12,4 @@ system-test/*key.json .DS_Store package-lock.json __pycache__ +.vscode \ No newline at end of file From 3b0eaf6b54fc8e05349b518432cc1c8e8e173b61 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 25 Mar 2020 08:37:41 -0700 Subject: [PATCH 009/213] chore: release 1.0.0 (#6) --- packages/google-cloud-documentai/CHANGELOG.md | 15 +++++++++++++++ packages/google-cloud-documentai/package.json | 2 +- .../google-cloud-documentai/samples/package.json | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 packages/google-cloud-documentai/CHANGELOG.md diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md new file mode 100644 index 00000000000..fe9c7325028 --- /dev/null +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -0,0 +1,15 @@ +# Changelog + +## 1.0.0 (2020-03-20) + + +### ⚠ BREAKING CHANGES + +* initial generation of beta client (#5) + +### Features + +* **samples:** adds Document AI parse table, forms samples ([#8](https://www.github.com/googleapis/nodejs-document-ai/issues/8)) ([2fdf913](https://www.github.com/googleapis/nodejs-document-ai/commit/2fdf913a29d5339b65212a3105a59435ebdd11b0)) +* adds beta samples ([30a5392](https://www.github.com/googleapis/nodejs-document-ai/commit/30a5392f806399ce233186f3ca3a1bf2bb1be044)) +* initial generation of beta client ([#5](https://www.github.com/googleapis/nodejs-document-ai/issues/5)) ([e5a34f1](https://www.github.com/googleapis/nodejs-document-ai/commit/e5a34f1de4ac9993bd51738e7a626a814c2d962a)) +* updated library from protos ([#9](https://www.github.com/googleapis/nodejs-document-ai/issues/9)) ([5ef7220](https://www.github.com/googleapis/nodejs-document-ai/commit/5ef722045146cd5dc8f8b7c3383136a9bc253f47)) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 5c76f8c4fa2..237c86515a4 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "0.1.0", + "version": "1.0.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index ea52d7dd9c0..f6b60880246 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^0.1.0", + "@google-cloud/documentai": "^1.0.0", "@google-cloud/storage": "^4.2.0" }, "devDependencies": { From c8ff10d4e2f03706c9ad077a4167dd5edd4f7639 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 25 Mar 2020 10:28:08 -0700 Subject: [PATCH 010/213] chore: regenerate the code (#22) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2020-03-22 04:26:13,376 synthtool > Executing /tmpfs/src/git/autosynth/working_repo/synth.py. 2020-03-22 04:26:13,427 synthtool > Ensuring dependencies. 2020-03-22 04:26:13,432 synthtool > Cloning googleapis. 2020-03-22 04:26:13,759 synthtool > Pulling Docker image: gapic-generator-typescript:latest latest: Pulling from gapic-images/gapic-generator-typescript Digest: sha256:3762b8bcba247ef4d020ffc7043e2881a20b5fab0ffd98d542f365d3f3a3829d Status: Image is up to date for gcr.io/gapic-images/gapic-generator-typescript:latest 2020-03-22 04:26:14,664 synthtool > Generating code for: google/cloud/documentai/v1beta2. 2020-03-22 04:26:15,880 synthtool > Generated code into /tmpfs/tmp/tmpv3rbhdm_. .eslintignore .eslintrc.yml .github/ISSUE_TEMPLATE/bug_report.md .github/ISSUE_TEMPLATE/feature_request.md .github/ISSUE_TEMPLATE/support_request.md .github/PULL_REQUEST_TEMPLATE.md .github/publish.yml .github/release-please.yml .github/workflows/ci.yaml .kokoro/common.cfg .kokoro/continuous/node10/common.cfg .kokoro/continuous/node10/docs.cfg .kokoro/continuous/node10/lint.cfg .kokoro/continuous/node10/samples-test.cfg .kokoro/continuous/node10/system-test.cfg .kokoro/continuous/node10/test.cfg .kokoro/continuous/node12/common.cfg .kokoro/continuous/node12/test.cfg .kokoro/continuous/node8/common.cfg .kokoro/continuous/node8/test.cfg .kokoro/docs.sh .kokoro/lint.sh .kokoro/presubmit/node10/common.cfg .kokoro/presubmit/node10/docs.cfg .kokoro/presubmit/node10/lint.cfg .kokoro/presubmit/node10/samples-test.cfg .kokoro/presubmit/node10/system-test.cfg .kokoro/presubmit/node10/test.cfg .kokoro/presubmit/node12/common.cfg .kokoro/presubmit/node12/test.cfg .kokoro/presubmit/node8/common.cfg .kokoro/presubmit/node8/test.cfg .kokoro/presubmit/windows/common.cfg .kokoro/presubmit/windows/test.cfg .kokoro/publish.sh .kokoro/release/docs.cfg .kokoro/release/docs.sh .kokoro/release/publish.cfg .kokoro/samples-test.sh .kokoro/system-test.sh .kokoro/test.bat .kokoro/test.sh .kokoro/trampoline.sh .mocharc.js .nycrc .prettierignore .prettierrc CODE_OF_CONDUCT.md CONTRIBUTING.md LICENSE README.md codecov.yaml renovate.json samples/README.md npm WARN npm npm does not support Node.js v12.16.1 npm WARN npm You should probably upgrade to a newer version of node as we npm WARN npm can't make any promises that npm will work with this version. npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11. npm WARN npm You can find the latest version at https://nodejs.org/ npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.) > protobufjs@6.8.9 postinstall /tmpfs/src/git/autosynth/working_repo/node_modules/protobufjs > node scripts/postinstall > @google-cloud/documentai@0.1.0 prepare /tmpfs/src/git/autosynth/working_repo > npm run compile-protos && npm run compile npm WARN npm npm does not support Node.js v12.16.1 npm WARN npm You should probably upgrade to a newer version of node as we npm WARN npm can't make any promises that npm will work with this version. npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11. npm WARN npm You can find the latest version at https://nodejs.org/ > @google-cloud/documentai@0.1.0 compile-protos /tmpfs/src/git/autosynth/working_repo > compileProtos src installing semver@^5.5.0 installing uglify-js@^3.3.25 installing espree@^3.5.4 installing escodegen@^1.9.1 npm WARN npm npm does not support Node.js v12.16.1 npm WARN npm You should probably upgrade to a newer version of node as we npm WARN npm can't make any promises that npm will work with this version. npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11. npm WARN npm You can find the latest version at https://nodejs.org/ > @google-cloud/documentai@0.1.0 compile /tmpfs/src/git/autosynth/working_repo > tsc -p . && cp -r protos build/ npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: abbrev@1.1.1 (node_modules/fsevents/node_modules/abbrev): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/abbrev' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.abbrev.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ansi-regex@2.1.1 (node_modules/fsevents/node_modules/ansi-regex): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/ansi-regex' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.ansi-regex.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: aproba@1.2.0 (node_modules/fsevents/node_modules/aproba): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/aproba' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.aproba.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: balanced-match@1.0.0 (node_modules/fsevents/node_modules/balanced-match): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/balanced-match' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.balanced-match.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: chownr@1.1.4 (node_modules/fsevents/node_modules/chownr): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/chownr' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.chownr.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: code-point-at@1.1.0 (node_modules/fsevents/node_modules/code-point-at): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/code-point-at' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.code-point-at.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: concat-map@0.0.1 (node_modules/fsevents/node_modules/concat-map): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/concat-map' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.concat-map.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: console-control-strings@1.1.0 (node_modules/fsevents/node_modules/console-control-strings): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/console-control-strings' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.console-control-strings.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: core-util-is@1.0.2 (node_modules/fsevents/node_modules/core-util-is): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/core-util-is' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.core-util-is.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: deep-extend@0.6.0 (node_modules/fsevents/node_modules/deep-extend): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/deep-extend' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.deep-extend.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: delegates@1.0.0 (node_modules/fsevents/node_modules/delegates): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/delegates' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.delegates.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: detect-libc@1.0.3 (node_modules/fsevents/node_modules/detect-libc): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/detect-libc' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.detect-libc.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs.realpath@1.0.0 (node_modules/fsevents/node_modules/fs.realpath): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/fs.realpath' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.fs.realpath.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: has-unicode@2.0.1 (node_modules/fsevents/node_modules/has-unicode): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/has-unicode' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.has-unicode.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: inherits@2.0.4 (node_modules/fsevents/node_modules/inherits): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/inherits' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.inherits.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ini@1.3.5 (node_modules/fsevents/node_modules/ini): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/ini' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.ini.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: isarray@1.0.0 (node_modules/fsevents/node_modules/isarray): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/isarray' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.isarray.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: minimist@1.2.5 (node_modules/fsevents/node_modules/minimist): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/minimist' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.minimist.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ms@2.1.2 (node_modules/fsevents/node_modules/ms): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/ms' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.ms.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: npm-normalize-package-bin@1.0.1 (node_modules/fsevents/node_modules/npm-normalize-package-bin): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/npm-normalize-package-bin' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.npm-normalize-package-bin.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: number-is-nan@1.0.1 (node_modules/fsevents/node_modules/number-is-nan): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/number-is-nan' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.number-is-nan.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: object-assign@4.1.1 (node_modules/fsevents/node_modules/object-assign): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/object-assign' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.object-assign.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: os-homedir@1.0.2 (node_modules/fsevents/node_modules/os-homedir): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/os-homedir' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.os-homedir.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: os-tmpdir@1.0.2 (node_modules/fsevents/node_modules/os-tmpdir): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/os-tmpdir' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.os-tmpdir.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: path-is-absolute@1.0.1 (node_modules/fsevents/node_modules/path-is-absolute): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/path-is-absolute' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.path-is-absolute.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: process-nextick-args@2.0.1 (node_modules/fsevents/node_modules/process-nextick-args): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/process-nextick-args' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.process-nextick-args.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: safe-buffer@5.1.2 (node_modules/fsevents/node_modules/safe-buffer): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/safe-buffer' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.safe-buffer.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: safer-buffer@2.1.2 (node_modules/fsevents/node_modules/safer-buffer): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/safer-buffer' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.safer-buffer.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: sax@1.2.4 (node_modules/fsevents/node_modules/sax): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/sax' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.sax.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: semver@5.7.1 (node_modules/fsevents/node_modules/semver): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/semver' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.semver.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: set-blocking@2.0.0 (node_modules/fsevents/node_modules/set-blocking): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/set-blocking' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.set-blocking.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: signal-exit@3.0.2 (node_modules/fsevents/node_modules/signal-exit): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/signal-exit' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.signal-exit.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: strip-json-comments@2.0.1 (node_modules/fsevents/node_modules/strip-json-comments): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/strip-json-comments' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.strip-json-comments.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: util-deprecate@1.0.2 (node_modules/fsevents/node_modules/util-deprecate): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/util-deprecate' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.util-deprecate.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: wrappy@1.0.2 (node_modules/fsevents/node_modules/wrappy): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/wrappy' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.wrappy.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: yallist@3.1.1 (node_modules/fsevents/node_modules/yallist): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/yallist' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/fsevents/node_modules/.yallist.DELETE' added 983 packages from 929 contributors and audited 6730 packages in 29.31s found 1 low severity vulnerability run `npm audit fix` to fix them, or `npm audit` for details npm WARN npm npm does not support Node.js v12.16.1 npm WARN npm You should probably upgrade to a newer version of node as we npm WARN npm can't make any promises that npm will work with this version. npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11. npm WARN npm You can find the latest version at https://nodejs.org/ > @google-cloud/documentai@0.1.0 fix /tmpfs/src/git/autosynth/working_repo > gts fix && eslint samples --fix 2020-03-22 04:26:56,743 synthtool > Wrote metadata to synth.metadata. ```
--- packages/google-cloud-documentai/.gitignore | 1 - packages/google-cloud-documentai/.jsdoc.js | 2 +- packages/google-cloud-documentai/README.md | 6 + .../linkinator.config.json | 3 +- .../google-cloud-documentai/samples/README.md | 108 ++++++++++++++++++ packages/google-cloud-documentai/src/index.ts | 2 +- .../document_understanding_service_client.ts | 12 +- .../src/v1beta2/index.ts | 2 +- .../google-cloud-documentai/synth.metadata | 15 ++- .../system-test/fixtures/sample/src/index.js | 2 +- .../system-test/fixtures/sample/src/index.ts | 2 +- .../system-test/install.ts | 2 +- ...-document_understanding_service-v1beta2.ts | 2 +- .../google-cloud-documentai/webpack.config.js | 2 +- 14 files changed, 143 insertions(+), 18 deletions(-) diff --git a/packages/google-cloud-documentai/.gitignore b/packages/google-cloud-documentai/.gitignore index f9f5d80fc7c..5d32b23782f 100644 --- a/packages/google-cloud-documentai/.gitignore +++ b/packages/google-cloud-documentai/.gitignore @@ -12,4 +12,3 @@ system-test/*key.json .DS_Store package-lock.json __pycache__ -.vscode \ No newline at end of file diff --git a/packages/google-cloud-documentai/.jsdoc.js b/packages/google-cloud-documentai/.jsdoc.js index cd83b15bb85..6eee4dc629e 100644 --- a/packages/google-cloud-documentai/.jsdoc.js +++ b/packages/google-cloud-documentai/.jsdoc.js @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// 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. diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index 11484f2d10e..178296d62ab 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -113,9 +113,15 @@ has instructions for running the samples. | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | +| Batch_parse_form | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch_parse_form.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch_parse_form.js,samples/README.md) | +| Batch_parse_table | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch_parse_table.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch_parse_table.js,samples/README.md) | | Parse Form | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parseForm.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parseForm.js,samples/README.md) | | Parse Table | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parseTable.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parseTable.js,samples/README.md) | +| Parse_form | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse_form.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse_form.js,samples/README.md) | +| Parse_table | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse_table.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse_table.js,samples/README.md) | +| Parse_with_model | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse_with_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse_with_model.js,samples/README.md) | | Quickstart | [source code](https://github.com/googleapis/nodejs-document-ai/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-document-ai&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | +| Set_endpoint | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/set_endpoint.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/set_endpoint.js,samples/README.md) | diff --git a/packages/google-cloud-documentai/linkinator.config.json b/packages/google-cloud-documentai/linkinator.config.json index b9e629720b7..29a223b6db6 100644 --- a/packages/google-cloud-documentai/linkinator.config.json +++ b/packages/google-cloud-documentai/linkinator.config.json @@ -3,8 +3,7 @@ "skip": [ "https://codecov.io/gh/googleapis/", "www.googleapis.com", - "img.shields.io", - "https://googleapis.dev/nodejs/documentai/latest/index.html" + "img.shields.io" ], "silent": true, "concurrency": 10 diff --git a/packages/google-cloud-documentai/samples/README.md b/packages/google-cloud-documentai/samples/README.md index 3cea9ee87c8..9f2f009e39a 100644 --- a/packages/google-cloud-documentai/samples/README.md +++ b/packages/google-cloud-documentai/samples/README.md @@ -12,9 +12,15 @@ * [Before you begin](#before-you-begin) * [Samples](#samples) + * [Batch_parse_form](#batch_parse_form) + * [Batch_parse_table](#batch_parse_table) * [Parse Form](#parse-form) * [Parse Table](#parse-table) + * [Parse_form](#parse_form) + * [Parse_table](#parse_table) + * [Parse_with_model](#parse_with_model) * [Quickstart](#quickstart) + * [Set_endpoint](#set_endpoint) ## Before you begin @@ -31,6 +37,40 @@ Before running the samples, make sure you've followed the steps outlined in +### Batch_parse_form + +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch_parse_form.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch_parse_form.js,samples/README.md) + +__Usage:__ + + +`node samples/batch_parse_form.js` + + +----- + + + + +### Batch_parse_table + +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch_parse_table.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch_parse_table.js,samples/README.md) + +__Usage:__ + + +`node samples/batch_parse_table.js` + + +----- + + + + ### Parse Form View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parseForm.js). @@ -65,6 +105,57 @@ __Usage:__ +### Parse_form + +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse_form.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse_form.js,samples/README.md) + +__Usage:__ + + +`node samples/parse_form.js` + + +----- + + + + +### Parse_table + +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse_table.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse_table.js,samples/README.md) + +__Usage:__ + + +`node samples/parse_table.js` + + +----- + + + + +### Parse_with_model + +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse_with_model.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse_with_model.js,samples/README.md) + +__Usage:__ + + +`node samples/parse_with_model.js` + + +----- + + + + ### Quickstart View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/quickstart.js). @@ -77,6 +168,23 @@ __Usage:__ `node samples/quickstart.js` +----- + + + + +### Set_endpoint + +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/set_endpoint.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/set_endpoint.js,samples/README.md) + +__Usage:__ + + +`node samples/set_endpoint.js` + + diff --git a/packages/google-cloud-documentai/src/index.ts b/packages/google-cloud-documentai/src/index.ts index b4935a21831..d0dd8971db9 100644 --- a/packages/google-cloud-documentai/src/index.ts +++ b/packages/google-cloud-documentai/src/index.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// 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. diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index 12d292ce779..8aafc22cae3 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// 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. @@ -40,7 +40,12 @@ const version = require('../../../package.json').version; * @memberof v1beta2 */ export class DocumentUnderstandingServiceClient { - private _descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}}; + private _descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; private _innerApiCalls: {[name: string]: Function}; private _terminated = false; private _opts: ClientOptions; @@ -235,7 +240,8 @@ export class DocumentUnderstandingServiceClient { if (this._terminated) { return Promise.reject('The client has already been closed.'); } - return stub[methodName].apply(stub, args); + const func = stub[methodName]; + return func.apply(stub, args); }, (err: Error | null | undefined) => () => { throw err; diff --git a/packages/google-cloud-documentai/src/v1beta2/index.ts b/packages/google-cloud-documentai/src/v1beta2/index.ts index 507b5f8f347..7ee10dea286 100644 --- a/packages/google-cloud-documentai/src/v1beta2/index.ts +++ b/packages/google-cloud-documentai/src/v1beta2/index.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// 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. diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 8d260eda9b2..5bc15edbdd1 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -1,13 +1,20 @@ { - "updateTime": "2020-03-18T21:20:42.050992Z", + "updateTime": "2020-03-22T11:26:56.743018Z", "sources": [ { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "275fbcce2c900278d487c33293a3c7e1fbcd3a34", - "internalRef": "301661567", - "log": "275fbcce2c900278d487c33293a3c7e1fbcd3a34\nfeat: pubsub/v1 add an experimental filter field to Subscription\n\nPiperOrigin-RevId: 301661567\n\nf2b18cec51d27c999ad30011dba17f3965677e9c\nFix: UpdateBackupRequest.backup is a resource, not a resource reference - remove annotation.\n\nPiperOrigin-RevId: 301636171\n\n800384063ac93a0cac3a510d41726fa4b2cd4a83\nCloud Billing Budget API v1beta1\nModified api documentation to include warnings about the new filter field.\n\nPiperOrigin-RevId: 301634389\n\n0cc6c146b660db21f04056c3d58a4b752ee445e3\nCloud Billing Budget API v1alpha1\nModified api documentation to include warnings about the new filter field.\n\nPiperOrigin-RevId: 301630018\n\nff2ea00f69065585c3ac0993c8b582af3b6fc215\nFix: Add resource definition for a parent of InspectTemplate which was otherwise missing.\n\nPiperOrigin-RevId: 301623052\n\n55fa441c9daf03173910760191646399338f2b7c\nAdd proto definition for AccessLevel, AccessPolicy, and ServicePerimeter.\n\nPiperOrigin-RevId: 301620844\n\ne7b10591c5408a67cf14ffafa267556f3290e262\nCloud Bigtable Managed Backup service and message proto files.\n\nPiperOrigin-RevId: 301585144\n\nd8e226f702f8ddf92915128c9f4693b63fb8685d\nfeat: Add time-to-live in a queue for builds\n\nPiperOrigin-RevId: 301579876\n\n430375af011f8c7a5174884f0d0e539c6ffa7675\ndocs: add missing closing backtick\n\nPiperOrigin-RevId: 301538851\n\n0e9f1f60ded9ad1c2e725e37719112f5b487ab65\nbazel: Use latest release of gax_java\n\nPiperOrigin-RevId: 301480457\n\n5058c1c96d0ece7f5301a154cf5a07b2ad03a571\nUpdate GAPIC v2 with batching parameters for Logging API\n\nPiperOrigin-RevId: 301443847\n\n" + "sha": "0be7105dc52590fa9a24e784052298ae37ce53aa", + "internalRef": "302154871", + "log": "0be7105dc52590fa9a24e784052298ae37ce53aa\nAdd BUILD.bazel file to asset/v1p1beta1\n\nPiperOrigin-RevId: 302154871\n\n6c248fd13e8543f8d22cbf118d978301a9fbe2a8\nAdd missing resource annotations and additional_bindings to dialogflow v2 API.\n\nPiperOrigin-RevId: 302063117\n\n9a3a7f33be9eeacf7b3e98435816b7022d206bd7\nChange the service name from \"chromeos-moblab.googleapis.com\" to \"chromeosmoblab.googleapis.com\"\n\nPiperOrigin-RevId: 302060989\n\n98a339237577e3de26cb4921f75fb5c57cc7a19f\nfeat: devtools/build/v1 publish client library config annotations\n\n* add details field to some of the BuildEvents\n* add final_invocation_id and build_tool_exit_code fields to BuildStatus\n\nPiperOrigin-RevId: 302044087\n\ncfabc98c6bbbb22d1aeaf7612179c0be193b3a13\nfeat: home/graph/v1 publish client library config annotations & comment updates\n\nThis change includes adding the client library configuration annotations, updated proto comments, and some client library configuration files.\n\nPiperOrigin-RevId: 302042647\n\nc8c8c0bd15d082db9546253dbaad1087c7a9782c\nchore: use latest gapic-generator in bazel WORKSPACE.\nincluding the following commits from gapic-generator:\n- feat: take source protos in all sub-packages (#3144)\n\nPiperOrigin-RevId: 301843591\n\ne4daf5202ea31cb2cb6916fdbfa9d6bd771aeb4c\nAdd bazel file for v1 client lib generation\n\nPiperOrigin-RevId: 301802926\n\n" + } + }, + { + "git": { + "name": "synthtool", + "remote": "https://github.com/googleapis/synthtool.git", + "sha": "7e98e1609c91082f4eeb63b530c6468aefd18cfd" } } ], diff --git a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js index 2b32d5b2a84..2a711d0a2cb 100644 --- a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// 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. diff --git a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts index 0e2b753d952..9a088a56e0d 100644 --- a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// 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. diff --git a/packages/google-cloud-documentai/system-test/install.ts b/packages/google-cloud-documentai/system-test/install.ts index c9aa74ec221..c4d80e9c0c8 100644 --- a/packages/google-cloud-documentai/system-test/install.ts +++ b/packages/google-cloud-documentai/system-test/install.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// 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. diff --git a/packages/google-cloud-documentai/test/gapic-document_understanding_service-v1beta2.ts b/packages/google-cloud-documentai/test/gapic-document_understanding_service-v1beta2.ts index 3327181d61f..6dd8f9b4a46 100644 --- a/packages/google-cloud-documentai/test/gapic-document_understanding_service-v1beta2.ts +++ b/packages/google-cloud-documentai/test/gapic-document_understanding_service-v1beta2.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// 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. diff --git a/packages/google-cloud-documentai/webpack.config.js b/packages/google-cloud-documentai/webpack.config.js index af2ed925ced..d1bfada9a69 100644 --- a/packages/google-cloud-documentai/webpack.config.js +++ b/packages/google-cloud-documentai/webpack.config.js @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// 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. From dd838a68bef1eac606c926fa09d8f3e1950bb192 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Thu, 2 Apr 2020 12:08:14 -0700 Subject: [PATCH 011/213] feat!: drop node8 support (#30) BREAKING CHANGE: The library now supports Node.js v10+. The last version to support Node.js v8 is tagged legacy-8 on NPM. --- .../google-cloud-documentai/.eslintrc.json | 3 + .../google-cloud-documentai/.eslintrc.yml | 15 - packages/google-cloud-documentai/.prettierrc | 8 - .../google-cloud-documentai/.prettierrc.js | 17 + packages/google-cloud-documentai/README.md | 23 +- packages/google-cloud-documentai/package.json | 16 +- .../google-cloud-documentai/protos/protos.js | 2 +- .../google-cloud-documentai/samples/README.md | 36 -- packages/google-cloud-documentai/src/index.ts | 2 - .../document_understanding_service_client.ts | 154 +++--- .../google-cloud-documentai/synth.metadata | 20 +- .../system-test/fixtures/sample/src/index.js | 1 - .../system-test/fixtures/sample/src/index.ts | 2 +- ...-document_understanding_service-v1beta2.ts | 260 ---------- ..._document_understanding_service_v1beta2.ts | 468 ++++++++++++++++++ .../google-cloud-documentai/webpack.config.js | 12 +- 16 files changed, 614 insertions(+), 425 deletions(-) create mode 100644 packages/google-cloud-documentai/.eslintrc.json delete mode 100644 packages/google-cloud-documentai/.eslintrc.yml delete mode 100644 packages/google-cloud-documentai/.prettierrc create mode 100644 packages/google-cloud-documentai/.prettierrc.js delete mode 100644 packages/google-cloud-documentai/test/gapic-document_understanding_service-v1beta2.ts create mode 100644 packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts diff --git a/packages/google-cloud-documentai/.eslintrc.json b/packages/google-cloud-documentai/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/packages/google-cloud-documentai/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/packages/google-cloud-documentai/.eslintrc.yml b/packages/google-cloud-documentai/.eslintrc.yml deleted file mode 100644 index 73eeec27612..00000000000 --- a/packages/google-cloud-documentai/.eslintrc.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -extends: - - 'eslint:recommended' - - 'plugin:node/recommended' - - prettier -plugins: - - node - - prettier -rules: - prettier/prettier: error - block-scoped-var: error - eqeqeq: error - no-warning-comments: warn - no-var: error - prefer-const: error diff --git a/packages/google-cloud-documentai/.prettierrc b/packages/google-cloud-documentai/.prettierrc deleted file mode 100644 index df6eac07446..00000000000 --- a/packages/google-cloud-documentai/.prettierrc +++ /dev/null @@ -1,8 +0,0 @@ ---- -bracketSpacing: false -printWidth: 80 -semi: true -singleQuote: true -tabWidth: 2 -trailingComma: es5 -useTabs: false diff --git a/packages/google-cloud-documentai/.prettierrc.js b/packages/google-cloud-documentai/.prettierrc.js new file mode 100644 index 00000000000..08cba3775be --- /dev/null +++ b/packages/google-cloud-documentai/.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 +// +// 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. + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index 178296d62ab..fe7dd7691c7 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -115,8 +115,6 @@ has instructions for running the samples. | --------------------------- | --------------------------------- | ------ | | Batch_parse_form | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch_parse_form.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch_parse_form.js,samples/README.md) | | Batch_parse_table | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch_parse_table.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch_parse_table.js,samples/README.md) | -| Parse Form | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parseForm.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parseForm.js,samples/README.md) | -| Parse Table | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parseTable.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parseTable.js,samples/README.md) | | Parse_form | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse_form.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse_form.js,samples/README.md) | | Parse_table | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse_table.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse_table.js,samples/README.md) | | Parse_with_model | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse_with_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse_with_model.js,samples/README.md) | @@ -128,6 +126,27 @@ has instructions for running the samples. The [Document AI 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 targetting 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/). diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 237c86515a4..46155c049f4 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -16,8 +16,8 @@ "compile-protos": "compileProtos src", "docs": "jsdoc -c .jsdoc.js", "docs-test": "linkinator docs", - "fix": "gts fix && eslint samples --fix", - "lint": "gts check && eslint samples", + "fix": "gts fix", + "lint": "gts check", "prelint": "cd samples; npm link ../; npm i", "predocs-test": "npm run docs", "prepare": "npm run compile-protos && npm run compile", @@ -26,17 +26,22 @@ "test": "c8 mocha build/test" }, "dependencies": { - "google-gax": "^1.14.2" + "fix": "0.0.6", + "google-gax": "^2.0.1", + "npm": "^6.14.4", + "run": "^1.4.0" }, "devDependencies": { "@types/mocha": "^5.2.7", "@types/node": "^12.12.29", + "@types/sinon": "^9.0.0", "c8": "^7.1.0", + "chai": "^4.2.0", "eslint": "^6.8.0", "eslint-config-prettier": "^6.10.0", "eslint-plugin-node": "^11.0.0", "eslint-plugin-prettier": "^3.1.2", - "gts": "^1.1.2", + "gts": "2.0.0-alpha.9", "jsdoc": "^3.6.3", "jsdoc-fresh": "^1.0.2", "jsdoc-region-tag": "^1.0.4", @@ -45,8 +50,9 @@ "null-loader": "^3.0.0", "pack-n-play": "^1.0.0-2", "prettier": "^1.19.1", + "sinon": "^9.0.1", "ts-loader": "^6.2.1", - "typescript": "~3.7.5", + "typescript": "^3.8.3", "webpack": "^4.42.0", "webpack-cli": "^3.3.11" }, diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 92eaeee0779..8979ae658c1 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -28,7 +28,7 @@ var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; // Exported root namespace - var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); + var $root = $protobuf.roots._google_cloud_documentai_1_0_0_protos || ($protobuf.roots._google_cloud_documentai_1_0_0_protos = {}); $root.google = (function() { diff --git a/packages/google-cloud-documentai/samples/README.md b/packages/google-cloud-documentai/samples/README.md index 9f2f009e39a..07794075d0d 100644 --- a/packages/google-cloud-documentai/samples/README.md +++ b/packages/google-cloud-documentai/samples/README.md @@ -14,8 +14,6 @@ * [Samples](#samples) * [Batch_parse_form](#batch_parse_form) * [Batch_parse_table](#batch_parse_table) - * [Parse Form](#parse-form) - * [Parse Table](#parse-table) * [Parse_form](#parse_form) * [Parse_table](#parse_table) * [Parse_with_model](#parse_with_model) @@ -71,40 +69,6 @@ __Usage:__ -### Parse Form - -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parseForm.js). - -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parseForm.js,samples/README.md) - -__Usage:__ - - -`node samples/parseForm.js` - - ------ - - - - -### Parse Table - -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parseTable.js). - -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parseTable.js,samples/README.md) - -__Usage:__ - - -`node samples/parseTable.js` - - ------ - - - - ### Parse_form View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse_form.js). diff --git a/packages/google-cloud-documentai/src/index.ts b/packages/google-cloud-documentai/src/index.ts index d0dd8971db9..7632bae77b0 100644 --- a/packages/google-cloud-documentai/src/index.ts +++ b/packages/google-cloud-documentai/src/index.ts @@ -20,8 +20,6 @@ import * as v1beta2 from './v1beta2'; const DocumentUnderstandingServiceClient = v1beta2.DocumentUnderstandingServiceClient; export {v1beta2, DocumentUnderstandingServiceClient}; -// For compatibility with JavaScript libraries we need to provide this default export: -// tslint:disable-next-line no-default-export export default {v1beta2, DocumentUnderstandingServiceClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index 8aafc22cae3..d9ef70f246a 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -18,7 +18,6 @@ import * as gax from 'google-gax'; import { - APICallback, Callback, CallOptions, Descriptors, @@ -27,7 +26,7 @@ import { } from 'google-gax'; import * as path from 'path'; -import * as protosTypes from '../../protos/protos'; +import * as protos from '../../protos/protos'; import * as gapicConfig from './document_understanding_service_client_config.json'; const version = require('../../../package.json').version; @@ -40,13 +39,6 @@ const version = require('../../../package.json').version; * @memberof v1beta2 */ export class DocumentUnderstandingServiceClient { - private _descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - private _innerApiCalls: {[name: string]: Function}; private _terminated = false; private _opts: ClientOptions; private _gaxModule: typeof gax | typeof gax.fallback; @@ -54,6 +46,13 @@ export class DocumentUnderstandingServiceClient { private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; operationsClient: gax.OperationsClient; documentUnderstandingServiceStub?: Promise<{[name: string]: Function}>; @@ -148,7 +147,10 @@ export class DocumentUnderstandingServiceClient { 'protos.json' ); this._protos = this._gaxGrpc.loadProto( - opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath ); // This API contains "long-running operations", which return a @@ -156,6 +158,7 @@ export class DocumentUnderstandingServiceClient { // 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); @@ -173,7 +176,7 @@ export class DocumentUnderstandingServiceClient { '.google.cloud.documentai.v1beta2.OperationMetadata' ) as gax.protobuf.Type; - this._descriptors.longrunning = { + this.descriptors.longrunning = { batchProcessDocuments: new this._gaxModule.LongrunningDescriptor( this.operationsClient, batchProcessDocumentsResponse.decode.bind( @@ -194,7 +197,7 @@ export class DocumentUnderstandingServiceClient { // 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 = {}; + this.innerApiCalls = {}; } /** @@ -221,7 +224,7 @@ export class DocumentUnderstandingServiceClient { ? (this._protos as protobuf.Root).lookupService( 'google.cloud.documentai.v1beta2.DocumentUnderstandingService' ) - : // tslint:disable-next-line no-any + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.documentai.v1beta2 .DocumentUnderstandingService, this._opts @@ -233,9 +236,8 @@ export class DocumentUnderstandingServiceClient { 'batchProcessDocuments', 'processDocument', ]; - for (const methodName of documentUnderstandingServiceStubMethods) { - const innerCallPromise = this.documentUnderstandingServiceStub.then( + const callPromise = this.documentUnderstandingServiceStub.then( stub => (...args: Array<{}>) => { if (this._terminated) { return Promise.reject('The client has already been closed.'); @@ -249,20 +251,14 @@ export class DocumentUnderstandingServiceClient { ); const apiCall = this._gaxModule.createApiCall( - innerCallPromise, + callPromise, this._defaults[methodName], - this._descriptors.page[methodName] || - this._descriptors.stream[methodName] || - this._descriptors.longrunning[methodName] + this.descriptors.page[methodName] || + this.descriptors.stream[methodName] || + this.descriptors.longrunning[methodName] ); - this._innerApiCalls[methodName] = ( - argument: {}, - callOptions?: CallOptions, - callback?: APICallback - ) => { - return apiCall(argument, callOptions, callback); - }; + this.innerApiCalls[methodName] = apiCall; } return this.documentUnderstandingServiceStub; @@ -319,26 +315,37 @@ export class DocumentUnderstandingServiceClient { // -- Service calls -- // ------------------- processDocument( - request: protosTypes.google.cloud.documentai.v1beta2.IProcessDocumentRequest, + request: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest, options?: gax.CallOptions ): Promise< [ - protosTypes.google.cloud.documentai.v1beta2.IDocument, + protos.google.cloud.documentai.v1beta2.IDocument, ( - | protosTypes.google.cloud.documentai.v1beta2.IProcessDocumentRequest + | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest | undefined ), {} | undefined ] >; processDocument( - request: protosTypes.google.cloud.documentai.v1beta2.IProcessDocumentRequest, + request: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest, options: gax.CallOptions, callback: Callback< - protosTypes.google.cloud.documentai.v1beta2.IDocument, - | protosTypes.google.cloud.documentai.v1beta2.IProcessDocumentRequest + protos.google.cloud.documentai.v1beta2.IDocument, + | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest + | null | undefined, - {} | undefined + {} | null | undefined + > + ): void; + processDocument( + request: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest, + callback: Callback< + protos.google.cloud.documentai.v1beta2.IDocument, + | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest + | null + | undefined, + {} | null | undefined > ): void; /** @@ -384,26 +391,28 @@ export class DocumentUnderstandingServiceClient { * The promise has a method named "cancel" which cancels the ongoing API call. */ processDocument( - request: protosTypes.google.cloud.documentai.v1beta2.IProcessDocumentRequest, + request: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest, optionsOrCallback?: | gax.CallOptions | Callback< - protosTypes.google.cloud.documentai.v1beta2.IDocument, - | protosTypes.google.cloud.documentai.v1beta2.IProcessDocumentRequest + protos.google.cloud.documentai.v1beta2.IDocument, + | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest + | null | undefined, - {} | undefined + {} | null | undefined >, callback?: Callback< - protosTypes.google.cloud.documentai.v1beta2.IDocument, - | protosTypes.google.cloud.documentai.v1beta2.IProcessDocumentRequest + protos.google.cloud.documentai.v1beta2.IDocument, + | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest + | null | undefined, - {} | undefined + {} | null | undefined > ): Promise< [ - protosTypes.google.cloud.documentai.v1beta2.IDocument, + protos.google.cloud.documentai.v1beta2.IDocument, ( - | protosTypes.google.cloud.documentai.v1beta2.IProcessDocumentRequest + | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest | undefined ), {} | undefined @@ -426,32 +435,43 @@ export class DocumentUnderstandingServiceClient { parent: request.parent || '', }); this.initialize(); - return this._innerApiCalls.processDocument(request, options, callback); + return this.innerApiCalls.processDocument(request, options, callback); } batchProcessDocuments( - request: protosTypes.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, + request: protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, options?: gax.CallOptions ): Promise< [ LROperation< - protosTypes.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, - protosTypes.google.cloud.documentai.v1beta2.IOperationMetadata + protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta2.IOperationMetadata >, - protosTypes.google.longrunning.IOperation | undefined, + protos.google.longrunning.IOperation | undefined, {} | undefined ] >; batchProcessDocuments( - request: protosTypes.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, + request: protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, options: gax.CallOptions, callback: Callback< LROperation< - protosTypes.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, - protosTypes.google.cloud.documentai.v1beta2.IOperationMetadata + protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta2.IOperationMetadata >, - protosTypes.google.longrunning.IOperation | undefined, - {} | undefined + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchProcessDocuments( + request: protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined > ): void; /** @@ -475,32 +495,32 @@ export class DocumentUnderstandingServiceClient { * The promise has a method named "cancel" which cancels the ongoing API call. */ batchProcessDocuments( - request: protosTypes.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, + request: protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, optionsOrCallback?: | gax.CallOptions | Callback< LROperation< - protosTypes.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, - protosTypes.google.cloud.documentai.v1beta2.IOperationMetadata + protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta2.IOperationMetadata >, - protosTypes.google.longrunning.IOperation | undefined, - {} | undefined + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined >, callback?: Callback< LROperation< - protosTypes.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, - protosTypes.google.cloud.documentai.v1beta2.IOperationMetadata + protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta2.IOperationMetadata >, - protosTypes.google.longrunning.IOperation | undefined, - {} | undefined + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined > ): Promise< [ LROperation< - protosTypes.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, - protosTypes.google.cloud.documentai.v1beta2.IOperationMetadata + protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta2.IOperationMetadata >, - protosTypes.google.longrunning.IOperation | undefined, + protos.google.longrunning.IOperation | undefined, {} | undefined ] > | void { @@ -521,11 +541,7 @@ export class DocumentUnderstandingServiceClient { parent: request.parent || '', }); this.initialize(); - return this._innerApiCalls.batchProcessDocuments( - request, - options, - callback - ); + return this.innerApiCalls.batchProcessDocuments(request, options, callback); } /** diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 5bc15edbdd1..29f3e14428d 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -1,23 +1,5 @@ { - "updateTime": "2020-03-22T11:26:56.743018Z", - "sources": [ - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "0be7105dc52590fa9a24e784052298ae37ce53aa", - "internalRef": "302154871", - "log": "0be7105dc52590fa9a24e784052298ae37ce53aa\nAdd BUILD.bazel file to asset/v1p1beta1\n\nPiperOrigin-RevId: 302154871\n\n6c248fd13e8543f8d22cbf118d978301a9fbe2a8\nAdd missing resource annotations and additional_bindings to dialogflow v2 API.\n\nPiperOrigin-RevId: 302063117\n\n9a3a7f33be9eeacf7b3e98435816b7022d206bd7\nChange the service name from \"chromeos-moblab.googleapis.com\" to \"chromeosmoblab.googleapis.com\"\n\nPiperOrigin-RevId: 302060989\n\n98a339237577e3de26cb4921f75fb5c57cc7a19f\nfeat: devtools/build/v1 publish client library config annotations\n\n* add details field to some of the BuildEvents\n* add final_invocation_id and build_tool_exit_code fields to BuildStatus\n\nPiperOrigin-RevId: 302044087\n\ncfabc98c6bbbb22d1aeaf7612179c0be193b3a13\nfeat: home/graph/v1 publish client library config annotations & comment updates\n\nThis change includes adding the client library configuration annotations, updated proto comments, and some client library configuration files.\n\nPiperOrigin-RevId: 302042647\n\nc8c8c0bd15d082db9546253dbaad1087c7a9782c\nchore: use latest gapic-generator in bazel WORKSPACE.\nincluding the following commits from gapic-generator:\n- feat: take source protos in all sub-packages (#3144)\n\nPiperOrigin-RevId: 301843591\n\ne4daf5202ea31cb2cb6916fdbfa9d6bd771aeb4c\nAdd bazel file for v1 client lib generation\n\nPiperOrigin-RevId: 301802926\n\n" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "7e98e1609c91082f4eeb63b530c6468aefd18cfd" - } - } - ], + "updateTime": "2020-04-01T23:46:49.301803Z", "destinations": [ { "client": { diff --git a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js index 2a711d0a2cb..6a68e96358b 100644 --- a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js @@ -16,7 +16,6 @@ // ** 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 documentai = require('@google-cloud/documentai'); diff --git a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts index 9a088a56e0d..042f6d5bd49 100644 --- a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts @@ -19,7 +19,7 @@ import {DocumentUnderstandingServiceClient} from '@google-cloud/documentai'; function main() { - const documentUnderstandingServiceClient = new DocumentUnderstandingServiceClient(); + new DocumentUnderstandingServiceClient(); } main(); diff --git a/packages/google-cloud-documentai/test/gapic-document_understanding_service-v1beta2.ts b/packages/google-cloud-documentai/test/gapic-document_understanding_service-v1beta2.ts deleted file mode 100644 index 6dd8f9b4a46..00000000000 --- a/packages/google-cloud-documentai/test/gapic-document_understanding_service-v1beta2.ts +++ /dev/null @@ -1,260 +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 -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT 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 protosTypes from '../protos/protos'; -import * as assert from 'assert'; -import {describe, it} from 'mocha'; -const documentunderstandingserviceModule = require('../src'); - -const FAKE_STATUS_CODE = 1; -class FakeError { - name: string; - message: string; - code: number; - constructor(n: number) { - this.name = 'fakeName'; - this.message = 'fake message'; - this.code = n; - } -} -const error = new FakeError(FAKE_STATUS_CODE); -export interface Callback { - (err: FakeError | null, response?: {} | null): void; -} - -export class Operation { - constructor() {} - promise() {} -} -function mockSimpleGrpcMethod( - expectedRequest: {}, - response: {} | null, - error: FakeError | null -) { - return (actualRequest: {}, options: {}, callback: Callback) => { - assert.deepStrictEqual(actualRequest, expectedRequest); - if (error) { - callback(error); - } else if (response) { - callback(null, response); - } else { - callback(null); - } - }; -} -function mockLongRunningGrpcMethod( - expectedRequest: {}, - response: {} | null, - error?: {} | null -) { - return (request: {}) => { - assert.deepStrictEqual(request, expectedRequest); - const mockOperation = { - promise() { - return new Promise((resolve, reject) => { - if (error) { - reject(error); - } else { - resolve([response]); - } - }); - }, - }; - return Promise.resolve([mockOperation]); - }; -} -describe('v1beta2.DocumentUnderstandingServiceClient', () => { - it('has servicePath', () => { - const servicePath = - documentunderstandingserviceModule.v1beta2 - .DocumentUnderstandingServiceClient.servicePath; - assert(servicePath); - }); - it('has apiEndpoint', () => { - const apiEndpoint = - documentunderstandingserviceModule.v1beta2 - .DocumentUnderstandingServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - it('has port', () => { - const port = - documentunderstandingserviceModule.v1beta2 - .DocumentUnderstandingServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - it('should create a client with no option', () => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient(); - assert(client); - }); - it('should create a client with gRPC fallback', () => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - fallback: true, - } - ); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - assert.strictEqual(client.documentUnderstandingServiceStub, undefined); - await client.initialize(); - assert(client.documentUnderstandingServiceStub); - }); - it('has close method', () => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.close(); - }); - describe('processDocument', () => { - it('invokes processDocument without error', done => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.documentai.v1beta2.IProcessDocumentRequest = {}; - request.parent = ''; - // Mock response - const expectedResponse = {}; - // Mock gRPC layer - client._innerApiCalls.processDocument = mockSimpleGrpcMethod( - request, - expectedResponse, - null - ); - client.processDocument(request, (err: {}, response: {}) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes processDocument with error', done => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.documentai.v1beta2.IProcessDocumentRequest = {}; - request.parent = ''; - // Mock response - const expectedResponse = {}; - // Mock gRPC layer - client._innerApiCalls.processDocument = mockSimpleGrpcMethod( - request, - null, - error - ); - client.processDocument(request, (err: FakeError, response: {}) => { - assert(err instanceof FakeError); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - describe('batchProcessDocuments', () => { - it('invokes batchProcessDocuments without error', done => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest = {}; - request.parent = ''; - // Mock response - const expectedResponse = {}; - // Mock gRPC layer - client._innerApiCalls.batchProcessDocuments = mockLongRunningGrpcMethod( - request, - expectedResponse - ); - client - .batchProcessDocuments(request) - .then((responses: [Operation]) => { - const operation = responses[0]; - return operation ? operation.promise() : {}; - }) - .then((responses: [Operation]) => { - assert.deepStrictEqual(responses[0], expectedResponse); - done(); - }) - .catch((err: {}) => { - done(err); - }); - }); - - it('invokes batchProcessDocuments with error', done => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest = {}; - request.parent = ''; - // Mock response - const expectedResponse = {}; - // Mock gRPC layer - client._innerApiCalls.batchProcessDocuments = mockLongRunningGrpcMethod( - request, - null, - error - ); - client - .batchProcessDocuments(request) - .then((responses: [Operation]) => { - const operation = responses[0]; - return operation ? operation.promise() : {}; - }) - .then(() => { - assert.fail(); - }) - .catch((err: FakeError) => { - assert(err instanceof FakeError); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - }); -}); diff --git a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts new file mode 100644 index 00000000000..fa6b1941832 --- /dev/null +++ b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts @@ -0,0 +1,468 @@ +// 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 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 documentunderstandingserviceModule from '../src'; + +import {protobuf, LROperation} 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('v1beta2.DocumentUnderstandingServiceClient', () => { + it('has servicePath', () => { + const servicePath = + documentunderstandingserviceModule.v1beta2 + .DocumentUnderstandingServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + documentunderstandingserviceModule.v1beta2 + .DocumentUnderstandingServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = + documentunderstandingserviceModule.v1beta2 + .DocumentUnderstandingServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + fallback: true, + } + ); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.documentUnderstandingServiceStub, undefined); + await client.initialize(); + assert(client.documentUnderstandingServiceStub); + }); + + it('has close method', () => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + 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 documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + 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('processDocument', () => { + it('invokes processDocument without error', async () => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta2.ProcessDocumentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1beta2.Document() + ); + client.innerApiCalls.processDocument = stubSimpleCall(expectedResponse); + const [response] = await client.processDocument(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.processDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes processDocument without error using callback', async () => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta2.ProcessDocumentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1beta2.Document() + ); + client.innerApiCalls.processDocument = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.processDocument( + request, + ( + err?: Error | null, + result?: protos.google.cloud.documentai.v1beta2.IDocument | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.processDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes processDocument with error', async () => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta2.ProcessDocumentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.processDocument = stubSimpleCall( + undefined, + expectedError + ); + assert.rejects(async () => { + await client.processDocument(request); + }, expectedError); + assert( + (client.innerApiCalls.processDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('batchProcessDocuments', () => { + it('invokes batchProcessDocuments without error', async () => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.batchProcessDocuments(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes batchProcessDocuments without error using callback', async () => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchProcessDocuments = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.batchProcessDocuments( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta2.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta2.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes batchProcessDocuments with call error', async () => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( + undefined, + expectedError + ); + assert.rejects(async () => { + await client.batchProcessDocuments(request); + }, expectedError); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes batchProcessDocuments with LRO error', async () => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchProcessDocuments(request); + assert.rejects(async () => { + await operation.promise(); + }, expectedError); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); +}); diff --git a/packages/google-cloud-documentai/webpack.config.js b/packages/google-cloud-documentai/webpack.config.js index d1bfada9a69..cd5a3fe7a3c 100644 --- a/packages/google-cloud-documentai/webpack.config.js +++ b/packages/google-cloud-documentai/webpack.config.js @@ -36,27 +36,27 @@ module.exports = { { test: /\.tsx?$/, use: 'ts-loader', - exclude: /node_modules/ + exclude: /node_modules/, }, { test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' + use: 'null-loader', }, { test: /node_modules[\\/]grpc/, - use: 'null-loader' + use: 'null-loader', }, { test: /node_modules[\\/]retry-request/, - use: 'null-loader' + use: 'null-loader', }, { test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' + use: 'null-loader', }, { test: /node_modules[\\/]gtoken/, - use: 'null-loader' + use: 'null-loader', }, ], }, From b20cf8f1209bc1ea82086304daca9226f09be893 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Sun, 5 Apr 2020 12:46:35 -0700 Subject: [PATCH 012/213] chore: remove duplicate mocha config (#32) --- packages/google-cloud-documentai/.mocharc.json | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 packages/google-cloud-documentai/.mocharc.json diff --git a/packages/google-cloud-documentai/.mocharc.json b/packages/google-cloud-documentai/.mocharc.json deleted file mode 100644 index 670c5e2c24b..00000000000 --- a/packages/google-cloud-documentai/.mocharc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} From 3ac4845e82c1ae4d3a6e8023e496320b8f153673 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 7 Apr 2020 19:16:27 +0200 Subject: [PATCH 013/213] chore(deps): update dependency @types/mocha (#18) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@types/mocha](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | devDependencies | major | [`^5.2.7` -> `^7.0.0`](https://renovatebot.com/diffs/npm/@types%2fmocha/5.2.7/7.0.2) | | [mocha](https://mochajs.org/) ([source](https://togithub.com/mochajs/mocha)) | devDependencies | major | [`^6.2.0` -> `^7.0.0`](https://renovatebot.com/diffs/npm/mocha/6.2.3/7.1.1) | --- ### Release Notes
mochajs/mocha ### [`v7.1.1`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​711--2020-03-18) [Compare Source](https://togithub.com/mochajs/mocha/compare/v7.1.0...v7.1.1) #### :lock: Security Fixes - [#​4204](https://togithub.com/mochajs/mocha/issues/4204): Update dependencies mkdirp, yargs-parser and yargs ([**@​juergba**](https://togithub.com/juergba)) #### :bug: Fixes - [#​3660](https://togithub.com/mochajs/mocha/issues/3660): Fix `runner` listening to `start` and `end` events ([**@​juergba**](https://togithub.com/juergba)) #### :book: Documentation - [#​4190](https://togithub.com/mochajs/mocha/issues/4190): Show Netlify badge on footer ([**@​outsideris**](https://togithub.com/outsideris)) ### [`v7.1.0`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​710--2020-02-26) [Compare Source](https://togithub.com/mochajs/mocha/compare/v7.0.1...v7.1.0) #### :tada: Enhancements [#​4038](https://togithub.com/mochajs/mocha/issues/4038): Add Node.js native ESM support ([**@​giltayar**](https://togithub.com/giltayar)) Mocha supports writing your test files as ES modules: - Node.js only v12.11.0 and above - Node.js below v13.2.0, you must set `--experimental-modules` option - current limitations: please check our [documentation](https://mochajs.org/#nodejs-native-esm-support) - for programmatic usage: see [API: loadFilesAsync()](https://mochajs.org/api/mocha#loadFilesAsync) **Note:** Node.JS native [ECMAScript Modules](https://nodejs.org/api/esm.html) implementation has status: **Stability: 1 - Experimental** #### :bug: Fixes - [#​4181](https://togithub.com/mochajs/mocha/issues/4181): Programmatic API cannot access retried test objects ([**@​juergba**](https://togithub.com/juergba)) - [#​4174](https://togithub.com/mochajs/mocha/issues/4174): Browser: fix `allowUncaught` option ([**@​juergba**](https://togithub.com/juergba)) #### :book: Documentation - [#​4058](https://togithub.com/mochajs/mocha/issues/4058): Manage author list in AUTHORS instead of `package.json` ([**@​outsideris**](https://togithub.com/outsideris)) #### :nut_and_bolt: Other - [#​4138](https://togithub.com/mochajs/mocha/issues/4138): Upgrade ESLint v6.8 ([**@​kaicataldo**](https://togithub.com/kaicataldo)) ### [`v7.0.1`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​701--2020-01-25) [Compare Source](https://togithub.com/mochajs/mocha/compare/v7.0.0...v7.0.1) #### :bug: Fixes - [#​4165](https://togithub.com/mochajs/mocha/issues/4165): Fix exception when skipping tests programmatically ([**@​juergba**](https://togithub.com/juergba)) - [#​4153](https://togithub.com/mochajs/mocha/issues/4153): Restore backwards compatibility for `reporterOptions` ([**@​holm**](https://togithub.com/holm)) - [#​4150](https://togithub.com/mochajs/mocha/issues/4150): Fix recovery of an open test upon uncaught exception ([**@​juergba**](https://togithub.com/juergba)) - [#​4147](https://togithub.com/mochajs/mocha/issues/4147): Fix regression of leaking uncaught exception handler ([**@​juergba**](https://togithub.com/juergba)) #### :book: Documentation - [#​4146](https://togithub.com/mochajs/mocha/issues/4146): Update copyright & trademark notices per OJSF ([**@​boneskull**](https://togithub.com/boneskull)) - [#​4140](https://togithub.com/mochajs/mocha/issues/4140): Fix broken links ([**@​KyoungWan**](https://togithub.com/KyoungWan)) #### :nut_and_bolt: Other - [#​4133](https://togithub.com/mochajs/mocha/issues/4133): Print more descriptive error message ([**@​Zirak**](https://togithub.com/Zirak)) ### [`v7.0.0`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​700--2020-01-05) [Compare Source](https://togithub.com/mochajs/mocha/compare/v6.2.3...v7.0.0) #### :boom: Breaking Changes - [#​3885](https://togithub.com/mochajs/mocha/issues/3885): **Drop Node.js v6.x support** ([**@​mojosoeun**](https://togithub.com/mojosoeun)) - [#​3890](https://togithub.com/mochajs/mocha/issues/3890): Remove Node.js debug-related flags `--debug`/`--debug-brk` and deprecate `debug` argument ([**@​juergba**](https://togithub.com/juergba)) - [#​3962](https://togithub.com/mochajs/mocha/issues/3962): Changes to command-line options ([**@​ParkSB**](https://togithub.com/ParkSB)): - `--list-interfaces` replaces `--interfaces` - `--list-reporters` replaces `--reporters` - Hook pattern of `this.skip()` ([**@​juergba**](https://togithub.com/juergba)): - [#​3859](https://togithub.com/mochajs/mocha/issues/3859): When conditionally skipping in a `it` test, related `afterEach` hooks are now executed - [#​3741](https://togithub.com/mochajs/mocha/issues/3741): When conditionally skipping in a `beforeEach` hook, subsequent inner `beforeEach` hooks are now skipped and related `afterEach` hooks are executed - [#​4136](https://togithub.com/mochajs/mocha/issues/4136): Disallow `this.skip()` within `after` hooks - [#​3967](https://togithub.com/mochajs/mocha/issues/3967): Remove deprecated `getOptions()` and `lib/cli/options.js` ([**@​juergba**](https://togithub.com/juergba)) - [#​4083](https://togithub.com/mochajs/mocha/issues/4083): Uncaught exception in `pending` test: don't swallow, but retrospectively fail the test for correct exit code ([**@​juergba**](https://togithub.com/juergba)) - [#​4004](https://togithub.com/mochajs/mocha/issues/4004): Align `Mocha` constructor's option names with command-line options ([**@​juergba**](https://togithub.com/juergba)) #### :tada: Enhancements - [#​3980](https://togithub.com/mochajs/mocha/issues/3980): Refactor and improve `--watch` mode with chokidar ([**@​geigerzaehler**](https://togithub.com/geigerzaehler)): - adds command-line options `--watch-files` and `--watch-ignore` - removes `--watch-extensions` - [#​3979](https://togithub.com/mochajs/mocha/issues/3979): Type "rs\\n" to restart tests ([**@​broofa**](https://togithub.com/broofa)) #### :fax: Deprecations These are _soft_-deprecated, and will emit a warning upon use. Support will be removed in (likely) the next major version of Mocha: - [#​3968](https://togithub.com/mochajs/mocha/issues/3968): Deprecate legacy configuration via `mocha.opts` ([**@​juergba**](https://togithub.com/juergba)) #### :bug: Fixes - [#​4125](https://togithub.com/mochajs/mocha/issues/4125): Fix timeout handling with `--inspect-brk`/`--inspect` ([**@​juergba**](https://togithub.com/juergba)) - [#​4070](https://togithub.com/mochajs/mocha/issues/4070): `Mocha` constructor: improve browser setup ([**@​juergba**](https://togithub.com/juergba)) - [#​4068](https://togithub.com/mochajs/mocha/issues/4068): XUnit reporter should handle exceptions during diff generation ([**@​rgroothuijsen**](https://togithub.com/rgroothuijsen)) - [#​4030](https://togithub.com/mochajs/mocha/issues/4030): Fix `--allow-uncaught` with `this.skip()` ([**@​juergba**](https://togithub.com/juergba)) #### :mag: Coverage - [#​4109](https://togithub.com/mochajs/mocha/issues/4109): Add Node.js v13.x to CI test matrix ([**@​juergba**](https://togithub.com/juergba)) #### :book: Documentation - [#​4129](https://togithub.com/mochajs/mocha/issues/4129): Fix broken links ([**@​SaeromB**](https://togithub.com/SaeromB)) - [#​4127](https://togithub.com/mochajs/mocha/issues/4127): Add reporter alias names to docs ([**@​khg0712**](https://togithub.com/khg0712)) - [#​4101](https://togithub.com/mochajs/mocha/issues/4101): Clarify invalid usage of `done()` ([**@​jgehrcke**](https://togithub.com/jgehrcke)) - [#​4092](https://togithub.com/mochajs/mocha/issues/4092): Replace `:coffee:` with emoji ☕️ ([**@​pzrq**](https://togithub.com/pzrq)) - [#​4088](https://togithub.com/mochajs/mocha/issues/4088): Initial draft of project charter ([**@​boneskull**](https://togithub.com/boneskull)) - [#​4066](https://togithub.com/mochajs/mocha/issues/4066): Change `sh` to `bash` for code block in docs/index.md ([**@​HyunSangHan**](https://togithub.com/HyunSangHan)) - [#​4045](https://togithub.com/mochajs/mocha/issues/4045): Update README.md concerning GraphicsMagick installation ([**@​HyunSangHan**](https://togithub.com/HyunSangHan)) - [#​3988](https://togithub.com/mochajs/mocha/issues/3988): Fix sponsors background color for readability ([**@​outsideris**](https://togithub.com/outsideris)) #### :nut_and_bolt: Other - [#​4118](https://togithub.com/mochajs/mocha/issues/4118): Update node-environment-flags to 1.0.6 ([**@​kylef**](https://togithub.com/kylef)) - [#​4097](https://togithub.com/mochajs/mocha/issues/4097): Add GH Funding Metadata ([**@​SheetJSDev**](https://togithub.com/SheetJSDev)) - [#​4089](https://togithub.com/mochajs/mocha/issues/4089): Add funding information to `package.json` ([**@​Munter**](https://togithub.com/Munter)) - [#​4077](https://togithub.com/mochajs/mocha/issues/4077): Improve integration tests ([**@​soobing**](https://togithub.com/soobing))
--- ### 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. :ghost: **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/config-help/issues) if that's undesired. --- - [ ] 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#googleapis/nodejs-document-ai). --- packages/google-cloud-documentai/package.json | 4 ++-- packages/google-cloud-documentai/samples/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 46155c049f4..2f4e0fa0697 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -32,7 +32,7 @@ "run": "^1.4.0" }, "devDependencies": { - "@types/mocha": "^5.2.7", + "@types/mocha": "^7.0.0", "@types/node": "^12.12.29", "@types/sinon": "^9.0.0", "c8": "^7.1.0", @@ -46,7 +46,7 @@ "jsdoc-fresh": "^1.0.2", "jsdoc-region-tag": "^1.0.4", "linkinator": "^2.0.3", - "mocha": "^6.2.2", + "mocha": "^7.0.0", "null-loader": "^3.0.0", "pack-n-play": "^1.0.0-2", "prettier": "^1.19.1", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index f6b60880246..c2839578100 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -18,6 +18,6 @@ }, "devDependencies": { "chai": "^4.2.0", - "mocha": "^6.2.0" + "mocha": "^7.0.0" } } From a64af0c2833cead505157005f607566f6d2abd3c Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Wed, 8 Apr 2020 14:40:10 -0700 Subject: [PATCH 014/213] chore: update region tags (#33) --- packages/google-cloud-documentai/samples/quickstart.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/samples/quickstart.js b/packages/google-cloud-documentai/samples/quickstart.js index a6bef04db8c..25e391f7e2a 100644 --- a/packages/google-cloud-documentai/samples/quickstart.js +++ b/packages/google-cloud-documentai/samples/quickstart.js @@ -26,7 +26,7 @@ async function main( location, gcsInputUri = 'gs://cloud-samples-data/documentai/invoice.pdf' ) { - // [START document_quickstart] + // [START documentai_quickstart] /** * TODO(developer): Uncomment these variables before running the sample. */ @@ -73,7 +73,7 @@ async function main( console.log(`Entity mention text: ${entity.mentionText}`); } } - // [END document_quickstart] + // [END documentai_quickstart] await quickstart(); } From f28ff12e31c9ca52ab92e2a3de48b99d8a127dad Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Sun, 12 Apr 2020 07:35:25 -0700 Subject: [PATCH 015/213] fix(samples): do not pass location (#39) --- packages/google-cloud-documentai/samples/quickstart.js | 5 +---- .../google-cloud-documentai/samples/test/quickstart.test.js | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-documentai/samples/quickstart.js b/packages/google-cloud-documentai/samples/quickstart.js index 25e391f7e2a..9741973141d 100644 --- a/packages/google-cloud-documentai/samples/quickstart.js +++ b/packages/google-cloud-documentai/samples/quickstart.js @@ -18,12 +18,10 @@ /** * Process a single PDF. * @param {string} projectId your Google Cloud project ID - * @param {string} location region to use for this operation * @param {string} gcsInputUri Cloud Storage URI of the PDF document to parse */ async function main( projectId, - location, gcsInputUri = 'gs://cloud-samples-data/documentai/invoice.pdf' ) { // [START documentai_quickstart] @@ -31,7 +29,6 @@ async function main( * TODO(developer): Uncomment these variables before running the sample. */ // const projectId = 'YOUR_PROJECT_ID'; - // const location = 'YOUR_PROJECT_LOCATION'; // const gcsInputUri = 'YOUR_SOURCE_PDF'; const { @@ -41,7 +38,7 @@ async function main( async function quickstart() { // Configure the request for processing the PDF - const parent = `projects/${projectId}/locations/${location}`; + const parent = `projects/${projectId}`; const request = { parent, inputConfig: { diff --git a/packages/google-cloud-documentai/samples/test/quickstart.test.js b/packages/google-cloud-documentai/samples/test/quickstart.test.js index 9a32e02e777..63c2285ba69 100644 --- a/packages/google-cloud-documentai/samples/test/quickstart.test.js +++ b/packages/google-cloud-documentai/samples/test/quickstart.test.js @@ -23,11 +23,10 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const cwd = path.join(__dirname, '..'); const projectId = process.env.GCLOUD_PROJECT; -const LOCATION = 'us-central1'; describe('Quickstart', () => { it('should run quickstart', async () => { - const stdout = execSync(`node ./quickstart.js ${projectId} ${LOCATION}`, { + const stdout = execSync(`node ./quickstart.js ${projectId}`, { cwd, }); assert.match(stdout, /Entity/); From 15c4dde54a8532137736f3228824e5a311009eb9 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sun, 12 Apr 2020 17:28:07 +0200 Subject: [PATCH 016/213] chore(deps): update dependency gts to v2.0.0 (#36) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [gts](https://togithub.com/google/gts) | devDependencies | patch | [`2.0.0-alpha.9` -> `2.0.0`](https://renovatebot.com/diffs/npm/gts/2.0.0-alpha.9/2.0.0) | --- ### Release Notes
google/gts ### [`v2.0.0`](https://togithub.com/google/gts/blob/master/CHANGELOG.md#​200-httpswwwgithubcomgooglegtscomparev112v200-2020-04-02) [Compare Source](https://togithub.com/google/gts/compare/39a2705e51b4b6329a70f91f8293a2d7a363bf5d...v2.0.0) ##### ⚠ BREAKING CHANGES ⚠ This is a major rewrite of the tool. Based on community guidance, we've switched from using [tslint](https://palantir.github.io/tslint/) to [eslint](https://eslint.org/). _Please read all of the steps below to upgrade_. ##### Configuring `eslint` With the shift to `eslint`, `gts` now will format and lint JavaScript _as well_ as TypeScript. Upgrading will require a number of manual steps. To format JavaScript and TypeScript, you can run: $ npx gts fix To specify only TypeScript: $ npx gts fix '**/*.ts' ##### Delete `tslint.json` This file is no longer used, and can lead to confusion. ##### Create a `.eslintrc.json` Now that we're using eslint, you need to extend the eslint configuration baked into the module. Create a new file named `.eslintrc.json`, and paste the following: ```js { "extends": "./node_modules/gts" } ``` ##### Create a `.eslintignore` The `.eslintignore` file lets you ignore specific directories. This tool now lints and formats JavaScript, so it's _really_ important to ignore your build directory! Here is an example of a `.eslintignore` file: **/node_modules build/ ##### Rule changes The underlying linter was changed, so naturally there are going to be a variety of rule changes along the way. To see the full list, check out [.eslintrc.json](https://togithub.com/google/gts/blob/master/.eslintrc.json). ##### Require Node.js 10.x and up Node.js 8.x is now end of life - this module now requires Ndoe.js 10.x and up. ##### Features - add the eol-last rule ([#​425](https://www.github.com/google/gts/issues/425)) ([50ebd4d](https://www.github.com/google/gts/commit/50ebd4dbaf063615f4c025f567ca28076a734223)) - allow eslintrc to run over tsx files ([#​469](https://www.github.com/google/gts/issues/469)) ([a21db94](https://www.github.com/google/gts/commit/a21db94601def563952d677cb0980a12b6730f4c)) - disable global rule for checking TODO comments ([#​459](https://www.github.com/google/gts/issues/459)) ([96aa84a](https://www.github.com/google/gts/commit/96aa84a0a42181046daa248750cc8fef0c320619)) - override require-atomic-updates ([#​468](https://www.github.com/google/gts/issues/468)) ([8105c93](https://www.github.com/google/gts/commit/8105c9334ee5104b05f6b1b2f150e51419637262)) - prefer single quotes if possible ([#​475](https://www.github.com/google/gts/issues/475)) ([39a2705](https://www.github.com/google/gts/commit/39a2705e51b4b6329a70f91f8293a2d7a363bf5d)) - use eslint instead of tslint ([#​400](https://www.github.com/google/gts/issues/400)) ([b3096fb](https://www.github.com/google/gts/commit/b3096fbd5076d302d93c2307bf627e12c423e726)) ##### Bug Fixes - use .prettierrc.js ([#​437](https://www.github.com/google/gts/issues/437)) ([06efa84](https://www.github.com/google/gts/commit/06efa8444cdf1064b64f3e8d61ebd04f45d90b4c)) - **deps:** update dependency chalk to v4 ([#​477](https://www.github.com/google/gts/issues/477)) ([061d64e](https://www.github.com/google/gts/commit/061d64e29d37b93ce55228937cc100e05ddef352)) - **deps:** update dependency eslint-plugin-node to v11 ([#​426](https://www.github.com/google/gts/issues/426)) ([a394b7c](https://www.github.com/google/gts/commit/a394b7c1f80437f25017ca5c500b968ebb789ece)) - **deps:** update dependency execa to v4 ([#​427](https://www.github.com/google/gts/issues/427)) ([f42ef36](https://www.github.com/google/gts/commit/f42ef36709251553342e655e287e889df72ee3e3)) - **deps:** update dependency prettier to v2 ([#​464](https://www.github.com/google/gts/issues/464)) ([20ef43d](https://www.github.com/google/gts/commit/20ef43d566df17d3c93949ef7db3b72ee9123ca3)) - disable no-use-before-define ([#​431](https://www.github.com/google/gts/issues/431)) ([dea2c22](https://www.github.com/google/gts/commit/dea2c223d1d3a60a1786aa820eebb93be27016a7)) - **deps:** update dependency update-notifier to v4 ([#​403](https://www.github.com/google/gts/issues/403)) ([57393b7](https://www.github.com/google/gts/commit/57393b74c6cf299e8ae09311f0382226b8baa3e3)) - **deps:** upgrade to meow 6.x ([#​423](https://www.github.com/google/gts/issues/423)) ([8f93d00](https://www.github.com/google/gts/commit/8f93d0049337a832d9a22b6ae4e86fd41140ec56)) - align back to the google style guide ([#​440](https://www.github.com/google/gts/issues/440)) ([8bd78c4](https://www.github.com/google/gts/commit/8bd78c4c78526a72400f618a95a987d2a7c1a8db)) - disable empty-function check ([#​467](https://www.github.com/google/gts/issues/467)) ([6455d7a](https://www.github.com/google/gts/commit/6455d7a9d227320d3ffe1b00c9c739b846f339a8)) - drop support for node 8 ([#​422](https://www.github.com/google/gts/issues/422)) ([888c686](https://www.github.com/google/gts/commit/888c68692079065f38ce66ec84472f1f3311a050)) - emit .prettierrc.js with init ([#​462](https://www.github.com/google/gts/issues/462)) ([b114614](https://www.github.com/google/gts/commit/b114614d22ab5560d2d1dd5cb6695968cc80027b)) - enable trailing comma ([#​470](https://www.github.com/google/gts/issues/470)) ([6518f58](https://www.github.com/google/gts/commit/6518f5843d3093e3beb7d3371b56d9aecedf3924)) - include _.tsx and _.jsx in default fix command ([#​473](https://www.github.com/google/gts/issues/473)) ([0509780](https://www.github.com/google/gts/commit/050978005ad089d9b3b5d8895b25ea1175d75db2)) ##### [1.1.2](https://www.github.com/google/gts/compare/v1.1.1...v1.1.2) (2019-11-20) ##### Bug Fixes - **deps:** update to newest prettier (with support for optional chain) ([#​396](https://www.github.com/google/gts/issues/396)) ([ce8ad06](https://www.github.com/google/gts/commit/ce8ad06c8489c44a9e2ed5292382637b3ebb7601)) ##### [1.1.1](https://www.github.com/google/gts/compare/v1.1.0...v1.1.1) (2019-11-11) ##### Bug Fixes - **deps:** update dependency chalk to v3 ([#​389](https://www.github.com/google/gts/issues/389)) ([1ce0f45](https://www.github.com/google/gts/commit/1ce0f450677e143a27efc39def617d13c66503e8)) - **deps:** update dependency inquirer to v7 ([#​377](https://www.github.com/google/gts/issues/377)) ([bf2c349](https://www.github.com/google/gts/commit/bf2c349b2208ac63e551542599ac9cd27b461338)) - **deps:** update dependency rimraf to v3 ([#​374](https://www.github.com/google/gts/issues/374)) ([2058eaa](https://www.github.com/google/gts/commit/2058eaa682f4baae978b469fd708d1f866e7da74)) - **deps:** update dependency write-file-atomic to v3 ([#​353](https://www.github.com/google/gts/issues/353)) ([59e6aa8](https://www.github.com/google/gts/commit/59e6aa8580a2f8e9457d2d2b6fa9e18e86347592))
--- ### 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#googleapis/nodejs-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 2f4e0fa0697..74683aae8bd 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -41,7 +41,7 @@ "eslint-config-prettier": "^6.10.0", "eslint-plugin-node": "^11.0.0", "eslint-plugin-prettier": "^3.1.2", - "gts": "2.0.0-alpha.9", + "gts": "2.0.0", "jsdoc": "^3.6.3", "jsdoc-fresh": "^1.0.2", "jsdoc-region-tag": "^1.0.4", From 028ced1e1d61dbea5af9fa063838f80a2eaeff36 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Sun, 12 Apr 2020 08:56:02 -0700 Subject: [PATCH 017/213] build: set AUTOSYNTH_MULTIPLE_COMMITS=true for context aware commits (#28) Co-authored-by: Alexander Fenster Co-authored-by: Justin Beckwith --- packages/google-cloud-documentai/synth.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/google-cloud-documentai/synth.py b/packages/google-cloud-documentai/synth.py index e52139887fb..5254c834708 100644 --- a/packages/google-cloud-documentai/synth.py +++ b/packages/google-cloud-documentai/synth.py @@ -20,6 +20,9 @@ logging.basicConfig(level=logging.DEBUG) +AUTOSYNTH_MULTIPLE_COMMITS = True + + # run the gapic generator gapic = gcp.GAPICMicrogenerator() versions = ['v1beta2'] From 563aa0ca8f66dc57387cc1d60b960fc3fbcf059b Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Sun, 12 Apr 2020 09:11:10 -0700 Subject: [PATCH 018/213] build: remove unused codecov config (#38) --- packages/google-cloud-documentai/codecov.yaml | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 packages/google-cloud-documentai/codecov.yaml diff --git a/packages/google-cloud-documentai/codecov.yaml b/packages/google-cloud-documentai/codecov.yaml deleted file mode 100644 index 5724ea9478d..00000000000 --- a/packages/google-cloud-documentai/codecov.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -codecov: - ci: - - source.cloud.google.com From 2a78af67cf009e9e6cd2cf29fcdedd1f61b19872 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Sun, 12 Apr 2020 09:22:01 -0700 Subject: [PATCH 019/213] fix: remove eslint, update gax, fix generated protos, run the generator (#37) Run the latest version of the generator, update google-gax, update gts, and remove direct dependencies on eslint. Co-authored-by: Justin Beckwith --- packages/google-cloud-documentai/.jsdoc.js | 2 +- packages/google-cloud-documentai/.prettierrc.js | 2 +- packages/google-cloud-documentai/package.json | 12 ++++-------- .../google-cloud-documentai/protos/protos.json | 16 ++++++++++++---- packages/google-cloud-documentai/synth.metadata | 11 ++++++++++- packages/google-cloud-documentai/synth.py | 2 +- ...pic_document_understanding_service_v1beta2.ts | 6 +++--- 7 files changed, 32 insertions(+), 19 deletions(-) diff --git a/packages/google-cloud-documentai/.jsdoc.js b/packages/google-cloud-documentai/.jsdoc.js index 6eee4dc629e..8b9a4964b53 100644 --- a/packages/google-cloud-documentai/.jsdoc.js +++ b/packages/google-cloud-documentai/.jsdoc.js @@ -40,7 +40,7 @@ module.exports = { includePattern: '\\.js$' }, templates: { - copyright: 'Copyright 2019 Google, LLC.', + copyright: 'Copyright 2020 Google LLC', includeDate: false, sourceFiles: false, systemName: '@google-cloud/documentai', diff --git a/packages/google-cloud-documentai/.prettierrc.js b/packages/google-cloud-documentai/.prettierrc.js index 08cba3775be..d1b95106f4c 100644 --- a/packages/google-cloud-documentai/.prettierrc.js +++ b/packages/google-cloud-documentai/.prettierrc.js @@ -4,7 +4,7 @@ // you may not use this 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, diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 74683aae8bd..48922d59a7e 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -17,8 +17,8 @@ "docs": "jsdoc -c .jsdoc.js", "docs-test": "linkinator docs", "fix": "gts fix", - "lint": "gts check", - "prelint": "cd samples; npm link ../; npm i", + "lint": "gts fix", + "prelint": "cd samples; npm link ../; npm install", "predocs-test": "npm run docs", "prepare": "npm run compile-protos && npm run compile", "system-test": "c8 mocha build/system-test", @@ -27,7 +27,7 @@ }, "dependencies": { "fix": "0.0.6", - "google-gax": "^2.0.1", + "google-gax": "^2.1.0", "npm": "^6.14.4", "run": "^1.4.0" }, @@ -37,11 +37,7 @@ "@types/sinon": "^9.0.0", "c8": "^7.1.0", "chai": "^4.2.0", - "eslint": "^6.8.0", - "eslint-config-prettier": "^6.10.0", - "eslint-plugin-node": "^11.0.0", - "eslint-plugin-prettier": "^3.1.2", - "gts": "2.0.0", + "gts": "^2.0.0", "jsdoc": "^3.6.3", "jsdoc-fresh": "^1.0.2", "jsdoc-region-tag": "^1.0.4", diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 91015992eab..0fdf3952613 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -2103,6 +2103,7 @@ }, "rpc": { "options": { + "cc_enable_arenas": true, "go_package": "google.golang.org/genproto/googleapis/rpc/status;status", "java_multiple_files": true, "java_outer_classname": "StatusProto", @@ -2178,26 +2179,32 @@ "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.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.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.http).delete": "/v1/{name=operations/**}", + "(google.api.method_signature)": "name" } }, "CancelOperation": { @@ -2205,7 +2212,8 @@ "responseType": "google.protobuf.Empty", "options": { "(google.api.http).post": "/v1/{name=operations/**}:cancel", - "(google.api.http).body": "*" + "(google.api.http).body": "*", + "(google.api.method_signature)": "name" } }, "WaitOperation": { diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 29f3e14428d..c63bfca487a 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -1,5 +1,14 @@ { - "updateTime": "2020-04-01T23:46:49.301803Z", + "updateTime": "2020-04-11T00:15:21.700620Z", + "sources": [ + { + "git": { + "name": "synthtool", + "remote": "https://github.com/googleapis/synthtool.git", + "sha": "6f32150677c9784f3c3a7e1949472bd29c9d72c5" + } + } + ], "destinations": [ { "client": { diff --git a/packages/google-cloud-documentai/synth.py b/packages/google-cloud-documentai/synth.py index 5254c834708..36bf5fa0c49 100644 --- a/packages/google-cloud-documentai/synth.py +++ b/packages/google-cloud-documentai/synth.py @@ -45,5 +45,5 @@ # Node.js specific cleanup subprocess.run(['npm', 'install']) -subprocess.run(['npm', 'run', 'fix']) +subprocess.run(['npm', 'run', 'lint']) subprocess.run(['npx', 'compileProtos', 'src']) diff --git a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts index fa6b1941832..cffa5a90c0d 100644 --- a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts +++ b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts @@ -288,7 +288,7 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.processDocument(request); }, expectedError); assert( @@ -418,7 +418,7 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.batchProcessDocuments(request); }, expectedError); assert( @@ -455,7 +455,7 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { expectedError ); const [operation] = await client.batchProcessDocuments(request); - assert.rejects(async () => { + await assert.rejects(async () => { await operation.promise(); }, expectedError); assert( From 9f1679180436369014d0a38870853f966586622a Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Sun, 12 Apr 2020 15:05:01 -0700 Subject: [PATCH 020/213] fix: remove unused dependencies (#41) Co-authored-by: Alexander Fenster --- packages/google-cloud-documentai/package.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 48922d59a7e..5cc05ad46e7 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -26,10 +26,7 @@ "test": "c8 mocha build/test" }, "dependencies": { - "fix": "0.0.6", - "google-gax": "^2.1.0", - "npm": "^6.14.4", - "run": "^1.4.0" + "google-gax": "^2.1.0" }, "devDependencies": { "@types/mocha": "^7.0.0", From a3895062bfd758644f94f67b127d20bcb345cc9d Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 13 Apr 2020 10:28:29 -0700 Subject: [PATCH 021/213] docs: update README to reflect quickstart (#42) --- packages/google-cloud-documentai/README.md | 3 +-- packages/google-cloud-documentai/synth.metadata | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index fe7dd7691c7..934dbf2997f 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -59,7 +59,6 @@ npm install @google-cloud/documentai * TODO(developer): Uncomment these variables before running the sample. */ // const projectId = 'YOUR_PROJECT_ID'; -// const location = 'YOUR_PROJECT_LOCATION'; // const gcsInputUri = 'YOUR_SOURCE_PDF'; const { @@ -69,7 +68,7 @@ const client = new DocumentUnderstandingServiceClient(); async function quickstart() { // Configure the request for processing the PDF - const parent = `projects/${projectId}/locations/${location}`; + const parent = `projects/${projectId}`; const request = { parent, inputConfig: { diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index c63bfca487a..b7798b32ee4 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -1,6 +1,20 @@ { - "updateTime": "2020-04-11T00:15:21.700620Z", "sources": [ + { + "git": { + "name": ".", + "remote": "https://github.com/googleapis/nodejs-document-ai.git", + "sha": "9e6cf011c010bdae157d022fa95edd0ad819862c" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "1bd77e8ce6f953ac641af7966d0c52646afc16a8", + "internalRef": "305974465" + } + }, { "git": { "name": "synthtool", From a0c91b52c2a0af2250b502ac2c337eb38eb40e75 Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Mon, 13 Apr 2020 14:24:41 -0700 Subject: [PATCH 022/213] chore: fix samples according to service resource change (#35) * chore: late breaking service change * fix: changes to location * fix: removed unnecessary set endpoint Co-authored-by: Benjamin E. Coe --- packages/google-cloud-documentai/samples/quickstart.js | 9 +++------ .../samples/test/quickstart.test.js | 3 ++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/google-cloud-documentai/samples/quickstart.js b/packages/google-cloud-documentai/samples/quickstart.js index 9741973141d..4ac5bf66991 100644 --- a/packages/google-cloud-documentai/samples/quickstart.js +++ b/packages/google-cloud-documentai/samples/quickstart.js @@ -15,13 +15,9 @@ 'use strict'; -/** - * Process a single PDF. - * @param {string} projectId your Google Cloud project ID - * @param {string} gcsInputUri Cloud Storage URI of the PDF document to parse - */ async function main( projectId, + location, gcsInputUri = 'gs://cloud-samples-data/documentai/invoice.pdf' ) { // [START documentai_quickstart] @@ -29,6 +25,7 @@ async function main( * TODO(developer): Uncomment these variables before running the sample. */ // const projectId = 'YOUR_PROJECT_ID'; + // const location = 'YOUR_PROJECT_LOCATION'; // Format is 'us' or 'eu' // const gcsInputUri = 'YOUR_SOURCE_PDF'; const { @@ -38,7 +35,7 @@ async function main( async function quickstart() { // Configure the request for processing the PDF - const parent = `projects/${projectId}`; + const parent = `projects/${projectId}/locations/${location}`; const request = { parent, inputConfig: { diff --git a/packages/google-cloud-documentai/samples/test/quickstart.test.js b/packages/google-cloud-documentai/samples/test/quickstart.test.js index 63c2285ba69..8a44c2d6c8d 100644 --- a/packages/google-cloud-documentai/samples/test/quickstart.test.js +++ b/packages/google-cloud-documentai/samples/test/quickstart.test.js @@ -23,10 +23,11 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const cwd = path.join(__dirname, '..'); const projectId = process.env.GCLOUD_PROJECT; +const LOCATION = 'us'; describe('Quickstart', () => { it('should run quickstart', async () => { - const stdout = execSync(`node ./quickstart.js ${projectId}`, { + const stdout = execSync(`node ./quickstart.js ${projectId} ${LOCATION}`, { cwd, }); assert.match(stdout, /Entity/); From 345c1b5d6b2f67fbb134f3e0988560e1fc74e812 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Mon, 13 Apr 2020 14:58:49 -0700 Subject: [PATCH 023/213] chore: update lint ignore files (#43) --- packages/google-cloud-documentai/.eslintignore | 3 ++- packages/google-cloud-documentai/.prettierignore | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-documentai/.eslintignore b/packages/google-cloud-documentai/.eslintignore index 09b31fe735a..9340ad9b86d 100644 --- a/packages/google-cloud-documentai/.eslintignore +++ b/packages/google-cloud-documentai/.eslintignore @@ -1,5 +1,6 @@ **/node_modules -src/**/doc/* +**/coverage +test/fixtures build/ docs/ protos/ diff --git a/packages/google-cloud-documentai/.prettierignore b/packages/google-cloud-documentai/.prettierignore index f6fac98b0a8..9340ad9b86d 100644 --- a/packages/google-cloud-documentai/.prettierignore +++ b/packages/google-cloud-documentai/.prettierignore @@ -1,3 +1,6 @@ -node_modules/* -samples/node_modules/* -src/**/doc/* +**/node_modules +**/coverage +test/fixtures +build/ +docs/ +protos/ From 8d2960ae18dfa21102eb8179440f9f2230f7ea12 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Mon, 13 Apr 2020 19:30:11 -0700 Subject: [PATCH 024/213] chore: remove tslint.json (#44) --- packages/google-cloud-documentai/tslint.json | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 packages/google-cloud-documentai/tslint.json diff --git a/packages/google-cloud-documentai/tslint.json b/packages/google-cloud-documentai/tslint.json deleted file mode 100644 index 617dc975bae..00000000000 --- a/packages/google-cloud-documentai/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "gts/tslint.json" -} From a1371068c757cf7a41d02da3fe3331153ff18ae7 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 14 Apr 2020 08:51:34 -0700 Subject: [PATCH 025/213] docs: update README to reflect quickstart (#45) --- packages/google-cloud-documentai/README.md | 3 ++- packages/google-cloud-documentai/synth.metadata | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index 934dbf2997f..aa33c0d4404 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -59,6 +59,7 @@ npm install @google-cloud/documentai * TODO(developer): Uncomment these variables before running the sample. */ // const projectId = 'YOUR_PROJECT_ID'; +// const location = 'YOUR_PROJECT_LOCATION'; // Format is 'us' or 'eu' // const gcsInputUri = 'YOUR_SOURCE_PDF'; const { @@ -68,7 +69,7 @@ const client = new DocumentUnderstandingServiceClient(); async function quickstart() { // Configure the request for processing the PDF - const parent = `projects/${projectId}`; + const parent = `projects/${projectId}/locations/${location}`; const request = { parent, inputConfig: { diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index b7798b32ee4..7046a29bcce 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,22 +4,24 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "9e6cf011c010bdae157d022fa95edd0ad819862c" + "sha": "01066765f60411608513e0e57b4955eaf390b371" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "1bd77e8ce6f953ac641af7966d0c52646afc16a8", - "internalRef": "305974465" + "sha": "26523a96798ce1a6caa1b3c912119059cfcc98a7", + "internalRef": "306320014", + "log": "26523a96798ce1a6caa1b3c912119059cfcc98a7\nchore: delete gapic config for resourcemanager/v2\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306320014\n\n35672e7936b923eff048d0ee1529faa163cc81b8\nchore: enable gapicv2 for datacatalog/v1beta1 API\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306318928\n\ndea1f52034d188ca371c3a70c716ca2a6b3f2aa1\nchore: delete gapic config for language/v1beta1\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306298030\n\ndf955af5d9508cf9215de6f1fbdad033d5b8fef6\nchore: enable gapicv2 for language/v1beta2 API\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306297639\n\ne2a59ff2f861b1b92b2f15b242780dccddd77ab9\nchore: enable gapicv2 for bigquery/reservation/v1 API\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306297615\n\nc9942c00e8f35b5b37cd589ef7a0323aeda264e2\nchore: enable gapicv2 for datacatalog/v1beta1 API\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306297587\n\nf561f57eea013327be27d8f6799b3cc2d18ee804\nbazel: upgrade gapic-generator-go to v0.13.2\n\nChanges include:\n* update Bazel rules_go to v0.22.3\n* update Bazel Go repositories with latest\n* fix Bazel go_gapic_assembly_pkg archive contents path\n\nPiperOrigin-RevId: 306294636\n\na34f4eb96a94bfd5b3e7f8de253db28d0a3e9237\nchore: enable gapicv2 for asset/v1beta1 API\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306283252\n\n4efd71279f0781579ced60c374336ce1b8b8cea8\nchore: enable gapicv2 for asset/v1p4beta1 API\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306282838\n\n789fd7e0680b04a589447139811d55c5d1f34afe\nchore: enable gapicv2 for asset/v1p1beta1 API\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306282062\n\n0feb08065d91d6deebffef3019751f0619a72140\nchore: enable gapicv2 for asset/v1p2beta1 API\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306281797\n\n9ea892ebe8a7cd66da9bd62eb7086b8dc2ddd559\nchore: enable gapicv2 for vision/v1 API\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306281271\n\n4d61e1cb40184a7ad63ef37b1813f6608718674a\nAdd speech adaptation, phrase sets and custom classes.\n\nPiperOrigin-RevId: 306280989\n\n3824f547aa44df459580615c73cabb30a2a78ee0\nfeat: Adding Retry policy for OS Config V1Beta AgentEndpointService\n\nPiperOrigin-RevId: 306254195\n\n" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "6f32150677c9784f3c3a7e1949472bd29c9d72c5" + "sha": "52638600f387deb98efb5f9c85fec39e82aa9052", + "log": "52638600f387deb98efb5f9c85fec39e82aa9052\nbuild(java): set GOOGLE_CLOUD_PROJECT env for samples/integration tests (#484)\n\n* build(java): set GOOGLE_CLOUD_PROJECT env variable for samples/integration tests\n\n* ci: use java-docs-samples-testing for sample tests\n3df869dd6eb546ef13beeb7a9efa6ee0226afafd\nci: add dependency list completeness check (#490)\n\n\n682c0c37d1054966ca662a44259e96cc7aea4413\nbuild(nodejs): update lint ignore rules (#488)\n\n\n97c7ccfdceb927db1cbe6f3bb09616aa02bafd89\ndoc: document context-aware commit flags (#481)\n\nAlso, delete obsolete blurb about cleaning up old, dead files.\n\nCo-authored-by: Jeff Ching \n8eff3790f88b50706a0c4b6a20b385f24e9ac4e7\nfeat: common postprocessing for node libraries (#485)\n\nCo-authored-by: Justin Beckwith \n21c3b57ae54ae9db6a3a6b48b31c970c6ab56f19\nbuild(nodejs): remove unused codecov config (#486)\n\n\n" } } ], From c0b076591480fdffb447927137f7fa42185d42b9 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Tue, 14 Apr 2020 09:56:01 -0700 Subject: [PATCH 026/213] chore: remove unused dev packages (#46) --- packages/google-cloud-documentai/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 5cc05ad46e7..ec1586af130 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -42,7 +42,6 @@ "mocha": "^7.0.0", "null-loader": "^3.0.0", "pack-n-play": "^1.0.0-2", - "prettier": "^1.19.1", "sinon": "^9.0.1", "ts-loader": "^6.2.1", "typescript": "^3.8.3", From ca413640613b8146d3be4234570a812140d996f6 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 15 Apr 2020 17:33:02 +0200 Subject: [PATCH 027/213] chore(deps): update dependency ts-loader to v7 (#47) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [ts-loader](https://togithub.com/TypeStrong/ts-loader) | devDependencies | major | [`^6.2.1` -> `^7.0.0`](https://renovatebot.com/diffs/npm/ts-loader/6.2.2/7.0.0) | --- ### Release Notes
TypeStrong/ts-loader ### [`v7.0.0`](https://togithub.com/TypeStrong/ts-loader/blob/master/CHANGELOG.md#v700) [Compare Source](https://togithub.com/TypeStrong/ts-loader/compare/v6.2.2...v7.0.0) - [Project reference support enhancements](https://togithub.com/TypeStrong/ts-loader/pull/1076) - thanks [@​sheetalkamat](https://togithub.com/sheetalkamat)! - Following the end of life of Node 8, `ts-loader` no longer supports Node 8 **BREAKING CHANGE**
--- ### 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#googleapis/nodejs-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index ec1586af130..e164fa01814 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -43,7 +43,7 @@ "null-loader": "^3.0.0", "pack-n-play": "^1.0.0-2", "sinon": "^9.0.1", - "ts-loader": "^6.2.1", + "ts-loader": "^7.0.0", "typescript": "^3.8.3", "webpack": "^4.42.0", "webpack-cli": "^3.3.11" From 7c275f84bb20dce5f447f56e739ccccb42748ff7 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 15 Apr 2020 18:32:23 +0200 Subject: [PATCH 028/213] chore(deps): update dependency null-loader to v4 (#49) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [null-loader](https://togithub.com/webpack-contrib/null-loader) | devDependencies | major | [`^3.0.0` -> `^4.0.0`](https://renovatebot.com/diffs/npm/null-loader/3.0.0/4.0.0) | --- ### Release Notes
webpack-contrib/null-loader ### [`v4.0.0`](https://togithub.com/webpack-contrib/null-loader/blob/master/CHANGELOG.md#​400-httpsgithubcomwebpack-contribnull-loadercomparev300v400-2020-04-15) [Compare Source](https://togithub.com/webpack-contrib/null-loader/compare/v3.0.0...v4.0.0) ##### Bug Fixes - support `webpack@5` ##### ⚠ BREAKING CHANGES - minimum required Nodejs version is `10.13`
--- ### 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#googleapis/nodejs-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index e164fa01814..2122a6d9c86 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -40,7 +40,7 @@ "jsdoc-region-tag": "^1.0.4", "linkinator": "^2.0.3", "mocha": "^7.0.0", - "null-loader": "^3.0.0", + "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", "sinon": "^9.0.1", "ts-loader": "^7.0.0", From 1dba7dcc0e5597753321b1a5480fb783dc9ecea2 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Wed, 15 Apr 2020 10:31:01 -0700 Subject: [PATCH 029/213] chore: run fix instead of lint in synthfile (#50) --- packages/google-cloud-documentai/synth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/synth.py b/packages/google-cloud-documentai/synth.py index 36bf5fa0c49..5254c834708 100644 --- a/packages/google-cloud-documentai/synth.py +++ b/packages/google-cloud-documentai/synth.py @@ -45,5 +45,5 @@ # Node.js specific cleanup subprocess.run(['npm', 'install']) -subprocess.run(['npm', 'run', 'lint']) +subprocess.run(['npm', 'run', 'fix']) subprocess.run(['npx', 'compileProtos', 'src']) From ef1d367b01fdc71efa9883844ca49eecf764354f Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 22 Apr 2020 08:07:25 -0700 Subject: [PATCH 030/213] build: update CI and address generator linting (#52) --- .../google-cloud-documentai/protos/protos.js | 510 +++++++++--------- .../google-cloud-documentai/synth.metadata | 10 +- .../system-test/install.ts | 4 +- 3 files changed, 261 insertions(+), 263 deletions(-) diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 8979ae658c1..206b7753584 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -231,13 +231,13 @@ Document.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && message.hasOwnProperty("uri")) + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - if (message.content != null && message.hasOwnProperty("content")) + if (message.content != null && Object.hasOwnProperty.call(message, "content")) writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.content); - if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.mimeType); - if (message.text != null && message.hasOwnProperty("text")) + if (message.text != null && Object.hasOwnProperty.call(message, "text")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.text); if (message.textStyles != null && message.textStyles.length) for (var i = 0; i < message.textStyles.length; ++i) @@ -251,9 +251,9 @@ if (message.entityRelations != null && message.entityRelations.length) for (var i = 0; i < message.entityRelations.length; ++i) $root.google.cloud.documentai.v1beta2.Document.EntityRelation.encode(message.entityRelations[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.shardInfo != null && message.hasOwnProperty("shardInfo")) + if (message.shardInfo != null && Object.hasOwnProperty.call(message, "shardInfo")) $root.google.cloud.documentai.v1beta2.Document.ShardInfo.encode(message.shardInfo, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.error != null && message.hasOwnProperty("error")) + if (message.error != null && Object.hasOwnProperty.call(message, "error")) $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); if (message.labels != null && message.labels.length) for (var i = 0; i < message.labels.length; ++i) @@ -690,11 +690,11 @@ ShardInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.shardIndex != null && message.hasOwnProperty("shardIndex")) + if (message.shardIndex != null && Object.hasOwnProperty.call(message, "shardIndex")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.shardIndex); - if (message.shardCount != null && message.hasOwnProperty("shardCount")) + if (message.shardCount != null && Object.hasOwnProperty.call(message, "shardCount")) writer.uint32(/* id 2, wireType 0 =*/16).int64(message.shardCount); - if (message.textOffset != null && message.hasOwnProperty("textOffset")) + if (message.textOffset != null && Object.hasOwnProperty.call(message, "textOffset")) writer.uint32(/* id 3, wireType 0 =*/24).int64(message.textOffset); return writer; }; @@ -978,11 +978,11 @@ Label.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.automlModel != null && message.hasOwnProperty("automlModel")) + if (message.automlModel != null && Object.hasOwnProperty.call(message, "automlModel")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.automlModel); - if (message.confidence != null && message.hasOwnProperty("confidence")) + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) writer.uint32(/* id 3, wireType 5 =*/29).float(message.confidence); return writer; }; @@ -1251,19 +1251,19 @@ Style.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + if (message.textAnchor != null && Object.hasOwnProperty.call(message, "textAnchor")) $root.google.cloud.documentai.v1beta2.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.color != null && message.hasOwnProperty("color")) + if (message.color != null && Object.hasOwnProperty.call(message, "color")) $root.google.type.Color.encode(message.color, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.backgroundColor != null && message.hasOwnProperty("backgroundColor")) + if (message.backgroundColor != null && Object.hasOwnProperty.call(message, "backgroundColor")) $root.google.type.Color.encode(message.backgroundColor, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.fontWeight != null && message.hasOwnProperty("fontWeight")) + if (message.fontWeight != null && Object.hasOwnProperty.call(message, "fontWeight")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.fontWeight); - if (message.textStyle != null && message.hasOwnProperty("textStyle")) + if (message.textStyle != null && Object.hasOwnProperty.call(message, "textStyle")) writer.uint32(/* id 5, wireType 2 =*/42).string(message.textStyle); - if (message.textDecoration != null && message.hasOwnProperty("textDecoration")) + if (message.textDecoration != null && Object.hasOwnProperty.call(message, "textDecoration")) writer.uint32(/* id 6, wireType 2 =*/50).string(message.textDecoration); - if (message.fontSize != null && message.hasOwnProperty("fontSize")) + if (message.fontSize != null && Object.hasOwnProperty.call(message, "fontSize")) $root.google.cloud.documentai.v1beta2.Document.Style.FontSize.encode(message.fontSize, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); return writer; }; @@ -1543,9 +1543,9 @@ FontSize.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.size != null && message.hasOwnProperty("size")) + if (message.size != null && Object.hasOwnProperty.call(message, "size")) writer.uint32(/* id 1, wireType 5 =*/13).float(message.size); - if (message.unit != null && message.hasOwnProperty("unit")) + if (message.unit != null && Object.hasOwnProperty.call(message, "unit")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.unit); return writer; }; @@ -1845,11 +1845,11 @@ Page.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + if (message.pageNumber != null && Object.hasOwnProperty.call(message, "pageNumber")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.pageNumber); - if (message.dimension != null && message.hasOwnProperty("dimension")) + if (message.dimension != null && Object.hasOwnProperty.call(message, "dimension")) $root.google.cloud.documentai.v1beta2.Document.Page.Dimension.encode(message.dimension, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.layout != null && message.hasOwnProperty("layout")) + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) $root.google.cloud.documentai.v1beta2.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); if (message.detectedLanguages != null && message.detectedLanguages.length) for (var i = 0; i < message.detectedLanguages.length; ++i) @@ -2350,11 +2350,11 @@ Dimension.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.width != null && message.hasOwnProperty("width")) + if (message.width != null && Object.hasOwnProperty.call(message, "width")) writer.uint32(/* id 1, wireType 5 =*/13).float(message.width); - if (message.height != null && message.hasOwnProperty("height")) + if (message.height != null && Object.hasOwnProperty.call(message, "height")) writer.uint32(/* id 2, wireType 5 =*/21).float(message.height); - if (message.unit != null && message.hasOwnProperty("unit")) + if (message.unit != null && Object.hasOwnProperty.call(message, "unit")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.unit); return writer; }; @@ -2600,15 +2600,15 @@ Layout.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + if (message.textAnchor != null && Object.hasOwnProperty.call(message, "textAnchor")) $root.google.cloud.documentai.v1beta2.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.confidence != null && message.hasOwnProperty("confidence")) + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) $root.google.cloud.documentai.v1beta2.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.orientation != null && message.hasOwnProperty("orientation")) + if (message.orientation != null && Object.hasOwnProperty.call(message, "orientation")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.orientation); - if (message.id != null && message.hasOwnProperty("id")) + if (message.id != null && Object.hasOwnProperty.call(message, "id")) writer.uint32(/* id 5, wireType 2 =*/42).string(message.id); return writer; }; @@ -2822,7 +2822,7 @@ /** * Orientation enum. * @name google.cloud.documentai.v1beta2.Document.Page.Layout.Orientation - * @enum {string} + * @enum {number} * @property {number} ORIENTATION_UNSPECIFIED=0 ORIENTATION_UNSPECIFIED value * @property {number} PAGE_UP=1 PAGE_UP value * @property {number} PAGE_RIGHT=2 PAGE_RIGHT value @@ -2908,7 +2908,7 @@ Block.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.layout != null && message.hasOwnProperty("layout")) + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) $root.google.cloud.documentai.v1beta2.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.detectedLanguages != null && message.detectedLanguages.length) for (var i = 0; i < message.detectedLanguages.length; ++i) @@ -3144,7 +3144,7 @@ Paragraph.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.layout != null && message.hasOwnProperty("layout")) + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) $root.google.cloud.documentai.v1beta2.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.detectedLanguages != null && message.detectedLanguages.length) for (var i = 0; i < message.detectedLanguages.length; ++i) @@ -3380,7 +3380,7 @@ Line.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.layout != null && message.hasOwnProperty("layout")) + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) $root.google.cloud.documentai.v1beta2.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.detectedLanguages != null && message.detectedLanguages.length) for (var i = 0; i < message.detectedLanguages.length; ++i) @@ -3625,9 +3625,9 @@ Token.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.layout != null && message.hasOwnProperty("layout")) + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) $root.google.cloud.documentai.v1beta2.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) + if (message.detectedBreak != null && Object.hasOwnProperty.call(message, "detectedBreak")) $root.google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.encode(message.detectedBreak, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.detectedLanguages != null && message.detectedLanguages.length) for (var i = 0; i < message.detectedLanguages.length; ++i) @@ -3867,7 +3867,7 @@ DetectedBreak.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.type != null && message.hasOwnProperty("type")) + if (message.type != null && Object.hasOwnProperty.call(message, "type")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); return writer; }; @@ -4021,7 +4021,7 @@ /** * Type enum. * @name google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.Type - * @enum {string} + * @enum {number} * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value * @property {number} SPACE=1 SPACE value * @property {number} WIDE_SPACE=2 WIDE_SPACE value @@ -4117,9 +4117,9 @@ VisualElement.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.layout != null && message.hasOwnProperty("layout")) + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) $root.google.cloud.documentai.v1beta2.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.type != null && message.hasOwnProperty("type")) + if (message.type != null && Object.hasOwnProperty.call(message, "type")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); if (message.detectedLanguages != null && message.detectedLanguages.length) for (var i = 0; i < message.detectedLanguages.length; ++i) @@ -4387,7 +4387,7 @@ Table.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.layout != null && message.hasOwnProperty("layout")) + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) $root.google.cloud.documentai.v1beta2.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.headerRows != null && message.headerRows.length) for (var i = 0; i < message.headerRows.length; ++i) @@ -4913,11 +4913,11 @@ TableCell.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.layout != null && message.hasOwnProperty("layout")) + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) $root.google.cloud.documentai.v1beta2.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.rowSpan != null && message.hasOwnProperty("rowSpan")) + if (message.rowSpan != null && Object.hasOwnProperty.call(message, "rowSpan")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.rowSpan); - if (message.colSpan != null && message.hasOwnProperty("colSpan")) + if (message.colSpan != null && Object.hasOwnProperty.call(message, "colSpan")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.colSpan); if (message.detectedLanguages != null && message.detectedLanguages.length) for (var i = 0; i < message.detectedLanguages.length; ++i) @@ -5225,9 +5225,9 @@ FormField.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.fieldName != null && message.hasOwnProperty("fieldName")) + if (message.fieldName != null && Object.hasOwnProperty.call(message, "fieldName")) $root.google.cloud.documentai.v1beta2.Document.Page.Layout.encode(message.fieldName, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.fieldValue != null && message.hasOwnProperty("fieldValue")) + if (message.fieldValue != null && Object.hasOwnProperty.call(message, "fieldValue")) $root.google.cloud.documentai.v1beta2.Document.Page.Layout.encode(message.fieldValue, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.nameDetectedLanguages != null && message.nameDetectedLanguages.length) for (var i = 0; i < message.nameDetectedLanguages.length; ++i) @@ -5235,11 +5235,11 @@ if (message.valueDetectedLanguages != null && message.valueDetectedLanguages.length) for (var i = 0; i < message.valueDetectedLanguages.length; ++i) $root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.encode(message.valueDetectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.valueType != null && message.hasOwnProperty("valueType")) + if (message.valueType != null && Object.hasOwnProperty.call(message, "valueType")) writer.uint32(/* id 5, wireType 2 =*/42).string(message.valueType); - if (message.correctedKeyText != null && message.hasOwnProperty("correctedKeyText")) + if (message.correctedKeyText != null && Object.hasOwnProperty.call(message, "correctedKeyText")) writer.uint32(/* id 6, wireType 2 =*/50).string(message.correctedKeyText); - if (message.correctedValueText != null && message.hasOwnProperty("correctedValueText")) + if (message.correctedValueText != null && Object.hasOwnProperty.call(message, "correctedValueText")) writer.uint32(/* id 7, wireType 2 =*/58).string(message.correctedValueText); return writer; }; @@ -5552,9 +5552,9 @@ DetectedLanguage.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.languageCode); - if (message.confidence != null && message.hasOwnProperty("confidence")) + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); return writer; }; @@ -5819,21 +5819,21 @@ Entity.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + if (message.textAnchor != null && Object.hasOwnProperty.call(message, "textAnchor")) $root.google.cloud.documentai.v1beta2.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.type != null && message.hasOwnProperty("type")) + if (message.type != null && Object.hasOwnProperty.call(message, "type")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); - if (message.mentionText != null && message.hasOwnProperty("mentionText")) + if (message.mentionText != null && Object.hasOwnProperty.call(message, "mentionText")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.mentionText); - if (message.mentionId != null && message.hasOwnProperty("mentionId")) + if (message.mentionId != null && Object.hasOwnProperty.call(message, "mentionId")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.mentionId); - if (message.confidence != null && message.hasOwnProperty("confidence")) + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); - if (message.pageAnchor != null && message.hasOwnProperty("pageAnchor")) + if (message.pageAnchor != null && Object.hasOwnProperty.call(message, "pageAnchor")) $root.google.cloud.documentai.v1beta2.Document.PageAnchor.encode(message.pageAnchor, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.id != null && message.hasOwnProperty("id")) + if (message.id != null && Object.hasOwnProperty.call(message, "id")) writer.uint32(/* id 7, wireType 2 =*/58).string(message.id); - if (message.boundingPolyForDemoFrontend != null && message.hasOwnProperty("boundingPolyForDemoFrontend")) + if (message.boundingPolyForDemoFrontend != null && Object.hasOwnProperty.call(message, "boundingPolyForDemoFrontend")) $root.google.cloud.documentai.v1beta2.BoundingPoly.encode(message.boundingPolyForDemoFrontend, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); return writer; }; @@ -6131,11 +6131,11 @@ EntityRelation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.subjectId != null && message.hasOwnProperty("subjectId")) + if (message.subjectId != null && Object.hasOwnProperty.call(message, "subjectId")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.subjectId); - if (message.objectId != null && message.hasOwnProperty("objectId")) + if (message.objectId != null && Object.hasOwnProperty.call(message, "objectId")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.objectId); - if (message.relation != null && message.hasOwnProperty("relation")) + if (message.relation != null && Object.hasOwnProperty.call(message, "relation")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.relation); return writer; }; @@ -6559,9 +6559,9 @@ TextSegment.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.startIndex != null && message.hasOwnProperty("startIndex")) + if (message.startIndex != null && Object.hasOwnProperty.call(message, "startIndex")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.startIndex); - if (message.endIndex != null && message.hasOwnProperty("endIndex")) + if (message.endIndex != null && Object.hasOwnProperty.call(message, "endIndex")) writer.uint32(/* id 2, wireType 0 =*/16).int64(message.endIndex); return writer; }; @@ -7014,11 +7014,11 @@ PageRef.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.page != null && message.hasOwnProperty("page")) + if (message.page != null && Object.hasOwnProperty.call(message, "page")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.page); - if (message.layoutType != null && message.hasOwnProperty("layoutType")) + if (message.layoutType != null && Object.hasOwnProperty.call(message, "layoutType")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.layoutType); - if (message.layoutId != null && message.hasOwnProperty("layoutId")) + if (message.layoutId != null && Object.hasOwnProperty.call(message, "layoutId")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.layoutId); return writer; }; @@ -7229,7 +7229,7 @@ /** * LayoutType enum. * @name google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.LayoutType - * @enum {string} + * @enum {number} * @property {number} LAYOUT_TYPE_UNSPECIFIED=0 LAYOUT_TYPE_UNSPECIFIED value * @property {number} BLOCK=1 BLOCK value * @property {number} PARAGRAPH=2 PARAGRAPH value @@ -7326,9 +7326,9 @@ Vertex.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.x != null && message.hasOwnProperty("x")) + if (message.x != null && Object.hasOwnProperty.call(message, "x")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); - if (message.y != null && message.hasOwnProperty("y")) + if (message.y != null && Object.hasOwnProperty.call(message, "y")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); return writer; }; @@ -7536,9 +7536,9 @@ NormalizedVertex.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.x != null && message.hasOwnProperty("x")) + if (message.x != null && Object.hasOwnProperty.call(message, "x")) writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); - if (message.y != null && message.hasOwnProperty("y")) + if (message.y != null && Object.hasOwnProperty.call(message, "y")) writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); return writer; }; @@ -8103,7 +8103,7 @@ if (message.requests != null && message.requests.length) for (var i = 0; i < message.requests.length; ++i) $root.google.cloud.documentai.v1beta2.ProcessDocumentRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.parent != null && message.hasOwnProperty("parent")) + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.parent); return writer; }; @@ -8393,23 +8393,23 @@ ProcessDocumentRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) $root.google.cloud.documentai.v1beta2.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) $root.google.cloud.documentai.v1beta2.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.documentType != null && message.hasOwnProperty("documentType")) + if (message.documentType != null && Object.hasOwnProperty.call(message, "documentType")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.documentType); - if (message.tableExtractionParams != null && message.hasOwnProperty("tableExtractionParams")) + if (message.tableExtractionParams != null && Object.hasOwnProperty.call(message, "tableExtractionParams")) $root.google.cloud.documentai.v1beta2.TableExtractionParams.encode(message.tableExtractionParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.formExtractionParams != null && message.hasOwnProperty("formExtractionParams")) + if (message.formExtractionParams != null && Object.hasOwnProperty.call(message, "formExtractionParams")) $root.google.cloud.documentai.v1beta2.FormExtractionParams.encode(message.formExtractionParams, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.entityExtractionParams != null && message.hasOwnProperty("entityExtractionParams")) + if (message.entityExtractionParams != null && Object.hasOwnProperty.call(message, "entityExtractionParams")) $root.google.cloud.documentai.v1beta2.EntityExtractionParams.encode(message.entityExtractionParams, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.ocrParams != null && message.hasOwnProperty("ocrParams")) + if (message.ocrParams != null && Object.hasOwnProperty.call(message, "ocrParams")) $root.google.cloud.documentai.v1beta2.OcrParams.encode(message.ocrParams, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.automlParams != null && message.hasOwnProperty("automlParams")) + if (message.automlParams != null && Object.hasOwnProperty.call(message, "automlParams")) $root.google.cloud.documentai.v1beta2.AutoMlParams.encode(message.automlParams, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.parent != null && message.hasOwnProperty("parent")) + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) writer.uint32(/* id 9, wireType 2 =*/74).string(message.parent); return writer; }; @@ -8937,9 +8937,9 @@ ProcessDocumentResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) $root.google.cloud.documentai.v1beta2.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) $root.google.cloud.documentai.v1beta2.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -9380,7 +9380,7 @@ TableExtractionParams.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.enabled != null && message.hasOwnProperty("enabled")) + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); if (message.tableBoundHints != null && message.tableBoundHints.length) for (var i = 0; i < message.tableBoundHints.length; ++i) @@ -9388,7 +9388,7 @@ if (message.headerHints != null && message.headerHints.length) for (var i = 0; i < message.headerHints.length; ++i) writer.uint32(/* id 3, wireType 2 =*/26).string(message.headerHints[i]); - if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + if (message.modelVersion != null && Object.hasOwnProperty.call(message, "modelVersion")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.modelVersion); return writer; }; @@ -9653,9 +9653,9 @@ TableBoundHint.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + if (message.pageNumber != null && Object.hasOwnProperty.call(message, "pageNumber")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.pageNumber); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) + if (message.boundingBox != null && Object.hasOwnProperty.call(message, "boundingBox")) $root.google.cloud.documentai.v1beta2.BoundingPoly.encode(message.boundingBox, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -9878,12 +9878,12 @@ FormExtractionParams.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.enabled != null && message.hasOwnProperty("enabled")) + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); if (message.keyValuePairHints != null && message.keyValuePairHints.length) for (var i = 0; i < message.keyValuePairHints.length; ++i) $root.google.cloud.documentai.v1beta2.KeyValuePairHint.encode(message.keyValuePairHints[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + if (message.modelVersion != null && Object.hasOwnProperty.call(message, "modelVersion")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.modelVersion); return writer; }; @@ -10123,7 +10123,7 @@ KeyValuePairHint.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.key != null && message.hasOwnProperty("key")) + if (message.key != null && Object.hasOwnProperty.call(message, "key")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); if (message.valueTypes != null && message.valueTypes.length) for (var i = 0; i < message.valueTypes.length; ++i) @@ -10348,9 +10348,9 @@ EntityExtractionParams.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.enabled != null && message.hasOwnProperty("enabled")) + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); - if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + if (message.modelVersion != null && Object.hasOwnProperty.call(message, "modelVersion")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.modelVersion); return writer; }; @@ -10549,7 +10549,7 @@ AutoMlParams.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.model != null && message.hasOwnProperty("model")) + if (message.model != null && Object.hasOwnProperty.call(message, "model")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.model); return writer; }; @@ -10768,11 +10768,11 @@ InputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) $root.google.cloud.documentai.v1beta2.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); - if (message.contents != null && message.hasOwnProperty("contents")) + if (message.contents != null && Object.hasOwnProperty.call(message, "contents")) writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.contents); return writer; }; @@ -11024,9 +11024,9 @@ OutputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) $root.google.cloud.documentai.v1beta2.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagesPerShard != null && message.hasOwnProperty("pagesPerShard")) + if (message.pagesPerShard != null && Object.hasOwnProperty.call(message, "pagesPerShard")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pagesPerShard); return writer; }; @@ -11235,7 +11235,7 @@ GcsSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && message.hasOwnProperty("uri")) + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); return writer; }; @@ -11422,7 +11422,7 @@ GcsDestination.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && message.hasOwnProperty("uri")) + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); return writer; }; @@ -11636,13 +11636,13 @@ OperationMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.state != null && message.hasOwnProperty("state")) + if (message.state != null && Object.hasOwnProperty.call(message, "state")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); - if (message.createTime != null && message.hasOwnProperty("createTime")) + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; @@ -11855,7 +11855,7 @@ /** * State enum. * @name google.cloud.documentai.v1beta2.OperationMetadata.State - * @enum {string} + * @enum {number} * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value * @property {number} ACCEPTED=1 ACCEPTED value * @property {number} WAITING=2 WAITING value @@ -11900,7 +11900,7 @@ /** * FieldBehavior enum. * @name google.api.FieldBehavior - * @enum {string} + * @enum {number} * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value * @property {number} OPTIONAL=1 OPTIONAL value * @property {number} REQUIRED=2 REQUIRED value @@ -11988,7 +11988,7 @@ 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 && message.hasOwnProperty("fullyDecodeReservedExpansion")) + if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); return writer; }; @@ -12302,26 +12302,26 @@ HttpRule.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.selector != null && message.hasOwnProperty("selector")) + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); - if (message.get != null && message.hasOwnProperty("get")) + if (message.get != null && Object.hasOwnProperty.call(message, "get")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); - if (message.put != null && message.hasOwnProperty("put")) + if (message.put != null && Object.hasOwnProperty.call(message, "put")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); - if (message.post != null && message.hasOwnProperty("post")) + if (message.post != null && Object.hasOwnProperty.call(message, "post")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); - if (message["delete"] != null && message.hasOwnProperty("delete")) + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); - if (message.patch != null && message.hasOwnProperty("patch")) + if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); - if (message.body != null && message.hasOwnProperty("body")) + if (message.body != null && Object.hasOwnProperty.call(message, "body")) writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); - if (message.custom != null && message.hasOwnProperty("custom")) + 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 && message.hasOwnProperty("responseBody")) + if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); return writer; }; @@ -12678,9 +12678,9 @@ CustomHttpPattern.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.kind != null && message.hasOwnProperty("kind")) + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.path != null && message.hasOwnProperty("path")) + if (message.path != null && Object.hasOwnProperty.call(message, "path")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); return writer; }; @@ -13205,9 +13205,9 @@ FileDescriptorProto.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message["package"] != null && message.hasOwnProperty("package")) + 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) @@ -13224,9 +13224,9 @@ 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 && message.hasOwnProperty("options")) + 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 && message.hasOwnProperty("sourceCodeInfo")) + 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) @@ -13234,7 +13234,7 @@ 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 && message.hasOwnProperty("syntax")) + if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); return writer; }; @@ -13772,7 +13772,7 @@ DescriptorProto.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + 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) @@ -13789,7 +13789,7 @@ 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 && message.hasOwnProperty("options")) + 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) @@ -14254,11 +14254,11 @@ ExtensionRange.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.start != null && message.hasOwnProperty("start")) + if (message.start != null && Object.hasOwnProperty.call(message, "start")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); - if (message.end != null && message.hasOwnProperty("end")) + if (message.end != null && Object.hasOwnProperty.call(message, "end")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); - if (message.options != null && message.hasOwnProperty("options")) + 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; }; @@ -14482,9 +14482,9 @@ ReservedRange.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.start != null && message.hasOwnProperty("start")) + if (message.start != null && Object.hasOwnProperty.call(message, "start")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); - if (message.end != null && message.hasOwnProperty("end")) + if (message.end != null && Object.hasOwnProperty.call(message, "end")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); return writer; }; @@ -14975,25 +14975,25 @@ FieldDescriptorProto.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.extendee != null && message.hasOwnProperty("extendee")) + if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.extendee); - if (message.number != null && message.hasOwnProperty("number")) + if (message.number != null && Object.hasOwnProperty.call(message, "number")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.number); - if (message.label != null && message.hasOwnProperty("label")) + if (message.label != null && Object.hasOwnProperty.call(message, "label")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.label); - if (message.type != null && message.hasOwnProperty("type")) + if (message.type != null && Object.hasOwnProperty.call(message, "type")) writer.uint32(/* id 5, wireType 0 =*/40).int32(message.type); - if (message.typeName != null && message.hasOwnProperty("typeName")) + if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) writer.uint32(/* id 6, wireType 2 =*/50).string(message.typeName); - if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) writer.uint32(/* id 7, wireType 2 =*/58).string(message.defaultValue); - if (message.options != null && message.hasOwnProperty("options")) + 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 && message.hasOwnProperty("oneofIndex")) + if (message.oneofIndex != null && Object.hasOwnProperty.call(message, "oneofIndex")) writer.uint32(/* id 9, wireType 0 =*/72).int32(message.oneofIndex); - if (message.jsonName != null && message.hasOwnProperty("jsonName")) + if (message.jsonName != null && Object.hasOwnProperty.call(message, "jsonName")) writer.uint32(/* id 10, wireType 2 =*/82).string(message.jsonName); return writer; }; @@ -15340,7 +15340,7 @@ /** * Type enum. * @name google.protobuf.FieldDescriptorProto.Type - * @enum {string} + * @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 @@ -15386,7 +15386,7 @@ /** * Label enum. * @name google.protobuf.FieldDescriptorProto.Label - * @enum {string} + * @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 @@ -15467,9 +15467,9 @@ OneofDescriptorProto.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.options != null && message.hasOwnProperty("options")) + 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; }; @@ -15712,12 +15712,12 @@ EnumDescriptorProto.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + 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 && message.hasOwnProperty("options")) + 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) @@ -16020,9 +16020,9 @@ EnumReservedRange.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.start != null && message.hasOwnProperty("start")) + if (message.start != null && Object.hasOwnProperty.call(message, "start")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); - if (message.end != null && message.hasOwnProperty("end")) + if (message.end != null && Object.hasOwnProperty.call(message, "end")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); return writer; }; @@ -16242,11 +16242,11 @@ EnumValueDescriptorProto.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.number != null && message.hasOwnProperty("number")) + if (message.number != null && Object.hasOwnProperty.call(message, "number")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); - if (message.options != null && message.hasOwnProperty("options")) + 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; }; @@ -16480,12 +16480,12 @@ ServiceDescriptorProto.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + 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 && message.hasOwnProperty("options")) + 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; }; @@ -16765,17 +16765,17 @@ MethodDescriptorProto.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.inputType != null && message.hasOwnProperty("inputType")) + if (message.inputType != null && Object.hasOwnProperty.call(message, "inputType")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.inputType); - if (message.outputType != null && message.hasOwnProperty("outputType")) + if (message.outputType != null && Object.hasOwnProperty.call(message, "outputType")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputType); - if (message.options != null && message.hasOwnProperty("options")) + 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 && message.hasOwnProperty("clientStreaming")) + if (message.clientStreaming != null && Object.hasOwnProperty.call(message, "clientStreaming")) writer.uint32(/* id 5, wireType 0 =*/40).bool(message.clientStreaming); - if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + if (message.serverStreaming != null && Object.hasOwnProperty.call(message, "serverStreaming")) writer.uint32(/* id 6, wireType 0 =*/48).bool(message.serverStreaming); return writer; }; @@ -17204,45 +17204,45 @@ FileOptions.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + if (message.javaPackage != null && Object.hasOwnProperty.call(message, "javaPackage")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.javaPackage); - if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + if (message.javaOuterClassname != null && Object.hasOwnProperty.call(message, "javaOuterClassname")) writer.uint32(/* id 8, wireType 2 =*/66).string(message.javaOuterClassname); - if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + if (message.optimizeFor != null && Object.hasOwnProperty.call(message, "optimizeFor")) writer.uint32(/* id 9, wireType 0 =*/72).int32(message.optimizeFor); - if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + if (message.javaMultipleFiles != null && Object.hasOwnProperty.call(message, "javaMultipleFiles")) writer.uint32(/* id 10, wireType 0 =*/80).bool(message.javaMultipleFiles); - if (message.goPackage != null && message.hasOwnProperty("goPackage")) + if (message.goPackage != null && Object.hasOwnProperty.call(message, "goPackage")) writer.uint32(/* id 11, wireType 2 =*/90).string(message.goPackage); - if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + if (message.ccGenericServices != null && Object.hasOwnProperty.call(message, "ccGenericServices")) writer.uint32(/* id 16, wireType 0 =*/128).bool(message.ccGenericServices); - if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + if (message.javaGenericServices != null && Object.hasOwnProperty.call(message, "javaGenericServices")) writer.uint32(/* id 17, wireType 0 =*/136).bool(message.javaGenericServices); - if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + if (message.pyGenericServices != null && Object.hasOwnProperty.call(message, "pyGenericServices")) writer.uint32(/* id 18, wireType 0 =*/144).bool(message.pyGenericServices); - if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + if (message.javaGenerateEqualsAndHash != null && Object.hasOwnProperty.call(message, "javaGenerateEqualsAndHash")) writer.uint32(/* id 20, wireType 0 =*/160).bool(message.javaGenerateEqualsAndHash); - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) writer.uint32(/* id 23, wireType 0 =*/184).bool(message.deprecated); - if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + if (message.javaStringCheckUtf8 != null && Object.hasOwnProperty.call(message, "javaStringCheckUtf8")) writer.uint32(/* id 27, wireType 0 =*/216).bool(message.javaStringCheckUtf8); - if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + if (message.ccEnableArenas != null && Object.hasOwnProperty.call(message, "ccEnableArenas")) writer.uint32(/* id 31, wireType 0 =*/248).bool(message.ccEnableArenas); - if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + if (message.objcClassPrefix != null && Object.hasOwnProperty.call(message, "objcClassPrefix")) writer.uint32(/* id 36, wireType 2 =*/290).string(message.objcClassPrefix); - if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + if (message.csharpNamespace != null && Object.hasOwnProperty.call(message, "csharpNamespace")) writer.uint32(/* id 37, wireType 2 =*/298).string(message.csharpNamespace); - if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + if (message.swiftPrefix != null && Object.hasOwnProperty.call(message, "swiftPrefix")) writer.uint32(/* id 39, wireType 2 =*/314).string(message.swiftPrefix); - if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + if (message.phpClassPrefix != null && Object.hasOwnProperty.call(message, "phpClassPrefix")) writer.uint32(/* id 40, wireType 2 =*/322).string(message.phpClassPrefix); - if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + if (message.phpNamespace != null && Object.hasOwnProperty.call(message, "phpNamespace")) writer.uint32(/* id 41, wireType 2 =*/330).string(message.phpNamespace); - if (message.phpGenericServices != null && message.hasOwnProperty("phpGenericServices")) + if (message.phpGenericServices != null && Object.hasOwnProperty.call(message, "phpGenericServices")) writer.uint32(/* id 42, wireType 0 =*/336).bool(message.phpGenericServices); - if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + if (message.phpMetadataNamespace != null && Object.hasOwnProperty.call(message, "phpMetadataNamespace")) writer.uint32(/* id 44, wireType 2 =*/354).string(message.phpMetadataNamespace); - if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + 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) @@ -17635,7 +17635,7 @@ /** * OptimizeMode enum. * @name google.protobuf.FileOptions.OptimizeMode - * @enum {string} + * @enum {number} * @property {number} SPEED=1 SPEED value * @property {number} CODE_SIZE=2 CODE_SIZE value * @property {number} LITE_RUNTIME=3 LITE_RUNTIME value @@ -17744,13 +17744,13 @@ MessageOptions.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + if (message.messageSetWireFormat != null && Object.hasOwnProperty.call(message, "messageSetWireFormat")) writer.uint32(/* id 1, wireType 0 =*/8).bool(message.messageSetWireFormat); - if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + if (message.noStandardDescriptorAccessor != null && Object.hasOwnProperty.call(message, "noStandardDescriptorAccessor")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.noStandardDescriptorAccessor); - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); - if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + 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) @@ -18070,17 +18070,17 @@ FieldOptions.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.ctype != null && message.hasOwnProperty("ctype")) + if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ctype); - if (message.packed != null && message.hasOwnProperty("packed")) + if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.packed); - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); - if (message.lazy != null && message.hasOwnProperty("lazy")) + if (message.lazy != null && Object.hasOwnProperty.call(message, "lazy")) writer.uint32(/* id 5, wireType 0 =*/40).bool(message.lazy); - if (message.jstype != null && message.hasOwnProperty("jstype")) + if (message.jstype != null && Object.hasOwnProperty.call(message, "jstype")) writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); - if (message.weak != null && message.hasOwnProperty("weak")) + 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) @@ -18409,7 +18409,7 @@ /** * CType enum. * @name google.protobuf.FieldOptions.CType - * @enum {string} + * @enum {number} * @property {number} STRING=0 STRING value * @property {number} CORD=1 CORD value * @property {number} STRING_PIECE=2 STRING_PIECE value @@ -18425,7 +18425,7 @@ /** * JSType enum. * @name google.protobuf.FieldOptions.JSType - * @enum {string} + * @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 @@ -18724,9 +18724,9 @@ EnumOptions.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + if (message.allowAlias != null && Object.hasOwnProperty.call(message, "allowAlias")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAlias); - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + 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) @@ -18969,7 +18969,7 @@ EnumValueOptions.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + 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) @@ -19218,14 +19218,14 @@ ServiceOptions.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + 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 && message.hasOwnProperty(".google.api.defaultHost")) + 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 && message.hasOwnProperty(".google.api.oauthScopes")) + 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; }; @@ -19513,19 +19513,19 @@ MethodOptions.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); - if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) + 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 && message.hasOwnProperty(".google.longrunning.operationInfo")) + 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 && message.hasOwnProperty(".google.api.http")) + 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; }; @@ -19775,7 +19775,7 @@ /** * IdempotencyLevel enum. * @name google.protobuf.MethodOptions.IdempotencyLevel - * @enum {string} + * @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 @@ -19905,17 +19905,17 @@ 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 && message.hasOwnProperty("identifierValue")) + if (message.identifierValue != null && Object.hasOwnProperty.call(message, "identifierValue")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.identifierValue); - if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + if (message.positiveIntValue != null && Object.hasOwnProperty.call(message, "positiveIntValue")) writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.positiveIntValue); - if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + if (message.negativeIntValue != null && Object.hasOwnProperty.call(message, "negativeIntValue")) writer.uint32(/* id 5, wireType 0 =*/40).int64(message.negativeIntValue); - if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) writer.uint32(/* id 6, wireType 1 =*/49).double(message.doubleValue); - if (message.stringValue != null && message.hasOwnProperty("stringValue")) + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.stringValue); - if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + if (message.aggregateValue != null && Object.hasOwnProperty.call(message, "aggregateValue")) writer.uint32(/* id 8, wireType 2 =*/66).string(message.aggregateValue); return writer; }; @@ -20692,9 +20692,9 @@ writer.int32(message.span[i]); writer.ldelim(); } - if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + if (message.leadingComments != null && Object.hasOwnProperty.call(message, "leadingComments")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.leadingComments); - if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + 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) @@ -21225,11 +21225,11 @@ writer.int32(message.path[i]); writer.ldelim(); } - if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + if (message.sourceFile != null && Object.hasOwnProperty.call(message, "sourceFile")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceFile); - if (message.begin != null && message.hasOwnProperty("begin")) + if (message.begin != null && Object.hasOwnProperty.call(message, "begin")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.begin); - if (message.end != null && message.hasOwnProperty("end")) + if (message.end != null && Object.hasOwnProperty.call(message, "end")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.end); return writer; }; @@ -21482,9 +21482,9 @@ Any.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.type_url != null && message.hasOwnProperty("type_url")) + 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 && message.hasOwnProperty("value")) + if (message.value != null && Object.hasOwnProperty.call(message, "value")) writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); return writer; }; @@ -21692,7 +21692,7 @@ DoubleValue.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.value != null && message.hasOwnProperty("value")) + if (message.value != null && Object.hasOwnProperty.call(message, "value")) writer.uint32(/* id 1, wireType 1 =*/9).double(message.value); return writer; }; @@ -21879,7 +21879,7 @@ FloatValue.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.value != null && message.hasOwnProperty("value")) + if (message.value != null && Object.hasOwnProperty.call(message, "value")) writer.uint32(/* id 1, wireType 5 =*/13).float(message.value); return writer; }; @@ -22066,7 +22066,7 @@ Int64Value.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.value != null && message.hasOwnProperty("value")) + if (message.value != null && Object.hasOwnProperty.call(message, "value")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.value); return writer; }; @@ -22267,7 +22267,7 @@ UInt64Value.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.value != null && message.hasOwnProperty("value")) + if (message.value != null && Object.hasOwnProperty.call(message, "value")) writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.value); return writer; }; @@ -22468,7 +22468,7 @@ Int32Value.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.value != null && message.hasOwnProperty("value")) + if (message.value != null && Object.hasOwnProperty.call(message, "value")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.value); return writer; }; @@ -22655,7 +22655,7 @@ UInt32Value.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.value != null && message.hasOwnProperty("value")) + if (message.value != null && Object.hasOwnProperty.call(message, "value")) writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.value); return writer; }; @@ -22842,7 +22842,7 @@ BoolValue.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.value != null && message.hasOwnProperty("value")) + if (message.value != null && Object.hasOwnProperty.call(message, "value")) writer.uint32(/* id 1, wireType 0 =*/8).bool(message.value); return writer; }; @@ -23029,7 +23029,7 @@ StringValue.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.value != null && message.hasOwnProperty("value")) + if (message.value != null && Object.hasOwnProperty.call(message, "value")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); return writer; }; @@ -23216,7 +23216,7 @@ BytesValue.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.value != null && message.hasOwnProperty("value")) + if (message.value != null && Object.hasOwnProperty.call(message, "value")) writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.value); return writer; }; @@ -23421,9 +23421,9 @@ Duration.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.seconds != null && message.hasOwnProperty("seconds")) + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); - if (message.nanos != null && message.hasOwnProperty("nanos")) + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); return writer; }; @@ -23805,9 +23805,9 @@ Timestamp.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.seconds != null && message.hasOwnProperty("seconds")) + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); - if (message.nanos != null && message.hasOwnProperty("nanos")) + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); return writer; }; @@ -24051,9 +24051,9 @@ Status.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.code != null && message.hasOwnProperty("code")) + if (message.code != null && Object.hasOwnProperty.call(message, "code")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); - if (message.message != null && message.hasOwnProperty("message")) + 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) @@ -24325,13 +24325,13 @@ Color.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.red != null && message.hasOwnProperty("red")) + if (message.red != null && Object.hasOwnProperty.call(message, "red")) writer.uint32(/* id 1, wireType 5 =*/13).float(message.red); - if (message.green != null && message.hasOwnProperty("green")) + if (message.green != null && Object.hasOwnProperty.call(message, "green")) writer.uint32(/* id 2, wireType 5 =*/21).float(message.green); - if (message.blue != null && message.hasOwnProperty("blue")) + if (message.blue != null && Object.hasOwnProperty.call(message, "blue")) writer.uint32(/* id 3, wireType 5 =*/29).float(message.blue); - if (message.alpha != null && message.hasOwnProperty("alpha")) + if (message.alpha != null && Object.hasOwnProperty.call(message, "alpha")) $root.google.protobuf.FloatValue.encode(message.alpha, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; @@ -24819,15 +24819,15 @@ Operation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.metadata != null && message.hasOwnProperty("metadata")) + 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 && message.hasOwnProperty("done")) + if (message.done != null && Object.hasOwnProperty.call(message, "done")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.done); - if (message.error != null && message.hasOwnProperty("error")) + 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 && message.hasOwnProperty("response")) + 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; }; @@ -25087,7 +25087,7 @@ GetOperationRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; @@ -25301,13 +25301,13 @@ ListOperationsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.filter != null && message.hasOwnProperty("filter")) + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); - if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.name); return writer; }; @@ -25541,7 +25541,7 @@ 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 && message.hasOwnProperty("nextPageToken")) + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; }; @@ -25759,7 +25759,7 @@ CancelOperationRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; @@ -25946,7 +25946,7 @@ DeleteOperationRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; @@ -26142,9 +26142,9 @@ WaitOperationRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.timeout != null && message.hasOwnProperty("timeout")) + 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; }; @@ -26357,9 +26357,9 @@ OperationInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.responseType != null && message.hasOwnProperty("responseType")) + if (message.responseType != null && Object.hasOwnProperty.call(message, "responseType")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.responseType); - if (message.metadataType != null && message.hasOwnProperty("metadataType")) + if (message.metadataType != null && Object.hasOwnProperty.call(message, "metadataType")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.metadataType); return writer; }; diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 7046a29bcce..64006e77fc5 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,24 +4,22 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "01066765f60411608513e0e57b4955eaf390b371" + "sha": "4cb651dfe590269cc6ad808a49b601d09447f21b" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "26523a96798ce1a6caa1b3c912119059cfcc98a7", - "internalRef": "306320014", - "log": "26523a96798ce1a6caa1b3c912119059cfcc98a7\nchore: delete gapic config for resourcemanager/v2\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306320014\n\n35672e7936b923eff048d0ee1529faa163cc81b8\nchore: enable gapicv2 for datacatalog/v1beta1 API\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306318928\n\ndea1f52034d188ca371c3a70c716ca2a6b3f2aa1\nchore: delete gapic config for language/v1beta1\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306298030\n\ndf955af5d9508cf9215de6f1fbdad033d5b8fef6\nchore: enable gapicv2 for language/v1beta2 API\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306297639\n\ne2a59ff2f861b1b92b2f15b242780dccddd77ab9\nchore: enable gapicv2 for bigquery/reservation/v1 API\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306297615\n\nc9942c00e8f35b5b37cd589ef7a0323aeda264e2\nchore: enable gapicv2 for datacatalog/v1beta1 API\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306297587\n\nf561f57eea013327be27d8f6799b3cc2d18ee804\nbazel: upgrade gapic-generator-go to v0.13.2\n\nChanges include:\n* update Bazel rules_go to v0.22.3\n* update Bazel Go repositories with latest\n* fix Bazel go_gapic_assembly_pkg archive contents path\n\nPiperOrigin-RevId: 306294636\n\na34f4eb96a94bfd5b3e7f8de253db28d0a3e9237\nchore: enable gapicv2 for asset/v1beta1 API\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306283252\n\n4efd71279f0781579ced60c374336ce1b8b8cea8\nchore: enable gapicv2 for asset/v1p4beta1 API\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306282838\n\n789fd7e0680b04a589447139811d55c5d1f34afe\nchore: enable gapicv2 for asset/v1p1beta1 API\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306282062\n\n0feb08065d91d6deebffef3019751f0619a72140\nchore: enable gapicv2 for asset/v1p2beta1 API\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306281797\n\n9ea892ebe8a7cd66da9bd62eb7086b8dc2ddd559\nchore: enable gapicv2 for vision/v1 API\n\nCommitter: @miraleung\nPiperOrigin-RevId: 306281271\n\n4d61e1cb40184a7ad63ef37b1813f6608718674a\nAdd speech adaptation, phrase sets and custom classes.\n\nPiperOrigin-RevId: 306280989\n\n3824f547aa44df459580615c73cabb30a2a78ee0\nfeat: Adding Retry policy for OS Config V1Beta AgentEndpointService\n\nPiperOrigin-RevId: 306254195\n\n" + "sha": "42ee97c1b93a0e3759bbba3013da309f670a90ab", + "internalRef": "307114445" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "52638600f387deb98efb5f9c85fec39e82aa9052", - "log": "52638600f387deb98efb5f9c85fec39e82aa9052\nbuild(java): set GOOGLE_CLOUD_PROJECT env for samples/integration tests (#484)\n\n* build(java): set GOOGLE_CLOUD_PROJECT env variable for samples/integration tests\n\n* ci: use java-docs-samples-testing for sample tests\n3df869dd6eb546ef13beeb7a9efa6ee0226afafd\nci: add dependency list completeness check (#490)\n\n\n682c0c37d1054966ca662a44259e96cc7aea4413\nbuild(nodejs): update lint ignore rules (#488)\n\n\n97c7ccfdceb927db1cbe6f3bb09616aa02bafd89\ndoc: document context-aware commit flags (#481)\n\nAlso, delete obsolete blurb about cleaning up old, dead files.\n\nCo-authored-by: Jeff Ching \n8eff3790f88b50706a0c4b6a20b385f24e9ac4e7\nfeat: common postprocessing for node libraries (#485)\n\nCo-authored-by: Justin Beckwith \n21c3b57ae54ae9db6a3a6b48b31c970c6ab56f19\nbuild(nodejs): remove unused codecov config (#486)\n\n\n" + "sha": "19465d3ec5e5acdb01521d8f3bddd311bcbee28d" } } ], diff --git a/packages/google-cloud-documentai/system-test/install.ts b/packages/google-cloud-documentai/system-test/install.ts index c4d80e9c0c8..4c1ba3eb79a 100644 --- a/packages/google-cloud-documentai/system-test/install.ts +++ b/packages/google-cloud-documentai/system-test/install.ts @@ -21,7 +21,7 @@ import {readFileSync} from 'fs'; import {describe, it} from 'mocha'; describe('typescript consumer tests', () => { - it('should have correct type signature for typescript users', async function() { + it('should have correct type signature for typescript users', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), // path to your module. @@ -35,7 +35,7 @@ describe('typescript consumer tests', () => { await packNTest(options); // will throw upon error. }); - it('should have correct type signature for javascript users', async function() { + it('should have correct type signature for javascript users', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), // path to your module. From ae189c67ff242fb32332245469682c9090b761e1 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Thu, 23 Apr 2020 19:29:45 -0700 Subject: [PATCH 031/213] chore: update npm scripts and synth.py (#53) Update npm scripts: add clean, prelint, prefix; make sure that lint and fix are set properly. Use post-process feature of synthtool. --- packages/google-cloud-documentai/package.json | 5 +++-- packages/google-cloud-documentai/synth.py | 7 ++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 2122a6d9c86..d47df536f1a 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -17,13 +17,14 @@ "docs": "jsdoc -c .jsdoc.js", "docs-test": "linkinator docs", "fix": "gts fix", - "lint": "gts fix", + "lint": "gts check", "prelint": "cd samples; npm link ../; npm install", "predocs-test": "npm run docs", "prepare": "npm run compile-protos && npm run compile", "system-test": "c8 mocha build/system-test", "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", - "test": "c8 mocha build/test" + "test": "c8 mocha build/test", + "precompile": "gts clean" }, "dependencies": { "google-gax": "^2.1.0" diff --git a/packages/google-cloud-documentai/synth.py b/packages/google-cloud-documentai/synth.py index 5254c834708..6e0c5870ec9 100644 --- a/packages/google-cloud-documentai/synth.py +++ b/packages/google-cloud-documentai/synth.py @@ -15,7 +15,7 @@ import synthtool as s import synthtool.gcp as gcp -import subprocess +import synthtool.languages.node as node import logging logging.basicConfig(level=logging.DEBUG) @@ -43,7 +43,4 @@ templates = common_templates.node_library(source_location='build/src') s.copy(templates, excludes=[]) -# Node.js specific cleanup -subprocess.run(['npm', 'install']) -subprocess.run(['npm', 'run', 'fix']) -subprocess.run(['npx', 'compileProtos', 'src']) +node.postprocess_gapic_library() From 9a51dae03edab3ad018de11b2f6db9d40075012f Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Tue, 5 May 2020 19:34:38 -0700 Subject: [PATCH 032/213] feat: check status of long running operation by its name (#54) For each client method returning a long running operation, a separate method to check its status is added. Added methods: `checkBatchProcessDocumentsProgress`. --- .../document_understanding_service_client.ts | 38 +++++++++++- .../google-cloud-documentai/synth.metadata | 14 +---- ..._document_understanding_service_v1beta2.ts | 62 ++++++++++++++++--- 3 files changed, 92 insertions(+), 22 deletions(-) diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index d9ef70f246a..416072c6efa 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -28,7 +28,7 @@ import * as path from 'path'; import * as protos from '../../protos/protos'; import * as gapicConfig from './document_understanding_service_client_config.json'; - +import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -543,6 +543,42 @@ export class DocumentUnderstandingServiceClient { this.initialize(); return this.innerApiCalls.batchProcessDocuments(request, options, callback); } + /** + * Check the status of the long running operation returned by the batchProcessDocuments() method. + * @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. + * + * @example: + * const decodedOperation = await checkBatchProcessDocumentsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + * + */ + async checkBatchProcessDocumentsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta2.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.batchProcessDocuments, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta2.OperationMetadata + >; + } /** * Terminate the GRPC channel and close the client. diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 64006e77fc5..9b2370cf53c 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -3,23 +3,15 @@ { "git": { "name": ".", - "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "4cb651dfe590269cc6ad808a49b601d09447f21b" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "42ee97c1b93a0e3759bbba3013da309f670a90ab", - "internalRef": "307114445" + "remote": "git@github.com:googleapis/nodejs-document-ai.git", + "sha": "8515d226f29f07969229575789d95a094a837d31" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "19465d3ec5e5acdb01521d8f3bddd311bcbee28d" + "sha": "ab883569eb0257bbf16a6d825fd018b3adde3912" } } ], diff --git a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts index cffa5a90c0d..d63dd5be679 100644 --- a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts +++ b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts @@ -23,7 +23,7 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as documentunderstandingserviceModule from '../src'; -import {protobuf, LROperation} from 'google-gax'; +import {protobuf, LROperation, operationsProtos} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = (instance.constructor as typeof protobuf.Message).toObject( @@ -288,9 +288,7 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { undefined, expectedError ); - await assert.rejects(async () => { - await client.processDocument(request); - }, expectedError); + await assert.rejects(client.processDocument(request), expectedError); assert( (client.innerApiCalls.processDocument as SinonStub) .getCall(0) @@ -418,9 +416,10 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { undefined, expectedError ); - await assert.rejects(async () => { - await client.batchProcessDocuments(request); - }, expectedError); + await assert.rejects( + client.batchProcessDocuments(request), + expectedError + ); assert( (client.innerApiCalls.batchProcessDocuments as SinonStub) .getCall(0) @@ -455,14 +454,57 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { expectedError ); const [operation] = await client.batchProcessDocuments(request); - await assert.rejects(async () => { - await operation.promise(); - }, expectedError); + await assert.rejects(operation.promise(), expectedError); assert( (client.innerApiCalls.batchProcessDocuments as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes checkBatchProcessDocumentsProgress without error', async () => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + 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.checkBatchProcessDocumentsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchProcessDocumentsProgress with error', async () => { + const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + 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.checkBatchProcessDocumentsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); }); }); From 00e871eb358d6c55942a9b4c7cccb055af9cc7b9 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 8 May 2020 11:24:42 -0700 Subject: [PATCH 033/213] build: do not fail builds on codecov errors (#528) (#55) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/13e8b547-7af0-436b-b85e-2c1942f8f36a/targets Source-Link: https://github.com/googleapis/synthtool/commit/be74d3e532faa47eb59f1a0eaebde0860d1d8ab4 --- packages/google-cloud-documentai/synth.metadata | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 9b2370cf53c..805dfa9cfaf 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -3,15 +3,23 @@ { "git": { "name": ".", - "remote": "git@github.com:googleapis/nodejs-document-ai.git", - "sha": "8515d226f29f07969229575789d95a094a837d31" + "remote": "https://github.com/googleapis/nodejs-document-ai.git", + "sha": "d88c23cb6722e8b4cac710f87bf1cfee1061a5e3" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "2fc2caaacb15949c7f80426bfc7dafdd41dbc333", + "internalRef": "310239576" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "ab883569eb0257bbf16a6d825fd018b3adde3912" + "sha": "be74d3e532faa47eb59f1a0eaebde0860d1d8ab4" } } ], From 1e04394b45c53f6c297a8ec659e1b26ac3848e89 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 15 May 2020 20:04:07 +0200 Subject: [PATCH 034/213] fix(deps): update dependency @google-cloud/storage to v5 (#56) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@google-cloud/storage](https://togithub.com/googleapis/nodejs-storage) | dependencies | major | [`^4.2.0` -> `^5.0.0`](https://renovatebot.com/diffs/npm/@google-cloud%2fstorage/4.7.0/5.0.0) | --- ### Release Notes
googleapis/nodejs-storage ### [`v5.0.0`](https://togithub.com/googleapis/nodejs-storage/blob/master/CHANGELOG.md#​500-httpswwwgithubcomgoogleapisnodejs-storagecomparev470v500-2020-05-13) [Compare Source](https://togithub.com/googleapis/nodejs-storage/compare/v4.7.0...v5.0.0) ##### ⚠ BREAKING CHANGES - automatically detect contentType if not provided ([#​1190](https://togithub.com/googleapis/nodejs-storage/issues/1190)) - drop keepAcl parameter in file copy ([#​1166](https://togithub.com/googleapis/nodejs-storage/issues/1166)) - drop support for node.js 8.x ##### Features - automatically detect contentType if not provided ([#​1190](https://www.github.com/googleapis/nodejs-storage/issues/1190)) ([b31ba4a](https://www.github.com/googleapis/nodejs-storage/commit/b31ba4a11399b57538ddf0d6ca2e10b2aa3fbc3a)) - enable bytes read tracking ([#​1074](https://www.github.com/googleapis/nodejs-storage/issues/1074)) ([0776a04](https://www.github.com/googleapis/nodejs-storage/commit/0776a044f3b2149b485e114369e952688df75645)) ##### Bug Fixes - **bucket:** Only disable resumable uploads for bucket.upload (fixes [#​1133](https://www.github.com/googleapis/nodejs-storage/issues/1133)) ([#​1135](https://www.github.com/googleapis/nodejs-storage/issues/1135)) ([2c20148](https://www.github.com/googleapis/nodejs-storage/commit/2c201486b7b2d3146846ac96c877a904c4a674b0)), closes [/github.com/googleapis/nodejs-storage/pull/1135#issuecomment-620070038](https://www.github.com/googleapis//github.com/googleapis/nodejs-storage/pull/1135/issues/issuecomment-620070038) - add whitespace to generateV4SignedPolicy ([#​1136](https://www.github.com/googleapis/nodejs-storage/issues/1136)) ([dcee78b](https://www.github.com/googleapis/nodejs-storage/commit/dcee78b98da23b02fe7d2f13a9270546bc07bba8)) - apache license URL ([#​468](https://www.github.com/googleapis/nodejs-storage/issues/468)) ([#​1151](https://www.github.com/googleapis/nodejs-storage/issues/1151)) ([e8116d3](https://www.github.com/googleapis/nodejs-storage/commit/e8116d3c6fa7412858692e67745b514eef78850e)) - Point to team in correct org ([#​1185](https://www.github.com/googleapis/nodejs-storage/issues/1185)) ([0bb1909](https://www.github.com/googleapis/nodejs-storage/commit/0bb19098013acf71cc3842f78ff333a8e356331a)) - **deps:** update dependency [@​google-cloud/common](https://togithub.com/google-cloud/common) to v3 ([#​1134](https://www.github.com/googleapis/nodejs-storage/issues/1134)) ([774ac5c](https://www.github.com/googleapis/nodejs-storage/commit/774ac5c75f02238418cc8ed7242297ea573ca9cb)) - **deps:** update dependency [@​google-cloud/paginator](https://togithub.com/google-cloud/paginator) to v3 ([#​1131](https://www.github.com/googleapis/nodejs-storage/issues/1131)) ([c1614d9](https://www.github.com/googleapis/nodejs-storage/commit/c1614d98e3047db379e09299b1014e80d73ed52f)) - **deps:** update dependency [@​google-cloud/promisify](https://togithub.com/google-cloud/promisify) to v2 ([#​1127](https://www.github.com/googleapis/nodejs-storage/issues/1127)) ([06624a5](https://www.github.com/googleapis/nodejs-storage/commit/06624a534cd1fdbc38455eee8d89f9f60ba75758)) - **deps:** update dependency uuid to v8 ([#​1170](https://www.github.com/googleapis/nodejs-storage/issues/1170)) ([6a98d64](https://www.github.com/googleapis/nodejs-storage/commit/6a98d64831baf1ca1ec2f03ecc4914745cba1c86)) - **deps:** update gcs-resumable-upload, remove gitnpm usage ([#​1186](https://www.github.com/googleapis/nodejs-storage/issues/1186)) ([c78c9cd](https://www.github.com/googleapis/nodejs-storage/commit/c78c9cde49dccb2fcd4ce10e4e9f8299d65f6838)) - **v4-policy:** encode special characters ([#​1169](https://www.github.com/googleapis/nodejs-storage/issues/1169)) ([6e48539](https://www.github.com/googleapis/nodejs-storage/commit/6e48539d76ca27e6f4c6cf2ac0872970f7391fed)) - sync to [googleapis/conformance-tests@`fa559a1`](https://togithub.com/googleapis/conformance-tests/commit/fa559a1) ([#​1167](https://www.github.com/googleapis/nodejs-storage/issues/1167)) ([5500446](https://www.github.com/googleapis/nodejs-storage/commit/550044619d2f17a1977c83bce5df915c6dc9578c)), closes [#​1168](https://www.github.com/googleapis/nodejs-storage/issues/1168) ##### Miscellaneous Chores - drop keepAcl parameter in file copy ([#​1166](https://www.github.com/googleapis/nodejs-storage/issues/1166)) ([5a4044a](https://www.github.com/googleapis/nodejs-storage/commit/5a4044a8ba13f248fc4f791248f797eb0f1f3c16)) ##### Build System - drop support for node.js 8.x ([b80c025](https://www.github.com/googleapis/nodejs-storage/commit/b80c025f106052fd25554c64314b3b3520e829b5))
--- ### 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#googleapis/nodejs-document-ai). --- packages/google-cloud-documentai/samples/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index c2839578100..916bd062810 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -14,7 +14,7 @@ }, "dependencies": { "@google-cloud/documentai": "^1.0.0", - "@google-cloud/storage": "^4.2.0" + "@google-cloud/storage": "^5.0.0" }, "devDependencies": { "chai": "^4.2.0", From be739b1f5a4beadca1e5100a2863e971a27c9fe0 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 2 Jun 2020 14:50:29 -0700 Subject: [PATCH 035/213] chore: release 2.0.0 (#31) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json [ci skip] Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-documentai/CHANGELOG.md | 20 +++++++++++++++++++ packages/google-cloud-documentai/package.json | 2 +- .../samples/package.json | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index fe9c7325028..9ff262fc3db 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## [2.0.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v1.0.0...v2.0.0) (2020-05-15) + + +### ⚠ BREAKING CHANGES + +* The library now supports Node.js v10+. The last version to support Node.js v8 is tagged legacy-8 on NPM. + +### Features + +* check status of long running operation by its name ([#54](https://www.github.com/googleapis/nodejs-document-ai/issues/54)) ([d88c23c](https://www.github.com/googleapis/nodejs-document-ai/commit/d88c23cb6722e8b4cac710f87bf1cfee1061a5e3)) +* drop node8 support ([#30](https://www.github.com/googleapis/nodejs-document-ai/issues/30)) ([67ff888](https://www.github.com/googleapis/nodejs-document-ai/commit/67ff88835475d12680e2a2af03987160af9d30e5)) + + +### Bug Fixes + +* remove eslint, update gax, fix generated protos, run the generator ([#37](https://www.github.com/googleapis/nodejs-document-ai/issues/37)) ([9e6cf01](https://www.github.com/googleapis/nodejs-document-ai/commit/9e6cf011c010bdae157d022fa95edd0ad819862c)) +* remove unused dependencies ([#41](https://www.github.com/googleapis/nodejs-document-ai/issues/41)) ([27077e9](https://www.github.com/googleapis/nodejs-document-ai/commit/27077e9348ce2991f0b506384871e42494baa085)) +* **deps:** update dependency @google-cloud/storage to v5 ([#56](https://www.github.com/googleapis/nodejs-document-ai/issues/56)) ([934f317](https://www.github.com/googleapis/nodejs-document-ai/commit/934f3170fd5650e766525e7d8b1f580a1eca7fab)) +* **samples:** do not pass location ([#39](https://www.github.com/googleapis/nodejs-document-ai/issues/39)) ([2ef2db5](https://www.github.com/googleapis/nodejs-document-ai/commit/2ef2db5f004eb5dcaef27fa85c0d723634661a34)) + ## 1.0.0 (2020-03-20) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index d47df536f1a..405eaee949b 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "1.0.0", + "version": "2.0.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 916bd062810..50fab5826f3 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^1.0.0", + "@google-cloud/documentai": "^2.0.0", "@google-cloud/storage": "^5.0.0" }, "devDependencies": { From bef6fc42870e5354804065cbdc91cf97e5a246ed Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 3 Jun 2020 17:38:19 -0700 Subject: [PATCH 036/213] build: update protos.js (#57) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/041f5df7-f5d3-4b2a-9ede-0752bf41c185/targets --- .../protos/protos.d.ts | 6 ++++ .../google-cloud-documentai/protos/protos.js | 28 +++++++++++++++++-- .../protos/protos.json | 6 +++- .../google-cloud-documentai/synth.metadata | 2 +- 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index cb586ed1cbd..137607068af 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -5785,6 +5785,9 @@ export namespace google { /** FieldDescriptorProto options */ options?: (google.protobuf.IFieldOptions|null); + + /** FieldDescriptorProto proto3Optional */ + proto3Optional?: (boolean|null); } /** Represents a FieldDescriptorProto. */ @@ -5826,6 +5829,9 @@ export namespace google { /** 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 diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 206b7753584..20d3b12c17f 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -28,7 +28,7 @@ var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; // Exported root namespace - var $root = $protobuf.roots._google_cloud_documentai_1_0_0_protos || ($protobuf.roots._google_cloud_documentai_1_0_0_protos = {}); + var $root = $protobuf.roots._google_cloud_documentai_2_0_0_protos || ($protobuf.roots._google_cloud_documentai_2_0_0_protos = {}); $root.google = (function() { @@ -14854,6 +14854,7 @@ * @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 */ /** @@ -14951,6 +14952,14 @@ */ 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 @@ -14995,6 +15004,8 @@ 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; }; @@ -15059,6 +15070,9 @@ 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; @@ -15153,6 +15167,9 @@ if (error) return "options." + error; } + if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + if (typeof message.proto3Optional !== "boolean") + return "proto3Optional: boolean expected"; return null; }; @@ -15275,6 +15292,8 @@ 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; }; @@ -15302,6 +15321,7 @@ object.options = null; object.oneofIndex = 0; object.jsonName = ""; + object.proto3Optional = false; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -15323,6 +15343,8 @@ 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; }; @@ -17114,7 +17136,7 @@ * @memberof google.protobuf.FileOptions * @instance */ - FileOptions.prototype.ccEnableArenas = false; + FileOptions.prototype.ccEnableArenas = true; /** * FileOptions objcClassPrefix. @@ -17563,7 +17585,7 @@ object.javaGenerateEqualsAndHash = false; object.deprecated = false; object.javaStringCheckUtf8 = false; - object.ccEnableArenas = false; + object.ccEnableArenas = true; object.objcClassPrefix = ""; object.csharpNamespace = ""; object.swiftPrefix = ""; diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 0fdf3952613..04d3c5e64aa 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -1320,6 +1320,10 @@ "options": { "type": "FieldOptions", "id": 8 + }, + "proto3Optional": { + "type": "bool", + "id": 17 } }, "nested": { @@ -1555,7 +1559,7 @@ "type": "bool", "id": 31, "options": { - "default": false + "default": true } }, "objcClassPrefix": { diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 805dfa9cfaf..a5b7d3d866b 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "d88c23cb6722e8b4cac710f87bf1cfee1061a5e3" + "sha": "52c0977a7a0f41276f24debf9ed9282719fa3472" } }, { From 9c1c89ce7e10e0918475b10cc3e9fb7f15aa9703 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 9 Jun 2020 17:39:24 -0700 Subject: [PATCH 037/213] feat: move ts target to es2018 from es2016 (#60) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/9b55eba7-85ee-48d5-a737-8b677439db4d/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/1c92077459db3dc50741e878f98b08c6261181e0 --- packages/google-cloud-documentai/protos/protos.js | 2 +- .../src/v1beta2/document_understanding_service_client.ts | 7 +++++++ packages/google-cloud-documentai/synth.metadata | 4 ++-- packages/google-cloud-documentai/tsconfig.json | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 20d3b12c17f..b4cd0df1f5c 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -28,7 +28,7 @@ var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; // Exported root namespace - var $root = $protobuf.roots._google_cloud_documentai_2_0_0_protos || ($protobuf.roots._google_cloud_documentai_2_0_0_protos = {}); + var $root = $protobuf.roots._google_cloud_documentai_protos || ($protobuf.roots._google_cloud_documentai_protos = {}); $root.google = (function() { diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index 416072c6efa..fb306bd24ed 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -99,6 +99,13 @@ export class DocumentUnderstandingServiceClient { } opts.servicePath = opts.servicePath || servicePath; opts.port = opts.port || port; + + // users can override the config from client side, like retry codes name. + // The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/master/src/gax.ts#L546 + // The way to override client config for Showcase API: + // + // const customConfig = {"interfaces": {"google.showcase.v1beta1.Echo": {"methods": {"Echo": {"retry_codes_name": "idempotent", "retry_params_name": "default"}}}}} + // const showcaseClient = new showcaseClient({ projectId, customConfig }); opts.clientConfig = opts.clientConfig || {}; const isBrowser = typeof window !== 'undefined'; diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index a5b7d3d866b..ec414a32021 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "52c0977a7a0f41276f24debf9ed9282719fa3472" + "sha": "0862794737fe7f2cafd8760f566fd255618c12ae" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "be74d3e532faa47eb59f1a0eaebde0860d1d8ab4" + "sha": "1c92077459db3dc50741e878f98b08c6261181e0" } } ], diff --git a/packages/google-cloud-documentai/tsconfig.json b/packages/google-cloud-documentai/tsconfig.json index 613d35597b5..c78f1c884ef 100644 --- a/packages/google-cloud-documentai/tsconfig.json +++ b/packages/google-cloud-documentai/tsconfig.json @@ -5,7 +5,7 @@ "outDir": "build", "resolveJsonModule": true, "lib": [ - "es2016", + "es2018", "dom" ] }, From 67b53555735f689fdeb826deb15f40de523b304d Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 11 Jun 2020 17:46:01 +0200 Subject: [PATCH 038/213] chore(deps): update dependency mocha to v8 (#63) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [mocha](https://mochajs.org/) ([source](https://togithub.com/mochajs/mocha)) | devDependencies | major | [`^7.0.0` -> `^8.0.0`](https://renovatebot.com/diffs/npm/mocha/7.2.0/8.0.1) | --- ### Release Notes
mochajs/mocha ### [`v8.0.1`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​801--2020-06-10) [Compare Source](https://togithub.com/mochajs/mocha/compare/v8.0.0...v8.0.1) The obligatory patch after a major. #### :bug: Fixes - [#​4328](https://togithub.com/mochajs/mocha/issues/4328): Fix `--parallel` when combined with `--watch` ([**@​boneskull**](https://togithub.com/boneskull)) ### [`v8.0.0`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​800--2020-06-10) [Compare Source](https://togithub.com/mochajs/mocha/compare/v7.2.0...v8.0.0) In this major release, Mocha adds the ability to _run tests in parallel_. Better late than never! Please note the **breaking changes** detailed below. Let's welcome [**@​giltayar**](https://togithub.com/giltayar) and [**@​nicojs**](https://togithub.com/nicojs) to the maintenance team! #### :boom: Breaking Changes - [#​4164](https://togithub.com/mochajs/mocha/issues/4164): **Mocha v8.0.0 now requires Node.js v10.0.0 or newer.** Mocha no longer supports the Node.js v8.x line ("Carbon"), which entered End-of-Life at the end of 2019 ([**@​UlisesGascon**](https://togithub.com/UlisesGascon)) - [#​4175](https://togithub.com/mochajs/mocha/issues/4175): Having been deprecated with a warning since v7.0.0, **`mocha.opts` is no longer supported** ([**@​juergba**](https://togithub.com/juergba)) :sparkles: **WORKAROUND:** Replace `mocha.opts` with a [configuration file](https://mochajs.org/#configuring-mocha-nodejs). - [#​4260](https://togithub.com/mochajs/mocha/issues/4260): Remove `enableTimeout()` (`this.enableTimeout()`) from the context object ([**@​craigtaub**](https://togithub.com/craigtaub)) :sparkles: **WORKAROUND:** Replace usage of `this.enableTimeout(false)` in your tests with `this.timeout(0)`. - [#​4315](https://togithub.com/mochajs/mocha/issues/4315): The `spec` option no longer supports a comma-delimited list of files ([**@​juergba**](https://togithub.com/juergba)) :sparkles: **WORKAROUND**: Use an array instead (e.g., `"spec": "foo.js,bar.js"` becomes `"spec": ["foo.js", "bar.js"]`). - [#​4309](https://togithub.com/mochajs/mocha/issues/4309): Drop support for Node.js v13.x line, which is now End-of-Life ([**@​juergba**](https://togithub.com/juergba)) - [#​4282](https://togithub.com/mochajs/mocha/issues/4282): `--forbid-only` will throw an error even if exclusive tests are avoided via `--grep` or other means ([**@​arvidOtt**](https://togithub.com/arvidOtt)) - [#​4223](https://togithub.com/mochajs/mocha/issues/4223): The context object's `skip()` (`this.skip()`) in a "before all" (`before()`) hook will no longer execute subsequent sibling hooks, in addition to hooks in child suites ([**@​juergba**](https://togithub.com/juergba)) - [#​4178](https://togithub.com/mochajs/mocha/issues/4178): Remove previously soft-deprecated APIs ([**@​wnghdcjfe**](https://togithub.com/wnghdcjfe)): - `Mocha.prototype.ignoreLeaks()` - `Mocha.prototype.useColors()` - `Mocha.prototype.useInlineDiffs()` - `Mocha.prototype.hideDiff()` #### :tada: Enhancements - [#​4245](https://togithub.com/mochajs/mocha/issues/4245): Add ability to run tests in parallel for Node.js (see [docs](https://mochajs.org/#parallel-tests)) ([**@​boneskull**](https://togithub.com/boneskull)) :exclamation: See also [#​4244](https://togithub.com/mochajs/mocha/issues/4244); [Root Hook Plugins (docs)](https://mochajs.org/#root-hook-plugins) -- _root hooks must be defined via Root Hook Plugins to work in parallel mode_ - [#​4304](https://togithub.com/mochajs/mocha/issues/4304): `--require` now works with ES modules ([**@​JacobLey**](https://togithub.com/JacobLey)) - [#​4299](https://togithub.com/mochajs/mocha/issues/4299): In some circumstances, Mocha can run ES modules under Node.js v10 -- _use at your own risk!_ ([**@​giltayar**](https://togithub.com/giltayar)) #### :book: Documentation - [#​4246](https://togithub.com/mochajs/mocha/issues/4246): Add documentation for parallel mode and Root Hook plugins ([**@​boneskull**](https://togithub.com/boneskull)) #### :bug: Fixes (All bug fixes in Mocha v8.0.0 are also breaking changes, and are listed above)
--- ### 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#googleapis/nodejs-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- packages/google-cloud-documentai/samples/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 405eaee949b..7c01c2a1092 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -40,7 +40,7 @@ "jsdoc-fresh": "^1.0.2", "jsdoc-region-tag": "^1.0.4", "linkinator": "^2.0.3", - "mocha": "^7.0.0", + "mocha": "^8.0.0", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", "sinon": "^9.0.1", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 50fab5826f3..020f6701a3a 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -18,6 +18,6 @@ }, "devDependencies": { "chai": "^4.2.0", - "mocha": "^7.0.0" + "mocha": "^8.0.0" } } From 7db135224e5d8f6e891d8ba809296fe1b64604b7 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 11 Jun 2020 10:00:53 -0700 Subject: [PATCH 039/213] chore(nodejs_templates): add script logging to node_library populate-secrets.sh (#64) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/e306327b-605f-4c07-9420-c106e40c47d5/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/e7034945fbdc0e79d3c57f6e299e5c90b0f11469 --- packages/google-cloud-documentai/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index ec414a32021..faaf41fcbaf 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "0862794737fe7f2cafd8760f566fd255618c12ae" + "sha": "73ab3b1a98286293b0c639ed0690914de0582987" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "1c92077459db3dc50741e878f98b08c6261181e0" + "sha": "e7034945fbdc0e79d3c57f6e299e5c90b0f11469" } } ], From d845f19eb14c41d59e54d5f691387c1502e140f1 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 15 Jun 2020 11:13:48 -0700 Subject: [PATCH 040/213] fix: proper fallback option handling autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. --- .../document_understanding_service_client.ts | 13 +++++-------- packages/google-cloud-documentai/synth.metadata | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index fb306bd24ed..ad809ab1363 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -108,14 +108,11 @@ export class DocumentUnderstandingServiceClient { // const showcaseClient = new showcaseClient({ projectId, customConfig }); opts.clientConfig = opts.clientConfig || {}; - const isBrowser = typeof window !== 'undefined'; - if (isBrowser) { - opts.fallback = true; - } - // If we are in browser, we are already using fallback because of the - // "browser" field in package.json. - // But if we were explicitly requested to use fallback, let's do it now. - this._gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; + // If we're running in browser, it's OK to omit `fallback` since + // google-gax has `browser` field in its `package.json`. + // For Electron (which does not respect `browser` field), + // pass `{fallback: true}` to the DocumentUnderstandingServiceClient constructor. + this._gaxModule = opts.fallback ? gax.fallback : gax; // Create a `gaxGrpc` object, with any grpc-specific options // sent to the client. diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index faaf41fcbaf..0887282b041 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "73ab3b1a98286293b0c639ed0690914de0582987" + "sha": "603094f27371d47707cd75c1d84098062e0e6855" } }, { From 508ff8ea29a520d649fcd331e8d4e596dd81087b Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 18 Jun 2020 07:47:52 -0700 Subject: [PATCH 041/213] chore: update node issue template (#66) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/37f383f8-7560-459e-b66c-def10ff830cb/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/b10590a4a1568548dd13cfcea9aa11d40898144b --- packages/google-cloud-documentai/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 0887282b041..f59622cf9ce 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "603094f27371d47707cd75c1d84098062e0e6855" + "sha": "b4aef1014338767666f05de59f04fb60b3600be6" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "e7034945fbdc0e79d3c57f6e299e5c90b0f11469" + "sha": "b10590a4a1568548dd13cfcea9aa11d40898144b" } } ], From e247f49af818678b66a2359884b9a41d4cb8c13e Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 22 Jun 2020 10:26:15 -0700 Subject: [PATCH 042/213] build: Provide C#, Ruby and PHP namespace/package options --- .../protos/google/cloud/documentai/v1beta2/document.proto | 3 +++ .../cloud/documentai/v1beta2/document_understanding.proto | 3 +++ .../protos/google/cloud/documentai/v1beta2/geometry.proto | 3 +++ packages/google-cloud-documentai/protos/protos.json | 5 ++++- packages/google-cloud-documentai/synth.metadata | 6 +++--- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto index d50320b12d7..327473048b1 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto @@ -22,10 +22,13 @@ import "google/rpc/status.proto"; import "google/type/color.proto"; import "google/api/annotations.proto"; +option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta2"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta2;documentai"; option java_multiple_files = true; option java_outer_classname = "DocumentProto"; option java_package = "com.google.cloud.documentai.v1beta2"; +option php_namespace = "Google\\Cloud\\DocumentAi\\V1beta2"; +option ruby_package = "Google::Cloud::DocumentAI::V1beta2"; // Document represents the canonical document resource in Document Understanding // AI. diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document_understanding.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document_understanding.proto index e0f94aa22fd..9d3c8d9416a 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document_understanding.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document_understanding.proto @@ -24,10 +24,13 @@ import "google/cloud/documentai/v1beta2/geometry.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/timestamp.proto"; +option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta2"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta2;documentai"; option java_multiple_files = true; option java_outer_classname = "DocumentAiProto"; option java_package = "com.google.cloud.documentai.v1beta2"; +option php_namespace = "Google\\Cloud\\DocumentAi\\V1beta2"; +option ruby_package = "Google::Cloud::DocumentAI::V1beta2"; // Service to parse structured information from unstructured or semi-structured // documents using state-of-the-art Google AI such as natural language, diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/geometry.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/geometry.proto index 7f53217fedf..21584ecfe2a 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/geometry.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/geometry.proto @@ -18,10 +18,13 @@ package google.cloud.documentai.v1beta2; import "google/api/annotations.proto"; +option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta2"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta2;documentai"; option java_multiple_files = true; option java_outer_classname = "GeometryProto"; option java_package = "com.google.cloud.documentai.v1beta2"; +option php_namespace = "Google\\Cloud\\DocumentAi\\V1beta2"; +option ruby_package = "Google::Cloud::DocumentAI::V1beta2"; // A vertex represents a 2D point in the image. // NOTE: the vertex coordinates are in the same scale as the original image. diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 04d3c5e64aa..ddee9b5036c 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -8,10 +8,13 @@ "nested": { "v1beta2": { "options": { + "csharp_namespace": "Google.Cloud.DocumentAI.V1Beta2", "go_package": "google.golang.org/genproto/googleapis/cloud/documentai/v1beta2;documentai", "java_multiple_files": true, "java_outer_classname": "DocumentAiProto", - "java_package": "com.google.cloud.documentai.v1beta2" + "java_package": "com.google.cloud.documentai.v1beta2", + "php_namespace": "Google\\Cloud\\DocumentAi\\V1beta2", + "ruby_package": "Google::Cloud::DocumentAI::V1beta2" }, "nested": { "Document": { diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index f59622cf9ce..064a183aa93 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "b4aef1014338767666f05de59f04fb60b3600be6" + "sha": "69a7715a8ca0718f426ce64833a281eef4a18f92" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "2fc2caaacb15949c7f80426bfc7dafdd41dbc333", - "internalRef": "310239576" + "sha": "ed1174659dc748903dbb635c7e01e38c3f812fbb", + "internalRef": "315627096" } }, { From c42ce70ea37c419e0920754ed36e969fe0249519 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Sat, 27 Jun 2020 17:48:40 -0700 Subject: [PATCH 043/213] build: add config .gitattributes (#67) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/2a81bca4-7abd-4108-ac1f-21340f858709/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/dc9caca650c77b7039e2bbc3339ffb34ae78e5b7 --- packages/google-cloud-documentai/.gitattributes | 3 +++ packages/google-cloud-documentai/synth.metadata | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 packages/google-cloud-documentai/.gitattributes diff --git a/packages/google-cloud-documentai/.gitattributes b/packages/google-cloud-documentai/.gitattributes new file mode 100644 index 00000000000..2e63216ae9c --- /dev/null +++ b/packages/google-cloud-documentai/.gitattributes @@ -0,0 +1,3 @@ +*.ts text eol=lf +*.js test eol=lf +protos/* linguist-generated diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 064a183aa93..77ae54df1fc 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "69a7715a8ca0718f426ce64833a281eef4a18f92" + "sha": "f16caf9adda417fcc153571c72b35deafd4e141e" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "b10590a4a1568548dd13cfcea9aa11d40898144b" + "sha": "dc9caca650c77b7039e2bbc3339ffb34ae78e5b7" } } ], From 37eea61456720b840dd3c1f29188ee96703dc4ac Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Sat, 27 Jun 2020 22:09:41 -0700 Subject: [PATCH 044/213] chore: release 2.1.0 (#61) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-documentai/CHANGELOG.md | 12 ++++++++++++ packages/google-cloud-documentai/package.json | 2 +- .../google-cloud-documentai/samples/package.json | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index 9ff262fc3db..71f7b452096 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [2.1.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.0.0...v2.1.0) (2020-06-28) + + +### Features + +* move ts target to es2018 from es2016 ([#60](https://www.github.com/googleapis/nodejs-document-ai/issues/60)) ([73ab3b1](https://www.github.com/googleapis/nodejs-document-ai/commit/73ab3b1a98286293b0c639ed0690914de0582987)) + + +### Bug Fixes + +* proper fallback option handling ([b4aef10](https://www.github.com/googleapis/nodejs-document-ai/commit/b4aef1014338767666f05de59f04fb60b3600be6)) + ## [2.0.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v1.0.0...v2.0.0) (2020-05-15) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 7c01c2a1092..a113d955162 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "2.0.0", + "version": "2.1.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 020f6701a3a..63a8533155b 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^2.0.0", + "@google-cloud/documentai": "^2.1.0", "@google-cloud/storage": "^5.0.0" }, "devDependencies": { From b476d25db8c14250a0ffb47945373678b89f979d Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Mon, 6 Jul 2020 10:18:18 -0700 Subject: [PATCH 045/213] build: use bazel build (#70) --- ...nt_understanding_service_client_config.json | 6 ++++-- .../google-cloud-documentai/synth.metadata | 18 +++++------------- packages/google-cloud-documentai/synth.py | 11 ++--------- 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client_config.json b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client_config.json index c6a58bac521..0038d2c60dd 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client_config.json +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client_config.json @@ -21,11 +21,13 @@ }, "methods": { "BatchProcessDocuments": { - "retry_codes_name": "non_idempotent", + "timeout_millis": 60000, + "retry_codes_name": "idempotent", "retry_params_name": "default" }, "ProcessDocument": { - "retry_codes_name": "non_idempotent", + "timeout_millis": 60000, + "retry_codes_name": "idempotent", "retry_params_name": "default" } } diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 77ae54df1fc..4db64259cd7 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -3,23 +3,15 @@ { "git": { "name": ".", - "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "f16caf9adda417fcc153571c72b35deafd4e141e" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "ed1174659dc748903dbb635c7e01e38c3f812fbb", - "internalRef": "315627096" + "remote": "git@github.com:googleapis/nodejs-document-ai.git", + "sha": "00d9df08951a61b3f57366dc3a6b69a4ec32ba7c" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "dc9caca650c77b7039e2bbc3339ffb34ae78e5b7" + "sha": "303271797a360f8a439203413f13a160f2f5b3b4" } } ], @@ -29,8 +21,8 @@ "source": "googleapis", "apiName": "documentai", "apiVersion": "v1beta2", - "language": "typescript", - "generator": "gapic-generator-typescript" + "language": "nodejs", + "generator": "bazel" } } ] diff --git a/packages/google-cloud-documentai/synth.py b/packages/google-cloud-documentai/synth.py index 6e0c5870ec9..ac68087031f 100644 --- a/packages/google-cloud-documentai/synth.py +++ b/packages/google-cloud-documentai/synth.py @@ -24,18 +24,11 @@ # run the gapic generator -gapic = gcp.GAPICMicrogenerator() +gapic = gcp.GAPICBazel() versions = ['v1beta2'] name = 'documentai' for version in versions: - library = gapic.typescript_library( - name, - generator_args={ - "package-name": "@google-cloud/documentai" - }, - extra_proto_files=['google/cloud/common_resources.proto'], - proto_path=f'/google/cloud/{name}/{version}', - version=version) + library = gapic.node_library(name, version) s.copy(library, excludes=['README.md', 'package.json']) # Copy common templates From 7627a06eb88049cac0278c3565dc6b1937b4ded0 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 8 Jul 2020 10:11:04 -0700 Subject: [PATCH 046/213] chore: update timeout ms from autosynth autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. --- ...document_understanding_service_client_config.json | 4 ++-- packages/google-cloud-documentai/synth.metadata | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client_config.json b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client_config.json index 0038d2c60dd..1dea85e9656 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client_config.json +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client_config.json @@ -21,12 +21,12 @@ }, "methods": { "BatchProcessDocuments": { - "timeout_millis": 60000, + "timeout_millis": 120000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "ProcessDocument": { - "timeout_millis": 60000, + "timeout_millis": 120000, "retry_codes_name": "idempotent", "retry_params_name": "default" } diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 4db64259cd7..70f656d9972 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -3,8 +3,16 @@ { "git": { "name": ".", - "remote": "git@github.com:googleapis/nodejs-document-ai.git", - "sha": "00d9df08951a61b3f57366dc3a6b69a4ec32ba7c" + "remote": "https://github.com/googleapis/nodejs-document-ai.git", + "sha": "ed6842304fb7c6547fa17d08ebdf68d1cc617c16" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "07460951fc07dd2b3f172d01b04e2a5fefd13ccc", + "internalRef": "320124233" } }, { From be2e7b42385ae68d842bed1785247e2bc91bf4a4 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 9 Jul 2020 06:32:03 -0700 Subject: [PATCH 047/213] fix: typeo in nodejs .gitattribute (#74) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/cc99acfa-05b8-434b-9500-2f6faf2eaa02/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/799d8e6522c1ef7cb55a70d9ea0b15e045c3d00b --- packages/google-cloud-documentai/.gitattributes | 2 +- packages/google-cloud-documentai/synth.metadata | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-documentai/.gitattributes b/packages/google-cloud-documentai/.gitattributes index 2e63216ae9c..d4f4169b28b 100644 --- a/packages/google-cloud-documentai/.gitattributes +++ b/packages/google-cloud-documentai/.gitattributes @@ -1,3 +1,3 @@ *.ts text eol=lf -*.js test eol=lf +*.js text eol=lf protos/* linguist-generated diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 70f656d9972..680ca1878fc 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "ed6842304fb7c6547fa17d08ebdf68d1cc617c16" + "sha": "a6b1493cbebf2f1af7b2555c20885be34a72a51c" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "303271797a360f8a439203413f13a160f2f5b3b4" + "sha": "799d8e6522c1ef7cb55a70d9ea0b15e045c3d00b" } } ], From 78ad6ff08364e42f626682987fd0f33f33f282f9 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2020 18:08:36 -0700 Subject: [PATCH 048/213] chore: release 2.1.1 (#75) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-documentai/CHANGELOG.md | 7 +++++++ packages/google-cloud-documentai/package.json | 2 +- packages/google-cloud-documentai/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index 71f7b452096..e8fcb42b2ca 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [2.1.1](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.1.0...v2.1.1) (2020-07-09) + + +### Bug Fixes + +* typeo in nodejs .gitattribute ([#74](https://www.github.com/googleapis/nodejs-document-ai/issues/74)) ([54782b4](https://www.github.com/googleapis/nodejs-document-ai/commit/54782b440b716967f722dec369556b183d1de878)) + ## [2.1.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.0.0...v2.1.0) (2020-06-28) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index a113d955162..655bb201a14 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "2.1.0", + "version": "2.1.1", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 63a8533155b..e84be17d21a 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^2.1.0", + "@google-cloud/documentai": "^2.1.1", "@google-cloud/storage": "^5.0.0" }, "devDependencies": { From fdc24d49fe4bc283b4f8221f0e44b76f7bed2afa Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sat, 11 Jul 2020 00:41:38 +0200 Subject: [PATCH 049/213] chore(deps): update dependency ts-loader to v8 (#73) --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 655bb201a14..b318d95ae98 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -44,7 +44,7 @@ "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", "sinon": "^9.0.1", - "ts-loader": "^7.0.0", + "ts-loader": "^8.0.0", "typescript": "^3.8.3", "webpack": "^4.42.0", "webpack-cli": "^3.3.11" From e18fcd966147bb333fb1ce6d449bfb481b1aa693 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sun, 12 Jul 2020 18:47:16 +0200 Subject: [PATCH 050/213] chore(deps): update dependency @types/mocha to v8 (#76) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@types/mocha](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | devDependencies | major | [`^7.0.0` -> `^8.0.0`](https://renovatebot.com/diffs/npm/@types%2fmocha/7.0.2/8.0.0) | --- ### 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#googleapis/nodejs-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index b318d95ae98..9888804e9fc 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -30,7 +30,7 @@ "google-gax": "^2.1.0" }, "devDependencies": { - "@types/mocha": "^7.0.0", + "@types/mocha": "^8.0.0", "@types/node": "^12.12.29", "@types/sinon": "^9.0.0", "c8": "^7.1.0", From 115a63ab0690f0ba2e44dda84b5dcc481548ad74 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 14 Jul 2020 09:07:32 -0700 Subject: [PATCH 051/213] build: missing closing paren in publish script (#78) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/9c6207e5-a7a6-4e44-ab6b-91751e0230b1/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/d82deccf657a66e31bd5da9efdb96c6fa322fc7e --- packages/google-cloud-documentai/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 680ca1878fc..aee9d390655 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "a6b1493cbebf2f1af7b2555c20885be34a72a51c" + "sha": "4190184b3cee159b5d10957d96bfb3f85f911d93" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "799d8e6522c1ef7cb55a70d9ea0b15e045c3d00b" + "sha": "d82deccf657a66e31bd5da9efdb96c6fa322fc7e" } } ], From 49c0ae3ee41c78783b20d85bb1b32f6952c184b9 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 17 Jul 2020 15:59:01 -0700 Subject: [PATCH 052/213] chore: add config files for cloud-rad for node.js, delete Node 8 templates (#82) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/5e903fff-57bb-4395-bb94-8b4d1909dbf6/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/21f1470ecd01424dc91c70f1a7c798e4e87d1eec Source-Link: https://github.com/googleapis/synthtool/commit/388e10f5ae302d3e8de1fac99f3a95d1ab8f824a --- .../api-extractor.json | 369 ++++++++++++++++++ .../google-cloud-documentai/synth.metadata | 4 +- 2 files changed, 371 insertions(+), 2 deletions(-) create mode 100644 packages/google-cloud-documentai/api-extractor.json diff --git a/packages/google-cloud-documentai/api-extractor.json b/packages/google-cloud-documentai/api-extractor.json new file mode 100644 index 00000000000..de228294b23 --- /dev/null +++ b/packages/google-cloud-documentai/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-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index aee9d390655..b068673d9a3 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "4190184b3cee159b5d10957d96bfb3f85f911d93" + "sha": "6e20c666dc6236996de5ff4ffdc35335e1262c04" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "d82deccf657a66e31bd5da9efdb96c6fa322fc7e" + "sha": "21f1470ecd01424dc91c70f1a7c798e4e87d1eec" } } ], From 3b93213253776a6157e40468cf3e4c4aa64392db Mon Sep 17 00:00:00 2001 From: "F. Hinkelmann" Date: Tue, 21 Jul 2020 14:46:54 -0400 Subject: [PATCH 053/213] chore: add dev dependencies for cloud-rad ref docs (#83) --- packages/google-cloud-documentai/package.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 9888804e9fc..81a1b5b445a 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -24,7 +24,9 @@ "system-test": "c8 mocha build/system-test", "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", "test": "c8 mocha build/test", - "precompile": "gts clean" + "precompile": "gts clean", + "api-extractor": "api-extractor run --local", + "api-documenter": "api-documenter yaml --input-folder=temp" }, "dependencies": { "google-gax": "^2.1.0" @@ -47,7 +49,9 @@ "ts-loader": "^8.0.0", "typescript": "^3.8.3", "webpack": "^4.42.0", - "webpack-cli": "^3.3.11" + "webpack-cli": "^3.3.11", + "@microsoft/api-documenter": "^7.8.10", + "@microsoft/api-extractor": "^7.8.10" }, "engines": { "node": ">=10" From 4f49c10a3d242a1b3688739ec2b508774ec64c33 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 22 Jul 2020 17:21:23 -0700 Subject: [PATCH 054/213] build: rename _toc to toc (#84) Source-Author: F. Hinkelmann Source-Date: Tue Jul 21 10:53:20 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: 99c93fe09f8c1dca09dfc0301c8668e3a70dd796 Source-Link: https://github.com/googleapis/synthtool/commit/99c93fe09f8c1dca09dfc0301c8668e3a70dd796 --- packages/google-cloud-documentai/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index b068673d9a3..c5701de9375 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "6e20c666dc6236996de5ff4ffdc35335e1262c04" + "sha": "841c3ee6a53f5c205e1b041634cf4a19071b6505" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "21f1470ecd01424dc91c70f1a7c798e4e87d1eec" + "sha": "99c93fe09f8c1dca09dfc0301c8668e3a70dd796" } } ], From e14975602676a0f16f0642a4beff8c18f84e662b Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 23 Jul 2020 20:06:20 -0700 Subject: [PATCH 055/213] chore: move gitattributes files to node templates (#85) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/d43b90cc-a087-4c57-864c-1e4f93292dc6/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/3a00b7fea8c4c83eaff8eb207f530a2e3e8e1de3 --- packages/google-cloud-documentai/.gitattributes | 1 + packages/google-cloud-documentai/synth.metadata | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/.gitattributes b/packages/google-cloud-documentai/.gitattributes index d4f4169b28b..33739cb74e4 100644 --- a/packages/google-cloud-documentai/.gitattributes +++ b/packages/google-cloud-documentai/.gitattributes @@ -1,3 +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-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index c5701de9375..28d25cfd77e 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "841c3ee6a53f5c205e1b041634cf4a19071b6505" + "sha": "bfb0007e3a66cf686d88a383ac02d50f14fc82b8" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "99c93fe09f8c1dca09dfc0301c8668e3a70dd796" + "sha": "3a00b7fea8c4c83eaff8eb207f530a2e3e8e1de3" } } ], From b0dec28a18de89b44dd8045797cb6b43d383e5a4 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 29 Jul 2020 17:09:25 -0700 Subject: [PATCH 056/213] chore(node): fix kokoro build path for cloud-rad (#86) Source-Author: F. Hinkelmann Source-Date: Wed Jul 29 00:28:42 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: 89d431fb2975fc4e0ed24995a6e6dfc8ff4c24fa Source-Link: https://github.com/googleapis/synthtool/commit/89d431fb2975fc4e0ed24995a6e6dfc8ff4c24fa --- packages/google-cloud-documentai/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 28d25cfd77e..dfd11d7ff9c 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "bfb0007e3a66cf686d88a383ac02d50f14fc82b8" + "sha": "df79ccec02e0a4c26869bb8f893bf511c8dae602" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "3a00b7fea8c4c83eaff8eb207f530a2e3e8e1de3" + "sha": "89d431fb2975fc4e0ed24995a6e6dfc8ff4c24fa" } } ], From 6eda97c439f06338542ab9d2d7c653266044b87f Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 30 Jul 2020 19:10:19 -0700 Subject: [PATCH 057/213] build: update protos (#87) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/b205fd33-200c-4298-88b8-18b0d1c79a3e/targets - [ ] To automatically regenerate this PR, check this box. --- packages/google-cloud-documentai/protos/protos.d.ts | 2 +- packages/google-cloud-documentai/protos/protos.js | 2 +- packages/google-cloud-documentai/synth.metadata | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 137607068af..01aa5a66824 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -13,7 +13,7 @@ // limitations under the License. import * as Long from "long"; -import * as $protobuf from "protobufjs"; +import {protobuf as $protobuf} from "google-gax"; /** Namespace google. */ export namespace google { diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index b4cd0df1f5c..13541453caa 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/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("protobufjs/minimal")); + module.exports = factory(require("google-gax").protobufMinimal); })(this, function($protobuf) { "use strict"; diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index dfd11d7ff9c..fa7a22577ef 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "df79ccec02e0a4c26869bb8f893bf511c8dae602" + "sha": "de862730af56b7ec366c14369c93529a7f6726b5" } }, { From cf0fe18b52bd31f4c84201991ff7936640d9088d Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 31 Jul 2020 09:24:32 -0700 Subject: [PATCH 058/213] docs: add links to the CHANGELOG from the README.md for Java and Node (#88) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/7b446397-88f3-4463-9e7d-d2ce7069989d/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/5936421202fb53ed4641bcb824017dd393a3dbcc --- packages/google-cloud-documentai/README.md | 3 +++ packages/google-cloud-documentai/synth.metadata | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index aa33c0d4404..f72f3c7aa00 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -14,6 +14,9 @@ Document AI client for Node.js +A comprehensive list of changes in each version may be found in +[the CHANGELOG](https://github.com/googleapis/nodejs-document-ai/blob/master/CHANGELOG.md). + * [Document AI Node.js Client API Reference][client-docs] * [Document AI Documentation][product-docs] * [github.com/googleapis/nodejs-document-ai](https://github.com/googleapis/nodejs-document-ai) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index fa7a22577ef..52add557fb0 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "de862730af56b7ec366c14369c93529a7f6726b5" + "sha": "5dc72df7b85c4f9de30d92636745beec03165f71" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "89d431fb2975fc4e0ed24995a6e6dfc8ff4c24fa" + "sha": "5936421202fb53ed4641bcb824017dd393a3dbcc" } } ], From 5cc3a8e65f987598cd15cbb116cf839f736fd90e Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Sat, 8 Aug 2020 11:36:37 -0700 Subject: [PATCH 059/213] build: --credential-file-override is no longer required (#90) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/4de22315-84b1-493d-8da2-dfa7688128f5/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/94421c47802f56a44c320257b2b4c190dc7d6b68 --- packages/google-cloud-documentai/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 52add557fb0..96c4cdfef6b 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "5dc72df7b85c4f9de30d92636745beec03165f71" + "sha": "3b743a6765d49ef00a1bbf50978359e52a361a8d" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "5936421202fb53ed4641bcb824017dd393a3dbcc" + "sha": "94421c47802f56a44c320257b2b4c190dc7d6b68" } } ], From 265a008120016b6221456b6892ec0ee8b36b19cc Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 11 Aug 2020 22:06:30 -0700 Subject: [PATCH 060/213] build: use gapic-generator-typescript v1.0.7. (#91) This new generator will bring some changes to the generated code across all libraries, but the behavior will only change for nodejs-logging and nodejs-pubsub (those two libraries that use request batching). For other libraries, the changes should be minor (the createApiCall call is simplified) and it should be safe to merge them. Please talk to @alexander-fenster if you have any questions. PiperOrigin-RevId: 325949033 Source-Author: Google APIs Source-Date: Mon Aug 10 21:11:13 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: 94006b3cb8d2fb44703cf535da15608eed6bf7db Source-Link: https://github.com/googleapis/googleapis/commit/94006b3cb8d2fb44703cf535da15608eed6bf7db --- .../src/v1beta2/document_understanding_service_client.ts | 5 ++--- packages/google-cloud-documentai/synth.metadata | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index ad809ab1363..284fa87ead6 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -254,12 +254,11 @@ export class DocumentUnderstandingServiceClient { } ); + const descriptor = this.descriptors.longrunning[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.longrunning[methodName] + descriptor ); this.innerApiCalls[methodName] = apiCall; diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 96c4cdfef6b..7ebb8652ba5 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "3b743a6765d49ef00a1bbf50978359e52a361a8d" + "sha": "36a2ab6e0b4c4d27eaa8da7da3f9a2aeb8cb7333" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "07460951fc07dd2b3f172d01b04e2a5fefd13ccc", - "internalRef": "320124233" + "sha": "94006b3cb8d2fb44703cf535da15608eed6bf7db", + "internalRef": "325949033" } }, { From 7270e3612e048e026ab16584334ccf9d992be7fb Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 11 Aug 2020 22:20:07 -0700 Subject: [PATCH 061/213] chore: update cloud rad kokoro build job (#92) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/5f7f9c6d-c75a-4c60-8bb8-0026a14cead7/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/bd0deaa1113b588d70449535ab9cbf0f2bd0e72f --- packages/google-cloud-documentai/synth.metadata | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 7ebb8652ba5..e8e587f3a9e 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "94421c47802f56a44c320257b2b4c190dc7d6b68" + "sha": "bd0deaa1113b588d70449535ab9cbf0f2bd0e72f" } } ], From 55c414e6d6f8633e6ffe7907e33e3f37032698ad Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 13 Aug 2020 09:14:21 -0700 Subject: [PATCH 062/213] build: perform publish using Node 12 (#93) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/c36c6dbc-ab79-4f17-b70b-523b420b2a70/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/5747555f7620113d9a2078a48f4c047a99d31b3e --- packages/google-cloud-documentai/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index e8e587f3a9e..288961ab395 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "36a2ab6e0b4c4d27eaa8da7da3f9a2aeb8cb7333" + "sha": "c9e57970f763ea7d04ab21bc51bf9ea32b0550b5" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "bd0deaa1113b588d70449535ab9cbf0f2bd0e72f" + "sha": "5747555f7620113d9a2078a48f4c047a99d31b3e" } } ], From 586151aa86a876b421e012ef0842ec61ae33d4d6 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 19 Aug 2020 09:42:15 -0700 Subject: [PATCH 063/213] chore: start tracking obsolete files (#94) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/7a1b0b96-8ddb-4836-a1a2-d2f73b7e6ffe/targets - [ ] To automatically regenerate this PR, check this box. --- .../google-cloud-documentai/synth.metadata | 82 ++++++++++++++++++- 1 file changed, 78 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 288961ab395..a4f45027642 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,22 +4,22 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "c9e57970f763ea7d04ab21bc51bf9ea32b0550b5" + "sha": "75a4430fddeaf4df6a991abee6647cc476eded5b" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "94006b3cb8d2fb44703cf535da15608eed6bf7db", - "internalRef": "325949033" + "sha": "4c5071b615d96ef9dfd6a63d8429090f1f2872bb", + "internalRef": "327369997" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "5747555f7620113d9a2078a48f4c047a99d31b3e" + "sha": "1a60ff2a3975c2f5054431588bd95db9c3b862ba" } } ], @@ -33,5 +33,79 @@ "generator": "bazel" } } + ], + "generatedFiles": [ + ".eslintignore", + ".eslintrc.json", + ".gitattributes", + ".github/ISSUE_TEMPLATE/bug_report.md", + ".github/ISSUE_TEMPLATE/feature_request.md", + ".github/ISSUE_TEMPLATE/support_request.md", + ".github/PULL_REQUEST_TEMPLATE.md", + ".github/publish.yml", + ".github/release-please.yml", + ".github/workflows/ci.yaml", + ".gitignore", + ".jsdoc.js", + ".kokoro/.gitattributes", + ".kokoro/common.cfg", + ".kokoro/continuous/node10/common.cfg", + ".kokoro/continuous/node10/docs.cfg", + ".kokoro/continuous/node10/lint.cfg", + ".kokoro/continuous/node10/samples-test.cfg", + ".kokoro/continuous/node10/system-test.cfg", + ".kokoro/continuous/node10/test.cfg", + ".kokoro/continuous/node12/common.cfg", + ".kokoro/continuous/node12/test.cfg", + ".kokoro/docs.sh", + ".kokoro/lint.sh", + ".kokoro/populate-secrets.sh", + ".kokoro/presubmit/node10/common.cfg", + ".kokoro/presubmit/node10/samples-test.cfg", + ".kokoro/presubmit/node10/system-test.cfg", + ".kokoro/presubmit/node12/common.cfg", + ".kokoro/presubmit/node12/test.cfg", + ".kokoro/publish.sh", + ".kokoro/release/docs-devsite.cfg", + ".kokoro/release/docs-devsite.sh", + ".kokoro/release/docs.cfg", + ".kokoro/release/docs.sh", + ".kokoro/release/publish.cfg", + ".kokoro/samples-test.sh", + ".kokoro/system-test.sh", + ".kokoro/test.bat", + ".kokoro/test.sh", + ".kokoro/trampoline.sh", + ".mocharc.js", + ".nycrc", + ".prettierignore", + ".prettierrc.js", + "CODE_OF_CONDUCT.md", + "CONTRIBUTING.md", + "LICENSE", + "README.md", + "api-extractor.json", + "linkinator.config.json", + "package-lock.json.2034964592", + "protos/google/cloud/documentai/v1beta2/document.proto", + "protos/google/cloud/documentai/v1beta2/document_understanding.proto", + "protos/google/cloud/documentai/v1beta2/geometry.proto", + "protos/protos.d.ts", + "protos/protos.js", + "protos/protos.json", + "renovate.json", + "samples/README.md", + "samples/package-lock.json.2020427487", + "src/index.ts", + "src/v1beta2/document_understanding_service_client.ts", + "src/v1beta2/document_understanding_service_client_config.json", + "src/v1beta2/document_understanding_service_proto_list.json", + "src/v1beta2/index.ts", + "system-test/fixtures/sample/src/index.js", + "system-test/fixtures/sample/src/index.ts", + "system-test/install.ts", + "test/gapic_document_understanding_service_v1beta2.ts", + "tsconfig.json", + "webpack.config.js" ] } \ No newline at end of file From 31cf1a9b0d3fe7679d47d478ae5ff0d07cabde06 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 21 Aug 2020 09:26:36 -0700 Subject: [PATCH 064/213] build: move system and samples test from Node 10 to Node 12 (#95) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/ba2d388f-b3b2-4ad7-a163-0c6b4d86894f/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/05de3e1e14a0b07eab8b474e669164dbd31f81fb --- packages/google-cloud-documentai/synth.metadata | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index a4f45027642..90dd5b2b592 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "75a4430fddeaf4df6a991abee6647cc476eded5b" + "sha": "edaa0c7c90df0d137b12c5f31a6bf0f73b53c901" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "1a60ff2a3975c2f5054431588bd95db9c3b862ba" + "sha": "05de3e1e14a0b07eab8b474e669164dbd31f81fb" } } ], @@ -51,19 +51,19 @@ ".kokoro/common.cfg", ".kokoro/continuous/node10/common.cfg", ".kokoro/continuous/node10/docs.cfg", - ".kokoro/continuous/node10/lint.cfg", - ".kokoro/continuous/node10/samples-test.cfg", - ".kokoro/continuous/node10/system-test.cfg", ".kokoro/continuous/node10/test.cfg", ".kokoro/continuous/node12/common.cfg", + ".kokoro/continuous/node12/lint.cfg", + ".kokoro/continuous/node12/samples-test.cfg", + ".kokoro/continuous/node12/system-test.cfg", ".kokoro/continuous/node12/test.cfg", ".kokoro/docs.sh", ".kokoro/lint.sh", ".kokoro/populate-secrets.sh", ".kokoro/presubmit/node10/common.cfg", - ".kokoro/presubmit/node10/samples-test.cfg", - ".kokoro/presubmit/node10/system-test.cfg", ".kokoro/presubmit/node12/common.cfg", + ".kokoro/presubmit/node12/samples-test.cfg", + ".kokoro/presubmit/node12/system-test.cfg", ".kokoro/presubmit/node12/test.cfg", ".kokoro/publish.sh", ".kokoro/release/docs-devsite.cfg", @@ -86,7 +86,6 @@ "README.md", "api-extractor.json", "linkinator.config.json", - "package-lock.json.2034964592", "protos/google/cloud/documentai/v1beta2/document.proto", "protos/google/cloud/documentai/v1beta2/document_understanding.proto", "protos/google/cloud/documentai/v1beta2/geometry.proto", @@ -95,7 +94,6 @@ "protos/protos.json", "renovate.json", "samples/README.md", - "samples/package-lock.json.2020427487", "src/index.ts", "src/v1beta2/document_understanding_service_client.ts", "src/v1beta2/document_understanding_service_client_config.json", From 4d9f442adff1e4d00a3fee058038c4e226c57de5 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 28 Aug 2020 10:02:17 -0700 Subject: [PATCH 065/213] build: track flaky tests for "nightly", add new secrets for tagging (#96) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/157de3e1-dc75-4d92-b3d9-35d704dfd201/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/8cf6d2834ad14318e64429c3b94f6443ae83daf9 --- packages/google-cloud-documentai/synth.metadata | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 90dd5b2b592..783a3a91a45 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "edaa0c7c90df0d137b12c5f31a6bf0f73b53c901" + "sha": "d5c097e5870862e38f2509f5667d93933fb856a1" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "05de3e1e14a0b07eab8b474e669164dbd31f81fb" + "sha": "8cf6d2834ad14318e64429c3b94f6443ae83daf9" } } ], @@ -42,7 +42,6 @@ ".github/ISSUE_TEMPLATE/feature_request.md", ".github/ISSUE_TEMPLATE/support_request.md", ".github/PULL_REQUEST_TEMPLATE.md", - ".github/publish.yml", ".github/release-please.yml", ".github/workflows/ci.yaml", ".gitignore", From fca19f4cd42afe0e6a5a9661da4969b60718228a Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 14 Sep 2020 18:13:11 -0700 Subject: [PATCH 066/213] build(test): recursively find test files; fail on unsupported dependency versions (#100) * build(test): recursively find test files; fail on unsupported dependency versions Source-Author: Megan Potter <57276408+feywind@users.noreply.github.com> Source-Date: Fri Sep 11 18:47:00 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: fdd03c161003ab97657cc0218f25c82c89ddf4b6 Source-Link: https://github.com/googleapis/synthtool/commit/fdd03c161003ab97657cc0218f25c82c89ddf4b6 * build: update test Co-authored-by: Sofia Leon --- packages/google-cloud-documentai/.mocharc.js | 3 ++- packages/google-cloud-documentai/synth.metadata | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-documentai/.mocharc.js b/packages/google-cloud-documentai/.mocharc.js index ff7b34fa5d1..0b600509bed 100644 --- a/packages/google-cloud-documentai/.mocharc.js +++ b/packages/google-cloud-documentai/.mocharc.js @@ -14,7 +14,8 @@ const config = { "enable-source-maps": true, "throw-deprecation": true, - "timeout": 10000 + "timeout": 10000, + "recursive": true } if (process.env.MOCHA_THROW_DEPRECATION === 'false') { delete config['throw-deprecation']; diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 783a3a91a45..6dbfd8aef16 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "d5c097e5870862e38f2509f5667d93933fb856a1" + "sha": "483df36ad3a047ac6e4ac9986026867f511e9528" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "8cf6d2834ad14318e64429c3b94f6443ae83daf9" + "sha": "fdd03c161003ab97657cc0218f25c82c89ddf4b6" } } ], From ee00eade4d5bc0b6dfbfa7aa34b538c994661c25 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 1 Oct 2020 05:04:29 -0700 Subject: [PATCH 067/213] chore: update bucket for cloud-rad (#102) Co-authored-by: gcf-merge-on-green[bot] <60162190+gcf-merge-on-green[bot]@users.noreply.github.com> Source-Author: F. Hinkelmann Source-Date: Wed Sep 30 14:13:57 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: 079dcce498117f9570cebe6e6cff254b38ba3860 Source-Link: https://github.com/googleapis/synthtool/commit/079dcce498117f9570cebe6e6cff254b38ba3860 --- packages/google-cloud-documentai/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 6dbfd8aef16..ba78224a322 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "483df36ad3a047ac6e4ac9986026867f511e9528" + "sha": "f73a09834860e175e3e8bbafcc963695af4583c4" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "fdd03c161003ab97657cc0218f25c82c89ddf4b6" + "sha": "079dcce498117f9570cebe6e6cff254b38ba3860" } } ], From f15609a9d3e2b4b256ca9f379b9576c5a3b4ae46 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 5 Oct 2020 10:42:21 -0700 Subject: [PATCH 068/213] build(node_library): migrate to Trampoline V2 (#104) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/939e9a1a-ee83-4100-84cf-4883fa030728/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/0c868d49b8e05bc1f299bc773df9eb4ef9ed96e9 --- packages/google-cloud-documentai/synth.metadata | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index ba78224a322..d8251c403b7 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "f73a09834860e175e3e8bbafcc963695af4583c4" + "sha": "44bb7b9f25e436dc8857b62993201ea17d5e4c1f" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "079dcce498117f9570cebe6e6cff254b38ba3860" + "sha": "0c868d49b8e05bc1f299bc773df9eb4ef9ed96e9" } } ], @@ -75,10 +75,12 @@ ".kokoro/test.bat", ".kokoro/test.sh", ".kokoro/trampoline.sh", + ".kokoro/trampoline_v2.sh", ".mocharc.js", ".nycrc", ".prettierignore", ".prettierrc.js", + ".trampolinerc", "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "LICENSE", From 80e0e072689c605a24eb08ff9d16d619b9c1211a Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Wed, 7 Oct 2020 10:03:10 -0700 Subject: [PATCH 069/213] feat: add v1beta3 version (#105) * feat: add v1beta3 version --- .../.repo-metadata.json | 2 +- .../cloud/documentai/v1beta3/document.proto | 740 + .../v1beta3/document_processor_service.proto | 291 + .../cloud/documentai/v1beta3/geometry.proto | 57 + .../protos/protos.d.ts | 7994 +++- .../google-cloud-documentai/protos/protos.js | 30810 ++++++++++++---- .../protos/protos.json | 1339 +- packages/google-cloud-documentai/src/index.ts | 11 +- .../document_processor_service_client.ts | 837 + ...ument_processor_service_client_config.json | 41 + ...document_processor_service_proto_list.json | 5 + .../src/v1beta3/index.ts | 19 + .../google-cloud-documentai/synth.metadata | 21 +- packages/google-cloud-documentai/synth.py | 4 +- .../system-test/fixtures/sample/src/index.js | 2 +- ...apic_document_processor_service_v1beta3.ts | 856 + .../google-cloud-documentai/webpack.config.js | 4 +- 17 files changed, 34465 insertions(+), 8568 deletions(-) create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/geometry.proto create mode 100644 packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts create mode 100644 packages/google-cloud-documentai/src/v1beta3/document_processor_service_client_config.json create mode 100644 packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json create mode 100644 packages/google-cloud-documentai/src/v1beta3/index.ts create mode 100644 packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts diff --git a/packages/google-cloud-documentai/.repo-metadata.json b/packages/google-cloud-documentai/.repo-metadata.json index 0ecb51b49de..f9a566b5816 100644 --- a/packages/google-cloud-documentai/.repo-metadata.json +++ b/packages/google-cloud-documentai/.repo-metadata.json @@ -1,5 +1,5 @@ { - "name": "documentai", + "name": "@google-cloud/documentai", "name_pretty": "Document AI", "product_documentation": "https://cloud.google.com/document-understanding/docs/", "client_documentation": "https://googleapis.dev/nodejs/documentai/latest/index.html", diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto new file mode 100644 index 00000000000..2498eb473fd --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto @@ -0,0 +1,740 @@ +// 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.documentai.v1beta3; + +import "google/api/field_behavior.proto"; +import "google/cloud/documentai/v1beta3/geometry.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; +import "google/type/color.proto"; +import "google/type/date.proto"; +import "google/type/datetime.proto"; +import "google/type/money.proto"; +import "google/type/postal_address.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.DocumentAI.v1beta3"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; +option java_multiple_files = true; +option java_outer_classname = "DocumentProto"; +option java_package = "com.google.cloud.documentai.v1beta3"; +option php_namespace = "Google\\Cloud\\DocumentAi\\v1beta3"; +option ruby_package = "Google::Cloud::DocumentAI::master"; + +// Document represents the canonical document resource in Document Understanding +// AI. +// It is an interchange format that provides insights into documents and allows +// for collaboration between users and Document Understanding AI to iterate and +// optimize for quality. +message Document { + // For a large document, sharding may be performed to produce several + // document shards. Each document shard contains this field to detail which + // shard it is. + message ShardInfo { + // The 0-based index of this shard. + int64 shard_index = 1; + + // Total number of shards. + int64 shard_count = 2; + + // The index of the first character in [Document.text][google.cloud.documentai.v1beta3.Document.text] in the overall + // document global text. + int64 text_offset = 3; + } + + // Annotation for common text style attributes. This adheres to CSS + // conventions as much as possible. + message Style { + // Font size with unit. + message FontSize { + // Font size for the text. + float size = 1; + + // Unit for the font size. Follows CSS naming (in, px, pt, etc.). + string unit = 2; + } + + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. + TextAnchor text_anchor = 1; + + // Text color. + google.type.Color color = 2; + + // Text background color. + google.type.Color background_color = 3; + + // Font weight. Possible values are normal, bold, bolder, and lighter. + // https://www.w3schools.com/cssref/pr_font_weight.asp + string font_weight = 4; + + // Text style. Possible values are normal, italic, and oblique. + // https://www.w3schools.com/cssref/pr_font_font-style.asp + string text_style = 5; + + // Text decoration. Follows CSS standard. + // + // https://www.w3schools.com/cssref/pr_text_text-decoration.asp + string text_decoration = 6; + + // Font size. + FontSize font_size = 7; + } + + // A page in a [Document][google.cloud.documentai.v1beta3.Document]. + message Page { + // Dimension for the page. + message Dimension { + // Page width. + float width = 1; + + // Page height. + float height = 2; + + // Dimension unit. + string unit = 3; + } + + // Rendered image contents for this page. + message Image { + // Raw byte content of the image. + bytes content = 1; + + // Encoding mime type for the image. + string mime_type = 2; + + // Width of the image in pixels. + int32 width = 3; + + // Height of the image in pixels. + int32 height = 4; + } + + // Representation for transformation matrix, intended to be compatible and + // used with OpenCV format for image manipulation. + message Matrix { + // Number of rows in the matrix. + int32 rows = 1; + + // Number of columns in the matrix. + int32 cols = 2; + + // This encodes information about what data type the matrix uses. + // For example, 0 (CV_8U) is an unsigned 8-bit image. For the full list + // of OpenCV primitive data types, please refer to + // https://docs.opencv.org/4.3.0/d1/d1b/group__core__hal__interface.html + int32 type = 3; + + // The matrix data. + bytes data = 4; + } + + // Visual element describing a layout unit on a page. + message Layout { + // Detected human reading orientation. + enum Orientation { + // Unspecified orientation. + ORIENTATION_UNSPECIFIED = 0; + + // Orientation is aligned with page up. + PAGE_UP = 1; + + // Orientation is aligned with page right. + // Turn the head 90 degrees clockwise from upright to read. + PAGE_RIGHT = 2; + + // Orientation is aligned with page down. + // Turn the head 180 degrees from upright to read. + PAGE_DOWN = 3; + + // Orientation is aligned with page left. + // Turn the head 90 degrees counterclockwise from upright to read. + PAGE_LEFT = 4; + } + + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. + TextAnchor text_anchor = 1; + + // Confidence of the current [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] within context of the object this + // layout is for. e.g. confidence can be for a single token, a table, + // a visual element, etc. depending on context. Range [0, 1]. + float confidence = 2; + + // The bounding polygon for the [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout]. + BoundingPoly bounding_poly = 3; + + // Detected orientation for the [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout]. + Orientation orientation = 4; + } + + // A block has a set of lines (collected into paragraphs) that have a + // common line-spacing and orientation. + message Block { + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Block][google.cloud.documentai.v1beta3.Document.Page.Block]. + Layout layout = 1; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 2; + + // The history of this annotation. + Provenance provenance = 3; + } + + // A collection of lines that a human would perceive as a paragraph. + message Paragraph { + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Paragraph][google.cloud.documentai.v1beta3.Document.Page.Paragraph]. + Layout layout = 1; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 2; + + // The history of this annotation. + Provenance provenance = 3; + } + + // A collection of tokens that a human would perceive as a line. + // Does not cross column boundaries, can be horizontal, vertical, etc. + message Line { + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Line][google.cloud.documentai.v1beta3.Document.Page.Line]. + Layout layout = 1; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 2; + + // The history of this annotation. + Provenance provenance = 3; + } + + // A detected token. + message Token { + // Detected break at the end of a [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. + message DetectedBreak { + // Enum to denote the type of break found. + enum Type { + // Unspecified break type. + TYPE_UNSPECIFIED = 0; + + // A single whitespace. + SPACE = 1; + + // A wider whitespace. + WIDE_SPACE = 2; + + // A hyphen that indicates that a token has been split across lines. + HYPHEN = 3; + } + + // Detected break type. + Type type = 1; + } + + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. + Layout layout = 1; + + // Detected break at the end of a [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. + DetectedBreak detected_break = 2; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 3; + + // The history of this annotation. + Provenance provenance = 4; + } + + // Detected non-text visual elements e.g. checkbox, signature etc. on the + // page. + message VisualElement { + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [VisualElement][google.cloud.documentai.v1beta3.Document.Page.VisualElement]. + Layout layout = 1; + + // Type of the [VisualElement][google.cloud.documentai.v1beta3.Document.Page.VisualElement]. + string type = 2; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 3; + } + + // A table representation similar to HTML table structure. + message Table { + // A row of table cells. + message TableRow { + // Cells that make up this row. + repeated TableCell cells = 1; + } + + // A cell representation inside the table. + message TableCell { + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [TableCell][google.cloud.documentai.v1beta3.Document.Page.Table.TableCell]. + Layout layout = 1; + + // How many rows this cell spans. + int32 row_span = 2; + + // How many columns this cell spans. + int32 col_span = 3; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 4; + } + + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Table][google.cloud.documentai.v1beta3.Document.Page.Table]. + Layout layout = 1; + + // Header rows of the table. + repeated TableRow header_rows = 2; + + // Body rows of the table. + repeated TableRow body_rows = 3; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 4; + } + + // A form field detected on the page. + message FormField { + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the [FormField][google.cloud.documentai.v1beta3.Document.Page.FormField] name. e.g. `Address`, `Email`, + // `Grand total`, `Phone number`, etc. + Layout field_name = 1; + + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the [FormField][google.cloud.documentai.v1beta3.Document.Page.FormField] value. + Layout field_value = 2; + + // A list of detected languages for name together with confidence. + repeated DetectedLanguage name_detected_languages = 3; + + // A list of detected languages for value together with confidence. + repeated DetectedLanguage value_detected_languages = 4; + + // If the value is non-textual, this field represents the type. Current + // valid values are: + // - blank (this indicates the field_value is normal text) + // - "unfilled_checkbox" + // - "filled_checkbox" + string value_type = 5; + } + + // Detected language for a structural component. + message DetectedLanguage { + // The BCP-47 language code, such as "en-US" or "sr-Latn". For more + // information, see + // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + string language_code = 1; + + // Confidence of detected language. Range [0, 1]. + float confidence = 2; + } + + // 1-based index for current [Page][google.cloud.documentai.v1beta3.Document.Page] in a parent [Document][google.cloud.documentai.v1beta3.Document]. + // Useful when a page is taken out of a [Document][google.cloud.documentai.v1beta3.Document] for individual + // processing. + int32 page_number = 1; + + // Rendered image for this page. This image is preprocessed to remove any + // skew, rotation, and distortions such that the annotation bounding boxes + // can be upright and axis-aligned. + Image image = 13; + + // Transformation matrices that were applied to the original document image + // to produce [Page.image][google.cloud.documentai.v1beta3.Document.Page.image]. + repeated Matrix transforms = 14; + + // Physical dimension of the page. + Dimension dimension = 2; + + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the page. + Layout layout = 3; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 4; + + // A list of visually detected text blocks on the page. + // A block has a set of lines (collected into paragraphs) that have a common + // line-spacing and orientation. + repeated Block blocks = 5; + + // A list of visually detected text paragraphs on the page. + // A collection of lines that a human would perceive as a paragraph. + repeated Paragraph paragraphs = 6; + + // A list of visually detected text lines on the page. + // A collection of tokens that a human would perceive as a line. + repeated Line lines = 7; + + // A list of visually detected tokens on the page. + repeated Token tokens = 8; + + // A list of detected non-text visual elements e.g. checkbox, + // signature etc. on the page. + repeated VisualElement visual_elements = 9; + + // A list of visually detected tables on the page. + repeated Table tables = 10; + + // A list of visually detected form fields on the page. + repeated FormField form_fields = 11; + } + + // A phrase in the text that is a known entity type, such as a person, an + // organization, or location. + message Entity { + // Parsed and normalized entity value. + message NormalizedValue { + // Structured entity value. Must match entity type defined in schema if + // known. If this field is present, the 'text' field is still populated. + oneof structured_value { + // Money value. See also: + // + // https: + // github.com/googleapis/googleapis/blob/master/google/type/money.proto + google.type.Money money_value = 2; + + // Date value. Includes year, month, day. See also: + // + // https: + // github.com/googleapis/googleapis/blob/master/google/type/date.proto + google.type.Date date_value = 3; + + // DateTime value. Includes date, time, and timezone. See also: + // + // https: + // github.com/googleapis/googleapis/blob/master/google/type/datetime.proto + google.type.DateTime datetime_value = 4; + + // Postal address. See also: + // + // https: + // github.com/googleapis/googleapis/blob/master/google/type/postal_address.proto + google.type.PostalAddress address_value = 5; + } + + // Required. Normalized entity value stored as a string. This field is populated for + // supported document type (e.g. Invoice). For some entity types, one of + // respective 'structured_value' fields may also be populated. + // + // - Money/Currency type (`money_value`) is in the ISO 4217 text format. + // - Date type (`date_value`) is in the ISO 8601 text format. + // - Datetime type (`datetime_value`) is in the ISO 8601 text format. + string text = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // Provenance of the entity. + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. + TextAnchor text_anchor = 1; + + // Entity type from a schema e.g. `Address`. + string type = 2; + + // Text value in the document e.g. `1600 Amphitheatre Pkwy`. + string mention_text = 3; + + // Deprecated. Use `id` field instead. + string mention_id = 4; + + // Optional. Confidence of detected Schema entity. Range [0, 1]. + float confidence = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Represents the provenance of this entity wrt. the location on the + // page where it was found. + PageAnchor page_anchor = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Canonical id. This will be a unique value in the entity list + // for this document. + string id = 7; + + // Optional. Normalized entity value. Absent if the extracted value could not be + // converted or the type (e.g. address) is not supported for certain + // parsers. This field is also only populated for certain supported document + // types. + NormalizedValue normalized_value = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Entities can be nested to form a hierarchical data structure representing + // the content in the document. + repeated Entity properties = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The history of this annotation. + Provenance provenance = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether the entity will be redacted for de-identification purposes. + bool redacted = 12 [(google.api.field_behavior) = OPTIONAL]; + } + + // Relationship between [Entities][google.cloud.documentai.v1beta3.Document.Entity]. + message EntityRelation { + // Subject entity id. + string subject_id = 1; + + // Object entity id. + string object_id = 2; + + // Relationship description. + string relation = 3; + } + + // A translation of the text segment. + message Translation { + // Provenance of the translation. + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. There can only be a + // single `TextAnchor.text_segments` element. If the start and + // end index of the text segment are the same, the text change is inserted + // before that index. + TextAnchor text_anchor = 1; + + // The BCP-47 language code, such as "en-US" or "sr-Latn". For more + // information, see + // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + string language_code = 2; + + // Text translated into the target language. + string translated_text = 3; + + // The history of this annotation. + repeated Provenance provenance = 4; + } + + // Text reference indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. + message TextAnchor { + // A text segment in the [Document.text][google.cloud.documentai.v1beta3.Document.text]. The indices may be out of bounds + // which indicate that the text extends into another document shard for + // large sharded documents. See [ShardInfo.text_offset][google.cloud.documentai.v1beta3.Document.ShardInfo.text_offset] + message TextSegment { + // [TextSegment][google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment] start UTF-8 char index in the [Document.text][google.cloud.documentai.v1beta3.Document.text]. + int64 start_index = 1; + + // [TextSegment][google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment] half open end UTF-8 char index in the + // [Document.text][google.cloud.documentai.v1beta3.Document.text]. + int64 end_index = 2; + } + + // The text segments from the [Document.text][google.cloud.documentai.v1beta3.Document.text]. + repeated TextSegment text_segments = 1; + + // Contains the content of the text span so that users do + // not have to look it up in the text_segments. + string content = 2; + } + + // Referencing the visual context of the entity in the [Document.pages][google.cloud.documentai.v1beta3.Document.pages]. + // Page anchors can be cross-page, consist of multiple bounding polygons and + // optionally reference specific layout element types. + message PageAnchor { + // Represents a weak reference to a page element within a document. + message PageRef { + // The type of layout that is being referenced. + enum LayoutType { + // Layout Unspecified. + LAYOUT_TYPE_UNSPECIFIED = 0; + + // References a [Page.blocks][google.cloud.documentai.v1beta3.Document.Page.blocks] element. + BLOCK = 1; + + // References a [Page.paragraphs][google.cloud.documentai.v1beta3.Document.Page.paragraphs] element. + PARAGRAPH = 2; + + // References a [Page.lines][google.cloud.documentai.v1beta3.Document.Page.lines] element. + LINE = 3; + + // References a [Page.tokens][google.cloud.documentai.v1beta3.Document.Page.tokens] element. + TOKEN = 4; + + // References a [Page.visual_elements][google.cloud.documentai.v1beta3.Document.Page.visual_elements] element. + VISUAL_ELEMENT = 5; + + // Refrrences a [Page.tables][google.cloud.documentai.v1beta3.Document.Page.tables] element. + TABLE = 6; + + // References a [Page.form_fields][google.cloud.documentai.v1beta3.Document.Page.form_fields] element. + FORM_FIELD = 7; + } + + // Required. Index into the [Document.pages][google.cloud.documentai.v1beta3.Document.pages] element + int64 page = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The type of the layout element that is being referenced if any. + LayoutType layout_type = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Deprecated. Use [PageRef.bounding_poly][google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.bounding_poly] instead. + string layout_id = 3 [ + deprecated = true, + (google.api.field_behavior) = OPTIONAL + ]; + + // Optional. Identifies the bounding polygon of a layout element on the page. + BoundingPoly bounding_poly = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // One or more references to visual page elements + repeated PageRef page_refs = 1; + } + + // Structure to identify provenance relationships between annotations in + // different revisions. + message Provenance { + // Structure for referencing parent provenances. When an element replaces + // one of more other elements parent references identify the elements that + // are replaced. + message Parent { + // The index of the [Document.revisions] identifying the parent revision. + int32 revision = 1; + + // The id of the parent provenance. + int32 id = 2; + } + + // If a processor or agent does an explicit operation on existing elements. + enum OperationType { + // Operation type unspecified. + OPERATION_TYPE_UNSPECIFIED = 0; + + // Add an element. Implicit if no `parents` are set for the provenance. + ADD = 1; + + // The element is removed. No `parents` should be set. + REMOVE = 2; + + // Explicitly replaces the element(s) identified by `parents`. + REPLACE = 3; + + // Element is requested for human review. + EVAL_REQUESTED = 4; + + // Element is review and approved at human review, confidence will be set + // to 1.0 + EVAL_APPROVED = 5; + } + + // The index of the revision that produced this element. + int32 revision = 1; + + // The Id of this operation. Needs to be unique within the scope of the + // revision. + int32 id = 2; + + // References to the original elements that are replaced. + repeated Parent parents = 3; + + // The type of provenance operation. + OperationType type = 4; + } + + // Contains past or forward revisions of this document. + message Revision { + // Human Review information of the document. + message HumanReview { + // Human review state. e.g. `requested`, `succeeded`, `rejected`. + string state = 1; + + // A message providing more details about the current state of processing. + // For example, the rejection reason when the state is `rejected`. + string state_message = 2; + } + + // Who/what made the change + oneof source { + // If the change was made by a person specify the name or id of that + // person. + string agent = 4; + + // If the annotation was made by processor identify the processor by its + // resource name. + string processor = 5; + } + + // Id of the revision. Unique within the context of the document. + string id = 1; + + // The revisions that this revision is based on. This can include one or + // more parent (when documents are merged.) This field represents the + // index into the `revisions` field. + repeated int32 parent = 2; + + // The time that the revision was created. + google.protobuf.Timestamp create_time = 3; + + // Human Review information of this revision. + HumanReview human_review = 6; + } + + // This message is used for text changes aka. OCR corrections. + message TextChange { + // Provenance of the correction. + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. There can only be a + // single `TextAnchor.text_segments` element. If the start and + // end index of the text segment are the same, the text change is inserted + // before that index. + TextAnchor text_anchor = 1; + + // The text that replaces the text identified in the `text_anchor`. + string changed_text = 2; + + // The history of this annotation. + repeated Provenance provenance = 3; + } + + // Original source document from the user. + oneof source { + // Currently supports Google Cloud Storage URI of the form + // `gs://bucket_name/object_name`. Object versioning is not supported. + // See [Google Cloud Storage Request + // URIs](https://cloud.google.com/storage/docs/reference-uris) for more + // info. + string uri = 1; + + // Inline document content, represented as a stream of bytes. + // Note: As with all `bytes` fields, protobuffers use a pure binary + // representation, whereas JSON representations use base64. + bytes content = 2; + } + + // An IANA published MIME type (also referred to as media type). For more + // information, see + // https://www.iana.org/assignments/media-types/media-types.xhtml. + string mime_type = 3; + + // UTF-8 encoded text in reading order from the document. + string text = 4; + + // Styles for the [Document.text][google.cloud.documentai.v1beta3.Document.text]. + repeated Style text_styles = 5; + + // Visual page layout for the [Document][google.cloud.documentai.v1beta3.Document]. + repeated Page pages = 6; + + // A list of entities detected on [Document.text][google.cloud.documentai.v1beta3.Document.text]. For document shards, + // entities in this list may cross shard boundaries. + repeated Entity entities = 7; + + // Relationship among [Document.entities][google.cloud.documentai.v1beta3.Document.entities]. + repeated EntityRelation entity_relations = 8; + + // A list of translations on [Document.text][google.cloud.documentai.v1beta3.Document.text]. For document shards, + // translations in this list may cross shard boundaries. + repeated Translation translations = 12; + + // A list of text corrections made to [Document.text]. This is usually + // used for annotating corrections to OCR mistakes. Text changes for a given + // revision may not overlap with each other. + repeated TextChange text_changes = 14; + + // Information about the sharding if this document is sharded part of a larger + // document. If the document is not sharded, this message is not specified. + ShardInfo shard_info = 9; + + // Any error that occurred while processing this document. + google.rpc.Status error = 10; + + // Revision history of this document. + repeated Revision revisions = 13; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto new file mode 100644 index 00000000000..7784da3ecec --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto @@ -0,0 +1,291 @@ +// 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.documentai.v1beta3; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/documentai/v1beta3/document.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.DocumentAI.v1beta3"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; +option java_multiple_files = true; +option java_outer_classname = "DocumentAiProcessorService"; +option java_package = "com.google.cloud.documentai.v1beta3"; +option php_namespace = "Google\\Cloud\\DocumentAi\\v1beta3"; +option ruby_package = "Google::Cloud::DocumentAI::master"; + +// (-- aip.dev/not-precedent: This is needed because we have references to +// these resources in our public API, but the resource management is not +// part of the public API (UI access only). So we have to define +// these resource here to avoid any "unable to find resources" error. --) +option (google.api.resource_definition) = { + type: "documentai.googleapis.com/Location" + pattern: "projects/{project}/locations/{location}" +}; +option (google.api.resource_definition) = { + type: "documentai.googleapis.com/Processor" + pattern: "projects/{project}/locations/{location}/processors/{processor}" +}; +option (google.api.resource_definition) = { + type: "documentai.googleapis.com/HumanReviewConfig" + pattern: "projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig" +}; + +// Service to call Cloud DocumentAI to process documents according to the +// processor's definition. Processors are built using state-of-the-art Google +// AI such as natural language, computer vision, and translation to extract +// structured information from unstructured or semi-structured documents. +service DocumentProcessorService { + option (google.api.default_host) = "us-documentai.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Processes a single document. + rpc ProcessDocument(ProcessRequest) returns (ProcessResponse) { + option (google.api.http) = { + post: "/v1beta3/{name=projects/*/locations/*/processors/*}:process" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // LRO endpoint to batch process many documents. The output is written + // to Cloud Storage as JSON in the [Document] format. + rpc BatchProcessDocuments(BatchProcessRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta3/{name=projects/*/locations/*/processors/*}:batchProcess" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "BatchProcessResponse" + metadata_type: "BatchProcessMetadata" + }; + } + + // Send a document for Human Review. The input document should be processed by + // the specified processor. + rpc ReviewDocument(ReviewDocumentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta3/{human_review_config=projects/*/locations/*/processors/*/humanReviewConfig}:reviewDocument" + body: "*" + }; + option (google.api.method_signature) = "human_review_config"; + option (google.longrunning.operation_info) = { + response_type: "ReviewDocumentResponse" + metadata_type: "ReviewDocumentOperationMetadata" + }; + } +} + +// Request message for the process document method. +message ProcessRequest { + // Required. The processor resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/Processor" + } + ]; + + // The document payload, the [content] and [mime_type] fields must be set. + Document document = 2; + + // Whether Human Review feature should be skipped for this request. Default to + // false. + bool skip_human_review = 3; +} + +// Response message for the process document method. +message ProcessResponse { + // The document payload, will populate fields based on the processor's + // behavior. + Document document = 1; + + // The name of the operation triggered by the processed document. If the human + // review process is not triggered, this field will be empty. It has the same + // response type and metadata as the long running operation returned by + // ReviewDocument method. + string human_review_operation = 2; +} + +// Request message for batch process document method. +message BatchProcessRequest { + // The message for input config in batch process. + message BatchInputConfig { + // The Cloud Storage location as the source of the document. + string gcs_source = 1; + + // Mimetype of the input. If the input is a raw document, the supported + // mimetypes are application/pdf, image/tiff, and image/gif. + // If the input is a [Document] proto, the type should be application/json. + string mime_type = 2; + } + + // The message for output config in batch process. + message BatchOutputConfig { + // The output Cloud Storage directory to put the processed documents. + string gcs_destination = 1; + } + + // Required. The processor resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/Processor" + } + ]; + + // The input config for each single document in the batch process. + repeated BatchInputConfig input_configs = 2; + + // The overall output config for batch process. + BatchOutputConfig output_config = 3; +} + +// Response message for batch process document method. +message BatchProcessResponse { + +} + +// The long running operation metadata for batch process method. +message BatchProcessMetadata { + // The status of a each individual document in the batch process. + message IndividualProcessStatus { + // The source of the document, same as the [input_gcs_source] field in the + // request when the batch process started. The batch process is started by + // take snapshot of that document, since a user can move or change that + // document during the process. + string input_gcs_source = 1; + + // The status of the processing of the document. + google.rpc.Status status = 2; + + // The output_gcs_destination (in the request as 'output_gcs_destination') + // of the processed document if it was successful, otherwise empty. + string output_gcs_destination = 3; + + // The name of the operation triggered by the processed document. If the + // human review process is not triggered, this field will be empty. It has + // the same response type and metadata as the long running operation + // returned by ReviewDocument method. + string human_review_operation = 4; + } + + // Possible states of the batch processing operation. + enum State { + // The default value. This value is used if the state is omitted. + STATE_UNSPECIFIED = 0; + + // Request operation is waiting for scheduling. + WAITING = 1; + + // Request is being processed. + RUNNING = 2; + + // The batch processing completed successfully. + SUCCEEDED = 3; + + // The batch processing was being cancelled. + CANCELLING = 4; + + // The batch processing was cancelled. + CANCELLED = 5; + + // The batch processing has failed. + FAILED = 6; + } + + // The state of the current batch processing. + State state = 1; + + // A message providing more details about the current state of processing. + // For example, the error message if the operation is failed. + string state_message = 2; + + // The creation time of the operation. + google.protobuf.Timestamp create_time = 3; + + // The last update time of the operation. + google.protobuf.Timestamp update_time = 4; + + // The list of response details of each document. + repeated IndividualProcessStatus individual_process_statuses = 5; +} + +// Request message for review document method. +message ReviewDocumentRequest { + // Required. The resource name of the HumanReviewConfig that the document will be + // reviewed with. + string human_review_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/HumanReviewConfig" + } + ]; + + // The document that needs human review. + Document document = 2; +} + +// Response message for review document method. +message ReviewDocumentResponse { + // The Cloud Storage uri for the human reviewed document. + string gcs_destination = 1; +} + +// The long running operation metadata for review document method. +message ReviewDocumentOperationMetadata { + // State of the longrunning operation. + enum State { + // Unspecified state. + STATE_UNSPECIFIED = 0; + + // Operation is still running. + RUNNING = 1; + + // Operation is being cancelled. + CANCELLING = 2; + + // Operation succeeded. + SUCCEEDED = 3; + + // Operation failed. + FAILED = 4; + + // Operation is cancelled. + CANCELLED = 5; + } + + // Used only when Operation.done is false. + State state = 1; + + // A message providing more details about the current state of processing. + // For example, the error message if the operation is failed. + string state_message = 2; + + // The creation time of the operation. + google.protobuf.Timestamp create_time = 3; + + // The last update time of the operation. + google.protobuf.Timestamp update_time = 4; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/geometry.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/geometry.proto new file mode 100644 index 00000000000..c70ae0c0d51 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/geometry.proto @@ -0,0 +1,57 @@ +// 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.documentai.v1beta3; + +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.DocumentAI.v1beta3"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; +option java_multiple_files = true; +option java_outer_classname = "GeometryProto"; +option java_package = "com.google.cloud.documentai.v1beta3"; +option php_namespace = "Google\\Cloud\\DocumentAi\\v1beta3"; +option ruby_package = "Google::Cloud::DocumentAI::master"; + +// A vertex represents a 2D point in the image. +// NOTE: the vertex coordinates are in the same scale as the original image. +message Vertex { + // X coordinate. + int32 x = 1; + + // Y coordinate. + int32 y = 2; +} + +// A vertex represents a 2D point in the image. +// NOTE: the normalized vertex coordinates are relative to the original image +// and range from 0 to 1. +message NormalizedVertex { + // X coordinate. + float x = 1; + + // Y coordinate. + float y = 2; +} + +// A bounding polygon for the detected image annotation. +message BoundingPoly { + // The bounding polygon vertices. + repeated Vertex vertices = 1; + + // The bounding polygon normalized vertices. + repeated NormalizedVertex normalized_vertices = 2; +} diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 01aa5a66824..dc18024d083 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -4713,6 +4713,5170 @@ export namespace google { } } } + + /** Namespace v1beta3. */ + namespace v1beta3 { + + /** Properties of a Document. */ + interface IDocument { + + /** Document uri */ + uri?: (string|null); + + /** Document content */ + content?: (Uint8Array|string|null); + + /** Document mimeType */ + mimeType?: (string|null); + + /** Document text */ + text?: (string|null); + + /** Document textStyles */ + textStyles?: (google.cloud.documentai.v1beta3.Document.IStyle[]|null); + + /** Document pages */ + pages?: (google.cloud.documentai.v1beta3.Document.IPage[]|null); + + /** Document entities */ + entities?: (google.cloud.documentai.v1beta3.Document.IEntity[]|null); + + /** Document entityRelations */ + entityRelations?: (google.cloud.documentai.v1beta3.Document.IEntityRelation[]|null); + + /** Document translations */ + translations?: (google.cloud.documentai.v1beta3.Document.ITranslation[]|null); + + /** Document textChanges */ + textChanges?: (google.cloud.documentai.v1beta3.Document.ITextChange[]|null); + + /** Document shardInfo */ + shardInfo?: (google.cloud.documentai.v1beta3.Document.IShardInfo|null); + + /** Document error */ + error?: (google.rpc.IStatus|null); + + /** Document revisions */ + revisions?: (google.cloud.documentai.v1beta3.Document.IRevision[]|null); + } + + /** Represents a Document. */ + class Document implements IDocument { + + /** + * Constructs a new Document. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IDocument); + + /** Document uri. */ + public uri: string; + + /** Document content. */ + public content: (Uint8Array|string); + + /** Document mimeType. */ + public mimeType: string; + + /** Document text. */ + public text: string; + + /** Document textStyles. */ + public textStyles: google.cloud.documentai.v1beta3.Document.IStyle[]; + + /** Document pages. */ + public pages: google.cloud.documentai.v1beta3.Document.IPage[]; + + /** Document entities. */ + public entities: google.cloud.documentai.v1beta3.Document.IEntity[]; + + /** Document entityRelations. */ + public entityRelations: google.cloud.documentai.v1beta3.Document.IEntityRelation[]; + + /** Document translations. */ + public translations: google.cloud.documentai.v1beta3.Document.ITranslation[]; + + /** Document textChanges. */ + public textChanges: google.cloud.documentai.v1beta3.Document.ITextChange[]; + + /** Document shardInfo. */ + public shardInfo?: (google.cloud.documentai.v1beta3.Document.IShardInfo|null); + + /** Document error. */ + public error?: (google.rpc.IStatus|null); + + /** Document revisions. */ + public revisions: google.cloud.documentai.v1beta3.Document.IRevision[]; + + /** Document source. */ + public source?: ("uri"|"content"); + + /** + * Creates a new Document instance using the specified properties. + * @param [properties] Properties to set + * @returns Document instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IDocument): google.cloud.documentai.v1beta3.Document; + + /** + * Encodes the specified Document message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.verify|verify} messages. + * @param message Document message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Document message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.verify|verify} messages. + * @param message Document message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Document message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document; + + /** + * Decodes a Document message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document; + + /** + * Verifies a Document message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Document message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Document + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document; + + /** + * Creates a plain object from a Document message. Also converts values to other types if specified. + * @param message Document + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Document to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Document { + + /** Properties of a ShardInfo. */ + interface IShardInfo { + + /** ShardInfo shardIndex */ + shardIndex?: (number|Long|string|null); + + /** ShardInfo shardCount */ + shardCount?: (number|Long|string|null); + + /** ShardInfo textOffset */ + textOffset?: (number|Long|string|null); + } + + /** Represents a ShardInfo. */ + class ShardInfo implements IShardInfo { + + /** + * Constructs a new ShardInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.IShardInfo); + + /** ShardInfo shardIndex. */ + public shardIndex: (number|Long|string); + + /** ShardInfo shardCount. */ + public shardCount: (number|Long|string); + + /** ShardInfo textOffset. */ + public textOffset: (number|Long|string); + + /** + * Creates a new ShardInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns ShardInfo instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.IShardInfo): google.cloud.documentai.v1beta3.Document.ShardInfo; + + /** + * Encodes the specified ShardInfo message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.ShardInfo.verify|verify} messages. + * @param message ShardInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.IShardInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ShardInfo message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.ShardInfo.verify|verify} messages. + * @param message ShardInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.IShardInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ShardInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ShardInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.ShardInfo; + + /** + * Decodes a ShardInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ShardInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.ShardInfo; + + /** + * Verifies a ShardInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ShardInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ShardInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.ShardInfo; + + /** + * Creates a plain object from a ShardInfo message. Also converts values to other types if specified. + * @param message ShardInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.ShardInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ShardInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Style. */ + interface IStyle { + + /** Style textAnchor */ + textAnchor?: (google.cloud.documentai.v1beta3.Document.ITextAnchor|null); + + /** Style color */ + color?: (google.type.IColor|null); + + /** Style backgroundColor */ + backgroundColor?: (google.type.IColor|null); + + /** Style fontWeight */ + fontWeight?: (string|null); + + /** Style textStyle */ + textStyle?: (string|null); + + /** Style textDecoration */ + textDecoration?: (string|null); + + /** Style fontSize */ + fontSize?: (google.cloud.documentai.v1beta3.Document.Style.IFontSize|null); + } + + /** Represents a Style. */ + class Style implements IStyle { + + /** + * Constructs a new Style. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.IStyle); + + /** Style textAnchor. */ + public textAnchor?: (google.cloud.documentai.v1beta3.Document.ITextAnchor|null); + + /** Style color. */ + public color?: (google.type.IColor|null); + + /** Style backgroundColor. */ + public backgroundColor?: (google.type.IColor|null); + + /** Style fontWeight. */ + public fontWeight: string; + + /** Style textStyle. */ + public textStyle: string; + + /** Style textDecoration. */ + public textDecoration: string; + + /** Style fontSize. */ + public fontSize?: (google.cloud.documentai.v1beta3.Document.Style.IFontSize|null); + + /** + * Creates a new Style instance using the specified properties. + * @param [properties] Properties to set + * @returns Style instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.IStyle): google.cloud.documentai.v1beta3.Document.Style; + + /** + * Encodes the specified Style message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Style.verify|verify} messages. + * @param message Style message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.IStyle, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Style message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Style.verify|verify} messages. + * @param message Style message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.IStyle, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Style message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Style + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Style; + + /** + * Decodes a Style message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Style + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Style; + + /** + * Verifies a Style message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Style message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Style + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Style; + + /** + * Creates a plain object from a Style message. Also converts values to other types if specified. + * @param message Style + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Style, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Style to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Style { + + /** Properties of a FontSize. */ + interface IFontSize { + + /** FontSize size */ + size?: (number|null); + + /** FontSize unit */ + unit?: (string|null); + } + + /** Represents a FontSize. */ + class FontSize implements IFontSize { + + /** + * Constructs a new FontSize. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Style.IFontSize); + + /** FontSize size. */ + public size: number; + + /** FontSize unit. */ + public unit: string; + + /** + * Creates a new FontSize instance using the specified properties. + * @param [properties] Properties to set + * @returns FontSize instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Style.IFontSize): google.cloud.documentai.v1beta3.Document.Style.FontSize; + + /** + * Encodes the specified FontSize message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Style.FontSize.verify|verify} messages. + * @param message FontSize message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Style.IFontSize, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FontSize message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Style.FontSize.verify|verify} messages. + * @param message FontSize message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Style.IFontSize, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FontSize message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FontSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Style.FontSize; + + /** + * Decodes a FontSize message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FontSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Style.FontSize; + + /** + * Verifies a FontSize message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FontSize message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FontSize + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Style.FontSize; + + /** + * Creates a plain object from a FontSize message. Also converts values to other types if specified. + * @param message FontSize + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Style.FontSize, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FontSize to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a Page. */ + interface IPage { + + /** Page pageNumber */ + pageNumber?: (number|null); + + /** Page image */ + image?: (google.cloud.documentai.v1beta3.Document.Page.IImage|null); + + /** Page transforms */ + transforms?: (google.cloud.documentai.v1beta3.Document.Page.IMatrix[]|null); + + /** Page dimension */ + dimension?: (google.cloud.documentai.v1beta3.Document.Page.IDimension|null); + + /** Page layout */ + layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** Page detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]|null); + + /** Page blocks */ + blocks?: (google.cloud.documentai.v1beta3.Document.Page.IBlock[]|null); + + /** Page paragraphs */ + paragraphs?: (google.cloud.documentai.v1beta3.Document.Page.IParagraph[]|null); + + /** Page lines */ + lines?: (google.cloud.documentai.v1beta3.Document.Page.ILine[]|null); + + /** Page tokens */ + tokens?: (google.cloud.documentai.v1beta3.Document.Page.IToken[]|null); + + /** Page visualElements */ + visualElements?: (google.cloud.documentai.v1beta3.Document.Page.IVisualElement[]|null); + + /** Page tables */ + tables?: (google.cloud.documentai.v1beta3.Document.Page.ITable[]|null); + + /** Page formFields */ + formFields?: (google.cloud.documentai.v1beta3.Document.Page.IFormField[]|null); + } + + /** Represents a Page. */ + class Page implements IPage { + + /** + * Constructs a new Page. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.IPage); + + /** Page pageNumber. */ + public pageNumber: number; + + /** Page image. */ + public image?: (google.cloud.documentai.v1beta3.Document.Page.IImage|null); + + /** Page transforms. */ + public transforms: google.cloud.documentai.v1beta3.Document.Page.IMatrix[]; + + /** Page dimension. */ + public dimension?: (google.cloud.documentai.v1beta3.Document.Page.IDimension|null); + + /** Page layout. */ + public layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** Page detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]; + + /** Page blocks. */ + public blocks: google.cloud.documentai.v1beta3.Document.Page.IBlock[]; + + /** Page paragraphs. */ + public paragraphs: google.cloud.documentai.v1beta3.Document.Page.IParagraph[]; + + /** Page lines. */ + public lines: google.cloud.documentai.v1beta3.Document.Page.ILine[]; + + /** Page tokens. */ + public tokens: google.cloud.documentai.v1beta3.Document.Page.IToken[]; + + /** Page visualElements. */ + public visualElements: google.cloud.documentai.v1beta3.Document.Page.IVisualElement[]; + + /** Page tables. */ + public tables: google.cloud.documentai.v1beta3.Document.Page.ITable[]; + + /** Page formFields. */ + public formFields: google.cloud.documentai.v1beta3.Document.Page.IFormField[]; + + /** + * Creates a new Page instance using the specified properties. + * @param [properties] Properties to set + * @returns Page instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.IPage): google.cloud.documentai.v1beta3.Document.Page; + + /** + * Encodes the specified Page message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.verify|verify} messages. + * @param message Page message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.IPage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Page message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.verify|verify} messages. + * @param message Page message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.IPage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Page message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Page + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Page; + + /** + * Decodes a Page message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Page + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Page; + + /** + * Verifies a Page message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Page message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Page + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Page; + + /** + * Creates a plain object from a Page message. Also converts values to other types if specified. + * @param message Page + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Page, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Page to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Page { + + /** Properties of a Dimension. */ + interface IDimension { + + /** Dimension width */ + width?: (number|null); + + /** Dimension height */ + height?: (number|null); + + /** Dimension unit */ + unit?: (string|null); + } + + /** Represents a Dimension. */ + class Dimension implements IDimension { + + /** + * Constructs a new Dimension. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Page.IDimension); + + /** Dimension width. */ + public width: number; + + /** Dimension height. */ + public height: number; + + /** Dimension unit. */ + public unit: string; + + /** + * Creates a new Dimension instance using the specified properties. + * @param [properties] Properties to set + * @returns Dimension instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Page.IDimension): google.cloud.documentai.v1beta3.Document.Page.Dimension; + + /** + * Encodes the specified Dimension message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Dimension.verify|verify} messages. + * @param message Dimension message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Page.IDimension, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Dimension message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Dimension.verify|verify} messages. + * @param message Dimension message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Page.IDimension, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Dimension message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Dimension + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Page.Dimension; + + /** + * Decodes a Dimension message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Dimension + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Page.Dimension; + + /** + * Verifies a Dimension message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Dimension message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Dimension + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Page.Dimension; + + /** + * Creates a plain object from a Dimension message. Also converts values to other types if specified. + * @param message Dimension + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Page.Dimension, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Dimension to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an Image. */ + interface IImage { + + /** Image content */ + content?: (Uint8Array|string|null); + + /** Image mimeType */ + mimeType?: (string|null); + + /** Image width */ + width?: (number|null); + + /** Image height */ + height?: (number|null); + } + + /** Represents an Image. */ + class Image implements IImage { + + /** + * Constructs a new Image. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Page.IImage); + + /** Image content. */ + public content: (Uint8Array|string); + + /** Image mimeType. */ + public mimeType: string; + + /** Image width. */ + public width: number; + + /** Image height. */ + public height: number; + + /** + * Creates a new Image instance using the specified properties. + * @param [properties] Properties to set + * @returns Image instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Page.IImage): google.cloud.documentai.v1beta3.Document.Page.Image; + + /** + * Encodes the specified Image message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.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.documentai.v1beta3.Document.Page.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.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.documentai.v1beta3.Document.Page.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.documentai.v1beta3.Document.Page.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.documentai.v1beta3.Document.Page.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.documentai.v1beta3.Document.Page.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.documentai.v1beta3.Document.Page.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Image to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Matrix. */ + interface IMatrix { + + /** Matrix rows */ + rows?: (number|null); + + /** Matrix cols */ + cols?: (number|null); + + /** Matrix type */ + type?: (number|null); + + /** Matrix data */ + data?: (Uint8Array|string|null); + } + + /** Represents a Matrix. */ + class Matrix implements IMatrix { + + /** + * Constructs a new Matrix. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Page.IMatrix); + + /** Matrix rows. */ + public rows: number; + + /** Matrix cols. */ + public cols: number; + + /** Matrix type. */ + public type: number; + + /** Matrix data. */ + public data: (Uint8Array|string); + + /** + * Creates a new Matrix instance using the specified properties. + * @param [properties] Properties to set + * @returns Matrix instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Page.IMatrix): google.cloud.documentai.v1beta3.Document.Page.Matrix; + + /** + * Encodes the specified Matrix message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Matrix.verify|verify} messages. + * @param message Matrix message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Page.IMatrix, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Matrix message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Matrix.verify|verify} messages. + * @param message Matrix message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Page.IMatrix, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Matrix message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Matrix + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Page.Matrix; + + /** + * Decodes a Matrix message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Matrix + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Page.Matrix; + + /** + * Verifies a Matrix message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Matrix message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Matrix + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Page.Matrix; + + /** + * Creates a plain object from a Matrix message. Also converts values to other types if specified. + * @param message Matrix + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Page.Matrix, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Matrix to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Layout. */ + interface ILayout { + + /** Layout textAnchor */ + textAnchor?: (google.cloud.documentai.v1beta3.Document.ITextAnchor|null); + + /** Layout confidence */ + confidence?: (number|null); + + /** Layout boundingPoly */ + boundingPoly?: (google.cloud.documentai.v1beta3.IBoundingPoly|null); + + /** Layout orientation */ + orientation?: (google.cloud.documentai.v1beta3.Document.Page.Layout.Orientation|keyof typeof google.cloud.documentai.v1beta3.Document.Page.Layout.Orientation|null); + } + + /** Represents a Layout. */ + class Layout implements ILayout { + + /** + * Constructs a new Layout. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Page.ILayout); + + /** Layout textAnchor. */ + public textAnchor?: (google.cloud.documentai.v1beta3.Document.ITextAnchor|null); + + /** Layout confidence. */ + public confidence: number; + + /** Layout boundingPoly. */ + public boundingPoly?: (google.cloud.documentai.v1beta3.IBoundingPoly|null); + + /** Layout orientation. */ + public orientation: (google.cloud.documentai.v1beta3.Document.Page.Layout.Orientation|keyof typeof google.cloud.documentai.v1beta3.Document.Page.Layout.Orientation); + + /** + * Creates a new Layout instance using the specified properties. + * @param [properties] Properties to set + * @returns Layout instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Page.ILayout): google.cloud.documentai.v1beta3.Document.Page.Layout; + + /** + * Encodes the specified Layout message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Layout.verify|verify} messages. + * @param message Layout message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Page.ILayout, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Layout message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Layout.verify|verify} messages. + * @param message Layout message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Page.ILayout, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Layout message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Layout + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Page.Layout; + + /** + * Decodes a Layout message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Layout + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Page.Layout; + + /** + * Verifies a Layout message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Layout message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Layout + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Page.Layout; + + /** + * Creates a plain object from a Layout message. Also converts values to other types if specified. + * @param message Layout + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Page.Layout, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Layout to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Layout { + + /** Orientation enum. */ + enum Orientation { + ORIENTATION_UNSPECIFIED = 0, + PAGE_UP = 1, + PAGE_RIGHT = 2, + PAGE_DOWN = 3, + PAGE_LEFT = 4 + } + } + + /** Properties of a Block. */ + interface IBlock { + + /** Block layout */ + layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** Block detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]|null); + + /** Block provenance */ + provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); + } + + /** Represents a Block. */ + class Block implements IBlock { + + /** + * Constructs a new Block. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Page.IBlock); + + /** Block layout. */ + public layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** Block detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]; + + /** Block provenance. */ + public provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); + + /** + * Creates a new Block instance using the specified properties. + * @param [properties] Properties to set + * @returns Block instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Page.IBlock): google.cloud.documentai.v1beta3.Document.Page.Block; + + /** + * Encodes the specified Block message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Block.verify|verify} messages. + * @param message Block message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Page.IBlock, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Block message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Block.verify|verify} messages. + * @param message Block message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Page.IBlock, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Block message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Block + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Page.Block; + + /** + * Decodes a Block message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Block + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Page.Block; + + /** + * Verifies a Block message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Block message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Block + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Page.Block; + + /** + * Creates a plain object from a Block message. Also converts values to other types if specified. + * @param message Block + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Page.Block, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Block to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Paragraph. */ + interface IParagraph { + + /** Paragraph layout */ + layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** Paragraph detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]|null); + + /** Paragraph provenance */ + provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); + } + + /** Represents a Paragraph. */ + class Paragraph implements IParagraph { + + /** + * Constructs a new Paragraph. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Page.IParagraph); + + /** Paragraph layout. */ + public layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** Paragraph detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]; + + /** Paragraph provenance. */ + public provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); + + /** + * Creates a new Paragraph instance using the specified properties. + * @param [properties] Properties to set + * @returns Paragraph instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Page.IParagraph): google.cloud.documentai.v1beta3.Document.Page.Paragraph; + + /** + * Encodes the specified Paragraph message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Paragraph.verify|verify} messages. + * @param message Paragraph message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Page.IParagraph, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Paragraph message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Paragraph.verify|verify} messages. + * @param message Paragraph message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Page.IParagraph, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Paragraph message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Paragraph + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Page.Paragraph; + + /** + * Decodes a Paragraph message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Paragraph + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Page.Paragraph; + + /** + * Verifies a Paragraph message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Paragraph message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Paragraph + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Page.Paragraph; + + /** + * Creates a plain object from a Paragraph message. Also converts values to other types if specified. + * @param message Paragraph + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Page.Paragraph, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Paragraph to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Line. */ + interface ILine { + + /** Line layout */ + layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** Line detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]|null); + + /** Line provenance */ + provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); + } + + /** Represents a Line. */ + class Line implements ILine { + + /** + * Constructs a new Line. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Page.ILine); + + /** Line layout. */ + public layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** Line detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]; + + /** Line provenance. */ + public provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); + + /** + * Creates a new Line instance using the specified properties. + * @param [properties] Properties to set + * @returns Line instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Page.ILine): google.cloud.documentai.v1beta3.Document.Page.Line; + + /** + * Encodes the specified Line message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Line.verify|verify} messages. + * @param message Line message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Page.ILine, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Line message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Line.verify|verify} messages. + * @param message Line message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Page.ILine, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Line message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Page.Line; + + /** + * Decodes a Line message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Page.Line; + + /** + * Verifies a Line message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Line message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Line + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Page.Line; + + /** + * Creates a plain object from a Line message. Also converts values to other types if specified. + * @param message Line + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Page.Line, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Line to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Token. */ + interface IToken { + + /** Token layout */ + layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** Token detectedBreak */ + detectedBreak?: (google.cloud.documentai.v1beta3.Document.Page.Token.IDetectedBreak|null); + + /** Token detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]|null); + + /** Token provenance */ + provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); + } + + /** Represents a Token. */ + class Token implements IToken { + + /** + * Constructs a new Token. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Page.IToken); + + /** Token layout. */ + public layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** Token detectedBreak. */ + public detectedBreak?: (google.cloud.documentai.v1beta3.Document.Page.Token.IDetectedBreak|null); + + /** Token detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]; + + /** Token provenance. */ + public provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); + + /** + * Creates a new Token instance using the specified properties. + * @param [properties] Properties to set + * @returns Token instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Page.IToken): google.cloud.documentai.v1beta3.Document.Page.Token; + + /** + * Encodes the specified Token message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Token.verify|verify} messages. + * @param message Token message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Page.IToken, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Token message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Token.verify|verify} messages. + * @param message Token message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Page.IToken, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Token message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Token + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Page.Token; + + /** + * Decodes a Token message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Token + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Page.Token; + + /** + * Verifies a Token message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Token message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Token + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Page.Token; + + /** + * Creates a plain object from a Token message. Also converts values to other types if specified. + * @param message Token + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Page.Token, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Token to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Token { + + /** Properties of a DetectedBreak. */ + interface IDetectedBreak { + + /** DetectedBreak type */ + type?: (google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.Type|keyof typeof google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.Type|null); + } + + /** Represents a DetectedBreak. */ + class DetectedBreak implements IDetectedBreak { + + /** + * Constructs a new DetectedBreak. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Page.Token.IDetectedBreak); + + /** DetectedBreak type. */ + public type: (google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.Type|keyof typeof google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.Type); + + /** + * Creates a new DetectedBreak instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectedBreak instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Page.Token.IDetectedBreak): google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak; + + /** + * Encodes the specified DetectedBreak message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.verify|verify} messages. + * @param message DetectedBreak message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Page.Token.IDetectedBreak, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectedBreak message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.verify|verify} messages. + * @param message DetectedBreak message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Page.Token.IDetectedBreak, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectedBreak message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectedBreak + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak; + + /** + * Decodes a DetectedBreak message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectedBreak + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak; + + /** + * Verifies a DetectedBreak message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DetectedBreak message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectedBreak + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak; + + /** + * Creates a plain object from a DetectedBreak message. Also converts values to other types if specified. + * @param message DetectedBreak + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectedBreak to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace DetectedBreak { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + SPACE = 1, + WIDE_SPACE = 2, + HYPHEN = 3 + } + } + } + + /** Properties of a VisualElement. */ + interface IVisualElement { + + /** VisualElement layout */ + layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** VisualElement type */ + type?: (string|null); + + /** VisualElement detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a VisualElement. */ + class VisualElement implements IVisualElement { + + /** + * Constructs a new VisualElement. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Page.IVisualElement); + + /** VisualElement layout. */ + public layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** VisualElement type. */ + public type: string; + + /** VisualElement detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new VisualElement instance using the specified properties. + * @param [properties] Properties to set + * @returns VisualElement instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Page.IVisualElement): google.cloud.documentai.v1beta3.Document.Page.VisualElement; + + /** + * Encodes the specified VisualElement message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.VisualElement.verify|verify} messages. + * @param message VisualElement message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Page.IVisualElement, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VisualElement message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.VisualElement.verify|verify} messages. + * @param message VisualElement message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Page.IVisualElement, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VisualElement message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VisualElement + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Page.VisualElement; + + /** + * Decodes a VisualElement message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VisualElement + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Page.VisualElement; + + /** + * Verifies a VisualElement message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a VisualElement message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VisualElement + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Page.VisualElement; + + /** + * Creates a plain object from a VisualElement message. Also converts values to other types if specified. + * @param message VisualElement + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Page.VisualElement, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VisualElement to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Table. */ + interface ITable { + + /** Table layout */ + layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** Table headerRows */ + headerRows?: (google.cloud.documentai.v1beta3.Document.Page.Table.ITableRow[]|null); + + /** Table bodyRows */ + bodyRows?: (google.cloud.documentai.v1beta3.Document.Page.Table.ITableRow[]|null); + + /** Table detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a Table. */ + class Table implements ITable { + + /** + * Constructs a new Table. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Page.ITable); + + /** Table layout. */ + public layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** Table headerRows. */ + public headerRows: google.cloud.documentai.v1beta3.Document.Page.Table.ITableRow[]; + + /** Table bodyRows. */ + public bodyRows: google.cloud.documentai.v1beta3.Document.Page.Table.ITableRow[]; + + /** Table detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new Table instance using the specified properties. + * @param [properties] Properties to set + * @returns Table instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Page.ITable): google.cloud.documentai.v1beta3.Document.Page.Table; + + /** + * Encodes the specified Table message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Table.verify|verify} messages. + * @param message Table message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Page.ITable, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Table message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Table.verify|verify} messages. + * @param message Table message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Page.ITable, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Table message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Table + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Page.Table; + + /** + * Decodes a Table message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Table + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Page.Table; + + /** + * Verifies a Table message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Table message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Table + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Page.Table; + + /** + * Creates a plain object from a Table message. Also converts values to other types if specified. + * @param message Table + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Page.Table, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Table to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Table { + + /** Properties of a TableRow. */ + interface ITableRow { + + /** TableRow cells */ + cells?: (google.cloud.documentai.v1beta3.Document.Page.Table.ITableCell[]|null); + } + + /** Represents a TableRow. */ + class TableRow implements ITableRow { + + /** + * Constructs a new TableRow. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Page.Table.ITableRow); + + /** TableRow cells. */ + public cells: google.cloud.documentai.v1beta3.Document.Page.Table.ITableCell[]; + + /** + * Creates a new TableRow instance using the specified properties. + * @param [properties] Properties to set + * @returns TableRow instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Page.Table.ITableRow): google.cloud.documentai.v1beta3.Document.Page.Table.TableRow; + + /** + * Encodes the specified TableRow message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Table.TableRow.verify|verify} messages. + * @param message TableRow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Page.Table.ITableRow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableRow message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Table.TableRow.verify|verify} messages. + * @param message TableRow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Page.Table.ITableRow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableRow message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Page.Table.TableRow; + + /** + * Decodes a TableRow message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Page.Table.TableRow; + + /** + * Verifies a TableRow message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TableRow message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableRow + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Page.Table.TableRow; + + /** + * Creates a plain object from a TableRow message. Also converts values to other types if specified. + * @param message TableRow + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Page.Table.TableRow, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableRow to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TableCell. */ + interface ITableCell { + + /** TableCell layout */ + layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** TableCell rowSpan */ + rowSpan?: (number|null); + + /** TableCell colSpan */ + colSpan?: (number|null); + + /** TableCell detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a TableCell. */ + class TableCell implements ITableCell { + + /** + * Constructs a new TableCell. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Page.Table.ITableCell); + + /** TableCell layout. */ + public layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** TableCell rowSpan. */ + public rowSpan: number; + + /** TableCell colSpan. */ + public colSpan: number; + + /** TableCell detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new TableCell instance using the specified properties. + * @param [properties] Properties to set + * @returns TableCell instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Page.Table.ITableCell): google.cloud.documentai.v1beta3.Document.Page.Table.TableCell; + + /** + * Encodes the specified TableCell message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Table.TableCell.verify|verify} messages. + * @param message TableCell message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Page.Table.ITableCell, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableCell message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Table.TableCell.verify|verify} messages. + * @param message TableCell message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Page.Table.ITableCell, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableCell message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Page.Table.TableCell; + + /** + * Decodes a TableCell message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Page.Table.TableCell; + + /** + * Verifies a TableCell message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TableCell message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableCell + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Page.Table.TableCell; + + /** + * Creates a plain object from a TableCell message. Also converts values to other types if specified. + * @param message TableCell + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Page.Table.TableCell, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableCell to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a FormField. */ + interface IFormField { + + /** FormField fieldName */ + fieldName?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** FormField fieldValue */ + fieldValue?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** FormField nameDetectedLanguages */ + nameDetectedLanguages?: (google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]|null); + + /** FormField valueDetectedLanguages */ + valueDetectedLanguages?: (google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]|null); + + /** FormField valueType */ + valueType?: (string|null); + } + + /** Represents a FormField. */ + class FormField implements IFormField { + + /** + * Constructs a new FormField. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Page.IFormField); + + /** FormField fieldName. */ + public fieldName?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** FormField fieldValue. */ + public fieldValue?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** FormField nameDetectedLanguages. */ + public nameDetectedLanguages: google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]; + + /** FormField valueDetectedLanguages. */ + public valueDetectedLanguages: google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]; + + /** FormField valueType. */ + public valueType: string; + + /** + * Creates a new FormField instance using the specified properties. + * @param [properties] Properties to set + * @returns FormField instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Page.IFormField): google.cloud.documentai.v1beta3.Document.Page.FormField; + + /** + * Encodes the specified FormField message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.FormField.verify|verify} messages. + * @param message FormField message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Page.IFormField, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FormField message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.FormField.verify|verify} messages. + * @param message FormField message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Page.IFormField, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FormField message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FormField + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Page.FormField; + + /** + * Decodes a FormField message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FormField + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Page.FormField; + + /** + * Verifies a FormField message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FormField message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FormField + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Page.FormField; + + /** + * Creates a plain object from a FormField message. Also converts values to other types if specified. + * @param message FormField + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Page.FormField, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FormField to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DetectedLanguage. */ + interface IDetectedLanguage { + + /** DetectedLanguage languageCode */ + languageCode?: (string|null); + + /** DetectedLanguage confidence */ + confidence?: (number|null); + } + + /** Represents a DetectedLanguage. */ + class DetectedLanguage implements IDetectedLanguage { + + /** + * Constructs a new DetectedLanguage. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage); + + /** DetectedLanguage languageCode. */ + public languageCode: string; + + /** DetectedLanguage confidence. */ + public confidence: number; + + /** + * Creates a new DetectedLanguage instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectedLanguage instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage): google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage; + + /** + * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.verify|verify} messages. + * @param message DetectedLanguage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.verify|verify} messages. + * @param message DetectedLanguage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectedLanguage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage; + + /** + * Decodes a DetectedLanguage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage; + + /** + * Verifies a DetectedLanguage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DetectedLanguage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectedLanguage + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage; + + /** + * Creates a plain object from a DetectedLanguage message. Also converts values to other types if specified. + * @param message DetectedLanguage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectedLanguage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an Entity. */ + interface IEntity { + + /** Entity textAnchor */ + textAnchor?: (google.cloud.documentai.v1beta3.Document.ITextAnchor|null); + + /** Entity type */ + type?: (string|null); + + /** Entity mentionText */ + mentionText?: (string|null); + + /** Entity mentionId */ + mentionId?: (string|null); + + /** Entity confidence */ + confidence?: (number|null); + + /** Entity pageAnchor */ + pageAnchor?: (google.cloud.documentai.v1beta3.Document.IPageAnchor|null); + + /** Entity id */ + id?: (string|null); + + /** Entity normalizedValue */ + normalizedValue?: (google.cloud.documentai.v1beta3.Document.Entity.INormalizedValue|null); + + /** Entity properties */ + properties?: (google.cloud.documentai.v1beta3.Document.IEntity[]|null); + + /** Entity provenance */ + provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); + + /** Entity redacted */ + redacted?: (boolean|null); + } + + /** Represents an Entity. */ + class Entity implements IEntity { + + /** + * Constructs a new Entity. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.IEntity); + + /** Entity textAnchor. */ + public textAnchor?: (google.cloud.documentai.v1beta3.Document.ITextAnchor|null); + + /** Entity type. */ + public type: string; + + /** Entity mentionText. */ + public mentionText: string; + + /** Entity mentionId. */ + public mentionId: string; + + /** Entity confidence. */ + public confidence: number; + + /** Entity pageAnchor. */ + public pageAnchor?: (google.cloud.documentai.v1beta3.Document.IPageAnchor|null); + + /** Entity id. */ + public id: string; + + /** Entity normalizedValue. */ + public normalizedValue?: (google.cloud.documentai.v1beta3.Document.Entity.INormalizedValue|null); + + /** Entity properties. */ + public properties: google.cloud.documentai.v1beta3.Document.IEntity[]; + + /** Entity provenance. */ + public provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); + + /** Entity redacted. */ + public redacted: boolean; + + /** + * Creates a new Entity instance using the specified properties. + * @param [properties] Properties to set + * @returns Entity instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.IEntity): google.cloud.documentai.v1beta3.Document.Entity; + + /** + * Encodes the specified Entity message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Entity.verify|verify} messages. + * @param message Entity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.IEntity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Entity message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Entity.verify|verify} messages. + * @param message Entity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.IEntity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Entity message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Entity; + + /** + * Decodes an Entity message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Entity; + + /** + * Verifies an Entity message. + * @param message Plain 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 Entity message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Entity + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Entity; + + /** + * Creates a plain object from an Entity message. Also converts values to other types if specified. + * @param message Entity + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Entity, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Entity to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Entity { + + /** Properties of a NormalizedValue. */ + interface INormalizedValue { + + /** NormalizedValue moneyValue */ + moneyValue?: (google.type.IMoney|null); + + /** NormalizedValue dateValue */ + dateValue?: (google.type.IDate|null); + + /** NormalizedValue datetimeValue */ + datetimeValue?: (google.type.IDateTime|null); + + /** NormalizedValue addressValue */ + addressValue?: (google.type.IPostalAddress|null); + + /** NormalizedValue text */ + text?: (string|null); + } + + /** Represents a NormalizedValue. */ + class NormalizedValue implements INormalizedValue { + + /** + * Constructs a new NormalizedValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Entity.INormalizedValue); + + /** NormalizedValue moneyValue. */ + public moneyValue?: (google.type.IMoney|null); + + /** NormalizedValue dateValue. */ + public dateValue?: (google.type.IDate|null); + + /** NormalizedValue datetimeValue. */ + public datetimeValue?: (google.type.IDateTime|null); + + /** NormalizedValue addressValue. */ + public addressValue?: (google.type.IPostalAddress|null); + + /** NormalizedValue text. */ + public text: string; + + /** NormalizedValue structuredValue. */ + public structuredValue?: ("moneyValue"|"dateValue"|"datetimeValue"|"addressValue"); + + /** + * Creates a new NormalizedValue instance using the specified properties. + * @param [properties] Properties to set + * @returns NormalizedValue instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Entity.INormalizedValue): google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue; + + /** + * Encodes the specified NormalizedValue message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue.verify|verify} messages. + * @param message NormalizedValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Entity.INormalizedValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NormalizedValue message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue.verify|verify} messages. + * @param message NormalizedValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Entity.INormalizedValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NormalizedValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NormalizedValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue; + + /** + * Decodes a NormalizedValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NormalizedValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue; + + /** + * Verifies a NormalizedValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NormalizedValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NormalizedValue + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue; + + /** + * Creates a plain object from a NormalizedValue message. Also converts values to other types if specified. + * @param message NormalizedValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NormalizedValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an EntityRelation. */ + interface IEntityRelation { + + /** EntityRelation subjectId */ + subjectId?: (string|null); + + /** EntityRelation objectId */ + objectId?: (string|null); + + /** EntityRelation relation */ + relation?: (string|null); + } + + /** Represents an EntityRelation. */ + class EntityRelation implements IEntityRelation { + + /** + * Constructs a new EntityRelation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.IEntityRelation); + + /** EntityRelation subjectId. */ + public subjectId: string; + + /** EntityRelation objectId. */ + public objectId: string; + + /** EntityRelation relation. */ + public relation: string; + + /** + * Creates a new EntityRelation instance using the specified properties. + * @param [properties] Properties to set + * @returns EntityRelation instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.IEntityRelation): google.cloud.documentai.v1beta3.Document.EntityRelation; + + /** + * Encodes the specified EntityRelation message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.EntityRelation.verify|verify} messages. + * @param message EntityRelation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.IEntityRelation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EntityRelation message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.EntityRelation.verify|verify} messages. + * @param message EntityRelation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.IEntityRelation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EntityRelation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EntityRelation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.EntityRelation; + + /** + * Decodes an EntityRelation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EntityRelation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.EntityRelation; + + /** + * Verifies an EntityRelation message. + * @param message Plain 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 EntityRelation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EntityRelation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.EntityRelation; + + /** + * Creates a plain object from an EntityRelation message. Also converts values to other types if specified. + * @param message EntityRelation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.EntityRelation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EntityRelation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Translation. */ + interface ITranslation { + + /** Translation textAnchor */ + textAnchor?: (google.cloud.documentai.v1beta3.Document.ITextAnchor|null); + + /** Translation languageCode */ + languageCode?: (string|null); + + /** Translation translatedText */ + translatedText?: (string|null); + + /** Translation provenance */ + provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance[]|null); + } + + /** Represents a Translation. */ + class Translation implements ITranslation { + + /** + * Constructs a new Translation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.ITranslation); + + /** Translation textAnchor. */ + public textAnchor?: (google.cloud.documentai.v1beta3.Document.ITextAnchor|null); + + /** Translation languageCode. */ + public languageCode: string; + + /** Translation translatedText. */ + public translatedText: string; + + /** Translation provenance. */ + public provenance: google.cloud.documentai.v1beta3.Document.IProvenance[]; + + /** + * Creates a new Translation instance using the specified properties. + * @param [properties] Properties to set + * @returns Translation instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.ITranslation): google.cloud.documentai.v1beta3.Document.Translation; + + /** + * Encodes the specified Translation message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Translation.verify|verify} messages. + * @param message Translation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.ITranslation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Translation message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Translation.verify|verify} messages. + * @param message Translation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.ITranslation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Translation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Translation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Translation; + + /** + * Decodes a Translation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Translation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Translation; + + /** + * Verifies a Translation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Translation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Translation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Translation; + + /** + * Creates a plain object from a Translation message. Also converts values to other types if specified. + * @param message Translation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Translation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Translation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TextAnchor. */ + interface ITextAnchor { + + /** TextAnchor textSegments */ + textSegments?: (google.cloud.documentai.v1beta3.Document.TextAnchor.ITextSegment[]|null); + + /** TextAnchor content */ + content?: (string|null); + } + + /** Represents a TextAnchor. */ + class TextAnchor implements ITextAnchor { + + /** + * Constructs a new TextAnchor. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.ITextAnchor); + + /** TextAnchor textSegments. */ + public textSegments: google.cloud.documentai.v1beta3.Document.TextAnchor.ITextSegment[]; + + /** TextAnchor content. */ + public content: string; + + /** + * Creates a new TextAnchor instance using the specified properties. + * @param [properties] Properties to set + * @returns TextAnchor instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.ITextAnchor): google.cloud.documentai.v1beta3.Document.TextAnchor; + + /** + * Encodes the specified TextAnchor message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.TextAnchor.verify|verify} messages. + * @param message TextAnchor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.ITextAnchor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TextAnchor message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.TextAnchor.verify|verify} messages. + * @param message TextAnchor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.ITextAnchor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TextAnchor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TextAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.TextAnchor; + + /** + * Decodes a TextAnchor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TextAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.TextAnchor; + + /** + * Verifies a TextAnchor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TextAnchor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TextAnchor + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.TextAnchor; + + /** + * Creates a plain object from a TextAnchor message. Also converts values to other types if specified. + * @param message TextAnchor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.TextAnchor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TextAnchor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace TextAnchor { + + /** Properties of a TextSegment. */ + interface ITextSegment { + + /** TextSegment startIndex */ + startIndex?: (number|Long|string|null); + + /** TextSegment endIndex */ + endIndex?: (number|Long|string|null); + } + + /** Represents a TextSegment. */ + class TextSegment implements ITextSegment { + + /** + * Constructs a new TextSegment. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.TextAnchor.ITextSegment); + + /** TextSegment startIndex. */ + public startIndex: (number|Long|string); + + /** TextSegment endIndex. */ + public endIndex: (number|Long|string); + + /** + * Creates a new TextSegment instance using the specified properties. + * @param [properties] Properties to set + * @returns TextSegment instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.TextAnchor.ITextSegment): google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment; + + /** + * Encodes the specified TextSegment message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment.verify|verify} messages. + * @param message TextSegment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.TextAnchor.ITextSegment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TextSegment message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment.verify|verify} messages. + * @param message TextSegment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.TextAnchor.ITextSegment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TextSegment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TextSegment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment; + + /** + * Decodes a TextSegment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TextSegment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment; + + /** + * Verifies a TextSegment message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TextSegment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TextSegment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment; + + /** + * Creates a plain object from a TextSegment message. Also converts values to other types if specified. + * @param message TextSegment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TextSegment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a PageAnchor. */ + interface IPageAnchor { + + /** PageAnchor pageRefs */ + pageRefs?: (google.cloud.documentai.v1beta3.Document.PageAnchor.IPageRef[]|null); + } + + /** Represents a PageAnchor. */ + class PageAnchor implements IPageAnchor { + + /** + * Constructs a new PageAnchor. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.IPageAnchor); + + /** PageAnchor pageRefs. */ + public pageRefs: google.cloud.documentai.v1beta3.Document.PageAnchor.IPageRef[]; + + /** + * Creates a new PageAnchor instance using the specified properties. + * @param [properties] Properties to set + * @returns PageAnchor instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.IPageAnchor): google.cloud.documentai.v1beta3.Document.PageAnchor; + + /** + * Encodes the specified PageAnchor message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.PageAnchor.verify|verify} messages. + * @param message PageAnchor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.IPageAnchor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PageAnchor message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.PageAnchor.verify|verify} messages. + * @param message PageAnchor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.IPageAnchor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PageAnchor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PageAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.PageAnchor; + + /** + * Decodes a PageAnchor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PageAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.PageAnchor; + + /** + * Verifies a PageAnchor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PageAnchor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PageAnchor + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.PageAnchor; + + /** + * Creates a plain object from a PageAnchor message. Also converts values to other types if specified. + * @param message PageAnchor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.PageAnchor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PageAnchor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PageAnchor { + + /** Properties of a PageRef. */ + interface IPageRef { + + /** PageRef page */ + page?: (number|Long|string|null); + + /** PageRef layoutType */ + layoutType?: (google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.LayoutType|keyof typeof google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.LayoutType|null); + + /** PageRef layoutId */ + layoutId?: (string|null); + + /** PageRef boundingPoly */ + boundingPoly?: (google.cloud.documentai.v1beta3.IBoundingPoly|null); + } + + /** Represents a PageRef. */ + class PageRef implements IPageRef { + + /** + * Constructs a new PageRef. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.PageAnchor.IPageRef); + + /** PageRef page. */ + public page: (number|Long|string); + + /** PageRef layoutType. */ + public layoutType: (google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.LayoutType|keyof typeof google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.LayoutType); + + /** PageRef layoutId. */ + public layoutId: string; + + /** PageRef boundingPoly. */ + public boundingPoly?: (google.cloud.documentai.v1beta3.IBoundingPoly|null); + + /** + * Creates a new PageRef instance using the specified properties. + * @param [properties] Properties to set + * @returns PageRef instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.PageAnchor.IPageRef): google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef; + + /** + * Encodes the specified PageRef message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.verify|verify} messages. + * @param message PageRef message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.PageAnchor.IPageRef, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PageRef message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.verify|verify} messages. + * @param message PageRef message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.PageAnchor.IPageRef, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PageRef message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PageRef + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef; + + /** + * Decodes a PageRef message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PageRef + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef; + + /** + * Verifies a PageRef message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PageRef message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PageRef + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef; + + /** + * Creates a plain object from a PageRef message. Also converts values to other types if specified. + * @param message PageRef + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PageRef to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PageRef { + + /** LayoutType enum. */ + enum LayoutType { + LAYOUT_TYPE_UNSPECIFIED = 0, + BLOCK = 1, + PARAGRAPH = 2, + LINE = 3, + TOKEN = 4, + VISUAL_ELEMENT = 5, + TABLE = 6, + FORM_FIELD = 7 + } + } + } + + /** Properties of a Provenance. */ + interface IProvenance { + + /** Provenance revision */ + revision?: (number|null); + + /** Provenance id */ + id?: (number|null); + + /** Provenance parents */ + parents?: (google.cloud.documentai.v1beta3.Document.Provenance.IParent[]|null); + + /** Provenance type */ + type?: (google.cloud.documentai.v1beta3.Document.Provenance.OperationType|keyof typeof google.cloud.documentai.v1beta3.Document.Provenance.OperationType|null); + } + + /** Represents a Provenance. */ + class Provenance implements IProvenance { + + /** + * Constructs a new Provenance. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.IProvenance); + + /** Provenance revision. */ + public revision: number; + + /** Provenance id. */ + public id: number; + + /** Provenance parents. */ + public parents: google.cloud.documentai.v1beta3.Document.Provenance.IParent[]; + + /** Provenance type. */ + public type: (google.cloud.documentai.v1beta3.Document.Provenance.OperationType|keyof typeof google.cloud.documentai.v1beta3.Document.Provenance.OperationType); + + /** + * Creates a new Provenance instance using the specified properties. + * @param [properties] Properties to set + * @returns Provenance instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.IProvenance): google.cloud.documentai.v1beta3.Document.Provenance; + + /** + * Encodes the specified Provenance message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Provenance.verify|verify} messages. + * @param message Provenance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.IProvenance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Provenance message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Provenance.verify|verify} messages. + * @param message Provenance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.IProvenance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Provenance message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Provenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Provenance; + + /** + * Decodes a Provenance message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Provenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Provenance; + + /** + * Verifies a Provenance message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Provenance message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Provenance + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Provenance; + + /** + * Creates a plain object from a Provenance message. Also converts values to other types if specified. + * @param message Provenance + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Provenance, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Provenance to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Provenance { + + /** Properties of a Parent. */ + interface IParent { + + /** Parent revision */ + revision?: (number|null); + + /** Parent id */ + id?: (number|null); + } + + /** Represents a Parent. */ + class Parent implements IParent { + + /** + * Constructs a new Parent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Provenance.IParent); + + /** Parent revision. */ + public revision: number; + + /** Parent id. */ + public id: number; + + /** + * Creates a new Parent instance using the specified properties. + * @param [properties] Properties to set + * @returns Parent instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Provenance.IParent): google.cloud.documentai.v1beta3.Document.Provenance.Parent; + + /** + * Encodes the specified Parent message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Provenance.Parent.verify|verify} messages. + * @param message Parent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Provenance.IParent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Parent message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Provenance.Parent.verify|verify} messages. + * @param message Parent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Provenance.IParent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Parent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Parent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Provenance.Parent; + + /** + * Decodes a Parent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Parent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Provenance.Parent; + + /** + * Verifies a Parent message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Parent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Parent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Provenance.Parent; + + /** + * Creates a plain object from a Parent message. Also converts values to other types if specified. + * @param message Parent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Provenance.Parent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Parent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** OperationType enum. */ + enum OperationType { + OPERATION_TYPE_UNSPECIFIED = 0, + ADD = 1, + REMOVE = 2, + REPLACE = 3, + EVAL_REQUESTED = 4, + EVAL_APPROVED = 5 + } + } + + /** Properties of a Revision. */ + interface IRevision { + + /** Revision agent */ + agent?: (string|null); + + /** Revision processor */ + processor?: (string|null); + + /** Revision id */ + id?: (string|null); + + /** Revision parent */ + parent?: (number[]|null); + + /** Revision createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Revision humanReview */ + humanReview?: (google.cloud.documentai.v1beta3.Document.Revision.IHumanReview|null); + } + + /** Represents a Revision. */ + class Revision implements IRevision { + + /** + * Constructs a new Revision. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.IRevision); + + /** Revision agent. */ + public agent: string; + + /** Revision processor. */ + public processor: string; + + /** Revision id. */ + public id: string; + + /** Revision parent. */ + public parent: number[]; + + /** Revision createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Revision humanReview. */ + public humanReview?: (google.cloud.documentai.v1beta3.Document.Revision.IHumanReview|null); + + /** Revision source. */ + public source?: ("agent"|"processor"); + + /** + * Creates a new Revision instance using the specified properties. + * @param [properties] Properties to set + * @returns Revision instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.IRevision): google.cloud.documentai.v1beta3.Document.Revision; + + /** + * Encodes the specified Revision message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Revision.verify|verify} messages. + * @param message Revision message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.IRevision, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Revision message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Revision.verify|verify} messages. + * @param message Revision message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.IRevision, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Revision message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Revision + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Revision; + + /** + * Decodes a Revision message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Revision + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Revision; + + /** + * Verifies a Revision message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Revision message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Revision + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Revision; + + /** + * Creates a plain object from a Revision message. Also converts values to other types if specified. + * @param message Revision + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Revision, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Revision to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Revision { + + /** Properties of a HumanReview. */ + interface IHumanReview { + + /** HumanReview state */ + state?: (string|null); + + /** HumanReview stateMessage */ + stateMessage?: (string|null); + } + + /** Represents a HumanReview. */ + class HumanReview implements IHumanReview { + + /** + * Constructs a new HumanReview. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Revision.IHumanReview); + + /** HumanReview state. */ + public state: string; + + /** HumanReview stateMessage. */ + public stateMessage: string; + + /** + * Creates a new HumanReview instance using the specified properties. + * @param [properties] Properties to set + * @returns HumanReview instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Revision.IHumanReview): google.cloud.documentai.v1beta3.Document.Revision.HumanReview; + + /** + * Encodes the specified HumanReview message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Revision.HumanReview.verify|verify} messages. + * @param message HumanReview message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Revision.IHumanReview, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HumanReview message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Revision.HumanReview.verify|verify} messages. + * @param message HumanReview message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Revision.IHumanReview, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HumanReview message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HumanReview + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Revision.HumanReview; + + /** + * Decodes a HumanReview message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HumanReview + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Revision.HumanReview; + + /** + * Verifies a HumanReview message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HumanReview message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HumanReview + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Revision.HumanReview; + + /** + * Creates a plain object from a HumanReview message. Also converts values to other types if specified. + * @param message HumanReview + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Revision.HumanReview, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HumanReview to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a TextChange. */ + interface ITextChange { + + /** TextChange textAnchor */ + textAnchor?: (google.cloud.documentai.v1beta3.Document.ITextAnchor|null); + + /** TextChange changedText */ + changedText?: (string|null); + + /** TextChange provenance */ + provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance[]|null); + } + + /** Represents a TextChange. */ + class TextChange implements ITextChange { + + /** + * Constructs a new TextChange. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.ITextChange); + + /** TextChange textAnchor. */ + public textAnchor?: (google.cloud.documentai.v1beta3.Document.ITextAnchor|null); + + /** TextChange changedText. */ + public changedText: string; + + /** TextChange provenance. */ + public provenance: google.cloud.documentai.v1beta3.Document.IProvenance[]; + + /** + * Creates a new TextChange instance using the specified properties. + * @param [properties] Properties to set + * @returns TextChange instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.ITextChange): google.cloud.documentai.v1beta3.Document.TextChange; + + /** + * Encodes the specified TextChange message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.TextChange.verify|verify} messages. + * @param message TextChange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.ITextChange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TextChange message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.TextChange.verify|verify} messages. + * @param message TextChange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.ITextChange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TextChange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TextChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.TextChange; + + /** + * Decodes a TextChange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TextChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.TextChange; + + /** + * Verifies a TextChange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TextChange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TextChange + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.TextChange; + + /** + * Creates a plain object from a TextChange message. Also converts values to other types if specified. + * @param message TextChange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.TextChange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TextChange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a Vertex. */ + interface IVertex { + + /** Vertex x */ + x?: (number|null); + + /** Vertex y */ + y?: (number|null); + } + + /** Represents a Vertex. */ + class Vertex implements IVertex { + + /** + * Constructs a new Vertex. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IVertex); + + /** Vertex x. */ + public x: number; + + /** Vertex y. */ + public y: number; + + /** + * Creates a new Vertex instance using the specified properties. + * @param [properties] Properties to set + * @returns Vertex instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IVertex): google.cloud.documentai.v1beta3.Vertex; + + /** + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.documentai.v1beta3.Vertex.verify|verify} messages. + * @param message Vertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Vertex.verify|verify} messages. + * @param message Vertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Vertex message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Vertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Vertex; + + /** + * Decodes a Vertex message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Vertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Vertex; + + /** + * Verifies a Vertex message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Vertex message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Vertex + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Vertex; + + /** + * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * @param message Vertex + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Vertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Vertex to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a NormalizedVertex. */ + interface INormalizedVertex { + + /** NormalizedVertex x */ + x?: (number|null); + + /** NormalizedVertex y */ + y?: (number|null); + } + + /** Represents a NormalizedVertex. */ + class NormalizedVertex implements INormalizedVertex { + + /** + * Constructs a new NormalizedVertex. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.INormalizedVertex); + + /** NormalizedVertex x. */ + public x: number; + + /** NormalizedVertex y. */ + public y: number; + + /** + * Creates a new NormalizedVertex instance using the specified properties. + * @param [properties] Properties to set + * @returns NormalizedVertex instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.INormalizedVertex): google.cloud.documentai.v1beta3.NormalizedVertex; + + /** + * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.documentai.v1beta3.NormalizedVertex.verify|verify} messages. + * @param message NormalizedVertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.NormalizedVertex.verify|verify} messages. + * @param message NormalizedVertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NormalizedVertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.NormalizedVertex; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NormalizedVertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.NormalizedVertex; + + /** + * Verifies a NormalizedVertex message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NormalizedVertex + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.NormalizedVertex; + + /** + * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. + * @param message NormalizedVertex + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.NormalizedVertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NormalizedVertex to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BoundingPoly. */ + interface IBoundingPoly { + + /** BoundingPoly vertices */ + vertices?: (google.cloud.documentai.v1beta3.IVertex[]|null); + + /** BoundingPoly normalizedVertices */ + normalizedVertices?: (google.cloud.documentai.v1beta3.INormalizedVertex[]|null); + } + + /** Represents a BoundingPoly. */ + class BoundingPoly implements IBoundingPoly { + + /** + * Constructs a new BoundingPoly. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IBoundingPoly); + + /** BoundingPoly vertices. */ + public vertices: google.cloud.documentai.v1beta3.IVertex[]; + + /** BoundingPoly normalizedVertices. */ + public normalizedVertices: google.cloud.documentai.v1beta3.INormalizedVertex[]; + + /** + * Creates a new BoundingPoly instance using the specified properties. + * @param [properties] Properties to set + * @returns BoundingPoly instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IBoundingPoly): google.cloud.documentai.v1beta3.BoundingPoly; + + /** + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.documentai.v1beta3.BoundingPoly.verify|verify} messages. + * @param message BoundingPoly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.BoundingPoly.verify|verify} messages. + * @param message BoundingPoly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoundingPoly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.BoundingPoly; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoundingPoly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.BoundingPoly; + + /** + * Verifies a BoundingPoly message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoundingPoly + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.BoundingPoly; + + /** + * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. + * @param message BoundingPoly + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.BoundingPoly, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoundingPoly to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a DocumentProcessorService */ + class DocumentProcessorService extends $protobuf.rpc.Service { + + /** + * Constructs a new DocumentProcessorService 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 DocumentProcessorService 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): DocumentProcessorService; + + /** + * Calls ProcessDocument. + * @param request ProcessRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ProcessResponse + */ + public processDocument(request: google.cloud.documentai.v1beta3.IProcessRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.ProcessDocumentCallback): void; + + /** + * Calls ProcessDocument. + * @param request ProcessRequest message or plain object + * @returns Promise + */ + public processDocument(request: google.cloud.documentai.v1beta3.IProcessRequest): Promise; + + /** + * Calls BatchProcessDocuments. + * @param request BatchProcessRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchProcessDocuments(request: google.cloud.documentai.v1beta3.IBatchProcessRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.BatchProcessDocumentsCallback): void; + + /** + * Calls BatchProcessDocuments. + * @param request BatchProcessRequest message or plain object + * @returns Promise + */ + public batchProcessDocuments(request: google.cloud.documentai.v1beta3.IBatchProcessRequest): Promise; + + /** + * Calls ReviewDocument. + * @param request ReviewDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public reviewDocument(request: google.cloud.documentai.v1beta3.IReviewDocumentRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.ReviewDocumentCallback): void; + + /** + * Calls ReviewDocument. + * @param request ReviewDocumentRequest message or plain object + * @returns Promise + */ + public reviewDocument(request: google.cloud.documentai.v1beta3.IReviewDocumentRequest): Promise; + } + + namespace DocumentProcessorService { + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#processDocument}. + * @param error Error, if any + * @param [response] ProcessResponse + */ + type ProcessDocumentCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.ProcessResponse) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#batchProcessDocuments}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchProcessDocumentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#reviewDocument}. + * @param error Error, if any + * @param [response] Operation + */ + type ReviewDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a ProcessRequest. */ + interface IProcessRequest { + + /** ProcessRequest name */ + name?: (string|null); + + /** ProcessRequest document */ + document?: (google.cloud.documentai.v1beta3.IDocument|null); + + /** ProcessRequest skipHumanReview */ + skipHumanReview?: (boolean|null); + } + + /** Represents a ProcessRequest. */ + class ProcessRequest implements IProcessRequest { + + /** + * Constructs a new ProcessRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IProcessRequest); + + /** ProcessRequest name. */ + public name: string; + + /** ProcessRequest document. */ + public document?: (google.cloud.documentai.v1beta3.IDocument|null); + + /** ProcessRequest skipHumanReview. */ + public skipHumanReview: boolean; + + /** + * Creates a new ProcessRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ProcessRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IProcessRequest): google.cloud.documentai.v1beta3.ProcessRequest; + + /** + * Encodes the specified ProcessRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessRequest.verify|verify} messages. + * @param message ProcessRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProcessRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessRequest.verify|verify} messages. + * @param message ProcessRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProcessRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ProcessRequest; + + /** + * Decodes a ProcessRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ProcessRequest; + + /** + * Verifies a ProcessRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProcessRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProcessRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ProcessRequest; + + /** + * Creates a plain object from a ProcessRequest message. Also converts values to other types if specified. + * @param message ProcessRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.ProcessRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProcessRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProcessResponse. */ + interface IProcessResponse { + + /** ProcessResponse document */ + document?: (google.cloud.documentai.v1beta3.IDocument|null); + + /** ProcessResponse humanReviewOperation */ + humanReviewOperation?: (string|null); + } + + /** Represents a ProcessResponse. */ + class ProcessResponse implements IProcessResponse { + + /** + * Constructs a new ProcessResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IProcessResponse); + + /** ProcessResponse document. */ + public document?: (google.cloud.documentai.v1beta3.IDocument|null); + + /** ProcessResponse humanReviewOperation. */ + public humanReviewOperation: string; + + /** + * Creates a new ProcessResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ProcessResponse instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IProcessResponse): google.cloud.documentai.v1beta3.ProcessResponse; + + /** + * Encodes the specified ProcessResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessResponse.verify|verify} messages. + * @param message ProcessResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProcessResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessResponse.verify|verify} messages. + * @param message ProcessResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProcessResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProcessResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ProcessResponse; + + /** + * Decodes a ProcessResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProcessResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ProcessResponse; + + /** + * Verifies a ProcessResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProcessResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProcessResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ProcessResponse; + + /** + * Creates a plain object from a ProcessResponse message. Also converts values to other types if specified. + * @param message ProcessResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.ProcessResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProcessResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BatchProcessRequest. */ + interface IBatchProcessRequest { + + /** BatchProcessRequest name */ + name?: (string|null); + + /** BatchProcessRequest inputConfigs */ + inputConfigs?: (google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchInputConfig[]|null); + + /** BatchProcessRequest outputConfig */ + outputConfig?: (google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchOutputConfig|null); + } + + /** Represents a BatchProcessRequest. */ + class BatchProcessRequest implements IBatchProcessRequest { + + /** + * Constructs a new BatchProcessRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IBatchProcessRequest); + + /** BatchProcessRequest name. */ + public name: string; + + /** BatchProcessRequest inputConfigs. */ + public inputConfigs: google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchInputConfig[]; + + /** BatchProcessRequest outputConfig. */ + public outputConfig?: (google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchOutputConfig|null); + + /** + * Creates a new BatchProcessRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchProcessRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IBatchProcessRequest): google.cloud.documentai.v1beta3.BatchProcessRequest; + + /** + * Encodes the specified BatchProcessRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessRequest.verify|verify} messages. + * @param message BatchProcessRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IBatchProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchProcessRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessRequest.verify|verify} messages. + * @param message BatchProcessRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IBatchProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchProcessRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.BatchProcessRequest; + + /** + * Decodes a BatchProcessRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.BatchProcessRequest; + + /** + * Verifies a BatchProcessRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchProcessRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchProcessRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.BatchProcessRequest; + + /** + * Creates a plain object from a BatchProcessRequest message. Also converts values to other types if specified. + * @param message BatchProcessRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.BatchProcessRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchProcessRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace BatchProcessRequest { + + /** Properties of a BatchInputConfig. */ + interface IBatchInputConfig { + + /** BatchInputConfig gcsSource */ + gcsSource?: (string|null); + + /** BatchInputConfig mimeType */ + mimeType?: (string|null); + } + + /** Represents a BatchInputConfig. */ + class BatchInputConfig implements IBatchInputConfig { + + /** + * Constructs a new BatchInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchInputConfig); + + /** BatchInputConfig gcsSource. */ + public gcsSource: string; + + /** BatchInputConfig mimeType. */ + public mimeType: string; + + /** + * Creates a new BatchInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchInputConfig instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchInputConfig): google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig; + + /** + * Encodes the specified BatchInputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.verify|verify} messages. + * @param message BatchInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchInputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.verify|verify} messages. + * @param message BatchInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig; + + /** + * Decodes a BatchInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig; + + /** + * Verifies a BatchInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig; + + /** + * Creates a plain object from a BatchInputConfig message. Also converts values to other types if specified. + * @param message BatchInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BatchOutputConfig. */ + interface IBatchOutputConfig { + + /** BatchOutputConfig gcsDestination */ + gcsDestination?: (string|null); + } + + /** Represents a BatchOutputConfig. */ + class BatchOutputConfig implements IBatchOutputConfig { + + /** + * Constructs a new BatchOutputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchOutputConfig); + + /** BatchOutputConfig gcsDestination. */ + public gcsDestination: string; + + /** + * Creates a new BatchOutputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchOutputConfig instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchOutputConfig): google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig; + + /** + * Encodes the specified BatchOutputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.verify|verify} messages. + * @param message BatchOutputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchOutputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.verify|verify} messages. + * @param message BatchOutputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchOutputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig; + + /** + * Decodes a BatchOutputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig; + + /** + * Verifies a BatchOutputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchOutputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchOutputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig; + + /** + * Creates a plain object from a BatchOutputConfig message. Also converts values to other types if specified. + * @param message BatchOutputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchOutputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a BatchProcessResponse. */ + interface IBatchProcessResponse { + } + + /** Represents a BatchProcessResponse. */ + class BatchProcessResponse implements IBatchProcessResponse { + + /** + * Constructs a new BatchProcessResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IBatchProcessResponse); + + /** + * Creates a new BatchProcessResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchProcessResponse instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IBatchProcessResponse): google.cloud.documentai.v1beta3.BatchProcessResponse; + + /** + * Encodes the specified BatchProcessResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessResponse.verify|verify} messages. + * @param message BatchProcessResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IBatchProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchProcessResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessResponse.verify|verify} messages. + * @param message BatchProcessResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IBatchProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchProcessResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchProcessResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.BatchProcessResponse; + + /** + * Decodes a BatchProcessResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchProcessResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.BatchProcessResponse; + + /** + * Verifies a BatchProcessResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchProcessResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchProcessResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.BatchProcessResponse; + + /** + * Creates a plain object from a BatchProcessResponse message. Also converts values to other types if specified. + * @param message BatchProcessResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.BatchProcessResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchProcessResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BatchProcessMetadata. */ + interface IBatchProcessMetadata { + + /** BatchProcessMetadata state */ + state?: (google.cloud.documentai.v1beta3.BatchProcessMetadata.State|keyof typeof google.cloud.documentai.v1beta3.BatchProcessMetadata.State|null); + + /** BatchProcessMetadata stateMessage */ + stateMessage?: (string|null); + + /** BatchProcessMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** BatchProcessMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** BatchProcessMetadata individualProcessStatuses */ + individualProcessStatuses?: (google.cloud.documentai.v1beta3.BatchProcessMetadata.IIndividualProcessStatus[]|null); + } + + /** Represents a BatchProcessMetadata. */ + class BatchProcessMetadata implements IBatchProcessMetadata { + + /** + * Constructs a new BatchProcessMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IBatchProcessMetadata); + + /** BatchProcessMetadata state. */ + public state: (google.cloud.documentai.v1beta3.BatchProcessMetadata.State|keyof typeof google.cloud.documentai.v1beta3.BatchProcessMetadata.State); + + /** BatchProcessMetadata stateMessage. */ + public stateMessage: string; + + /** BatchProcessMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** BatchProcessMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** BatchProcessMetadata individualProcessStatuses. */ + public individualProcessStatuses: google.cloud.documentai.v1beta3.BatchProcessMetadata.IIndividualProcessStatus[]; + + /** + * Creates a new BatchProcessMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchProcessMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IBatchProcessMetadata): google.cloud.documentai.v1beta3.BatchProcessMetadata; + + /** + * Encodes the specified BatchProcessMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessMetadata.verify|verify} messages. + * @param message BatchProcessMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IBatchProcessMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchProcessMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessMetadata.verify|verify} messages. + * @param message BatchProcessMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IBatchProcessMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchProcessMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchProcessMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.BatchProcessMetadata; + + /** + * Decodes a BatchProcessMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchProcessMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.BatchProcessMetadata; + + /** + * Verifies a BatchProcessMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchProcessMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchProcessMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.BatchProcessMetadata; + + /** + * Creates a plain object from a BatchProcessMetadata message. Also converts values to other types if specified. + * @param message BatchProcessMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.BatchProcessMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchProcessMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace BatchProcessMetadata { + + /** Properties of an IndividualProcessStatus. */ + interface IIndividualProcessStatus { + + /** IndividualProcessStatus inputGcsSource */ + inputGcsSource?: (string|null); + + /** IndividualProcessStatus status */ + status?: (google.rpc.IStatus|null); + + /** IndividualProcessStatus outputGcsDestination */ + outputGcsDestination?: (string|null); + + /** IndividualProcessStatus humanReviewOperation */ + humanReviewOperation?: (string|null); + } + + /** Represents an IndividualProcessStatus. */ + class IndividualProcessStatus implements IIndividualProcessStatus { + + /** + * Constructs a new IndividualProcessStatus. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.BatchProcessMetadata.IIndividualProcessStatus); + + /** IndividualProcessStatus inputGcsSource. */ + public inputGcsSource: string; + + /** IndividualProcessStatus status. */ + public status?: (google.rpc.IStatus|null); + + /** IndividualProcessStatus outputGcsDestination. */ + public outputGcsDestination: string; + + /** IndividualProcessStatus humanReviewOperation. */ + public humanReviewOperation: string; + + /** + * Creates a new IndividualProcessStatus instance using the specified properties. + * @param [properties] Properties to set + * @returns IndividualProcessStatus instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.BatchProcessMetadata.IIndividualProcessStatus): google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus; + + /** + * Encodes the specified IndividualProcessStatus message. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus.verify|verify} messages. + * @param message IndividualProcessStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.BatchProcessMetadata.IIndividualProcessStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IndividualProcessStatus message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus.verify|verify} messages. + * @param message IndividualProcessStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.BatchProcessMetadata.IIndividualProcessStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IndividualProcessStatus message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IndividualProcessStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus; + + /** + * Decodes an IndividualProcessStatus message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IndividualProcessStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus; + + /** + * Verifies an IndividualProcessStatus message. + * @param message Plain 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 IndividualProcessStatus message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IndividualProcessStatus + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus; + + /** + * Creates a plain object from an IndividualProcessStatus message. Also converts values to other types if specified. + * @param message IndividualProcessStatus + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IndividualProcessStatus to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + WAITING = 1, + RUNNING = 2, + SUCCEEDED = 3, + CANCELLING = 4, + CANCELLED = 5, + FAILED = 6 + } + } + + /** Properties of a ReviewDocumentRequest. */ + interface IReviewDocumentRequest { + + /** ReviewDocumentRequest humanReviewConfig */ + humanReviewConfig?: (string|null); + + /** ReviewDocumentRequest document */ + document?: (google.cloud.documentai.v1beta3.IDocument|null); + } + + /** Represents a ReviewDocumentRequest. */ + class ReviewDocumentRequest implements IReviewDocumentRequest { + + /** + * Constructs a new ReviewDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentRequest); + + /** ReviewDocumentRequest humanReviewConfig. */ + public humanReviewConfig: string; + + /** ReviewDocumentRequest document. */ + public document?: (google.cloud.documentai.v1beta3.IDocument|null); + + /** + * Creates a new ReviewDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ReviewDocumentRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentRequest): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + + /** + * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * @param message ReviewDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * @param message ReviewDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + + /** + * Verifies a ReviewDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReviewDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + + /** + * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. + * @param message ReviewDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReviewDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ReviewDocumentResponse. */ + interface IReviewDocumentResponse { + + /** ReviewDocumentResponse gcsDestination */ + gcsDestination?: (string|null); + } + + /** Represents a ReviewDocumentResponse. */ + class ReviewDocumentResponse implements IReviewDocumentResponse { + + /** + * Constructs a new ReviewDocumentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentResponse); + + /** ReviewDocumentResponse gcsDestination. */ + public gcsDestination: string; + + /** + * Creates a new ReviewDocumentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ReviewDocumentResponse instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentResponse): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + + /** + * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * @param message ReviewDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * @param message ReviewDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + + /** + * Verifies a ReviewDocumentResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReviewDocumentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + + /** + * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. + * @param message ReviewDocumentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReviewDocumentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ReviewDocumentOperationMetadata. */ + interface IReviewDocumentOperationMetadata { + + /** ReviewDocumentOperationMetadata state */ + state?: (google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|null); + + /** ReviewDocumentOperationMetadata stateMessage */ + stateMessage?: (string|null); + + /** ReviewDocumentOperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ReviewDocumentOperationMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a ReviewDocumentOperationMetadata. */ + class ReviewDocumentOperationMetadata implements IReviewDocumentOperationMetadata { + + /** + * Constructs a new ReviewDocumentOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata); + + /** ReviewDocumentOperationMetadata state. */ + public state: (google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State); + + /** ReviewDocumentOperationMetadata stateMessage. */ + public stateMessage: string; + + /** ReviewDocumentOperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ReviewDocumentOperationMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ReviewDocumentOperationMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * @param message ReviewDocumentOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * @param message ReviewDocumentOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + + /** + * Verifies a ReviewDocumentOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReviewDocumentOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + + /** + * Creates a plain object from a ReviewDocumentOperationMetadata message. Also converts values to other types if specified. + * @param message ReviewDocumentOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReviewDocumentOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ReviewDocumentOperationMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + CANCELLING = 2, + SUCCEEDED = 3, + FAILED = 4, + CANCELLED = 5 + } + } + } } } @@ -5049,20 +10213,246 @@ export namespace google { /** * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CustomHttpPattern + * @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 }; + } + + /** 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); + } + + /** 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; + + /** + * 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 + } + } + + /** 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.CustomHttpPattern; + public static fromObject(object: { [k: string]: any }): google.api.ResourceReference; /** - * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. - * @param message CustomHttpPattern + * 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.CustomHttpPattern, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.api.ResourceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CustomHttpPattern to JSON. + * Converts this ResourceReference to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; @@ -6633,6 +12023,9 @@ export namespace google { /** FileOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** FileOptions .google.api.resourceDefinition */ + ".google.api.resourceDefinition"?: (google.api.IResourceDescriptor[]|null); } /** Represents a FileOptions. */ @@ -6805,6 +12198,9 @@ export namespace google { /** MessageOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** MessageOptions .google.api.resource */ + ".google.api.resource"?: (google.api.IResourceDescriptor|null); } /** Represents a MessageOptions. */ @@ -6928,6 +12324,9 @@ export namespace google { /** 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. */ @@ -7403,2190 +12802,2871 @@ export namespace google { /** * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ServiceOptions + * @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.ServiceOptions; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption; /** - * Verifies a ServiceOptions message. + * 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 a ServiceOptions message from a plain object. Also converts values to their respective internal types. + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ServiceOptions + * @returns UninterpretedOption */ - public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceOptions; + public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption; /** - * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. - * @param message ServiceOptions + * 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.ServiceOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.UninterpretedOption, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ServiceOptions to JSON. + * Converts this UninterpretedOption to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a MethodOptions. */ - interface IMethodOptions { + namespace UninterpretedOption { - /** MethodOptions deprecated */ - deprecated?: (boolean|null); + /** Properties of a NamePart. */ + interface INamePart { - /** MethodOptions idempotencyLevel */ - idempotencyLevel?: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel|null); + /** NamePart namePart */ + namePart: string; - /** MethodOptions uninterpretedOption */ - uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + /** NamePart isExtension */ + isExtension: boolean; + } - /** MethodOptions .google.api.http */ - ".google.api.http"?: (google.api.IHttpRule|null); + /** Represents a NamePart. */ + class NamePart implements INamePart { - /** MethodOptions .google.api.methodSignature */ - ".google.api.methodSignature"?: (string[]|null); + /** + * Constructs a new NamePart. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.UninterpretedOption.INamePart); - /** MethodOptions .google.longrunning.operationInfo */ - ".google.longrunning.operationInfo"?: (google.longrunning.IOperationInfo|null); + /** 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 }; + } } - /** Represents a MethodOptions. */ - class MethodOptions implements IMethodOptions { + /** Properties of a SourceCodeInfo. */ + interface ISourceCodeInfo { + + /** SourceCodeInfo location */ + location?: (google.protobuf.SourceCodeInfo.ILocation[]|null); + } + + /** Represents a SourceCodeInfo. */ + class SourceCodeInfo implements ISourceCodeInfo { /** - * Constructs a new MethodOptions. + * Constructs a new SourceCodeInfo. * @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); + constructor(properties?: google.protobuf.ISourceCodeInfo); - /** MethodOptions uninterpretedOption. */ - public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + /** SourceCodeInfo location. */ + public location: google.protobuf.SourceCodeInfo.ILocation[]; /** - * Creates a new MethodOptions instance using the specified properties. + * Creates a new SourceCodeInfo instance using the specified properties. * @param [properties] Properties to set - * @returns MethodOptions instance + * @returns SourceCodeInfo instance */ - public static create(properties?: google.protobuf.IMethodOptions): google.protobuf.MethodOptions; + public static create(properties?: google.protobuf.ISourceCodeInfo): google.protobuf.SourceCodeInfo; /** - * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. - * @param message MethodOptions message or plain object to encode + * 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.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.ISourceCodeInfo, 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 + * 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.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a MethodOptions message from the specified reader or buffer. + * 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 MethodOptions + * @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.MethodOptions; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo; /** - * Decodes a MethodOptions message from the specified reader or buffer, length delimited. + * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns MethodOptions + * @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.MethodOptions; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo; /** - * Verifies a MethodOptions message. + * 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 MethodOptions message from a plain object. Also converts values to their respective internal types. + * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns MethodOptions + * @returns SourceCodeInfo */ - public static fromObject(object: { [k: string]: any }): google.protobuf.MethodOptions; + public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo; /** - * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. - * @param message MethodOptions + * 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.MethodOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.SourceCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this MethodOptions to JSON. + * Converts this SourceCodeInfo to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace MethodOptions { + 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; - /** IdempotencyLevel enum. */ - enum IdempotencyLevel { - IDEMPOTENCY_UNKNOWN = 0, - NO_SIDE_EFFECTS = 1, - IDEMPOTENT = 2 - } - } + /** + * 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; - /** Properties of an UninterpretedOption. */ - interface IUninterpretedOption { + /** + * 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; - /** UninterpretedOption name */ - name?: (google.protobuf.UninterpretedOption.INamePart[]|null); + /** + * 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; - /** UninterpretedOption identifierValue */ - identifierValue?: (string|null); + /** + * 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); - /** UninterpretedOption positiveIntValue */ - positiveIntValue?: (number|Long|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; - /** UninterpretedOption negativeIntValue */ - negativeIntValue?: (number|Long|string|null); + /** + * 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 }; - /** UninterpretedOption doubleValue */ - doubleValue?: (number|null); + /** + * Converts this Location to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } - /** UninterpretedOption stringValue */ - stringValue?: (Uint8Array|string|null); + /** Properties of a GeneratedCodeInfo. */ + interface IGeneratedCodeInfo { - /** UninterpretedOption aggregateValue */ - aggregateValue?: (string|null); + /** GeneratedCodeInfo annotation */ + annotation?: (google.protobuf.GeneratedCodeInfo.IAnnotation[]|null); } - /** Represents an UninterpretedOption. */ - class UninterpretedOption implements IUninterpretedOption { + /** Represents a GeneratedCodeInfo. */ + class GeneratedCodeInfo implements IGeneratedCodeInfo { /** - * Constructs a new UninterpretedOption. + * Constructs a new GeneratedCodeInfo. * @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); + constructor(properties?: google.protobuf.IGeneratedCodeInfo); - /** UninterpretedOption aggregateValue. */ - public aggregateValue: string; + /** GeneratedCodeInfo annotation. */ + public annotation: google.protobuf.GeneratedCodeInfo.IAnnotation[]; /** - * Creates a new UninterpretedOption instance using the specified properties. + * Creates a new GeneratedCodeInfo instance using the specified properties. * @param [properties] Properties to set - * @returns UninterpretedOption instance + * @returns GeneratedCodeInfo instance */ - public static create(properties?: google.protobuf.IUninterpretedOption): google.protobuf.UninterpretedOption; + public static create(properties?: google.protobuf.IGeneratedCodeInfo): google.protobuf.GeneratedCodeInfo; /** - * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. - * @param message UninterpretedOption message or plain object to encode + * 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.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IGeneratedCodeInfo, 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 + * 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.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an UninterpretedOption message from the specified reader or buffer. + * 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 UninterpretedOption + * @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.UninterpretedOption; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo; /** - * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UninterpretedOption + * @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.UninterpretedOption; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo; /** - * Verifies an UninterpretedOption message. + * 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 an UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UninterpretedOption + * @returns GeneratedCodeInfo */ - public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption; + public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo; /** - * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. - * @param message UninterpretedOption + * 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.UninterpretedOption, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.GeneratedCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UninterpretedOption to JSON. + * Converts this GeneratedCodeInfo to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace UninterpretedOption { + namespace GeneratedCodeInfo { - /** Properties of a NamePart. */ - interface INamePart { + /** Properties of an Annotation. */ + interface IAnnotation { - /** NamePart namePart */ - namePart: string; + /** Annotation path */ + path?: (number[]|null); - /** NamePart isExtension */ - isExtension: boolean; + /** Annotation sourceFile */ + sourceFile?: (string|null); + + /** Annotation begin */ + begin?: (number|null); + + /** Annotation end */ + end?: (number|null); } - /** Represents a NamePart. */ - class NamePart implements INamePart { + /** Represents an Annotation. */ + class Annotation implements IAnnotation { /** - * Constructs a new NamePart. + * Constructs a new Annotation. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.UninterpretedOption.INamePart); + constructor(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation); - /** NamePart namePart. */ - public namePart: string; + /** Annotation path. */ + public path: number[]; - /** NamePart isExtension. */ - public isExtension: boolean; + /** Annotation sourceFile. */ + public sourceFile: string; + + /** Annotation begin. */ + public begin: number; + + /** Annotation end. */ + public end: number; /** - * Creates a new NamePart instance using the specified properties. + * Creates a new Annotation instance using the specified properties. * @param [properties] Properties to set - * @returns NamePart instance + * @returns Annotation instance */ - public static create(properties?: google.protobuf.UninterpretedOption.INamePart): google.protobuf.UninterpretedOption.NamePart; + public static create(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation): google.protobuf.GeneratedCodeInfo.Annotation; /** - * 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 + * 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.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.GeneratedCodeInfo.IAnnotation, 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 + * 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.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a NamePart message from the specified reader or buffer. + * 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 NamePart + * @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.UninterpretedOption.NamePart; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo.Annotation; /** - * Decodes a NamePart message from the specified reader or buffer, length delimited. + * Decodes an Annotation message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns NamePart + * @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.UninterpretedOption.NamePart; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo.Annotation; /** - * Verifies a NamePart message. + * 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 a NamePart message from a plain object. Also converts values to their respective internal types. + * Creates an Annotation message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns NamePart + * @returns Annotation */ - public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption.NamePart; + public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo.Annotation; /** - * Creates a plain object from a NamePart message. Also converts values to other types if specified. - * @param message NamePart + * 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.UninterpretedOption.NamePart, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.GeneratedCodeInfo.Annotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this NamePart to JSON. + * Converts this Annotation to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } } - /** Properties of a SourceCodeInfo. */ - interface ISourceCodeInfo { + /** Properties of an Any. */ + interface IAny { - /** SourceCodeInfo location */ - location?: (google.protobuf.SourceCodeInfo.ILocation[]|null); + /** Any type_url */ + type_url?: (string|null); + + /** Any value */ + value?: (Uint8Array|string|null); } - /** Represents a SourceCodeInfo. */ - class SourceCodeInfo implements ISourceCodeInfo { + /** Represents an Any. */ + class Any implements IAny { /** - * Constructs a new SourceCodeInfo. + * Constructs a new Any. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.ISourceCodeInfo); + constructor(properties?: google.protobuf.IAny); - /** SourceCodeInfo location. */ - public location: google.protobuf.SourceCodeInfo.ILocation[]; + /** Any type_url. */ + public type_url: string; + + /** Any value. */ + public value: (Uint8Array|string); /** - * Creates a new SourceCodeInfo instance using the specified properties. + * Creates a new Any instance using the specified properties. * @param [properties] Properties to set - * @returns SourceCodeInfo instance + * @returns Any instance */ - public static create(properties?: google.protobuf.ISourceCodeInfo): google.protobuf.SourceCodeInfo; + public static create(properties?: google.protobuf.IAny): google.protobuf.Any; /** - * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. - * @param message SourceCodeInfo message or plain object to encode + * 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.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IAny, 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 + * 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.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SourceCodeInfo message from the specified reader or buffer. + * 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 SourceCodeInfo + * @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.SourceCodeInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Any; /** - * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. + * Decodes an Any message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SourceCodeInfo + * @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.SourceCodeInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Any; /** - * Verifies a SourceCodeInfo message. + * 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 a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. + * Creates an Any message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SourceCodeInfo + * @returns Any */ - public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo; + public static fromObject(object: { [k: string]: any }): google.protobuf.Any; /** - * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. - * @param message SourceCodeInfo + * 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.SourceCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.Any, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this SourceCodeInfo to JSON. + * Converts this Any to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace SourceCodeInfo { + /** Properties of a DoubleValue. */ + interface IDoubleValue { - /** Properties of a Location. */ - interface ILocation { + /** DoubleValue value */ + value?: (number|null); + } - /** Location path */ - path?: (number[]|null); + /** Represents a DoubleValue. */ + class DoubleValue implements IDoubleValue { - /** Location span */ - span?: (number[]|null); + /** + * Constructs a new DoubleValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDoubleValue); - /** Location leadingComments */ - leadingComments?: (string|null); + /** DoubleValue value. */ + public value: number; - /** Location trailingComments */ - trailingComments?: (string|null); + /** + * 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; - /** Location leadingDetachedComments */ - leadingDetachedComments?: (string[]|null); - } + /** + * 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; - /** Represents a Location. */ - class Location implements ILocation { + /** + * 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; - /** - * Constructs a new Location. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.SourceCodeInfo.ILocation); + /** + * 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; - /** Location path. */ - public path: number[]; + /** + * 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; - /** Location span. */ - public span: number[]; + /** + * 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); - /** Location leadingComments. */ - public leadingComments: string; + /** + * 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; - /** Location trailingComments. */ - public trailingComments: string; + /** + * 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 }; - /** Location leadingDetachedComments. */ - public leadingDetachedComments: string[]; + /** + * Converts this DoubleValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * 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; + /** Properties of a FloatValue. */ + interface IFloatValue { - /** - * 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; + /** FloatValue value */ + value?: (number|null); + } - /** - * 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; + /** Represents a FloatValue. */ + class FloatValue implements IFloatValue { - /** - * 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; + /** + * Constructs a new FloatValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFloatValue); - /** - * 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; + /** 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 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); + /** + * 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 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 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 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 }; + /** + * 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 Location to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Converts this FloatValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; } - /** Properties of a GeneratedCodeInfo. */ - interface IGeneratedCodeInfo { + /** Properties of an Int64Value. */ + interface IInt64Value { - /** GeneratedCodeInfo annotation */ - annotation?: (google.protobuf.GeneratedCodeInfo.IAnnotation[]|null); + /** Int64Value value */ + value?: (number|Long|string|null); } - /** Represents a GeneratedCodeInfo. */ - class GeneratedCodeInfo implements IGeneratedCodeInfo { + /** Represents an Int64Value. */ + class Int64Value implements IInt64Value { /** - * Constructs a new GeneratedCodeInfo. + * Constructs a new Int64Value. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IGeneratedCodeInfo); + constructor(properties?: google.protobuf.IInt64Value); - /** GeneratedCodeInfo annotation. */ - public annotation: google.protobuf.GeneratedCodeInfo.IAnnotation[]; + /** Int64Value value. */ + public value: (number|Long|string); /** - * Creates a new GeneratedCodeInfo instance using the specified properties. + * Creates a new Int64Value instance using the specified properties. * @param [properties] Properties to set - * @returns GeneratedCodeInfo instance + * @returns Int64Value instance */ - public static create(properties?: google.protobuf.IGeneratedCodeInfo): google.protobuf.GeneratedCodeInfo; + public static create(properties?: google.protobuf.IInt64Value): google.protobuf.Int64Value; /** - * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. - * @param message GeneratedCodeInfo message or plain object to encode + * 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.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IInt64Value, 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 + * 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.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.IInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GeneratedCodeInfo message from the specified reader or buffer. + * 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 GeneratedCodeInfo + * @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.GeneratedCodeInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Int64Value; /** - * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. + * Decodes an Int64Value message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GeneratedCodeInfo + * @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.GeneratedCodeInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Int64Value; /** - * Verifies a GeneratedCodeInfo message. + * 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 a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. + * Creates an Int64Value message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GeneratedCodeInfo + * @returns Int64Value */ - public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo; + public static fromObject(object: { [k: string]: any }): google.protobuf.Int64Value; /** - * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. - * @param message GeneratedCodeInfo + * 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.GeneratedCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.Int64Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GeneratedCodeInfo to JSON. + * Converts this Int64Value to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace GeneratedCodeInfo { + /** Properties of a UInt64Value. */ + interface IUInt64Value { - /** Properties of an Annotation. */ - interface IAnnotation { + /** UInt64Value value */ + value?: (number|Long|string|null); + } - /** Annotation path */ - path?: (number[]|null); + /** Represents a UInt64Value. */ + class UInt64Value implements IUInt64Value { - /** Annotation sourceFile */ - sourceFile?: (string|null); + /** + * Constructs a new UInt64Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IUInt64Value); - /** Annotation begin */ - begin?: (number|null); + /** UInt64Value value. */ + public value: (number|Long|string); - /** Annotation end */ - end?: (number|null); - } + /** + * 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; - /** Represents an Annotation. */ - class Annotation implements IAnnotation { + /** + * 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; - /** - * Constructs a new Annotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation); + /** + * 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; - /** Annotation path. */ - public path: number[]; + /** + * 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; - /** Annotation sourceFile. */ - public sourceFile: string; + /** + * 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; - /** Annotation begin. */ - public begin: number; + /** + * 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); - /** Annotation end. */ - public end: number; + /** + * 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 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; + /** + * 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 }; - /** - * 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; + /** + * 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 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; + /** + * 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; - /** - * 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; + /** + * 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 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; + /** + * 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; - /** - * 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); + /** + * 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; - /** - * 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; + /** + * 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 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 }; + /** + * 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; - /** - * Converts this Annotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } + /** + * 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 }; - /** Properties of an Any. */ - interface IAny { + /** + * Converts this Int32Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** Any type_url */ - type_url?: (string|null); + /** Properties of a UInt32Value. */ + interface IUInt32Value { - /** Any value */ - value?: (Uint8Array|string|null); + /** UInt32Value value */ + value?: (number|null); } - /** Represents an Any. */ - class Any implements IAny { + /** Represents a UInt32Value. */ + class UInt32Value implements IUInt32Value { /** - * Constructs a new Any. + * Constructs a new UInt32Value. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IAny); - - /** Any type_url. */ - public type_url: string; + constructor(properties?: google.protobuf.IUInt32Value); - /** Any value. */ - public value: (Uint8Array|string); + /** UInt32Value value. */ + public value: number; /** - * Creates a new Any instance using the specified properties. + * Creates a new UInt32Value instance using the specified properties. * @param [properties] Properties to set - * @returns Any instance + * @returns UInt32Value instance */ - public static create(properties?: google.protobuf.IAny): google.protobuf.Any; + public static create(properties?: google.protobuf.IUInt32Value): google.protobuf.UInt32Value; /** - * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. - * @param message Any message or plain object to encode + * 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.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IUInt32Value, 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 + * 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.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.IUInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Any message from the specified reader or buffer. + * 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 Any + * @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.Any; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UInt32Value; /** - * Decodes an Any message from the specified reader or buffer, length delimited. + * Decodes a UInt32Value message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Any + * @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.Any; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UInt32Value; /** - * Verifies an Any message. + * 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 an Any message from a plain object. Also converts values to their respective internal types. + * Creates a UInt32Value message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Any + * @returns UInt32Value */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Any; + public static fromObject(object: { [k: string]: any }): google.protobuf.UInt32Value; /** - * Creates a plain object from an Any message. Also converts values to other types if specified. - * @param message Any + * 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.Any, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.UInt32Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Any to JSON. + * Converts this UInt32Value to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a DoubleValue. */ - interface IDoubleValue { + /** Properties of a BoolValue. */ + interface IBoolValue { - /** DoubleValue value */ - value?: (number|null); + /** BoolValue value */ + value?: (boolean|null); } - /** Represents a DoubleValue. */ - class DoubleValue implements IDoubleValue { + /** Represents a BoolValue. */ + class BoolValue implements IBoolValue { /** - * Constructs a new DoubleValue. + * Constructs a new BoolValue. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IDoubleValue); + constructor(properties?: google.protobuf.IBoolValue); - /** DoubleValue value. */ - public value: number; + /** BoolValue value. */ + public value: boolean; /** - * Creates a new DoubleValue instance using the specified properties. + * Creates a new BoolValue instance using the specified properties. * @param [properties] Properties to set - * @returns DoubleValue instance + * @returns BoolValue instance */ - public static create(properties?: google.protobuf.IDoubleValue): google.protobuf.DoubleValue; + public static create(properties?: google.protobuf.IBoolValue): google.protobuf.BoolValue; /** - * Encodes the specified DoubleValue message. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. - * @param message DoubleValue message or plain object to encode + * 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.IDoubleValue, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IBoolValue, 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 + * 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.IDoubleValue, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.IBoolValue, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a DoubleValue message from the specified reader or buffer. + * 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 DoubleValue + * @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.DoubleValue; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.BoolValue; /** - * Decodes a DoubleValue message from the specified reader or buffer, length delimited. + * Decodes a BoolValue message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns DoubleValue + * @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.DoubleValue; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.BoolValue; /** - * Verifies a DoubleValue message. + * 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 DoubleValue message from a plain object. Also converts values to their respective internal types. + * Creates a BoolValue message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns DoubleValue + * @returns BoolValue */ - public static fromObject(object: { [k: string]: any }): google.protobuf.DoubleValue; + public static fromObject(object: { [k: string]: any }): google.protobuf.BoolValue; /** - * Creates a plain object from a DoubleValue message. Also converts values to other types if specified. - * @param message DoubleValue + * 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.DoubleValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.BoolValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this DoubleValue to JSON. + * Converts this BoolValue to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a FloatValue. */ - interface IFloatValue { + /** Properties of a StringValue. */ + interface IStringValue { - /** FloatValue value */ - value?: (number|null); + /** StringValue value */ + value?: (string|null); } - /** Represents a FloatValue. */ - class FloatValue implements IFloatValue { - + /** Represents a StringValue. */ + class StringValue implements IStringValue { + /** - * Constructs a new FloatValue. + * Constructs a new StringValue. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IFloatValue); + constructor(properties?: google.protobuf.IStringValue); - /** FloatValue value. */ - public value: number; + /** StringValue value. */ + public value: string; /** - * Creates a new FloatValue instance using the specified properties. + * Creates a new StringValue instance using the specified properties. * @param [properties] Properties to set - * @returns FloatValue instance + * @returns StringValue instance */ - public static create(properties?: google.protobuf.IFloatValue): google.protobuf.FloatValue; + public static create(properties?: google.protobuf.IStringValue): google.protobuf.StringValue; /** - * Encodes the specified FloatValue message. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. - * @param message FloatValue message or plain object to encode + * 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.IFloatValue, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IStringValue, 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 + * 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.IFloatValue, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.IStringValue, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a FloatValue message from the specified reader or buffer. + * 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 FloatValue + * @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.FloatValue; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.StringValue; /** - * Decodes a FloatValue message from the specified reader or buffer, length delimited. + * Decodes a StringValue message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns FloatValue + * @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.FloatValue; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.StringValue; /** - * Verifies a FloatValue message. + * 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 FloatValue message from a plain object. Also converts values to their respective internal types. + * Creates a StringValue message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns FloatValue + * @returns StringValue */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FloatValue; + public static fromObject(object: { [k: string]: any }): google.protobuf.StringValue; /** - * Creates a plain object from a FloatValue message. Also converts values to other types if specified. - * @param message FloatValue + * 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.FloatValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.StringValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this FloatValue to JSON. + * Converts this StringValue to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an Int64Value. */ - interface IInt64Value { + /** Properties of a BytesValue. */ + interface IBytesValue { - /** Int64Value value */ - value?: (number|Long|string|null); + /** BytesValue value */ + value?: (Uint8Array|string|null); } - /** Represents an Int64Value. */ - class Int64Value implements IInt64Value { + /** Represents a BytesValue. */ + class BytesValue implements IBytesValue { /** - * Constructs a new Int64Value. + * Constructs a new BytesValue. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IInt64Value); + constructor(properties?: google.protobuf.IBytesValue); - /** Int64Value value. */ - public value: (number|Long|string); + /** BytesValue value. */ + public value: (Uint8Array|string); /** - * Creates a new Int64Value instance using the specified properties. + * Creates a new BytesValue instance using the specified properties. * @param [properties] Properties to set - * @returns Int64Value instance + * @returns BytesValue instance */ - public static create(properties?: google.protobuf.IInt64Value): google.protobuf.Int64Value; + public static create(properties?: google.protobuf.IBytesValue): google.protobuf.BytesValue; /** - * Encodes the specified Int64Value message. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. - * @param message Int64Value message or plain object to encode + * 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.IInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IBytesValue, 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 + * 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.IInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.IBytesValue, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Int64Value message from the specified reader or buffer. + * 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 Int64Value + * @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.Int64Value; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.BytesValue; /** - * Decodes an Int64Value message from the specified reader or buffer, length delimited. + * Decodes a BytesValue message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Int64Value + * @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.Int64Value; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.BytesValue; /** - * Verifies an Int64Value message. + * 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 an Int64Value message from a plain object. Also converts values to their respective internal types. + * Creates a BytesValue message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Int64Value + * @returns BytesValue */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Int64Value; + public static fromObject(object: { [k: string]: any }): google.protobuf.BytesValue; /** - * Creates a plain object from an Int64Value message. Also converts values to other types if specified. - * @param message Int64Value + * 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.Int64Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.BytesValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Int64Value to JSON. + * Converts this BytesValue to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a UInt64Value. */ - interface IUInt64Value { + /** Properties of a Duration. */ + interface IDuration { - /** UInt64Value value */ - value?: (number|Long|string|null); + /** Duration seconds */ + seconds?: (number|Long|string|null); + + /** Duration nanos */ + nanos?: (number|null); } - /** Represents a UInt64Value. */ - class UInt64Value implements IUInt64Value { + /** Represents a Duration. */ + class Duration implements IDuration { /** - * Constructs a new UInt64Value. + * Constructs a new Duration. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IUInt64Value); + constructor(properties?: google.protobuf.IDuration); - /** UInt64Value value. */ - public value: (number|Long|string); + /** Duration seconds. */ + public seconds: (number|Long|string); + + /** Duration nanos. */ + public nanos: number; /** - * Creates a new UInt64Value instance using the specified properties. + * Creates a new Duration instance using the specified properties. * @param [properties] Properties to set - * @returns UInt64Value instance + * @returns Duration instance */ - public static create(properties?: google.protobuf.IUInt64Value): google.protobuf.UInt64Value; + public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; /** - * Encodes the specified UInt64Value message. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. - * @param message UInt64Value 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.IUInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IDuration, 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 + * 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.IUInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UInt64Value 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 UInt64Value + * @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.UInt64Value; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Duration; /** - * Decodes a UInt64Value 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 UInt64Value + * @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.UInt64Value; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Duration; /** - * Verifies a UInt64Value 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 UInt64Value 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 UInt64Value + * @returns Duration */ - public static fromObject(object: { [k: string]: any }): google.protobuf.UInt64Value; + public static fromObject(object: { [k: string]: any }): google.protobuf.Duration; /** - * Creates a plain object from a UInt64Value message. Also converts values to other types if specified. - * @param message UInt64Value + * 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.UInt64Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.Duration, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UInt64Value to JSON. + * Converts this Duration to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an Int32Value. */ - interface IInt32Value { - - /** Int32Value value */ - value?: (number|null); + /** Properties of an Empty. */ + interface IEmpty { } - /** Represents an Int32Value. */ - class Int32Value implements IInt32Value { + /** Represents an Empty. */ + class Empty implements IEmpty { /** - * Constructs a new Int32Value. + * Constructs a new Empty. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IInt32Value); - - /** Int32Value value. */ - public value: number; + constructor(properties?: google.protobuf.IEmpty); /** - * Creates a new Int32Value instance using the specified properties. + * Creates a new Empty instance using the specified properties. * @param [properties] Properties to set - * @returns Int32Value instance + * @returns Empty instance */ - public static create(properties?: google.protobuf.IInt32Value): google.protobuf.Int32Value; + public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; /** - * Encodes the specified Int32Value message. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. - * @param message Int32Value 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.IInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IEmpty, 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 + * 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.IInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Int32Value 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 Int32Value + * @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.Int32Value; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Empty; /** - * Decodes an Int32Value 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 Int32Value + * @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.Int32Value; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Empty; /** - * Verifies an Int32Value 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 an Int32Value 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 Int32Value + * @returns Empty */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Int32Value; + public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; /** - * Creates a plain object from an Int32Value message. Also converts values to other types if specified. - * @param message Int32Value + * 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.Int32Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Int32Value to JSON. + * Converts this Empty to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a UInt32Value. */ - interface IUInt32Value { + /** Properties of a Timestamp. */ + interface ITimestamp { - /** UInt32Value value */ - value?: (number|null); + /** Timestamp seconds */ + seconds?: (number|Long|string|null); + + /** Timestamp nanos */ + nanos?: (number|null); } - /** Represents a UInt32Value. */ - class UInt32Value implements IUInt32Value { + /** Represents a Timestamp. */ + class Timestamp implements ITimestamp { /** - * Constructs a new UInt32Value. + * Constructs a new Timestamp. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IUInt32Value); + constructor(properties?: google.protobuf.ITimestamp); - /** UInt32Value value. */ - public value: number; + /** Timestamp seconds. */ + public seconds: (number|Long|string); + + /** Timestamp nanos. */ + public nanos: number; /** - * Creates a new UInt32Value instance using the specified properties. + * Creates a new Timestamp instance using the specified properties. * @param [properties] Properties to set - * @returns UInt32Value instance + * @returns Timestamp instance */ - public static create(properties?: google.protobuf.IUInt32Value): google.protobuf.UInt32Value; + public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; /** - * Encodes the specified UInt32Value message. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. - * @param message UInt32Value 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.IUInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.ITimestamp, 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 + * 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.IUInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UInt32Value 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 UInt32Value + * @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.UInt32Value; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Timestamp; /** - * Decodes a UInt32Value 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 UInt32Value + * @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.UInt32Value; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Timestamp; /** - * Verifies a UInt32Value 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 a UInt32Value 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 UInt32Value + * @returns Timestamp */ - public static fromObject(object: { [k: string]: any }): google.protobuf.UInt32Value; + public static fromObject(object: { [k: string]: any }): google.protobuf.Timestamp; /** - * Creates a plain object from a UInt32Value message. Also converts values to other types if specified. - * @param message UInt32Value + * 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.UInt32Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.Timestamp, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UInt32Value to JSON. + * Converts this Timestamp to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a BoolValue. */ - interface IBoolValue { + /** Properties of a FieldMask. */ + interface IFieldMask { - /** BoolValue value */ - value?: (boolean|null); + /** FieldMask paths */ + paths?: (string[]|null); } - /** Represents a BoolValue. */ - class BoolValue implements IBoolValue { + /** Represents a FieldMask. */ + class FieldMask implements IFieldMask { /** - * Constructs a new BoolValue. + * Constructs a new FieldMask. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IBoolValue); + constructor(properties?: google.protobuf.IFieldMask); - /** BoolValue value. */ - public value: boolean; + /** FieldMask paths. */ + public paths: string[]; /** - * Creates a new BoolValue instance using the specified properties. + * Creates a new FieldMask instance using the specified properties. * @param [properties] Properties to set - * @returns BoolValue instance + * @returns FieldMask instance */ - public static create(properties?: google.protobuf.IBoolValue): google.protobuf.BoolValue; + public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; /** - * Encodes the specified BoolValue message. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. - * @param message BoolValue 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.IBoolValue, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IFieldMask, 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 + * 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.IBoolValue, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BoolValue 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 BoolValue + * @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.BoolValue; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldMask; /** - * Decodes a BoolValue 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 BoolValue + * @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.BoolValue; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldMask; /** - * Verifies a BoolValue 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 BoolValue 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 BoolValue + * @returns FieldMask */ - public static fromObject(object: { [k: string]: any }): google.protobuf.BoolValue; + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; /** - * Creates a plain object from a BoolValue message. Also converts values to other types if specified. - * @param message BoolValue + * 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.BoolValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BoolValue to JSON. + * Converts this FieldMask to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } + } - /** Properties of a StringValue. */ - interface IStringValue { + /** Namespace rpc. */ + namespace rpc { - /** StringValue value */ - value?: (string|null); + /** 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 StringValue. */ - class StringValue implements IStringValue { + /** Represents a Status. */ + class Status implements IStatus { /** - * Constructs a new StringValue. + * Constructs a new Status. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IStringValue); + constructor(properties?: google.rpc.IStatus); - /** StringValue value. */ - public value: string; + /** Status code. */ + public code: number; + + /** Status message. */ + public message: string; + + /** Status details. */ + public details: google.protobuf.IAny[]; /** - * Creates a new StringValue instance using the specified properties. + * Creates a new Status instance using the specified properties. * @param [properties] Properties to set - * @returns StringValue instance + * @returns Status instance */ - public static create(properties?: google.protobuf.IStringValue): google.protobuf.StringValue; + public static create(properties?: google.rpc.IStatus): google.rpc.Status; /** - * Encodes the specified StringValue message. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. - * @param message StringValue 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.IStringValue, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.rpc.IStatus, 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 + * 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.IStringValue, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a StringValue 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 StringValue + * @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.StringValue; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.rpc.Status; /** - * Decodes a StringValue 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 StringValue + * @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.StringValue; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.rpc.Status; /** - * Verifies a StringValue 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 StringValue 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 StringValue + * @returns Status */ - public static fromObject(object: { [k: string]: any }): google.protobuf.StringValue; + public static fromObject(object: { [k: string]: any }): google.rpc.Status; /** - * Creates a plain object from a StringValue message. Also converts values to other types if specified. - * @param message StringValue + * 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.StringValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.rpc.Status, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this StringValue to JSON. + * Converts this Status to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } + } - /** Properties of a BytesValue. */ - interface IBytesValue { + /** Namespace type. */ + namespace type { - /** BytesValue value */ - value?: (Uint8Array|string|null); + /** Properties of a Color. */ + interface IColor { + + /** Color red */ + red?: (number|null); + + /** Color green */ + green?: (number|null); + + /** Color blue */ + blue?: (number|null); + + /** Color alpha */ + alpha?: (google.protobuf.IFloatValue|null); } - /** Represents a BytesValue. */ - class BytesValue implements IBytesValue { + /** Represents a Color. */ + class Color implements IColor { /** - * Constructs a new BytesValue. + * Constructs a new Color. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IBytesValue); + constructor(properties?: google.type.IColor); - /** BytesValue value. */ - public value: (Uint8Array|string); + /** Color red. */ + public red: number; + + /** Color green. */ + public green: number; + + /** Color blue. */ + public blue: number; + + /** Color alpha. */ + public alpha?: (google.protobuf.IFloatValue|null); /** - * Creates a new BytesValue instance using the specified properties. + * Creates a new Color instance using the specified properties. * @param [properties] Properties to set - * @returns BytesValue instance + * @returns Color instance */ - public static create(properties?: google.protobuf.IBytesValue): google.protobuf.BytesValue; + public static create(properties?: google.type.IColor): google.type.Color; /** - * Encodes the specified BytesValue message. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. - * @param message BytesValue message or plain object to encode + * Encodes the specified Color message. Does not implicitly {@link google.type.Color.verify|verify} messages. + * @param message Color 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; + public static encode(message: google.type.IColor, 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 + * Encodes the specified Color message, length delimited. Does not implicitly {@link google.type.Color.verify|verify} messages. + * @param message Color 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; + public static encodeDelimited(message: google.type.IColor, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BytesValue message from the specified reader or buffer. + * Decodes a Color message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BytesValue + * @returns Color * @throws {Error} If the payload is not 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; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.type.Color; /** - * Decodes a BytesValue message from the specified reader or buffer, length delimited. + * Decodes a Color message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BytesValue + * @returns Color * @throws {Error} If the payload 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; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.type.Color; /** - * Verifies a BytesValue message. + * Verifies a Color message. * @param message Plain object 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. + * Creates a Color message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BytesValue + * @returns Color */ - public static fromObject(object: { [k: string]: any }): google.protobuf.BytesValue; + public static fromObject(object: { [k: string]: any }): google.type.Color; /** - * Creates a plain object from a BytesValue message. Also converts values to other types if specified. - * @param message BytesValue + * Creates a plain object from a Color message. Also converts values to other types if specified. + * @param message Color * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.protobuf.BytesValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.type.Color, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BytesValue to JSON. + * Converts this Color to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Duration. */ - interface IDuration { + /** Properties of a Date. */ + interface IDate { - /** Duration seconds */ - seconds?: (number|Long|string|null); + /** Date year */ + year?: (number|null); - /** Duration nanos */ - nanos?: (number|null); + /** Date month */ + month?: (number|null); + + /** Date day */ + day?: (number|null); } - /** Represents a Duration. */ - class Duration implements IDuration { + /** Represents a Date. */ + class Date implements IDate { /** - * Constructs a new Duration. + * Constructs a new Date. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IDuration); + constructor(properties?: google.type.IDate); - /** Duration seconds. */ - public seconds: (number|Long|string); + /** Date year. */ + public year: number; - /** Duration nanos. */ - public nanos: number; + /** Date month. */ + public month: number; + + /** Date day. */ + public day: number; /** - * Creates a new Duration instance using the specified properties. + * Creates a new Date instance using the specified properties. * @param [properties] Properties to set - * @returns Duration instance + * @returns Date instance */ - public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; + public static create(properties?: google.type.IDate): google.type.Date; /** - * 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 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.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.type.IDate, 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 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.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.type.IDate, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Duration 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 Duration + * @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.protobuf.Duration; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.type.Date; /** - * Decodes a Duration 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 Duration + * @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.protobuf.Duration; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.type.Date; /** - * Verifies a Duration 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 Duration 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 Duration + * @returns Date */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Duration; + public static fromObject(object: { [k: string]: any }): google.type.Date; /** - * 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 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.protobuf.Duration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.type.Date, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Duration to JSON. + * Converts this Date to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an Empty. */ - interface IEmpty { + /** Properties of a DateTime. */ + interface IDateTime { + + /** DateTime year */ + year?: (number|null); + + /** DateTime month */ + month?: (number|null); + + /** DateTime day */ + day?: (number|null); + + /** DateTime hours */ + hours?: (number|null); + + /** DateTime minutes */ + minutes?: (number|null); + + /** DateTime seconds */ + seconds?: (number|null); + + /** DateTime nanos */ + nanos?: (number|null); + + /** DateTime utcOffset */ + utcOffset?: (google.protobuf.IDuration|null); + + /** DateTime timeZone */ + timeZone?: (google.type.ITimeZone|null); } - /** Represents an Empty. */ - class Empty implements IEmpty { + /** Represents a DateTime. */ + class DateTime implements IDateTime { /** - * Constructs a new Empty. + * Constructs a new DateTime. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IEmpty); + constructor(properties?: google.type.IDateTime); + + /** DateTime year. */ + public year: number; + + /** DateTime month. */ + public month: number; + + /** DateTime day. */ + public day: number; + + /** DateTime hours. */ + public hours: number; + + /** DateTime minutes. */ + public minutes: number; + + /** DateTime seconds. */ + public seconds: number; + + /** DateTime nanos. */ + public nanos: number; + + /** DateTime utcOffset. */ + public utcOffset?: (google.protobuf.IDuration|null); + + /** DateTime timeZone. */ + public timeZone?: (google.type.ITimeZone|null); + + /** DateTime timeOffset. */ + public timeOffset?: ("utcOffset"|"timeZone"); /** - * Creates a new Empty instance using the specified properties. + * Creates a new DateTime instance using the specified properties. * @param [properties] Properties to set - * @returns Empty instance + * @returns DateTime instance */ - public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; + public static create(properties?: google.type.IDateTime): google.type.DateTime; /** - * 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 DateTime message. Does not implicitly {@link google.type.DateTime.verify|verify} messages. + * @param message DateTime 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.type.IDateTime, 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 DateTime message, length delimited. Does not implicitly {@link google.type.DateTime.verify|verify} messages. + * @param message DateTime 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.type.IDateTime, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Empty message from the specified reader or buffer. + * Decodes a DateTime 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 DateTime * @throws {Error} If the payload is not 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.type.DateTime; /** - * Decodes an Empty message from the specified reader or buffer, length delimited. + * Decodes a DateTime message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Empty + * @returns DateTime * @throws {Error} If the payload 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.type.DateTime; /** - * Verifies an Empty message. + * Verifies a DateTime message. * @param message Plain 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 DateTime message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Empty + * @returns DateTime */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; + public static fromObject(object: { [k: string]: any }): google.type.DateTime; /** - * 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 DateTime message. Also converts values to other types if specified. + * @param message DateTime * @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.type.DateTime, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Empty to JSON. + * Converts this DateTime to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Timestamp. */ - interface ITimestamp { + /** Properties of a TimeZone. */ + interface ITimeZone { - /** Timestamp seconds */ - seconds?: (number|Long|string|null); + /** TimeZone id */ + id?: (string|null); - /** Timestamp nanos */ - nanos?: (number|null); + /** TimeZone version */ + version?: (string|null); } - /** Represents a Timestamp. */ - class Timestamp implements ITimestamp { + /** Represents a TimeZone. */ + class TimeZone implements ITimeZone { /** - * Constructs a new Timestamp. + * Constructs a new TimeZone. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.ITimestamp); + constructor(properties?: google.type.ITimeZone); - /** Timestamp seconds. */ - public seconds: (number|Long|string); + /** TimeZone id. */ + public id: string; - /** Timestamp nanos. */ - public nanos: number; + /** TimeZone version. */ + public version: string; /** - * Creates a new Timestamp instance using the specified properties. + * Creates a new TimeZone instance using the specified properties. * @param [properties] Properties to set - * @returns Timestamp instance + * @returns TimeZone instance */ - public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; + public static create(properties?: google.type.ITimeZone): google.type.TimeZone; /** - * 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 TimeZone message. Does not implicitly {@link google.type.TimeZone.verify|verify} messages. + * @param message TimeZone 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.type.ITimeZone, 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 TimeZone message, length delimited. Does not implicitly {@link google.type.TimeZone.verify|verify} messages. + * @param message TimeZone 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.type.ITimeZone, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Timestamp message from the specified reader or buffer. + * Decodes a TimeZone 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 TimeZone * @throws {Error} If the payload is not 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.type.TimeZone; /** - * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * Decodes a TimeZone message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Timestamp + * @returns TimeZone * @throws {Error} If the payload 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.type.TimeZone; /** - * Verifies a Timestamp message. + * Verifies a TimeZone message. * @param message Plain object 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 TimeZone message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Timestamp + * @returns TimeZone */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Timestamp; + public static fromObject(object: { [k: string]: any }): google.type.TimeZone; /** - * 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 TimeZone message. Also converts values to other types if specified. + * @param message TimeZone * @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.type.TimeZone, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Timestamp to JSON. + * Converts this TimeZone to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - } - - /** Namespace rpc. */ - namespace rpc { - /** Properties of a Status. */ - interface IStatus { + /** Properties of a Money. */ + interface IMoney { - /** Status code */ - code?: (number|null); + /** Money currencyCode */ + currencyCode?: (string|null); - /** Status message */ - message?: (string|null); + /** Money units */ + units?: (number|Long|string|null); - /** Status details */ - details?: (google.protobuf.IAny[]|null); + /** Money nanos */ + nanos?: (number|null); } - /** Represents a Status. */ - class Status implements IStatus { + /** Represents a Money. */ + class Money implements IMoney { /** - * Constructs a new Status. + * Constructs a new Money. * @param [properties] Properties to set */ - constructor(properties?: google.rpc.IStatus); + constructor(properties?: google.type.IMoney); - /** Status code. */ - public code: number; + /** Money currencyCode. */ + public currencyCode: string; - /** Status message. */ - public message: string; + /** Money units. */ + public units: (number|Long|string); - /** Status details. */ - public details: google.protobuf.IAny[]; + /** Money nanos. */ + public nanos: number; /** - * Creates a new Status instance using the specified properties. + * Creates a new Money instance using the specified properties. * @param [properties] Properties to set - * @returns Status instance + * @returns Money instance */ - public static create(properties?: google.rpc.IStatus): google.rpc.Status; + public static create(properties?: google.type.IMoney): google.type.Money; /** - * 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 Money message. Does not implicitly {@link google.type.Money.verify|verify} messages. + * @param message Money 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.IMoney, 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 Money message, length delimited. Does not implicitly {@link google.type.Money.verify|verify} messages. + * @param message Money 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.IMoney, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Status message from the specified reader or buffer. + * Decodes a Money 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 Money * @throws {Error} If the payload is not 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.Money; /** - * Decodes a Status message from the specified reader or buffer, length delimited. + * Decodes a Money message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Status + * @returns Money * @throws {Error} If the payload 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.Money; /** - * Verifies a Status message. + * Verifies a Money message. * @param message Plain object 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 Money message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Status + * @returns Money */ - public static fromObject(object: { [k: string]: any }): google.rpc.Status; + public static fromObject(object: { [k: string]: any }): google.type.Money; /** - * 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 Money message. Also converts values to other types if specified. + * @param message Money * @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.Money, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Status to JSON. + * Converts this Money to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - } - /** Namespace type. */ - namespace type { + /** Properties of a PostalAddress. */ + interface IPostalAddress { - /** Properties of a Color. */ - interface IColor { + /** PostalAddress revision */ + revision?: (number|null); - /** Color red */ - red?: (number|null); + /** PostalAddress regionCode */ + regionCode?: (string|null); - /** Color green */ - green?: (number|null); + /** PostalAddress languageCode */ + languageCode?: (string|null); - /** Color blue */ - blue?: (number|null); + /** PostalAddress postalCode */ + postalCode?: (string|null); - /** Color alpha */ - alpha?: (google.protobuf.IFloatValue|null); + /** PostalAddress sortingCode */ + sortingCode?: (string|null); + + /** PostalAddress administrativeArea */ + administrativeArea?: (string|null); + + /** PostalAddress locality */ + locality?: (string|null); + + /** PostalAddress sublocality */ + sublocality?: (string|null); + + /** PostalAddress addressLines */ + addressLines?: (string[]|null); + + /** PostalAddress recipients */ + recipients?: (string[]|null); + + /** PostalAddress organization */ + organization?: (string|null); } - /** Represents a Color. */ - class Color implements IColor { + /** Represents a PostalAddress. */ + class PostalAddress implements IPostalAddress { /** - * Constructs a new Color. + * Constructs a new PostalAddress. * @param [properties] Properties to set */ - constructor(properties?: google.type.IColor); + constructor(properties?: google.type.IPostalAddress); - /** Color red. */ - public red: number; + /** PostalAddress revision. */ + public revision: number; - /** Color green. */ - public green: number; + /** PostalAddress regionCode. */ + public regionCode: string; - /** Color blue. */ - public blue: number; + /** PostalAddress languageCode. */ + public languageCode: string; - /** Color alpha. */ - public alpha?: (google.protobuf.IFloatValue|null); + /** PostalAddress postalCode. */ + public postalCode: string; + + /** PostalAddress sortingCode. */ + public sortingCode: string; + + /** PostalAddress administrativeArea. */ + public administrativeArea: string; + + /** PostalAddress locality. */ + public locality: string; + + /** PostalAddress sublocality. */ + public sublocality: string; + + /** PostalAddress addressLines. */ + public addressLines: string[]; + + /** PostalAddress recipients. */ + public recipients: string[]; + + /** PostalAddress organization. */ + public organization: string; /** - * Creates a new Color instance using the specified properties. + * Creates a new PostalAddress instance using the specified properties. * @param [properties] Properties to set - * @returns Color instance + * @returns PostalAddress instance */ - public static create(properties?: google.type.IColor): google.type.Color; + public static create(properties?: google.type.IPostalAddress): google.type.PostalAddress; /** - * Encodes the specified Color message. Does not implicitly {@link google.type.Color.verify|verify} messages. - * @param message Color message or plain object to encode + * Encodes the specified PostalAddress message. Does not implicitly {@link google.type.PostalAddress.verify|verify} messages. + * @param message PostalAddress message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.type.IColor, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.type.IPostalAddress, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Color message, length delimited. Does not implicitly {@link google.type.Color.verify|verify} messages. - * @param message Color message or plain object to encode + * Encodes the specified PostalAddress message, length delimited. Does not implicitly {@link google.type.PostalAddress.verify|verify} messages. + * @param message PostalAddress message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.type.IColor, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.type.IPostalAddress, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Color message from the specified reader or buffer. + * Decodes a PostalAddress message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Color + * @returns PostalAddress * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.type.Color; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.type.PostalAddress; /** - * Decodes a Color message from the specified reader or buffer, length delimited. + * Decodes a PostalAddress message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Color + * @returns PostalAddress * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.type.Color; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.type.PostalAddress; /** - * Verifies a Color message. + * Verifies a PostalAddress message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Color message from a plain object. Also converts values to their respective internal types. + * Creates a PostalAddress message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Color + * @returns PostalAddress */ - public static fromObject(object: { [k: string]: any }): google.type.Color; + public static fromObject(object: { [k: string]: any }): google.type.PostalAddress; /** - * Creates a plain object from a Color message. Also converts values to other types if specified. - * @param message Color + * Creates a plain object from a PostalAddress message. Also converts values to other types if specified. + * @param message PostalAddress * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.type.Color, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.type.PostalAddress, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Color to JSON. + * Converts this PostalAddress to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 13541453caa..9d33bcf99f0 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -11882,512 +11882,15797 @@ return v1beta2; })(); - return documentai; - })(); + documentai.v1beta3 = (function() { - return cloud; - })(); + /** + * Namespace v1beta3. + * @memberof google.cloud.documentai + * @namespace + */ + var v1beta3 = {}; - google.api = (function() { + v1beta3.Document = (function() { - /** - * Namespace api. - * @memberof google - * @namespace - */ - var api = {}; + /** + * Properties of a Document. + * @memberof google.cloud.documentai.v1beta3 + * @interface IDocument + * @property {string|null} [uri] Document uri + * @property {Uint8Array|null} [content] Document content + * @property {string|null} [mimeType] Document mimeType + * @property {string|null} [text] Document text + * @property {Array.|null} [textStyles] Document textStyles + * @property {Array.|null} [pages] Document pages + * @property {Array.|null} [entities] Document entities + * @property {Array.|null} [entityRelations] Document entityRelations + * @property {Array.|null} [translations] Document translations + * @property {Array.|null} [textChanges] Document textChanges + * @property {google.cloud.documentai.v1beta3.Document.IShardInfo|null} [shardInfo] Document shardInfo + * @property {google.rpc.IStatus|null} [error] Document error + * @property {Array.|null} [revisions] Document revisions + */ - /** - * 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; - })(); + /** + * Constructs a new Document. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a Document. + * @implements IDocument + * @constructor + * @param {google.cloud.documentai.v1beta3.IDocument=} [properties] Properties to set + */ + function Document(properties) { + this.textStyles = []; + this.pages = []; + this.entities = []; + this.entityRelations = []; + this.translations = []; + this.textChanges = []; + this.revisions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - api.Http = (function() { + /** + * Document uri. + * @member {string} uri + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.uri = ""; - /** - * Properties of a Http. - * @memberof google.api - * @interface IHttp - * @property {Array.|null} [rules] Http rules - * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion - */ + /** + * Document content. + * @member {Uint8Array} content + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.content = $util.newBuffer([]); - /** - * 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]]; - } + /** + * Document mimeType. + * @member {string} mimeType + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.mimeType = ""; - /** - * Http rules. - * @member {Array.} rules - * @memberof google.api.Http - * @instance - */ - Http.prototype.rules = $util.emptyArray; + /** + * Document text. + * @member {string} text + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.text = ""; - /** - * Http fullyDecodeReservedExpansion. - * @member {boolean} fullyDecodeReservedExpansion - * @memberof google.api.Http - * @instance - */ - Http.prototype.fullyDecodeReservedExpansion = false; + /** + * Document textStyles. + * @member {Array.} textStyles + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.textStyles = $util.emptyArray; - /** - * 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); - }; + /** + * Document pages. + * @member {Array.} pages + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.pages = $util.emptyArray; - /** - * 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; - }; + /** + * Document entities. + * @member {Array.} entities + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.entities = $util.emptyArray; - /** - * 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(); - }; + /** + * Document entityRelations. + * @member {Array.} entityRelations + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.entityRelations = $util.emptyArray; - /** - * 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; - }; + /** + * Document translations. + * @member {Array.} translations + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.translations = $util.emptyArray; - /** - * 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()); - }; + /** + * Document textChanges. + * @member {Array.} textChanges + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.textChanges = $util.emptyArray; - /** - * 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; - }; + /** + * Document shardInfo. + * @member {google.cloud.documentai.v1beta3.Document.IShardInfo|null|undefined} shardInfo + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.shardInfo = null; - /** - * 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); - }; + /** + * Document error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.error = null; - return Http; - })(); + /** + * Document revisions. + * @member {Array.} revisions + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.revisions = $util.emptyArray; - api.HttpRule = (function() { + // OneOf field names bound to virtual getters and setters + var $oneOfFields; - /** - * 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 - */ + /** + * Document source. + * @member {"uri"|"content"|undefined} source + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Object.defineProperty(Document.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["uri", "content"]), + set: $util.oneOfSetter($oneOfFields) + }); - /** - * 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]]; - } + /** + * Creates a new Document instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document + * @static + * @param {google.cloud.documentai.v1beta3.IDocument=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document} Document instance + */ + Document.create = function create(properties) { + return new Document(properties); + }; - /** - * HttpRule selector. - * @member {string} selector - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.selector = ""; + /** + * Encodes the specified Document message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document + * @static + * @param {google.cloud.documentai.v1beta3.IDocument} message Document message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Document.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.content != null && Object.hasOwnProperty.call(message, "content")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.content); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.mimeType); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.text); + if (message.textStyles != null && message.textStyles.length) + for (var i = 0; i < message.textStyles.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Style.encode(message.textStyles[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.pages != null && message.pages.length) + for (var i = 0; i < message.pages.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.encode(message.pages[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.entities != null && message.entities.length) + for (var i = 0; i < message.entities.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Entity.encode(message.entities[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.entityRelations != null && message.entityRelations.length) + for (var i = 0; i < message.entityRelations.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.EntityRelation.encode(message.entityRelations[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.shardInfo != null && Object.hasOwnProperty.call(message, "shardInfo")) + $root.google.cloud.documentai.v1beta3.Document.ShardInfo.encode(message.shardInfo, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.translations != null && message.translations.length) + for (var i = 0; i < message.translations.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Translation.encode(message.translations[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.revisions != null && message.revisions.length) + for (var i = 0; i < message.revisions.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Revision.encode(message.revisions[i], writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.textChanges != null && message.textChanges.length) + for (var i = 0; i < message.textChanges.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.TextChange.encode(message.textChanges[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + return writer; + }; - /** - * HttpRule get. - * @member {string} get - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.get = ""; + /** + * Encodes the specified Document message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document + * @static + * @param {google.cloud.documentai.v1beta3.IDocument} message Document message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Document.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * HttpRule put. - * @member {string} put - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.put = ""; + /** + * Decodes a Document message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document} Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Document.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uri = reader.string(); + break; + case 2: + message.content = reader.bytes(); + break; + case 3: + message.mimeType = reader.string(); + break; + case 4: + message.text = reader.string(); + break; + case 5: + if (!(message.textStyles && message.textStyles.length)) + message.textStyles = []; + message.textStyles.push($root.google.cloud.documentai.v1beta3.Document.Style.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.pages && message.pages.length)) + message.pages = []; + message.pages.push($root.google.cloud.documentai.v1beta3.Document.Page.decode(reader, reader.uint32())); + break; + case 7: + if (!(message.entities && message.entities.length)) + message.entities = []; + message.entities.push($root.google.cloud.documentai.v1beta3.Document.Entity.decode(reader, reader.uint32())); + break; + case 8: + if (!(message.entityRelations && message.entityRelations.length)) + message.entityRelations = []; + message.entityRelations.push($root.google.cloud.documentai.v1beta3.Document.EntityRelation.decode(reader, reader.uint32())); + break; + case 12: + if (!(message.translations && message.translations.length)) + message.translations = []; + message.translations.push($root.google.cloud.documentai.v1beta3.Document.Translation.decode(reader, reader.uint32())); + break; + case 14: + if (!(message.textChanges && message.textChanges.length)) + message.textChanges = []; + message.textChanges.push($root.google.cloud.documentai.v1beta3.Document.TextChange.decode(reader, reader.uint32())); + break; + case 9: + message.shardInfo = $root.google.cloud.documentai.v1beta3.Document.ShardInfo.decode(reader, reader.uint32()); + break; + case 10: + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + case 13: + if (!(message.revisions && message.revisions.length)) + message.revisions = []; + message.revisions.push($root.google.cloud.documentai.v1beta3.Document.Revision.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** + /** + * Decodes a Document message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document} Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Document.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Document message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Document.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.uri != null && message.hasOwnProperty("uri")) { + properties.source = 1; + if (!$util.isString(message.uri)) + return "uri: string expected"; + } + if (message.content != null && message.hasOwnProperty("content")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) + return "content: buffer expected"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.textStyles != null && message.hasOwnProperty("textStyles")) { + if (!Array.isArray(message.textStyles)) + return "textStyles: array expected"; + for (var i = 0; i < message.textStyles.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Style.verify(message.textStyles[i]); + if (error) + return "textStyles." + error; + } + } + if (message.pages != null && message.hasOwnProperty("pages")) { + if (!Array.isArray(message.pages)) + return "pages: array expected"; + for (var i = 0; i < message.pages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.verify(message.pages[i]); + if (error) + return "pages." + error; + } + } + if (message.entities != null && message.hasOwnProperty("entities")) { + if (!Array.isArray(message.entities)) + return "entities: array expected"; + for (var i = 0; i < message.entities.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Entity.verify(message.entities[i]); + if (error) + return "entities." + error; + } + } + if (message.entityRelations != null && message.hasOwnProperty("entityRelations")) { + if (!Array.isArray(message.entityRelations)) + return "entityRelations: array expected"; + for (var i = 0; i < message.entityRelations.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.EntityRelation.verify(message.entityRelations[i]); + if (error) + return "entityRelations." + error; + } + } + if (message.translations != null && message.hasOwnProperty("translations")) { + if (!Array.isArray(message.translations)) + return "translations: array expected"; + for (var i = 0; i < message.translations.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Translation.verify(message.translations[i]); + if (error) + return "translations." + error; + } + } + if (message.textChanges != null && message.hasOwnProperty("textChanges")) { + if (!Array.isArray(message.textChanges)) + return "textChanges: array expected"; + for (var i = 0; i < message.textChanges.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.TextChange.verify(message.textChanges[i]); + if (error) + return "textChanges." + error; + } + } + if (message.shardInfo != null && message.hasOwnProperty("shardInfo")) { + var error = $root.google.cloud.documentai.v1beta3.Document.ShardInfo.verify(message.shardInfo); + if (error) + return "shardInfo." + error; + } + if (message.error != null && message.hasOwnProperty("error")) { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; + } + if (message.revisions != null && message.hasOwnProperty("revisions")) { + if (!Array.isArray(message.revisions)) + return "revisions: array expected"; + for (var i = 0; i < message.revisions.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Revision.verify(message.revisions[i]); + if (error) + return "revisions." + error; + } + } + return null; + }; + + /** + * Creates a Document message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document} Document + */ + Document.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.content != null) + if (typeof object.content === "string") + $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); + else if (object.content.length) + message.content = object.content; + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + if (object.text != null) + message.text = String(object.text); + if (object.textStyles) { + if (!Array.isArray(object.textStyles)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.textStyles: array expected"); + message.textStyles = []; + for (var i = 0; i < object.textStyles.length; ++i) { + if (typeof object.textStyles[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.textStyles: object expected"); + message.textStyles[i] = $root.google.cloud.documentai.v1beta3.Document.Style.fromObject(object.textStyles[i]); + } + } + if (object.pages) { + if (!Array.isArray(object.pages)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.pages: array expected"); + message.pages = []; + for (var i = 0; i < object.pages.length; ++i) { + if (typeof object.pages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.pages: object expected"); + message.pages[i] = $root.google.cloud.documentai.v1beta3.Document.Page.fromObject(object.pages[i]); + } + } + if (object.entities) { + if (!Array.isArray(object.entities)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.entities: array expected"); + message.entities = []; + for (var i = 0; i < object.entities.length; ++i) { + if (typeof object.entities[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.entities: object expected"); + message.entities[i] = $root.google.cloud.documentai.v1beta3.Document.Entity.fromObject(object.entities[i]); + } + } + if (object.entityRelations) { + if (!Array.isArray(object.entityRelations)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.entityRelations: array expected"); + message.entityRelations = []; + for (var i = 0; i < object.entityRelations.length; ++i) { + if (typeof object.entityRelations[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.entityRelations: object expected"); + message.entityRelations[i] = $root.google.cloud.documentai.v1beta3.Document.EntityRelation.fromObject(object.entityRelations[i]); + } + } + if (object.translations) { + if (!Array.isArray(object.translations)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.translations: array expected"); + message.translations = []; + for (var i = 0; i < object.translations.length; ++i) { + if (typeof object.translations[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.translations: object expected"); + message.translations[i] = $root.google.cloud.documentai.v1beta3.Document.Translation.fromObject(object.translations[i]); + } + } + if (object.textChanges) { + if (!Array.isArray(object.textChanges)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.textChanges: array expected"); + message.textChanges = []; + for (var i = 0; i < object.textChanges.length; ++i) { + if (typeof object.textChanges[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.textChanges: object expected"); + message.textChanges[i] = $root.google.cloud.documentai.v1beta3.Document.TextChange.fromObject(object.textChanges[i]); + } + } + if (object.shardInfo != null) { + if (typeof object.shardInfo !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.shardInfo: object expected"); + message.shardInfo = $root.google.cloud.documentai.v1beta3.Document.ShardInfo.fromObject(object.shardInfo); + } + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error); + } + if (object.revisions) { + if (!Array.isArray(object.revisions)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.revisions: array expected"); + message.revisions = []; + for (var i = 0; i < object.revisions.length; ++i) { + if (typeof object.revisions[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.revisions: object expected"); + message.revisions[i] = $root.google.cloud.documentai.v1beta3.Document.Revision.fromObject(object.revisions[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Document message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document + * @static + * @param {google.cloud.documentai.v1beta3.Document} message Document + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Document.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.textStyles = []; + object.pages = []; + object.entities = []; + object.entityRelations = []; + object.translations = []; + object.revisions = []; + object.textChanges = []; + } + if (options.defaults) { + object.mimeType = ""; + object.text = ""; + object.shardInfo = null; + object.error = null; + } + if (message.uri != null && message.hasOwnProperty("uri")) { + object.uri = message.uri; + if (options.oneofs) + object.source = "uri"; + } + if (message.content != null && message.hasOwnProperty("content")) { + object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; + if (options.oneofs) + object.source = "content"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.textStyles && message.textStyles.length) { + object.textStyles = []; + for (var j = 0; j < message.textStyles.length; ++j) + object.textStyles[j] = $root.google.cloud.documentai.v1beta3.Document.Style.toObject(message.textStyles[j], options); + } + if (message.pages && message.pages.length) { + object.pages = []; + for (var j = 0; j < message.pages.length; ++j) + object.pages[j] = $root.google.cloud.documentai.v1beta3.Document.Page.toObject(message.pages[j], options); + } + if (message.entities && message.entities.length) { + object.entities = []; + for (var j = 0; j < message.entities.length; ++j) + object.entities[j] = $root.google.cloud.documentai.v1beta3.Document.Entity.toObject(message.entities[j], options); + } + if (message.entityRelations && message.entityRelations.length) { + object.entityRelations = []; + for (var j = 0; j < message.entityRelations.length; ++j) + object.entityRelations[j] = $root.google.cloud.documentai.v1beta3.Document.EntityRelation.toObject(message.entityRelations[j], options); + } + if (message.shardInfo != null && message.hasOwnProperty("shardInfo")) + object.shardInfo = $root.google.cloud.documentai.v1beta3.Document.ShardInfo.toObject(message.shardInfo, options); + if (message.error != null && message.hasOwnProperty("error")) + object.error = $root.google.rpc.Status.toObject(message.error, options); + if (message.translations && message.translations.length) { + object.translations = []; + for (var j = 0; j < message.translations.length; ++j) + object.translations[j] = $root.google.cloud.documentai.v1beta3.Document.Translation.toObject(message.translations[j], options); + } + if (message.revisions && message.revisions.length) { + object.revisions = []; + for (var j = 0; j < message.revisions.length; ++j) + object.revisions[j] = $root.google.cloud.documentai.v1beta3.Document.Revision.toObject(message.revisions[j], options); + } + if (message.textChanges && message.textChanges.length) { + object.textChanges = []; + for (var j = 0; j < message.textChanges.length; ++j) + object.textChanges[j] = $root.google.cloud.documentai.v1beta3.Document.TextChange.toObject(message.textChanges[j], options); + } + return object; + }; + + /** + * Converts this Document to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + * @returns {Object.} JSON object + */ + Document.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Document.ShardInfo = (function() { + + /** + * Properties of a ShardInfo. + * @memberof google.cloud.documentai.v1beta3.Document + * @interface IShardInfo + * @property {number|Long|null} [shardIndex] ShardInfo shardIndex + * @property {number|Long|null} [shardCount] ShardInfo shardCount + * @property {number|Long|null} [textOffset] ShardInfo textOffset + */ + + /** + * Constructs a new ShardInfo. + * @memberof google.cloud.documentai.v1beta3.Document + * @classdesc Represents a ShardInfo. + * @implements IShardInfo + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.IShardInfo=} [properties] Properties to set + */ + function ShardInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ShardInfo shardIndex. + * @member {number|Long} shardIndex + * @memberof google.cloud.documentai.v1beta3.Document.ShardInfo + * @instance + */ + ShardInfo.prototype.shardIndex = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ShardInfo shardCount. + * @member {number|Long} shardCount + * @memberof google.cloud.documentai.v1beta3.Document.ShardInfo + * @instance + */ + ShardInfo.prototype.shardCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ShardInfo textOffset. + * @member {number|Long} textOffset + * @memberof google.cloud.documentai.v1beta3.Document.ShardInfo + * @instance + */ + ShardInfo.prototype.textOffset = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new ShardInfo instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.ShardInfo + * @static + * @param {google.cloud.documentai.v1beta3.Document.IShardInfo=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.ShardInfo} ShardInfo instance + */ + ShardInfo.create = function create(properties) { + return new ShardInfo(properties); + }; + + /** + * Encodes the specified ShardInfo message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.ShardInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.ShardInfo + * @static + * @param {google.cloud.documentai.v1beta3.Document.IShardInfo} message ShardInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ShardInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.shardIndex != null && Object.hasOwnProperty.call(message, "shardIndex")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.shardIndex); + if (message.shardCount != null && Object.hasOwnProperty.call(message, "shardCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.shardCount); + if (message.textOffset != null && Object.hasOwnProperty.call(message, "textOffset")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.textOffset); + return writer; + }; + + /** + * Encodes the specified ShardInfo message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.ShardInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.ShardInfo + * @static + * @param {google.cloud.documentai.v1beta3.Document.IShardInfo} message ShardInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ShardInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ShardInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.ShardInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.ShardInfo} ShardInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ShardInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.ShardInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.shardIndex = reader.int64(); + break; + case 2: + message.shardCount = reader.int64(); + break; + case 3: + message.textOffset = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ShardInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.ShardInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.ShardInfo} ShardInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ShardInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ShardInfo message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.ShardInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ShardInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.shardIndex != null && message.hasOwnProperty("shardIndex")) + if (!$util.isInteger(message.shardIndex) && !(message.shardIndex && $util.isInteger(message.shardIndex.low) && $util.isInteger(message.shardIndex.high))) + return "shardIndex: integer|Long expected"; + if (message.shardCount != null && message.hasOwnProperty("shardCount")) + if (!$util.isInteger(message.shardCount) && !(message.shardCount && $util.isInteger(message.shardCount.low) && $util.isInteger(message.shardCount.high))) + return "shardCount: integer|Long expected"; + if (message.textOffset != null && message.hasOwnProperty("textOffset")) + if (!$util.isInteger(message.textOffset) && !(message.textOffset && $util.isInteger(message.textOffset.low) && $util.isInteger(message.textOffset.high))) + return "textOffset: integer|Long expected"; + return null; + }; + + /** + * Creates a ShardInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.ShardInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.ShardInfo} ShardInfo + */ + ShardInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.ShardInfo) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.ShardInfo(); + if (object.shardIndex != null) + if ($util.Long) + (message.shardIndex = $util.Long.fromValue(object.shardIndex)).unsigned = false; + else if (typeof object.shardIndex === "string") + message.shardIndex = parseInt(object.shardIndex, 10); + else if (typeof object.shardIndex === "number") + message.shardIndex = object.shardIndex; + else if (typeof object.shardIndex === "object") + message.shardIndex = new $util.LongBits(object.shardIndex.low >>> 0, object.shardIndex.high >>> 0).toNumber(); + if (object.shardCount != null) + if ($util.Long) + (message.shardCount = $util.Long.fromValue(object.shardCount)).unsigned = false; + else if (typeof object.shardCount === "string") + message.shardCount = parseInt(object.shardCount, 10); + else if (typeof object.shardCount === "number") + message.shardCount = object.shardCount; + else if (typeof object.shardCount === "object") + message.shardCount = new $util.LongBits(object.shardCount.low >>> 0, object.shardCount.high >>> 0).toNumber(); + if (object.textOffset != null) + if ($util.Long) + (message.textOffset = $util.Long.fromValue(object.textOffset)).unsigned = false; + else if (typeof object.textOffset === "string") + message.textOffset = parseInt(object.textOffset, 10); + else if (typeof object.textOffset === "number") + message.textOffset = object.textOffset; + else if (typeof object.textOffset === "object") + message.textOffset = new $util.LongBits(object.textOffset.low >>> 0, object.textOffset.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a ShardInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.ShardInfo + * @static + * @param {google.cloud.documentai.v1beta3.Document.ShardInfo} message ShardInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ShardInfo.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.shardIndex = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.shardIndex = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.shardCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.shardCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.textOffset = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.textOffset = options.longs === String ? "0" : 0; + } + if (message.shardIndex != null && message.hasOwnProperty("shardIndex")) + if (typeof message.shardIndex === "number") + object.shardIndex = options.longs === String ? String(message.shardIndex) : message.shardIndex; + else + object.shardIndex = options.longs === String ? $util.Long.prototype.toString.call(message.shardIndex) : options.longs === Number ? new $util.LongBits(message.shardIndex.low >>> 0, message.shardIndex.high >>> 0).toNumber() : message.shardIndex; + if (message.shardCount != null && message.hasOwnProperty("shardCount")) + if (typeof message.shardCount === "number") + object.shardCount = options.longs === String ? String(message.shardCount) : message.shardCount; + else + object.shardCount = options.longs === String ? $util.Long.prototype.toString.call(message.shardCount) : options.longs === Number ? new $util.LongBits(message.shardCount.low >>> 0, message.shardCount.high >>> 0).toNumber() : message.shardCount; + if (message.textOffset != null && message.hasOwnProperty("textOffset")) + if (typeof message.textOffset === "number") + object.textOffset = options.longs === String ? String(message.textOffset) : message.textOffset; + else + object.textOffset = options.longs === String ? $util.Long.prototype.toString.call(message.textOffset) : options.longs === Number ? new $util.LongBits(message.textOffset.low >>> 0, message.textOffset.high >>> 0).toNumber() : message.textOffset; + return object; + }; + + /** + * Converts this ShardInfo to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.ShardInfo + * @instance + * @returns {Object.} JSON object + */ + ShardInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ShardInfo; + })(); + + Document.Style = (function() { + + /** + * Properties of a Style. + * @memberof google.cloud.documentai.v1beta3.Document + * @interface IStyle + * @property {google.cloud.documentai.v1beta3.Document.ITextAnchor|null} [textAnchor] Style textAnchor + * @property {google.type.IColor|null} [color] Style color + * @property {google.type.IColor|null} [backgroundColor] Style backgroundColor + * @property {string|null} [fontWeight] Style fontWeight + * @property {string|null} [textStyle] Style textStyle + * @property {string|null} [textDecoration] Style textDecoration + * @property {google.cloud.documentai.v1beta3.Document.Style.IFontSize|null} [fontSize] Style fontSize + */ + + /** + * Constructs a new Style. + * @memberof google.cloud.documentai.v1beta3.Document + * @classdesc Represents a Style. + * @implements IStyle + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.IStyle=} [properties] Properties to set + */ + function Style(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Style textAnchor. + * @member {google.cloud.documentai.v1beta3.Document.ITextAnchor|null|undefined} textAnchor + * @memberof google.cloud.documentai.v1beta3.Document.Style + * @instance + */ + Style.prototype.textAnchor = null; + + /** + * Style color. + * @member {google.type.IColor|null|undefined} color + * @memberof google.cloud.documentai.v1beta3.Document.Style + * @instance + */ + Style.prototype.color = null; + + /** + * Style backgroundColor. + * @member {google.type.IColor|null|undefined} backgroundColor + * @memberof google.cloud.documentai.v1beta3.Document.Style + * @instance + */ + Style.prototype.backgroundColor = null; + + /** + * Style fontWeight. + * @member {string} fontWeight + * @memberof google.cloud.documentai.v1beta3.Document.Style + * @instance + */ + Style.prototype.fontWeight = ""; + + /** + * Style textStyle. + * @member {string} textStyle + * @memberof google.cloud.documentai.v1beta3.Document.Style + * @instance + */ + Style.prototype.textStyle = ""; + + /** + * Style textDecoration. + * @member {string} textDecoration + * @memberof google.cloud.documentai.v1beta3.Document.Style + * @instance + */ + Style.prototype.textDecoration = ""; + + /** + * Style fontSize. + * @member {google.cloud.documentai.v1beta3.Document.Style.IFontSize|null|undefined} fontSize + * @memberof google.cloud.documentai.v1beta3.Document.Style + * @instance + */ + Style.prototype.fontSize = null; + + /** + * Creates a new Style instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Style + * @static + * @param {google.cloud.documentai.v1beta3.Document.IStyle=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Style} Style instance + */ + Style.create = function create(properties) { + return new Style(properties); + }; + + /** + * Encodes the specified Style message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Style.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Style + * @static + * @param {google.cloud.documentai.v1beta3.Document.IStyle} message Style message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Style.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textAnchor != null && Object.hasOwnProperty.call(message, "textAnchor")) + $root.google.cloud.documentai.v1beta3.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.color != null && Object.hasOwnProperty.call(message, "color")) + $root.google.type.Color.encode(message.color, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.backgroundColor != null && Object.hasOwnProperty.call(message, "backgroundColor")) + $root.google.type.Color.encode(message.backgroundColor, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.fontWeight != null && Object.hasOwnProperty.call(message, "fontWeight")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.fontWeight); + if (message.textStyle != null && Object.hasOwnProperty.call(message, "textStyle")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.textStyle); + if (message.textDecoration != null && Object.hasOwnProperty.call(message, "textDecoration")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.textDecoration); + if (message.fontSize != null && Object.hasOwnProperty.call(message, "fontSize")) + $root.google.cloud.documentai.v1beta3.Document.Style.FontSize.encode(message.fontSize, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Style message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Style.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Style + * @static + * @param {google.cloud.documentai.v1beta3.Document.IStyle} message Style message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Style.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Style message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Style + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Style} Style + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Style.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Style(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.decode(reader, reader.uint32()); + break; + case 2: + message.color = $root.google.type.Color.decode(reader, reader.uint32()); + break; + case 3: + message.backgroundColor = $root.google.type.Color.decode(reader, reader.uint32()); + break; + case 4: + message.fontWeight = reader.string(); + break; + case 5: + message.textStyle = reader.string(); + break; + case 6: + message.textDecoration = reader.string(); + break; + case 7: + message.fontSize = $root.google.cloud.documentai.v1beta3.Document.Style.FontSize.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Style message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Style + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Style} Style + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Style.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Style message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Style + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Style.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) { + var error = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.verify(message.textAnchor); + if (error) + return "textAnchor." + error; + } + if (message.color != null && message.hasOwnProperty("color")) { + var error = $root.google.type.Color.verify(message.color); + if (error) + return "color." + error; + } + if (message.backgroundColor != null && message.hasOwnProperty("backgroundColor")) { + var error = $root.google.type.Color.verify(message.backgroundColor); + if (error) + return "backgroundColor." + error; + } + if (message.fontWeight != null && message.hasOwnProperty("fontWeight")) + if (!$util.isString(message.fontWeight)) + return "fontWeight: string expected"; + if (message.textStyle != null && message.hasOwnProperty("textStyle")) + if (!$util.isString(message.textStyle)) + return "textStyle: string expected"; + if (message.textDecoration != null && message.hasOwnProperty("textDecoration")) + if (!$util.isString(message.textDecoration)) + return "textDecoration: string expected"; + if (message.fontSize != null && message.hasOwnProperty("fontSize")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Style.FontSize.verify(message.fontSize); + if (error) + return "fontSize." + error; + } + return null; + }; + + /** + * Creates a Style message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Style + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Style} Style + */ + Style.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Style) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Style(); + if (object.textAnchor != null) { + if (typeof object.textAnchor !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Style.textAnchor: object expected"); + message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.fromObject(object.textAnchor); + } + if (object.color != null) { + if (typeof object.color !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Style.color: object expected"); + message.color = $root.google.type.Color.fromObject(object.color); + } + if (object.backgroundColor != null) { + if (typeof object.backgroundColor !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Style.backgroundColor: object expected"); + message.backgroundColor = $root.google.type.Color.fromObject(object.backgroundColor); + } + if (object.fontWeight != null) + message.fontWeight = String(object.fontWeight); + if (object.textStyle != null) + message.textStyle = String(object.textStyle); + if (object.textDecoration != null) + message.textDecoration = String(object.textDecoration); + if (object.fontSize != null) { + if (typeof object.fontSize !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Style.fontSize: object expected"); + message.fontSize = $root.google.cloud.documentai.v1beta3.Document.Style.FontSize.fromObject(object.fontSize); + } + return message; + }; + + /** + * Creates a plain object from a Style message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Style + * @static + * @param {google.cloud.documentai.v1beta3.Document.Style} message Style + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Style.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.textAnchor = null; + object.color = null; + object.backgroundColor = null; + object.fontWeight = ""; + object.textStyle = ""; + object.textDecoration = ""; + object.fontSize = null; + } + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + object.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.toObject(message.textAnchor, options); + if (message.color != null && message.hasOwnProperty("color")) + object.color = $root.google.type.Color.toObject(message.color, options); + if (message.backgroundColor != null && message.hasOwnProperty("backgroundColor")) + object.backgroundColor = $root.google.type.Color.toObject(message.backgroundColor, options); + if (message.fontWeight != null && message.hasOwnProperty("fontWeight")) + object.fontWeight = message.fontWeight; + if (message.textStyle != null && message.hasOwnProperty("textStyle")) + object.textStyle = message.textStyle; + if (message.textDecoration != null && message.hasOwnProperty("textDecoration")) + object.textDecoration = message.textDecoration; + if (message.fontSize != null && message.hasOwnProperty("fontSize")) + object.fontSize = $root.google.cloud.documentai.v1beta3.Document.Style.FontSize.toObject(message.fontSize, options); + return object; + }; + + /** + * Converts this Style to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Style + * @instance + * @returns {Object.} JSON object + */ + Style.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Style.FontSize = (function() { + + /** + * Properties of a FontSize. + * @memberof google.cloud.documentai.v1beta3.Document.Style + * @interface IFontSize + * @property {number|null} [size] FontSize size + * @property {string|null} [unit] FontSize unit + */ + + /** + * Constructs a new FontSize. + * @memberof google.cloud.documentai.v1beta3.Document.Style + * @classdesc Represents a FontSize. + * @implements IFontSize + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Style.IFontSize=} [properties] Properties to set + */ + function FontSize(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FontSize size. + * @member {number} size + * @memberof google.cloud.documentai.v1beta3.Document.Style.FontSize + * @instance + */ + FontSize.prototype.size = 0; + + /** + * FontSize unit. + * @member {string} unit + * @memberof google.cloud.documentai.v1beta3.Document.Style.FontSize + * @instance + */ + FontSize.prototype.unit = ""; + + /** + * Creates a new FontSize instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Style.FontSize + * @static + * @param {google.cloud.documentai.v1beta3.Document.Style.IFontSize=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Style.FontSize} FontSize instance + */ + FontSize.create = function create(properties) { + return new FontSize(properties); + }; + + /** + * Encodes the specified FontSize message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Style.FontSize.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Style.FontSize + * @static + * @param {google.cloud.documentai.v1beta3.Document.Style.IFontSize} message FontSize message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FontSize.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.size != null && Object.hasOwnProperty.call(message, "size")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.size); + if (message.unit != null && Object.hasOwnProperty.call(message, "unit")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.unit); + return writer; + }; + + /** + * Encodes the specified FontSize message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Style.FontSize.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Style.FontSize + * @static + * @param {google.cloud.documentai.v1beta3.Document.Style.IFontSize} message FontSize message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FontSize.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FontSize message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Style.FontSize + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Style.FontSize} FontSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FontSize.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Style.FontSize(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.size = reader.float(); + break; + case 2: + message.unit = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FontSize message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Style.FontSize + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Style.FontSize} FontSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FontSize.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FontSize message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Style.FontSize + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FontSize.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.size != null && message.hasOwnProperty("size")) + if (typeof message.size !== "number") + return "size: number expected"; + if (message.unit != null && message.hasOwnProperty("unit")) + if (!$util.isString(message.unit)) + return "unit: string expected"; + return null; + }; + + /** + * Creates a FontSize message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Style.FontSize + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Style.FontSize} FontSize + */ + FontSize.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Style.FontSize) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Style.FontSize(); + if (object.size != null) + message.size = Number(object.size); + if (object.unit != null) + message.unit = String(object.unit); + return message; + }; + + /** + * Creates a plain object from a FontSize message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Style.FontSize + * @static + * @param {google.cloud.documentai.v1beta3.Document.Style.FontSize} message FontSize + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FontSize.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.size = 0; + object.unit = ""; + } + if (message.size != null && message.hasOwnProperty("size")) + object.size = options.json && !isFinite(message.size) ? String(message.size) : message.size; + if (message.unit != null && message.hasOwnProperty("unit")) + object.unit = message.unit; + return object; + }; + + /** + * Converts this FontSize to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Style.FontSize + * @instance + * @returns {Object.} JSON object + */ + FontSize.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FontSize; + })(); + + return Style; + })(); + + Document.Page = (function() { + + /** + * Properties of a Page. + * @memberof google.cloud.documentai.v1beta3.Document + * @interface IPage + * @property {number|null} [pageNumber] Page pageNumber + * @property {google.cloud.documentai.v1beta3.Document.Page.IImage|null} [image] Page image + * @property {Array.|null} [transforms] Page transforms + * @property {google.cloud.documentai.v1beta3.Document.Page.IDimension|null} [dimension] Page dimension + * @property {google.cloud.documentai.v1beta3.Document.Page.ILayout|null} [layout] Page layout + * @property {Array.|null} [detectedLanguages] Page detectedLanguages + * @property {Array.|null} [blocks] Page blocks + * @property {Array.|null} [paragraphs] Page paragraphs + * @property {Array.|null} [lines] Page lines + * @property {Array.|null} [tokens] Page tokens + * @property {Array.|null} [visualElements] Page visualElements + * @property {Array.|null} [tables] Page tables + * @property {Array.|null} [formFields] Page formFields + */ + + /** + * Constructs a new Page. + * @memberof google.cloud.documentai.v1beta3.Document + * @classdesc Represents a Page. + * @implements IPage + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.IPage=} [properties] Properties to set + */ + function Page(properties) { + this.transforms = []; + this.detectedLanguages = []; + this.blocks = []; + this.paragraphs = []; + this.lines = []; + this.tokens = []; + this.visualElements = []; + this.tables = []; + this.formFields = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Page pageNumber. + * @member {number} pageNumber + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + */ + Page.prototype.pageNumber = 0; + + /** + * Page image. + * @member {google.cloud.documentai.v1beta3.Document.Page.IImage|null|undefined} image + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + */ + Page.prototype.image = null; + + /** + * Page transforms. + * @member {Array.} transforms + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + */ + Page.prototype.transforms = $util.emptyArray; + + /** + * Page dimension. + * @member {google.cloud.documentai.v1beta3.Document.Page.IDimension|null|undefined} dimension + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + */ + Page.prototype.dimension = null; + + /** + * Page layout. + * @member {google.cloud.documentai.v1beta3.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + */ + Page.prototype.layout = null; + + /** + * Page detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + */ + Page.prototype.detectedLanguages = $util.emptyArray; + + /** + * Page blocks. + * @member {Array.} blocks + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + */ + Page.prototype.blocks = $util.emptyArray; + + /** + * Page paragraphs. + * @member {Array.} paragraphs + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + */ + Page.prototype.paragraphs = $util.emptyArray; + + /** + * Page lines. + * @member {Array.} lines + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + */ + Page.prototype.lines = $util.emptyArray; + + /** + * Page tokens. + * @member {Array.} tokens + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + */ + Page.prototype.tokens = $util.emptyArray; + + /** + * Page visualElements. + * @member {Array.} visualElements + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + */ + Page.prototype.visualElements = $util.emptyArray; + + /** + * Page tables. + * @member {Array.} tables + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + */ + Page.prototype.tables = $util.emptyArray; + + /** + * Page formFields. + * @member {Array.} formFields + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + */ + Page.prototype.formFields = $util.emptyArray; + + /** + * Creates a new Page instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @static + * @param {google.cloud.documentai.v1beta3.Document.IPage=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page} Page instance + */ + Page.create = function create(properties) { + return new Page(properties); + }; + + /** + * Encodes the specified Page message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @static + * @param {google.cloud.documentai.v1beta3.Document.IPage} message Page message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Page.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageNumber != null && Object.hasOwnProperty.call(message, "pageNumber")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.pageNumber); + if (message.dimension != null && Object.hasOwnProperty.call(message, "dimension")) + $root.google.cloud.documentai.v1beta3.Document.Page.Dimension.encode(message.dimension, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1beta3.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.blocks != null && message.blocks.length) + for (var i = 0; i < message.blocks.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.Block.encode(message.blocks[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.paragraphs != null && message.paragraphs.length) + for (var i = 0; i < message.paragraphs.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.Paragraph.encode(message.paragraphs[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.lines != null && message.lines.length) + for (var i = 0; i < message.lines.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.Line.encode(message.lines[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.tokens != null && message.tokens.length) + for (var i = 0; i < message.tokens.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.Token.encode(message.tokens[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.visualElements != null && message.visualElements.length) + for (var i = 0; i < message.visualElements.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.VisualElement.encode(message.visualElements[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.tables != null && message.tables.length) + for (var i = 0; i < message.tables.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.Table.encode(message.tables[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.formFields != null && message.formFields.length) + for (var i = 0; i < message.formFields.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.FormField.encode(message.formFields[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.image != null && Object.hasOwnProperty.call(message, "image")) + $root.google.cloud.documentai.v1beta3.Document.Page.Image.encode(message.image, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.transforms != null && message.transforms.length) + for (var i = 0; i < message.transforms.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.Matrix.encode(message.transforms[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Page message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @static + * @param {google.cloud.documentai.v1beta3.Document.IPage} message Page message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Page.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Page message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page} Page + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Page.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Page(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pageNumber = reader.int32(); + break; + case 13: + message.image = $root.google.cloud.documentai.v1beta3.Document.Page.Image.decode(reader, reader.uint32()); + break; + case 14: + if (!(message.transforms && message.transforms.length)) + message.transforms = []; + message.transforms.push($root.google.cloud.documentai.v1beta3.Document.Page.Matrix.decode(reader, reader.uint32())); + break; + case 2: + message.dimension = $root.google.cloud.documentai.v1beta3.Document.Page.Dimension.decode(reader, reader.uint32()); + break; + case 3: + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.blocks && message.blocks.length)) + message.blocks = []; + message.blocks.push($root.google.cloud.documentai.v1beta3.Document.Page.Block.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.paragraphs && message.paragraphs.length)) + message.paragraphs = []; + message.paragraphs.push($root.google.cloud.documentai.v1beta3.Document.Page.Paragraph.decode(reader, reader.uint32())); + break; + case 7: + if (!(message.lines && message.lines.length)) + message.lines = []; + message.lines.push($root.google.cloud.documentai.v1beta3.Document.Page.Line.decode(reader, reader.uint32())); + break; + case 8: + if (!(message.tokens && message.tokens.length)) + message.tokens = []; + message.tokens.push($root.google.cloud.documentai.v1beta3.Document.Page.Token.decode(reader, reader.uint32())); + break; + case 9: + if (!(message.visualElements && message.visualElements.length)) + message.visualElements = []; + message.visualElements.push($root.google.cloud.documentai.v1beta3.Document.Page.VisualElement.decode(reader, reader.uint32())); + break; + case 10: + if (!(message.tables && message.tables.length)) + message.tables = []; + message.tables.push($root.google.cloud.documentai.v1beta3.Document.Page.Table.decode(reader, reader.uint32())); + break; + case 11: + if (!(message.formFields && message.formFields.length)) + message.formFields = []; + message.formFields.push($root.google.cloud.documentai.v1beta3.Document.Page.FormField.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Page message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page} Page + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Page.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Page message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Page.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + if (!$util.isInteger(message.pageNumber)) + return "pageNumber: integer expected"; + if (message.image != null && message.hasOwnProperty("image")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Image.verify(message.image); + if (error) + return "image." + error; + } + if (message.transforms != null && message.hasOwnProperty("transforms")) { + if (!Array.isArray(message.transforms)) + return "transforms: array expected"; + for (var i = 0; i < message.transforms.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Matrix.verify(message.transforms[i]); + if (error) + return "transforms." + error; + } + } + if (message.dimension != null && message.hasOwnProperty("dimension")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Dimension.verify(message.dimension); + if (error) + return "dimension." + error; + } + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + if (message.blocks != null && message.hasOwnProperty("blocks")) { + if (!Array.isArray(message.blocks)) + return "blocks: array expected"; + for (var i = 0; i < message.blocks.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Block.verify(message.blocks[i]); + if (error) + return "blocks." + error; + } + } + if (message.paragraphs != null && message.hasOwnProperty("paragraphs")) { + if (!Array.isArray(message.paragraphs)) + return "paragraphs: array expected"; + for (var i = 0; i < message.paragraphs.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Paragraph.verify(message.paragraphs[i]); + if (error) + return "paragraphs." + error; + } + } + if (message.lines != null && message.hasOwnProperty("lines")) { + if (!Array.isArray(message.lines)) + return "lines: array expected"; + for (var i = 0; i < message.lines.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Line.verify(message.lines[i]); + if (error) + return "lines." + error; + } + } + if (message.tokens != null && message.hasOwnProperty("tokens")) { + if (!Array.isArray(message.tokens)) + return "tokens: array expected"; + for (var i = 0; i < message.tokens.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Token.verify(message.tokens[i]); + if (error) + return "tokens." + error; + } + } + if (message.visualElements != null && message.hasOwnProperty("visualElements")) { + if (!Array.isArray(message.visualElements)) + return "visualElements: array expected"; + for (var i = 0; i < message.visualElements.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.VisualElement.verify(message.visualElements[i]); + if (error) + return "visualElements." + error; + } + } + if (message.tables != null && message.hasOwnProperty("tables")) { + if (!Array.isArray(message.tables)) + return "tables: array expected"; + for (var i = 0; i < message.tables.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Table.verify(message.tables[i]); + if (error) + return "tables." + error; + } + } + if (message.formFields != null && message.hasOwnProperty("formFields")) { + if (!Array.isArray(message.formFields)) + return "formFields: array expected"; + for (var i = 0; i < message.formFields.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.FormField.verify(message.formFields[i]); + if (error) + return "formFields." + error; + } + } + return null; + }; + + /** + * Creates a Page message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page} Page + */ + Page.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page(); + if (object.pageNumber != null) + message.pageNumber = object.pageNumber | 0; + if (object.image != null) { + if (typeof object.image !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.image: object expected"); + message.image = $root.google.cloud.documentai.v1beta3.Document.Page.Image.fromObject(object.image); + } + if (object.transforms) { + if (!Array.isArray(object.transforms)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.transforms: array expected"); + message.transforms = []; + for (var i = 0; i < object.transforms.length; ++i) { + if (typeof object.transforms[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.transforms: object expected"); + message.transforms[i] = $root.google.cloud.documentai.v1beta3.Document.Page.Matrix.fromObject(object.transforms[i]); + } + } + if (object.dimension != null) { + if (typeof object.dimension !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.dimension: object expected"); + message.dimension = $root.google.cloud.documentai.v1beta3.Document.Page.Dimension.fromObject(object.dimension); + } + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + if (object.blocks) { + if (!Array.isArray(object.blocks)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.blocks: array expected"); + message.blocks = []; + for (var i = 0; i < object.blocks.length; ++i) { + if (typeof object.blocks[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.blocks: object expected"); + message.blocks[i] = $root.google.cloud.documentai.v1beta3.Document.Page.Block.fromObject(object.blocks[i]); + } + } + if (object.paragraphs) { + if (!Array.isArray(object.paragraphs)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.paragraphs: array expected"); + message.paragraphs = []; + for (var i = 0; i < object.paragraphs.length; ++i) { + if (typeof object.paragraphs[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.paragraphs: object expected"); + message.paragraphs[i] = $root.google.cloud.documentai.v1beta3.Document.Page.Paragraph.fromObject(object.paragraphs[i]); + } + } + if (object.lines) { + if (!Array.isArray(object.lines)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.lines: array expected"); + message.lines = []; + for (var i = 0; i < object.lines.length; ++i) { + if (typeof object.lines[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.lines: object expected"); + message.lines[i] = $root.google.cloud.documentai.v1beta3.Document.Page.Line.fromObject(object.lines[i]); + } + } + if (object.tokens) { + if (!Array.isArray(object.tokens)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.tokens: array expected"); + message.tokens = []; + for (var i = 0; i < object.tokens.length; ++i) { + if (typeof object.tokens[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.tokens: object expected"); + message.tokens[i] = $root.google.cloud.documentai.v1beta3.Document.Page.Token.fromObject(object.tokens[i]); + } + } + if (object.visualElements) { + if (!Array.isArray(object.visualElements)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.visualElements: array expected"); + message.visualElements = []; + for (var i = 0; i < object.visualElements.length; ++i) { + if (typeof object.visualElements[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.visualElements: object expected"); + message.visualElements[i] = $root.google.cloud.documentai.v1beta3.Document.Page.VisualElement.fromObject(object.visualElements[i]); + } + } + if (object.tables) { + if (!Array.isArray(object.tables)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.tables: array expected"); + message.tables = []; + for (var i = 0; i < object.tables.length; ++i) { + if (typeof object.tables[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.tables: object expected"); + message.tables[i] = $root.google.cloud.documentai.v1beta3.Document.Page.Table.fromObject(object.tables[i]); + } + } + if (object.formFields) { + if (!Array.isArray(object.formFields)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.formFields: array expected"); + message.formFields = []; + for (var i = 0; i < object.formFields.length; ++i) { + if (typeof object.formFields[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.formFields: object expected"); + message.formFields[i] = $root.google.cloud.documentai.v1beta3.Document.Page.FormField.fromObject(object.formFields[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Page message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page} message Page + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Page.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.detectedLanguages = []; + object.blocks = []; + object.paragraphs = []; + object.lines = []; + object.tokens = []; + object.visualElements = []; + object.tables = []; + object.formFields = []; + object.transforms = []; + } + if (options.defaults) { + object.pageNumber = 0; + object.dimension = null; + object.layout = null; + object.image = null; + } + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + object.pageNumber = message.pageNumber; + if (message.dimension != null && message.hasOwnProperty("dimension")) + object.dimension = $root.google.cloud.documentai.v1beta3.Document.Page.Dimension.toObject(message.dimension, options); + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + if (message.blocks && message.blocks.length) { + object.blocks = []; + for (var j = 0; j < message.blocks.length; ++j) + object.blocks[j] = $root.google.cloud.documentai.v1beta3.Document.Page.Block.toObject(message.blocks[j], options); + } + if (message.paragraphs && message.paragraphs.length) { + object.paragraphs = []; + for (var j = 0; j < message.paragraphs.length; ++j) + object.paragraphs[j] = $root.google.cloud.documentai.v1beta3.Document.Page.Paragraph.toObject(message.paragraphs[j], options); + } + if (message.lines && message.lines.length) { + object.lines = []; + for (var j = 0; j < message.lines.length; ++j) + object.lines[j] = $root.google.cloud.documentai.v1beta3.Document.Page.Line.toObject(message.lines[j], options); + } + if (message.tokens && message.tokens.length) { + object.tokens = []; + for (var j = 0; j < message.tokens.length; ++j) + object.tokens[j] = $root.google.cloud.documentai.v1beta3.Document.Page.Token.toObject(message.tokens[j], options); + } + if (message.visualElements && message.visualElements.length) { + object.visualElements = []; + for (var j = 0; j < message.visualElements.length; ++j) + object.visualElements[j] = $root.google.cloud.documentai.v1beta3.Document.Page.VisualElement.toObject(message.visualElements[j], options); + } + if (message.tables && message.tables.length) { + object.tables = []; + for (var j = 0; j < message.tables.length; ++j) + object.tables[j] = $root.google.cloud.documentai.v1beta3.Document.Page.Table.toObject(message.tables[j], options); + } + if (message.formFields && message.formFields.length) { + object.formFields = []; + for (var j = 0; j < message.formFields.length; ++j) + object.formFields[j] = $root.google.cloud.documentai.v1beta3.Document.Page.FormField.toObject(message.formFields[j], options); + } + if (message.image != null && message.hasOwnProperty("image")) + object.image = $root.google.cloud.documentai.v1beta3.Document.Page.Image.toObject(message.image, options); + if (message.transforms && message.transforms.length) { + object.transforms = []; + for (var j = 0; j < message.transforms.length; ++j) + object.transforms[j] = $root.google.cloud.documentai.v1beta3.Document.Page.Matrix.toObject(message.transforms[j], options); + } + return object; + }; + + /** + * Converts this Page to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + * @returns {Object.} JSON object + */ + Page.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Page.Dimension = (function() { + + /** + * Properties of a Dimension. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @interface IDimension + * @property {number|null} [width] Dimension width + * @property {number|null} [height] Dimension height + * @property {string|null} [unit] Dimension unit + */ + + /** + * Constructs a new Dimension. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @classdesc Represents a Dimension. + * @implements IDimension + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Page.IDimension=} [properties] Properties to set + */ + function Dimension(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Dimension width. + * @member {number} width + * @memberof google.cloud.documentai.v1beta3.Document.Page.Dimension + * @instance + */ + Dimension.prototype.width = 0; + + /** + * Dimension height. + * @member {number} height + * @memberof google.cloud.documentai.v1beta3.Document.Page.Dimension + * @instance + */ + Dimension.prototype.height = 0; + + /** + * Dimension unit. + * @member {string} unit + * @memberof google.cloud.documentai.v1beta3.Document.Page.Dimension + * @instance + */ + Dimension.prototype.unit = ""; + + /** + * Creates a new Dimension instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.Dimension + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IDimension=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.Dimension} Dimension instance + */ + Dimension.create = function create(properties) { + return new Dimension(properties); + }; + + /** + * Encodes the specified Dimension message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Dimension.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Dimension + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IDimension} message Dimension message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Dimension.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.width); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.height); + if (message.unit != null && Object.hasOwnProperty.call(message, "unit")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unit); + return writer; + }; + + /** + * Encodes the specified Dimension message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Dimension.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Dimension + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IDimension} message Dimension message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Dimension.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Dimension message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Dimension + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page.Dimension} Dimension + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Dimension.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Page.Dimension(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.width = reader.float(); + break; + case 2: + message.height = reader.float(); + break; + case 3: + message.unit = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Dimension message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Dimension + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page.Dimension} Dimension + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Dimension.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Dimension message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Page.Dimension + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Dimension.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (typeof message.width !== "number") + return "width: number expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height !== "number") + return "height: number expected"; + if (message.unit != null && message.hasOwnProperty("unit")) + if (!$util.isString(message.unit)) + return "unit: string expected"; + return null; + }; + + /** + * Creates a Dimension message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Dimension + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page.Dimension} Dimension + */ + Dimension.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page.Dimension) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page.Dimension(); + if (object.width != null) + message.width = Number(object.width); + if (object.height != null) + message.height = Number(object.height); + if (object.unit != null) + message.unit = String(object.unit); + return message; + }; + + /** + * Creates a plain object from a Dimension message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Dimension + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Dimension} message Dimension + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Dimension.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.width = 0; + object.height = 0; + object.unit = ""; + } + if (message.width != null && message.hasOwnProperty("width")) + object.width = options.json && !isFinite(message.width) ? String(message.width) : message.width; + if (message.height != null && message.hasOwnProperty("height")) + object.height = options.json && !isFinite(message.height) ? String(message.height) : message.height; + if (message.unit != null && message.hasOwnProperty("unit")) + object.unit = message.unit; + return object; + }; + + /** + * Converts this Dimension to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page.Dimension + * @instance + * @returns {Object.} JSON object + */ + Dimension.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Dimension; + })(); + + Page.Image = (function() { + + /** + * Properties of an Image. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @interface IImage + * @property {Uint8Array|null} [content] Image content + * @property {string|null} [mimeType] Image mimeType + * @property {number|null} [width] Image width + * @property {number|null} [height] Image height + */ + + /** + * Constructs a new Image. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @classdesc Represents an Image. + * @implements IImage + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Page.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 content. + * @member {Uint8Array} content + * @memberof google.cloud.documentai.v1beta3.Document.Page.Image + * @instance + */ + Image.prototype.content = $util.newBuffer([]); + + /** + * Image mimeType. + * @member {string} mimeType + * @memberof google.cloud.documentai.v1beta3.Document.Page.Image + * @instance + */ + Image.prototype.mimeType = ""; + + /** + * Image width. + * @member {number} width + * @memberof google.cloud.documentai.v1beta3.Document.Page.Image + * @instance + */ + Image.prototype.width = 0; + + /** + * Image height. + * @member {number} height + * @memberof google.cloud.documentai.v1beta3.Document.Page.Image + * @instance + */ + Image.prototype.height = 0; + + /** + * Creates a new Image instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.Image + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IImage=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.Image} Image instance + */ + Image.create = function create(properties) { + return new Image(properties); + }; + + /** + * Encodes the specified Image message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Image.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Image + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.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.content != null && Object.hasOwnProperty.call(message, "content")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.content); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.width); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.height); + return writer; + }; + + /** + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Image.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Image + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.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.documentai.v1beta3.Document.Page.Image + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page.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.documentai.v1beta3.Document.Page.Image(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.content = reader.bytes(); + break; + case 2: + message.mimeType = reader.string(); + break; + case 3: + message.width = reader.int32(); + break; + case 4: + message.height = 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.documentai.v1beta3.Document.Page.Image + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page.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.documentai.v1beta3.Document.Page.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.content != null && message.hasOwnProperty("content")) + if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) + return "content: buffer expected"; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (!$util.isInteger(message.width)) + return "width: integer expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: 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.documentai.v1beta3.Document.Page.Image + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page.Image} Image + */ + Image.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page.Image) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page.Image(); + if (object.content != null) + if (typeof object.content === "string") + $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); + else if (object.content.length) + message.content = object.content; + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + if (object.width != null) + message.width = object.width | 0; + if (object.height != null) + message.height = object.height | 0; + return message; + }; + + /** + * Creates a plain object from an Image message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Image + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.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) { + if (options.bytes === String) + object.content = ""; + else { + object.content = []; + if (options.bytes !== Array) + object.content = $util.newBuffer(object.content); + } + object.mimeType = ""; + object.width = 0; + object.height = 0; + } + if (message.content != null && message.hasOwnProperty("content")) + object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.width != null && message.hasOwnProperty("width")) + object.width = message.width; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + return object; + }; + + /** + * Converts this Image to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page.Image + * @instance + * @returns {Object.} JSON object + */ + Image.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Image; + })(); + + Page.Matrix = (function() { + + /** + * Properties of a Matrix. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @interface IMatrix + * @property {number|null} [rows] Matrix rows + * @property {number|null} [cols] Matrix cols + * @property {number|null} [type] Matrix type + * @property {Uint8Array|null} [data] Matrix data + */ + + /** + * Constructs a new Matrix. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @classdesc Represents a Matrix. + * @implements IMatrix + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Page.IMatrix=} [properties] Properties to set + */ + function Matrix(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Matrix rows. + * @member {number} rows + * @memberof google.cloud.documentai.v1beta3.Document.Page.Matrix + * @instance + */ + Matrix.prototype.rows = 0; + + /** + * Matrix cols. + * @member {number} cols + * @memberof google.cloud.documentai.v1beta3.Document.Page.Matrix + * @instance + */ + Matrix.prototype.cols = 0; + + /** + * Matrix type. + * @member {number} type + * @memberof google.cloud.documentai.v1beta3.Document.Page.Matrix + * @instance + */ + Matrix.prototype.type = 0; + + /** + * Matrix data. + * @member {Uint8Array} data + * @memberof google.cloud.documentai.v1beta3.Document.Page.Matrix + * @instance + */ + Matrix.prototype.data = $util.newBuffer([]); + + /** + * Creates a new Matrix instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.Matrix + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IMatrix=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.Matrix} Matrix instance + */ + Matrix.create = function create(properties) { + return new Matrix(properties); + }; + + /** + * Encodes the specified Matrix message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Matrix.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Matrix + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IMatrix} message Matrix message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Matrix.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rows != null && Object.hasOwnProperty.call(message, "rows")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.rows); + if (message.cols != null && Object.hasOwnProperty.call(message, "cols")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.cols); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.data); + return writer; + }; + + /** + * Encodes the specified Matrix message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Matrix.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Matrix + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IMatrix} message Matrix message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Matrix.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Matrix message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Matrix + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page.Matrix} Matrix + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Matrix.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Page.Matrix(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rows = reader.int32(); + break; + case 2: + message.cols = reader.int32(); + break; + case 3: + message.type = reader.int32(); + break; + case 4: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Matrix message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Matrix + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page.Matrix} Matrix + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Matrix.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Matrix message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Page.Matrix + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Matrix.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rows != null && message.hasOwnProperty("rows")) + if (!$util.isInteger(message.rows)) + return "rows: integer expected"; + if (message.cols != null && message.hasOwnProperty("cols")) + if (!$util.isInteger(message.cols)) + return "cols: integer expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isInteger(message.type)) + return "type: integer expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + return null; + }; + + /** + * Creates a Matrix message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Matrix + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page.Matrix} Matrix + */ + Matrix.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page.Matrix) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page.Matrix(); + if (object.rows != null) + message.rows = object.rows | 0; + if (object.cols != null) + message.cols = object.cols | 0; + if (object.type != null) + message.type = object.type | 0; + 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; + return message; + }; + + /** + * Creates a plain object from a Matrix message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Matrix + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Matrix} message Matrix + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Matrix.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.rows = 0; + object.cols = 0; + object.type = 0; + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + } + if (message.rows != null && message.hasOwnProperty("rows")) + object.rows = message.rows; + if (message.cols != null && message.hasOwnProperty("cols")) + object.cols = message.cols; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + 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; + return object; + }; + + /** + * Converts this Matrix to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page.Matrix + * @instance + * @returns {Object.} JSON object + */ + Matrix.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Matrix; + })(); + + Page.Layout = (function() { + + /** + * Properties of a Layout. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @interface ILayout + * @property {google.cloud.documentai.v1beta3.Document.ITextAnchor|null} [textAnchor] Layout textAnchor + * @property {number|null} [confidence] Layout confidence + * @property {google.cloud.documentai.v1beta3.IBoundingPoly|null} [boundingPoly] Layout boundingPoly + * @property {google.cloud.documentai.v1beta3.Document.Page.Layout.Orientation|null} [orientation] Layout orientation + */ + + /** + * Constructs a new Layout. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @classdesc Represents a Layout. + * @implements ILayout + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Page.ILayout=} [properties] Properties to set + */ + function Layout(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Layout textAnchor. + * @member {google.cloud.documentai.v1beta3.Document.ITextAnchor|null|undefined} textAnchor + * @memberof google.cloud.documentai.v1beta3.Document.Page.Layout + * @instance + */ + Layout.prototype.textAnchor = null; + + /** + * Layout confidence. + * @member {number} confidence + * @memberof google.cloud.documentai.v1beta3.Document.Page.Layout + * @instance + */ + Layout.prototype.confidence = 0; + + /** + * Layout boundingPoly. + * @member {google.cloud.documentai.v1beta3.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.documentai.v1beta3.Document.Page.Layout + * @instance + */ + Layout.prototype.boundingPoly = null; + + /** + * Layout orientation. + * @member {google.cloud.documentai.v1beta3.Document.Page.Layout.Orientation} orientation + * @memberof google.cloud.documentai.v1beta3.Document.Page.Layout + * @instance + */ + Layout.prototype.orientation = 0; + + /** + * Creates a new Layout instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.Layout + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.ILayout=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.Layout} Layout instance + */ + Layout.create = function create(properties) { + return new Layout(properties); + }; + + /** + * Encodes the specified Layout message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Layout.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Layout + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.ILayout} message Layout message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Layout.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textAnchor != null && Object.hasOwnProperty.call(message, "textAnchor")) + $root.google.cloud.documentai.v1beta3.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) + $root.google.cloud.documentai.v1beta3.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.orientation != null && Object.hasOwnProperty.call(message, "orientation")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.orientation); + return writer; + }; + + /** + * Encodes the specified Layout message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Layout.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Layout + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.ILayout} message Layout message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Layout.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Layout message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Layout + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page.Layout} Layout + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Layout.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Page.Layout(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.decode(reader, reader.uint32()); + break; + case 2: + message.confidence = reader.float(); + break; + case 3: + message.boundingPoly = $root.google.cloud.documentai.v1beta3.BoundingPoly.decode(reader, reader.uint32()); + break; + case 4: + message.orientation = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Layout message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Layout + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page.Layout} Layout + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Layout.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Layout message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Page.Layout + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Layout.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) { + var error = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.verify(message.textAnchor); + if (error) + return "textAnchor." + error; + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { + var error = $root.google.cloud.documentai.v1beta3.BoundingPoly.verify(message.boundingPoly); + if (error) + return "boundingPoly." + error; + } + if (message.orientation != null && message.hasOwnProperty("orientation")) + switch (message.orientation) { + default: + return "orientation: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a Layout message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Layout + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page.Layout} Layout + */ + Layout.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page.Layout) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page.Layout(); + if (object.textAnchor != null) { + if (typeof object.textAnchor !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Layout.textAnchor: object expected"); + message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.fromObject(object.textAnchor); + } + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Layout.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.documentai.v1beta3.BoundingPoly.fromObject(object.boundingPoly); + } + switch (object.orientation) { + case "ORIENTATION_UNSPECIFIED": + case 0: + message.orientation = 0; + break; + case "PAGE_UP": + case 1: + message.orientation = 1; + break; + case "PAGE_RIGHT": + case 2: + message.orientation = 2; + break; + case "PAGE_DOWN": + case 3: + message.orientation = 3; + break; + case "PAGE_LEFT": + case 4: + message.orientation = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a Layout message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Layout + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Layout} message Layout + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Layout.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.textAnchor = null; + object.confidence = 0; + object.boundingPoly = null; + object.orientation = options.enums === String ? "ORIENTATION_UNSPECIFIED" : 0; + } + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + object.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.toObject(message.textAnchor, options); + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.documentai.v1beta3.BoundingPoly.toObject(message.boundingPoly, options); + if (message.orientation != null && message.hasOwnProperty("orientation")) + object.orientation = options.enums === String ? $root.google.cloud.documentai.v1beta3.Document.Page.Layout.Orientation[message.orientation] : message.orientation; + return object; + }; + + /** + * Converts this Layout to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page.Layout + * @instance + * @returns {Object.} JSON object + */ + Layout.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Orientation enum. + * @name google.cloud.documentai.v1beta3.Document.Page.Layout.Orientation + * @enum {number} + * @property {number} ORIENTATION_UNSPECIFIED=0 ORIENTATION_UNSPECIFIED value + * @property {number} PAGE_UP=1 PAGE_UP value + * @property {number} PAGE_RIGHT=2 PAGE_RIGHT value + * @property {number} PAGE_DOWN=3 PAGE_DOWN value + * @property {number} PAGE_LEFT=4 PAGE_LEFT value + */ + Layout.Orientation = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ORIENTATION_UNSPECIFIED"] = 0; + values[valuesById[1] = "PAGE_UP"] = 1; + values[valuesById[2] = "PAGE_RIGHT"] = 2; + values[valuesById[3] = "PAGE_DOWN"] = 3; + values[valuesById[4] = "PAGE_LEFT"] = 4; + return values; + })(); + + return Layout; + })(); + + Page.Block = (function() { + + /** + * Properties of a Block. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @interface IBlock + * @property {google.cloud.documentai.v1beta3.Document.Page.ILayout|null} [layout] Block layout + * @property {Array.|null} [detectedLanguages] Block detectedLanguages + * @property {google.cloud.documentai.v1beta3.Document.IProvenance|null} [provenance] Block provenance + */ + + /** + * Constructs a new Block. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @classdesc Represents a Block. + * @implements IBlock + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Page.IBlock=} [properties] Properties to set + */ + function Block(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Block layout. + * @member {google.cloud.documentai.v1beta3.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta3.Document.Page.Block + * @instance + */ + Block.prototype.layout = null; + + /** + * Block detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta3.Document.Page.Block + * @instance + */ + Block.prototype.detectedLanguages = $util.emptyArray; + + /** + * Block provenance. + * @member {google.cloud.documentai.v1beta3.Document.IProvenance|null|undefined} provenance + * @memberof google.cloud.documentai.v1beta3.Document.Page.Block + * @instance + */ + Block.prototype.provenance = null; + + /** + * Creates a new Block instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.Block + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IBlock=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.Block} Block instance + */ + Block.create = function create(properties) { + return new Block(properties); + }; + + /** + * Encodes the specified Block message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Block.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Block + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IBlock} message Block message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Block.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1beta3.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) + $root.google.cloud.documentai.v1beta3.Document.Provenance.encode(message.provenance, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Block message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Block.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Block + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IBlock} message Block message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Block.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Block message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Block + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page.Block} Block + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Block.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Page.Block(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + case 3: + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Block message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Block + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page.Block} Block + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Block.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Block message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Page.Block + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Block.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + if (message.provenance != null && message.hasOwnProperty("provenance")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Provenance.verify(message.provenance); + if (error) + return "provenance." + error; + } + return null; + }; + + /** + * Creates a Block message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Block + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page.Block} Block + */ + Block.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page.Block) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page.Block(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Block.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Block.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Block.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + if (object.provenance != null) { + if (typeof object.provenance !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Block.provenance: object expected"); + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.fromObject(object.provenance); + } + return message; + }; + + /** + * Creates a plain object from a Block message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Block + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Block} message Block + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Block.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) { + object.layout = null; + object.provenance = null; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + if (message.provenance != null && message.hasOwnProperty("provenance")) + object.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.toObject(message.provenance, options); + return object; + }; + + /** + * Converts this Block to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page.Block + * @instance + * @returns {Object.} JSON object + */ + Block.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Block; + })(); + + Page.Paragraph = (function() { + + /** + * Properties of a Paragraph. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @interface IParagraph + * @property {google.cloud.documentai.v1beta3.Document.Page.ILayout|null} [layout] Paragraph layout + * @property {Array.|null} [detectedLanguages] Paragraph detectedLanguages + * @property {google.cloud.documentai.v1beta3.Document.IProvenance|null} [provenance] Paragraph provenance + */ + + /** + * Constructs a new Paragraph. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @classdesc Represents a Paragraph. + * @implements IParagraph + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Page.IParagraph=} [properties] Properties to set + */ + function Paragraph(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Paragraph layout. + * @member {google.cloud.documentai.v1beta3.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta3.Document.Page.Paragraph + * @instance + */ + Paragraph.prototype.layout = null; + + /** + * Paragraph detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta3.Document.Page.Paragraph + * @instance + */ + Paragraph.prototype.detectedLanguages = $util.emptyArray; + + /** + * Paragraph provenance. + * @member {google.cloud.documentai.v1beta3.Document.IProvenance|null|undefined} provenance + * @memberof google.cloud.documentai.v1beta3.Document.Page.Paragraph + * @instance + */ + Paragraph.prototype.provenance = null; + + /** + * Creates a new Paragraph instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.Paragraph + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IParagraph=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.Paragraph} Paragraph instance + */ + Paragraph.create = function create(properties) { + return new Paragraph(properties); + }; + + /** + * Encodes the specified Paragraph message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Paragraph.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Paragraph + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IParagraph} message Paragraph message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Paragraph.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1beta3.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) + $root.google.cloud.documentai.v1beta3.Document.Provenance.encode(message.provenance, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Paragraph message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Paragraph.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Paragraph + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IParagraph} message Paragraph message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Paragraph.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Paragraph message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Paragraph + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page.Paragraph} Paragraph + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Paragraph.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Page.Paragraph(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + case 3: + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Paragraph message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Paragraph + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page.Paragraph} Paragraph + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Paragraph.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Paragraph message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Page.Paragraph + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Paragraph.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + if (message.provenance != null && message.hasOwnProperty("provenance")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Provenance.verify(message.provenance); + if (error) + return "provenance." + error; + } + return null; + }; + + /** + * Creates a Paragraph message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Paragraph + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page.Paragraph} Paragraph + */ + Paragraph.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page.Paragraph) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page.Paragraph(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Paragraph.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Paragraph.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Paragraph.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + if (object.provenance != null) { + if (typeof object.provenance !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Paragraph.provenance: object expected"); + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.fromObject(object.provenance); + } + return message; + }; + + /** + * Creates a plain object from a Paragraph message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Paragraph + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Paragraph} message Paragraph + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Paragraph.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) { + object.layout = null; + object.provenance = null; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + if (message.provenance != null && message.hasOwnProperty("provenance")) + object.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.toObject(message.provenance, options); + return object; + }; + + /** + * Converts this Paragraph to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page.Paragraph + * @instance + * @returns {Object.} JSON object + */ + Paragraph.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Paragraph; + })(); + + Page.Line = (function() { + + /** + * Properties of a Line. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @interface ILine + * @property {google.cloud.documentai.v1beta3.Document.Page.ILayout|null} [layout] Line layout + * @property {Array.|null} [detectedLanguages] Line detectedLanguages + * @property {google.cloud.documentai.v1beta3.Document.IProvenance|null} [provenance] Line provenance + */ + + /** + * Constructs a new Line. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @classdesc Represents a Line. + * @implements ILine + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Page.ILine=} [properties] Properties to set + */ + function Line(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Line layout. + * @member {google.cloud.documentai.v1beta3.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta3.Document.Page.Line + * @instance + */ + Line.prototype.layout = null; + + /** + * Line detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta3.Document.Page.Line + * @instance + */ + Line.prototype.detectedLanguages = $util.emptyArray; + + /** + * Line provenance. + * @member {google.cloud.documentai.v1beta3.Document.IProvenance|null|undefined} provenance + * @memberof google.cloud.documentai.v1beta3.Document.Page.Line + * @instance + */ + Line.prototype.provenance = null; + + /** + * Creates a new Line instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.Line + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.ILine=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.Line} Line instance + */ + Line.create = function create(properties) { + return new Line(properties); + }; + + /** + * Encodes the specified Line message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Line.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Line + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.ILine} message Line message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Line.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1beta3.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) + $root.google.cloud.documentai.v1beta3.Document.Provenance.encode(message.provenance, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Line message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Line.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Line + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.ILine} message Line message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Line.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Line message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Line + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page.Line} Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Line.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Page.Line(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + case 3: + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Line message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Line + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page.Line} Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Line.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Line message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Page.Line + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Line.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + if (message.provenance != null && message.hasOwnProperty("provenance")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Provenance.verify(message.provenance); + if (error) + return "provenance." + error; + } + return null; + }; + + /** + * Creates a Line message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Line + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page.Line} Line + */ + Line.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page.Line) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page.Line(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Line.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Line.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Line.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + if (object.provenance != null) { + if (typeof object.provenance !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Line.provenance: object expected"); + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.fromObject(object.provenance); + } + return message; + }; + + /** + * Creates a plain object from a Line message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Line + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Line} message Line + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Line.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) { + object.layout = null; + object.provenance = null; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + if (message.provenance != null && message.hasOwnProperty("provenance")) + object.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.toObject(message.provenance, options); + return object; + }; + + /** + * Converts this Line to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page.Line + * @instance + * @returns {Object.} JSON object + */ + Line.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Line; + })(); + + Page.Token = (function() { + + /** + * Properties of a Token. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @interface IToken + * @property {google.cloud.documentai.v1beta3.Document.Page.ILayout|null} [layout] Token layout + * @property {google.cloud.documentai.v1beta3.Document.Page.Token.IDetectedBreak|null} [detectedBreak] Token detectedBreak + * @property {Array.|null} [detectedLanguages] Token detectedLanguages + * @property {google.cloud.documentai.v1beta3.Document.IProvenance|null} [provenance] Token provenance + */ + + /** + * Constructs a new Token. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @classdesc Represents a Token. + * @implements IToken + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Page.IToken=} [properties] Properties to set + */ + function Token(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Token layout. + * @member {google.cloud.documentai.v1beta3.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token + * @instance + */ + Token.prototype.layout = null; + + /** + * Token detectedBreak. + * @member {google.cloud.documentai.v1beta3.Document.Page.Token.IDetectedBreak|null|undefined} detectedBreak + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token + * @instance + */ + Token.prototype.detectedBreak = null; + + /** + * Token detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token + * @instance + */ + Token.prototype.detectedLanguages = $util.emptyArray; + + /** + * Token provenance. + * @member {google.cloud.documentai.v1beta3.Document.IProvenance|null|undefined} provenance + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token + * @instance + */ + Token.prototype.provenance = null; + + /** + * Creates a new Token instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IToken=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.Token} Token instance + */ + Token.create = function create(properties) { + return new Token(properties); + }; + + /** + * Encodes the specified Token message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Token.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IToken} message Token message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Token.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1beta3.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectedBreak != null && Object.hasOwnProperty.call(message, "detectedBreak")) + $root.google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.encode(message.detectedBreak, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) + $root.google.cloud.documentai.v1beta3.Document.Provenance.encode(message.provenance, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Token message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Token.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IToken} message Token message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Token.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Token message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page.Token} Token + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Token.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Page.Token(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + message.detectedBreak = $root.google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.decode(reader, reader.uint32()); + break; + case 3: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + case 4: + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Token message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page.Token} Token + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Token.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Token message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Token.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.verify(message.detectedBreak); + if (error) + return "detectedBreak." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + if (message.provenance != null && message.hasOwnProperty("provenance")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Provenance.verify(message.provenance); + if (error) + return "provenance." + error; + } + return null; + }; + + /** + * Creates a Token message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page.Token} Token + */ + Token.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page.Token) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page.Token(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Token.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedBreak != null) { + if (typeof object.detectedBreak !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Token.detectedBreak: object expected"); + message.detectedBreak = $root.google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.fromObject(object.detectedBreak); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Token.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Token.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + if (object.provenance != null) { + if (typeof object.provenance !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Token.provenance: object expected"); + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.fromObject(object.provenance); + } + return message; + }; + + /** + * Creates a plain object from a Token message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Token} message Token + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Token.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) { + object.layout = null; + object.detectedBreak = null; + object.provenance = null; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) + object.detectedBreak = $root.google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.toObject(message.detectedBreak, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + if (message.provenance != null && message.hasOwnProperty("provenance")) + object.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.toObject(message.provenance, options); + return object; + }; + + /** + * Converts this Token to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token + * @instance + * @returns {Object.} JSON object + */ + Token.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Token.DetectedBreak = (function() { + + /** + * Properties of a DetectedBreak. + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token + * @interface IDetectedBreak + * @property {google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.Type|null} [type] DetectedBreak type + */ + + /** + * Constructs a new DetectedBreak. + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token + * @classdesc Represents a DetectedBreak. + * @implements IDetectedBreak + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Page.Token.IDetectedBreak=} [properties] Properties to set + */ + function DetectedBreak(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DetectedBreak type. + * @member {google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.Type} type + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak + * @instance + */ + DetectedBreak.prototype.type = 0; + + /** + * Creates a new DetectedBreak instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Token.IDetectedBreak=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak} DetectedBreak instance + */ + DetectedBreak.create = function create(properties) { + return new DetectedBreak(properties); + }; + + /** + * Encodes the specified DetectedBreak message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Token.IDetectedBreak} message DetectedBreak message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedBreak.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); + return writer; + }; + + /** + * Encodes the specified DetectedBreak message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Token.IDetectedBreak} message DetectedBreak message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedBreak.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectedBreak message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak} DetectedBreak + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedBreak.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectedBreak message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak} DetectedBreak + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedBreak.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectedBreak message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectedBreak.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object 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; + } + return null; + }; + + /** + * Creates a DetectedBreak message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak} DetectedBreak + */ + DetectedBreak.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak(); + switch (object.type) { + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "SPACE": + case 1: + message.type = 1; + break; + case "WIDE_SPACE": + case 2: + message.type = 2; + break; + case "HYPHEN": + case 3: + message.type = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a DetectedBreak message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak} message DetectedBreak + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectedBreak.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.Type[message.type] : message.type; + return object; + }; + + /** + * Converts this DetectedBreak to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak + * @instance + * @returns {Object.} JSON object + */ + DetectedBreak.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Type enum. + * @name google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} SPACE=1 SPACE value + * @property {number} WIDE_SPACE=2 WIDE_SPACE value + * @property {number} HYPHEN=3 HYPHEN value + */ + DetectedBreak.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SPACE"] = 1; + values[valuesById[2] = "WIDE_SPACE"] = 2; + values[valuesById[3] = "HYPHEN"] = 3; + return values; + })(); + + return DetectedBreak; + })(); + + return Token; + })(); + + Page.VisualElement = (function() { + + /** + * Properties of a VisualElement. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @interface IVisualElement + * @property {google.cloud.documentai.v1beta3.Document.Page.ILayout|null} [layout] VisualElement layout + * @property {string|null} [type] VisualElement type + * @property {Array.|null} [detectedLanguages] VisualElement detectedLanguages + */ + + /** + * Constructs a new VisualElement. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @classdesc Represents a VisualElement. + * @implements IVisualElement + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Page.IVisualElement=} [properties] Properties to set + */ + function VisualElement(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * VisualElement layout. + * @member {google.cloud.documentai.v1beta3.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta3.Document.Page.VisualElement + * @instance + */ + VisualElement.prototype.layout = null; + + /** + * VisualElement type. + * @member {string} type + * @memberof google.cloud.documentai.v1beta3.Document.Page.VisualElement + * @instance + */ + VisualElement.prototype.type = ""; + + /** + * VisualElement detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta3.Document.Page.VisualElement + * @instance + */ + VisualElement.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new VisualElement instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.VisualElement + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IVisualElement=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.VisualElement} VisualElement instance + */ + VisualElement.create = function create(properties) { + return new VisualElement(properties); + }; + + /** + * Encodes the specified VisualElement message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.VisualElement.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page.VisualElement + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IVisualElement} message VisualElement message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisualElement.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1beta3.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified VisualElement message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.VisualElement.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.VisualElement + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IVisualElement} message VisualElement message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisualElement.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VisualElement message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Page.VisualElement + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page.VisualElement} VisualElement + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisualElement.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Page.VisualElement(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + message.type = reader.string(); + break; + case 3: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VisualElement message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.VisualElement + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page.VisualElement} VisualElement + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisualElement.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VisualElement message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Page.VisualElement + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VisualElement.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a VisualElement message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.VisualElement + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page.VisualElement} VisualElement + */ + VisualElement.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page.VisualElement) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page.VisualElement(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.VisualElement.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.fromObject(object.layout); + } + if (object.type != null) + message.type = String(object.type); + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.VisualElement.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.VisualElement.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a VisualElement message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.VisualElement + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.VisualElement} message VisualElement + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VisualElement.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) { + object.layout = null; + object.type = ""; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.toObject(message.layout, options); + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this VisualElement to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page.VisualElement + * @instance + * @returns {Object.} JSON object + */ + VisualElement.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return VisualElement; + })(); + + Page.Table = (function() { + + /** + * Properties of a Table. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @interface ITable + * @property {google.cloud.documentai.v1beta3.Document.Page.ILayout|null} [layout] Table layout + * @property {Array.|null} [headerRows] Table headerRows + * @property {Array.|null} [bodyRows] Table bodyRows + * @property {Array.|null} [detectedLanguages] Table detectedLanguages + */ + + /** + * Constructs a new Table. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @classdesc Represents a Table. + * @implements ITable + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Page.ITable=} [properties] Properties to set + */ + function Table(properties) { + this.headerRows = []; + this.bodyRows = []; + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Table layout. + * @member {google.cloud.documentai.v1beta3.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table + * @instance + */ + Table.prototype.layout = null; + + /** + * Table headerRows. + * @member {Array.} headerRows + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table + * @instance + */ + Table.prototype.headerRows = $util.emptyArray; + + /** + * Table bodyRows. + * @member {Array.} bodyRows + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table + * @instance + */ + Table.prototype.bodyRows = $util.emptyArray; + + /** + * Table detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table + * @instance + */ + Table.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new Table instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.ITable=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.Table} Table instance + */ + Table.create = function create(properties) { + return new Table(properties); + }; + + /** + * Encodes the specified Table message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Table.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.ITable} message Table message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Table.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1beta3.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.headerRows != null && message.headerRows.length) + for (var i = 0; i < message.headerRows.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.Table.TableRow.encode(message.headerRows[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bodyRows != null && message.bodyRows.length) + for (var i = 0; i < message.bodyRows.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.Table.TableRow.encode(message.bodyRows[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Table message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Table.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.ITable} message Table message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Table.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Table message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page.Table} Table + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Table.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Page.Table(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.headerRows && message.headerRows.length)) + message.headerRows = []; + message.headerRows.push($root.google.cloud.documentai.v1beta3.Document.Page.Table.TableRow.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.bodyRows && message.bodyRows.length)) + message.bodyRows = []; + message.bodyRows.push($root.google.cloud.documentai.v1beta3.Document.Page.Table.TableRow.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Table message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page.Table} Table + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Table.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Table message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Table.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.headerRows != null && message.hasOwnProperty("headerRows")) { + if (!Array.isArray(message.headerRows)) + return "headerRows: array expected"; + for (var i = 0; i < message.headerRows.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Table.TableRow.verify(message.headerRows[i]); + if (error) + return "headerRows." + error; + } + } + if (message.bodyRows != null && message.hasOwnProperty("bodyRows")) { + if (!Array.isArray(message.bodyRows)) + return "bodyRows: array expected"; + for (var i = 0; i < message.bodyRows.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Table.TableRow.verify(message.bodyRows[i]); + if (error) + return "bodyRows." + error; + } + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a Table message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page.Table} Table + */ + Table.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page.Table) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page.Table(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Table.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.fromObject(object.layout); + } + if (object.headerRows) { + if (!Array.isArray(object.headerRows)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Table.headerRows: array expected"); + message.headerRows = []; + for (var i = 0; i < object.headerRows.length; ++i) { + if (typeof object.headerRows[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Table.headerRows: object expected"); + message.headerRows[i] = $root.google.cloud.documentai.v1beta3.Document.Page.Table.TableRow.fromObject(object.headerRows[i]); + } + } + if (object.bodyRows) { + if (!Array.isArray(object.bodyRows)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Table.bodyRows: array expected"); + message.bodyRows = []; + for (var i = 0; i < object.bodyRows.length; ++i) { + if (typeof object.bodyRows[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Table.bodyRows: object expected"); + message.bodyRows[i] = $root.google.cloud.documentai.v1beta3.Document.Page.Table.TableRow.fromObject(object.bodyRows[i]); + } + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Table.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Table.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Table message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Table} message Table + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Table.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.headerRows = []; + object.bodyRows = []; + object.detectedLanguages = []; + } + if (options.defaults) + object.layout = null; + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.toObject(message.layout, options); + if (message.headerRows && message.headerRows.length) { + object.headerRows = []; + for (var j = 0; j < message.headerRows.length; ++j) + object.headerRows[j] = $root.google.cloud.documentai.v1beta3.Document.Page.Table.TableRow.toObject(message.headerRows[j], options); + } + if (message.bodyRows && message.bodyRows.length) { + object.bodyRows = []; + for (var j = 0; j < message.bodyRows.length; ++j) + object.bodyRows[j] = $root.google.cloud.documentai.v1beta3.Document.Page.Table.TableRow.toObject(message.bodyRows[j], options); + } + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this Table to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table + * @instance + * @returns {Object.} JSON object + */ + Table.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Table.TableRow = (function() { + + /** + * Properties of a TableRow. + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table + * @interface ITableRow + * @property {Array.|null} [cells] TableRow cells + */ + + /** + * Constructs a new TableRow. + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table + * @classdesc Represents a TableRow. + * @implements ITableRow + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Page.Table.ITableRow=} [properties] Properties to set + */ + function TableRow(properties) { + this.cells = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TableRow cells. + * @member {Array.} cells + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableRow + * @instance + */ + TableRow.prototype.cells = $util.emptyArray; + + /** + * Creates a new TableRow instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableRow + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Table.ITableRow=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.Table.TableRow} TableRow instance + */ + TableRow.create = function create(properties) { + return new TableRow(properties); + }; + + /** + * Encodes the specified TableRow message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Table.TableRow.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableRow + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Table.ITableRow} message TableRow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableRow.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cells != null && message.cells.length) + for (var i = 0; i < message.cells.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.Table.TableCell.encode(message.cells[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TableRow message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Table.TableRow.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableRow + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Table.ITableRow} message TableRow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableRow.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableRow message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableRow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page.Table.TableRow} TableRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableRow.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Page.Table.TableRow(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.cells && message.cells.length)) + message.cells = []; + message.cells.push($root.google.cloud.documentai.v1beta3.Document.Page.Table.TableCell.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableRow message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableRow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page.Table.TableRow} TableRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableRow.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableRow message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableRow + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableRow.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cells != null && message.hasOwnProperty("cells")) { + if (!Array.isArray(message.cells)) + return "cells: array expected"; + for (var i = 0; i < message.cells.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Table.TableCell.verify(message.cells[i]); + if (error) + return "cells." + error; + } + } + return null; + }; + + /** + * Creates a TableRow message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableRow + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page.Table.TableRow} TableRow + */ + TableRow.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page.Table.TableRow) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page.Table.TableRow(); + if (object.cells) { + if (!Array.isArray(object.cells)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Table.TableRow.cells: array expected"); + message.cells = []; + for (var i = 0; i < object.cells.length; ++i) { + if (typeof object.cells[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Table.TableRow.cells: object expected"); + message.cells[i] = $root.google.cloud.documentai.v1beta3.Document.Page.Table.TableCell.fromObject(object.cells[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TableRow message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableRow + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Table.TableRow} message TableRow + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableRow.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.cells = []; + if (message.cells && message.cells.length) { + object.cells = []; + for (var j = 0; j < message.cells.length; ++j) + object.cells[j] = $root.google.cloud.documentai.v1beta3.Document.Page.Table.TableCell.toObject(message.cells[j], options); + } + return object; + }; + + /** + * Converts this TableRow to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableRow + * @instance + * @returns {Object.} JSON object + */ + TableRow.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TableRow; + })(); + + Table.TableCell = (function() { + + /** + * Properties of a TableCell. + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table + * @interface ITableCell + * @property {google.cloud.documentai.v1beta3.Document.Page.ILayout|null} [layout] TableCell layout + * @property {number|null} [rowSpan] TableCell rowSpan + * @property {number|null} [colSpan] TableCell colSpan + * @property {Array.|null} [detectedLanguages] TableCell detectedLanguages + */ + + /** + * Constructs a new TableCell. + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table + * @classdesc Represents a TableCell. + * @implements ITableCell + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Page.Table.ITableCell=} [properties] Properties to set + */ + function TableCell(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TableCell layout. + * @member {google.cloud.documentai.v1beta3.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableCell + * @instance + */ + TableCell.prototype.layout = null; + + /** + * TableCell rowSpan. + * @member {number} rowSpan + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableCell + * @instance + */ + TableCell.prototype.rowSpan = 0; + + /** + * TableCell colSpan. + * @member {number} colSpan + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableCell + * @instance + */ + TableCell.prototype.colSpan = 0; + + /** + * TableCell detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableCell + * @instance + */ + TableCell.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new TableCell instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableCell + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Table.ITableCell=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.Table.TableCell} TableCell instance + */ + TableCell.create = function create(properties) { + return new TableCell(properties); + }; + + /** + * Encodes the specified TableCell message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Table.TableCell.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableCell + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Table.ITableCell} message TableCell message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableCell.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1beta3.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.rowSpan != null && Object.hasOwnProperty.call(message, "rowSpan")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.rowSpan); + if (message.colSpan != null && Object.hasOwnProperty.call(message, "colSpan")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.colSpan); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TableCell message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Table.TableCell.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableCell + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Table.ITableCell} message TableCell message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableCell.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableCell message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableCell + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page.Table.TableCell} TableCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableCell.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Page.Table.TableCell(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + message.rowSpan = reader.int32(); + break; + case 3: + message.colSpan = reader.int32(); + break; + case 4: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableCell message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableCell + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page.Table.TableCell} TableCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableCell.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableCell message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableCell + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableCell.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.rowSpan != null && message.hasOwnProperty("rowSpan")) + if (!$util.isInteger(message.rowSpan)) + return "rowSpan: integer expected"; + if (message.colSpan != null && message.hasOwnProperty("colSpan")) + if (!$util.isInteger(message.colSpan)) + return "colSpan: integer expected"; + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a TableCell message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableCell + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page.Table.TableCell} TableCell + */ + TableCell.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page.Table.TableCell) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page.Table.TableCell(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Table.TableCell.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.fromObject(object.layout); + } + if (object.rowSpan != null) + message.rowSpan = object.rowSpan | 0; + if (object.colSpan != null) + message.colSpan = object.colSpan | 0; + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Table.TableCell.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Table.TableCell.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TableCell message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableCell + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Table.TableCell} message TableCell + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableCell.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) { + object.layout = null; + object.rowSpan = 0; + object.colSpan = 0; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.toObject(message.layout, options); + if (message.rowSpan != null && message.hasOwnProperty("rowSpan")) + object.rowSpan = message.rowSpan; + if (message.colSpan != null && message.hasOwnProperty("colSpan")) + object.colSpan = message.colSpan; + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this TableCell to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableCell + * @instance + * @returns {Object.} JSON object + */ + TableCell.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TableCell; + })(); + + return Table; + })(); + + Page.FormField = (function() { + + /** + * Properties of a FormField. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @interface IFormField + * @property {google.cloud.documentai.v1beta3.Document.Page.ILayout|null} [fieldName] FormField fieldName + * @property {google.cloud.documentai.v1beta3.Document.Page.ILayout|null} [fieldValue] FormField fieldValue + * @property {Array.|null} [nameDetectedLanguages] FormField nameDetectedLanguages + * @property {Array.|null} [valueDetectedLanguages] FormField valueDetectedLanguages + * @property {string|null} [valueType] FormField valueType + */ + + /** + * Constructs a new FormField. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @classdesc Represents a FormField. + * @implements IFormField + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Page.IFormField=} [properties] Properties to set + */ + function FormField(properties) { + this.nameDetectedLanguages = []; + this.valueDetectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FormField fieldName. + * @member {google.cloud.documentai.v1beta3.Document.Page.ILayout|null|undefined} fieldName + * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField + * @instance + */ + FormField.prototype.fieldName = null; + + /** + * FormField fieldValue. + * @member {google.cloud.documentai.v1beta3.Document.Page.ILayout|null|undefined} fieldValue + * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField + * @instance + */ + FormField.prototype.fieldValue = null; + + /** + * FormField nameDetectedLanguages. + * @member {Array.} nameDetectedLanguages + * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField + * @instance + */ + FormField.prototype.nameDetectedLanguages = $util.emptyArray; + + /** + * FormField valueDetectedLanguages. + * @member {Array.} valueDetectedLanguages + * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField + * @instance + */ + FormField.prototype.valueDetectedLanguages = $util.emptyArray; + + /** + * FormField valueType. + * @member {string} valueType + * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField + * @instance + */ + FormField.prototype.valueType = ""; + + /** + * Creates a new FormField instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IFormField=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.FormField} FormField instance + */ + FormField.create = function create(properties) { + return new FormField(properties); + }; + + /** + * Encodes the specified FormField message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.FormField.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IFormField} message FormField message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FormField.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fieldName != null && Object.hasOwnProperty.call(message, "fieldName")) + $root.google.cloud.documentai.v1beta3.Document.Page.Layout.encode(message.fieldName, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fieldValue != null && Object.hasOwnProperty.call(message, "fieldValue")) + $root.google.cloud.documentai.v1beta3.Document.Page.Layout.encode(message.fieldValue, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nameDetectedLanguages != null && message.nameDetectedLanguages.length) + for (var i = 0; i < message.nameDetectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.encode(message.nameDetectedLanguages[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.valueDetectedLanguages != null && message.valueDetectedLanguages.length) + for (var i = 0; i < message.valueDetectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.encode(message.valueDetectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.valueType != null && Object.hasOwnProperty.call(message, "valueType")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.valueType); + return writer; + }; + + /** + * Encodes the specified FormField message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.FormField.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IFormField} message FormField message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FormField.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FormField message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page.FormField} FormField + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FormField.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Page.FormField(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fieldName = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + message.fieldValue = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 3: + if (!(message.nameDetectedLanguages && message.nameDetectedLanguages.length)) + message.nameDetectedLanguages = []; + message.nameDetectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.valueDetectedLanguages && message.valueDetectedLanguages.length)) + message.valueDetectedLanguages = []; + message.valueDetectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + case 5: + message.valueType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FormField message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page.FormField} FormField + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FormField.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FormField message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FormField.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fieldName != null && message.hasOwnProperty("fieldName")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.verify(message.fieldName); + if (error) + return "fieldName." + error; + } + if (message.fieldValue != null && message.hasOwnProperty("fieldValue")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.verify(message.fieldValue); + if (error) + return "fieldValue." + error; + } + if (message.nameDetectedLanguages != null && message.hasOwnProperty("nameDetectedLanguages")) { + if (!Array.isArray(message.nameDetectedLanguages)) + return "nameDetectedLanguages: array expected"; + for (var i = 0; i < message.nameDetectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.verify(message.nameDetectedLanguages[i]); + if (error) + return "nameDetectedLanguages." + error; + } + } + if (message.valueDetectedLanguages != null && message.hasOwnProperty("valueDetectedLanguages")) { + if (!Array.isArray(message.valueDetectedLanguages)) + return "valueDetectedLanguages: array expected"; + for (var i = 0; i < message.valueDetectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.verify(message.valueDetectedLanguages[i]); + if (error) + return "valueDetectedLanguages." + error; + } + } + if (message.valueType != null && message.hasOwnProperty("valueType")) + if (!$util.isString(message.valueType)) + return "valueType: string expected"; + return null; + }; + + /** + * Creates a FormField message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page.FormField} FormField + */ + FormField.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page.FormField) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page.FormField(); + if (object.fieldName != null) { + if (typeof object.fieldName !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.FormField.fieldName: object expected"); + message.fieldName = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.fromObject(object.fieldName); + } + if (object.fieldValue != null) { + if (typeof object.fieldValue !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.FormField.fieldValue: object expected"); + message.fieldValue = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.fromObject(object.fieldValue); + } + if (object.nameDetectedLanguages) { + if (!Array.isArray(object.nameDetectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.FormField.nameDetectedLanguages: array expected"); + message.nameDetectedLanguages = []; + for (var i = 0; i < object.nameDetectedLanguages.length; ++i) { + if (typeof object.nameDetectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.FormField.nameDetectedLanguages: object expected"); + message.nameDetectedLanguages[i] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.fromObject(object.nameDetectedLanguages[i]); + } + } + if (object.valueDetectedLanguages) { + if (!Array.isArray(object.valueDetectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.FormField.valueDetectedLanguages: array expected"); + message.valueDetectedLanguages = []; + for (var i = 0; i < object.valueDetectedLanguages.length; ++i) { + if (typeof object.valueDetectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.FormField.valueDetectedLanguages: object expected"); + message.valueDetectedLanguages[i] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.fromObject(object.valueDetectedLanguages[i]); + } + } + if (object.valueType != null) + message.valueType = String(object.valueType); + return message; + }; + + /** + * Creates a plain object from a FormField message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.FormField} message FormField + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FormField.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.nameDetectedLanguages = []; + object.valueDetectedLanguages = []; + } + if (options.defaults) { + object.fieldName = null; + object.fieldValue = null; + object.valueType = ""; + } + if (message.fieldName != null && message.hasOwnProperty("fieldName")) + object.fieldName = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.toObject(message.fieldName, options); + if (message.fieldValue != null && message.hasOwnProperty("fieldValue")) + object.fieldValue = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.toObject(message.fieldValue, options); + if (message.nameDetectedLanguages && message.nameDetectedLanguages.length) { + object.nameDetectedLanguages = []; + for (var j = 0; j < message.nameDetectedLanguages.length; ++j) + object.nameDetectedLanguages[j] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.toObject(message.nameDetectedLanguages[j], options); + } + if (message.valueDetectedLanguages && message.valueDetectedLanguages.length) { + object.valueDetectedLanguages = []; + for (var j = 0; j < message.valueDetectedLanguages.length; ++j) + object.valueDetectedLanguages[j] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.toObject(message.valueDetectedLanguages[j], options); + } + if (message.valueType != null && message.hasOwnProperty("valueType")) + object.valueType = message.valueType; + return object; + }; + + /** + * Converts this FormField to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField + * @instance + * @returns {Object.} JSON object + */ + FormField.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FormField; + })(); + + Page.DetectedLanguage = (function() { + + /** + * Properties of a DetectedLanguage. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @interface IDetectedLanguage + * @property {string|null} [languageCode] DetectedLanguage languageCode + * @property {number|null} [confidence] DetectedLanguage confidence + */ + + /** + * Constructs a new DetectedLanguage. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @classdesc Represents a DetectedLanguage. + * @implements IDetectedLanguage + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage=} [properties] Properties to set + */ + function DetectedLanguage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DetectedLanguage languageCode. + * @member {string} languageCode + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage + * @instance + */ + DetectedLanguage.prototype.languageCode = ""; + + /** + * DetectedLanguage confidence. + * @member {number} confidence + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage + * @instance + */ + DetectedLanguage.prototype.confidence = 0; + + /** + * Creates a new DetectedLanguage instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage} DetectedLanguage instance + */ + DetectedLanguage.create = function create(properties) { + return new DetectedLanguage(properties); + }; + + /** + * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage} message DetectedLanguage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedLanguage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.languageCode); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + return writer; + }; + + /** + * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage} message DetectedLanguage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedLanguage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectedLanguage message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage} DetectedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedLanguage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.languageCode = reader.string(); + break; + case 2: + message.confidence = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectedLanguage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage} DetectedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedLanguage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectedLanguage message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectedLanguage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + return null; + }; + + /** + * Creates a DetectedLanguage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage} DetectedLanguage + */ + DetectedLanguage.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage(); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.confidence != null) + message.confidence = Number(object.confidence); + return message; + }; + + /** + * Creates a plain object from a DetectedLanguage message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage} message DetectedLanguage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectedLanguage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.languageCode = ""; + object.confidence = 0; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + return object; + }; + + /** + * Converts this DetectedLanguage to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage + * @instance + * @returns {Object.} JSON object + */ + DetectedLanguage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DetectedLanguage; + })(); + + return Page; + })(); + + Document.Entity = (function() { + + /** + * Properties of an Entity. + * @memberof google.cloud.documentai.v1beta3.Document + * @interface IEntity + * @property {google.cloud.documentai.v1beta3.Document.ITextAnchor|null} [textAnchor] Entity textAnchor + * @property {string|null} [type] Entity type + * @property {string|null} [mentionText] Entity mentionText + * @property {string|null} [mentionId] Entity mentionId + * @property {number|null} [confidence] Entity confidence + * @property {google.cloud.documentai.v1beta3.Document.IPageAnchor|null} [pageAnchor] Entity pageAnchor + * @property {string|null} [id] Entity id + * @property {google.cloud.documentai.v1beta3.Document.Entity.INormalizedValue|null} [normalizedValue] Entity normalizedValue + * @property {Array.|null} [properties] Entity properties + * @property {google.cloud.documentai.v1beta3.Document.IProvenance|null} [provenance] Entity provenance + * @property {boolean|null} [redacted] Entity redacted + */ + + /** + * Constructs a new Entity. + * @memberof google.cloud.documentai.v1beta3.Document + * @classdesc Represents an Entity. + * @implements IEntity + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.IEntity=} [properties] Properties to set + */ + function Entity(properties) { + this.properties = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Entity textAnchor. + * @member {google.cloud.documentai.v1beta3.Document.ITextAnchor|null|undefined} textAnchor + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + */ + Entity.prototype.textAnchor = null; + + /** + * Entity type. + * @member {string} type + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + */ + Entity.prototype.type = ""; + + /** + * Entity mentionText. + * @member {string} mentionText + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + */ + Entity.prototype.mentionText = ""; + + /** + * Entity mentionId. + * @member {string} mentionId + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + */ + Entity.prototype.mentionId = ""; + + /** + * Entity confidence. + * @member {number} confidence + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + */ + Entity.prototype.confidence = 0; + + /** + * Entity pageAnchor. + * @member {google.cloud.documentai.v1beta3.Document.IPageAnchor|null|undefined} pageAnchor + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + */ + Entity.prototype.pageAnchor = null; + + /** + * Entity id. + * @member {string} id + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + */ + Entity.prototype.id = ""; + + /** + * Entity normalizedValue. + * @member {google.cloud.documentai.v1beta3.Document.Entity.INormalizedValue|null|undefined} normalizedValue + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + */ + Entity.prototype.normalizedValue = null; + + /** + * Entity properties. + * @member {Array.} properties + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + */ + Entity.prototype.properties = $util.emptyArray; + + /** + * Entity provenance. + * @member {google.cloud.documentai.v1beta3.Document.IProvenance|null|undefined} provenance + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + */ + Entity.prototype.provenance = null; + + /** + * Entity redacted. + * @member {boolean} redacted + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + */ + Entity.prototype.redacted = false; + + /** + * Creates a new Entity instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @static + * @param {google.cloud.documentai.v1beta3.Document.IEntity=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Entity} Entity instance + */ + Entity.create = function create(properties) { + return new Entity(properties); + }; + + /** + * Encodes the specified Entity message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Entity.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @static + * @param {google.cloud.documentai.v1beta3.Document.IEntity} message Entity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entity.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textAnchor != null && Object.hasOwnProperty.call(message, "textAnchor")) + $root.google.cloud.documentai.v1beta3.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.mentionText != null && Object.hasOwnProperty.call(message, "mentionText")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.mentionText); + if (message.mentionId != null && Object.hasOwnProperty.call(message, "mentionId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.mentionId); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); + if (message.pageAnchor != null && Object.hasOwnProperty.call(message, "pageAnchor")) + $root.google.cloud.documentai.v1beta3.Document.PageAnchor.encode(message.pageAnchor, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.id); + if (message.normalizedValue != null && Object.hasOwnProperty.call(message, "normalizedValue")) + $root.google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue.encode(message.normalizedValue, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.properties != null && message.properties.length) + for (var i = 0; i < message.properties.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Entity.encode(message.properties[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) + $root.google.cloud.documentai.v1beta3.Document.Provenance.encode(message.provenance, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.redacted != null && Object.hasOwnProperty.call(message, "redacted")) + writer.uint32(/* id 12, wireType 0 =*/96).bool(message.redacted); + return writer; + }; + + /** + * Encodes the specified Entity message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Entity.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @static + * @param {google.cloud.documentai.v1beta3.Document.IEntity} message Entity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entity.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Entity message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Entity} Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entity.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Entity(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.decode(reader, reader.uint32()); + break; + case 2: + message.type = reader.string(); + break; + case 3: + message.mentionText = reader.string(); + break; + case 4: + message.mentionId = reader.string(); + break; + case 5: + message.confidence = reader.float(); + break; + case 6: + message.pageAnchor = $root.google.cloud.documentai.v1beta3.Document.PageAnchor.decode(reader, reader.uint32()); + break; + case 7: + message.id = reader.string(); + break; + case 9: + message.normalizedValue = $root.google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue.decode(reader, reader.uint32()); + break; + case 10: + if (!(message.properties && message.properties.length)) + message.properties = []; + message.properties.push($root.google.cloud.documentai.v1beta3.Document.Entity.decode(reader, reader.uint32())); + break; + case 11: + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); + break; + case 12: + message.redacted = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Entity message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Entity} Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entity.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Entity message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Entity.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) { + var error = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.verify(message.textAnchor); + if (error) + return "textAnchor." + error; + } + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.mentionText != null && message.hasOwnProperty("mentionText")) + if (!$util.isString(message.mentionText)) + return "mentionText: string expected"; + if (message.mentionId != null && message.hasOwnProperty("mentionId")) + if (!$util.isString(message.mentionId)) + return "mentionId: string expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.pageAnchor != null && message.hasOwnProperty("pageAnchor")) { + var error = $root.google.cloud.documentai.v1beta3.Document.PageAnchor.verify(message.pageAnchor); + if (error) + return "pageAnchor." + error; + } + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.normalizedValue != null && message.hasOwnProperty("normalizedValue")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue.verify(message.normalizedValue); + if (error) + return "normalizedValue." + error; + } + if (message.properties != null && message.hasOwnProperty("properties")) { + if (!Array.isArray(message.properties)) + return "properties: array expected"; + for (var i = 0; i < message.properties.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Entity.verify(message.properties[i]); + if (error) + return "properties." + error; + } + } + if (message.provenance != null && message.hasOwnProperty("provenance")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Provenance.verify(message.provenance); + if (error) + return "provenance." + error; + } + if (message.redacted != null && message.hasOwnProperty("redacted")) + if (typeof message.redacted !== "boolean") + return "redacted: boolean expected"; + return null; + }; + + /** + * Creates an Entity message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Entity} Entity + */ + Entity.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Entity) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Entity(); + if (object.textAnchor != null) { + if (typeof object.textAnchor !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Entity.textAnchor: object expected"); + message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.fromObject(object.textAnchor); + } + if (object.type != null) + message.type = String(object.type); + if (object.mentionText != null) + message.mentionText = String(object.mentionText); + if (object.mentionId != null) + message.mentionId = String(object.mentionId); + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.pageAnchor != null) { + if (typeof object.pageAnchor !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Entity.pageAnchor: object expected"); + message.pageAnchor = $root.google.cloud.documentai.v1beta3.Document.PageAnchor.fromObject(object.pageAnchor); + } + if (object.id != null) + message.id = String(object.id); + if (object.normalizedValue != null) { + if (typeof object.normalizedValue !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Entity.normalizedValue: object expected"); + message.normalizedValue = $root.google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue.fromObject(object.normalizedValue); + } + if (object.properties) { + if (!Array.isArray(object.properties)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Entity.properties: array expected"); + message.properties = []; + for (var i = 0; i < object.properties.length; ++i) { + if (typeof object.properties[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Entity.properties: object expected"); + message.properties[i] = $root.google.cloud.documentai.v1beta3.Document.Entity.fromObject(object.properties[i]); + } + } + if (object.provenance != null) { + if (typeof object.provenance !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Entity.provenance: object expected"); + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.fromObject(object.provenance); + } + if (object.redacted != null) + message.redacted = Boolean(object.redacted); + return message; + }; + + /** + * Creates a plain object from an Entity message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @static + * @param {google.cloud.documentai.v1beta3.Document.Entity} message Entity + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Entity.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.properties = []; + if (options.defaults) { + object.textAnchor = null; + object.type = ""; + object.mentionText = ""; + object.mentionId = ""; + object.confidence = 0; + object.pageAnchor = null; + object.id = ""; + object.normalizedValue = null; + object.provenance = null; + object.redacted = false; + } + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + object.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.toObject(message.textAnchor, options); + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.mentionText != null && message.hasOwnProperty("mentionText")) + object.mentionText = message.mentionText; + if (message.mentionId != null && message.hasOwnProperty("mentionId")) + object.mentionId = message.mentionId; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.pageAnchor != null && message.hasOwnProperty("pageAnchor")) + object.pageAnchor = $root.google.cloud.documentai.v1beta3.Document.PageAnchor.toObject(message.pageAnchor, options); + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.normalizedValue != null && message.hasOwnProperty("normalizedValue")) + object.normalizedValue = $root.google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue.toObject(message.normalizedValue, options); + if (message.properties && message.properties.length) { + object.properties = []; + for (var j = 0; j < message.properties.length; ++j) + object.properties[j] = $root.google.cloud.documentai.v1beta3.Document.Entity.toObject(message.properties[j], options); + } + if (message.provenance != null && message.hasOwnProperty("provenance")) + object.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.toObject(message.provenance, options); + if (message.redacted != null && message.hasOwnProperty("redacted")) + object.redacted = message.redacted; + return object; + }; + + /** + * Converts this Entity to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + * @returns {Object.} JSON object + */ + Entity.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Entity.NormalizedValue = (function() { + + /** + * Properties of a NormalizedValue. + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @interface INormalizedValue + * @property {google.type.IMoney|null} [moneyValue] NormalizedValue moneyValue + * @property {google.type.IDate|null} [dateValue] NormalizedValue dateValue + * @property {google.type.IDateTime|null} [datetimeValue] NormalizedValue datetimeValue + * @property {google.type.IPostalAddress|null} [addressValue] NormalizedValue addressValue + * @property {string|null} [text] NormalizedValue text + */ + + /** + * Constructs a new NormalizedValue. + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @classdesc Represents a NormalizedValue. + * @implements INormalizedValue + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Entity.INormalizedValue=} [properties] Properties to set + */ + function NormalizedValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NormalizedValue moneyValue. + * @member {google.type.IMoney|null|undefined} moneyValue + * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue + * @instance + */ + NormalizedValue.prototype.moneyValue = null; + + /** + * NormalizedValue dateValue. + * @member {google.type.IDate|null|undefined} dateValue + * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue + * @instance + */ + NormalizedValue.prototype.dateValue = null; + + /** + * NormalizedValue datetimeValue. + * @member {google.type.IDateTime|null|undefined} datetimeValue + * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue + * @instance + */ + NormalizedValue.prototype.datetimeValue = null; + + /** + * NormalizedValue addressValue. + * @member {google.type.IPostalAddress|null|undefined} addressValue + * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue + * @instance + */ + NormalizedValue.prototype.addressValue = null; + + /** + * NormalizedValue text. + * @member {string} text + * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue + * @instance + */ + NormalizedValue.prototype.text = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * NormalizedValue structuredValue. + * @member {"moneyValue"|"dateValue"|"datetimeValue"|"addressValue"|undefined} structuredValue + * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue + * @instance + */ + Object.defineProperty(NormalizedValue.prototype, "structuredValue", { + get: $util.oneOfGetter($oneOfFields = ["moneyValue", "dateValue", "datetimeValue", "addressValue"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new NormalizedValue instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue + * @static + * @param {google.cloud.documentai.v1beta3.Document.Entity.INormalizedValue=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue} NormalizedValue instance + */ + NormalizedValue.create = function create(properties) { + return new NormalizedValue(properties); + }; + + /** + * Encodes the specified NormalizedValue message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue + * @static + * @param {google.cloud.documentai.v1beta3.Document.Entity.INormalizedValue} message NormalizedValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NormalizedValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.moneyValue != null && Object.hasOwnProperty.call(message, "moneyValue")) + $root.google.type.Money.encode(message.moneyValue, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.dateValue != null && Object.hasOwnProperty.call(message, "dateValue")) + $root.google.type.Date.encode(message.dateValue, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.datetimeValue != null && Object.hasOwnProperty.call(message, "datetimeValue")) + $root.google.type.DateTime.encode(message.datetimeValue, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.addressValue != null && Object.hasOwnProperty.call(message, "addressValue")) + $root.google.type.PostalAddress.encode(message.addressValue, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified NormalizedValue message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue + * @static + * @param {google.cloud.documentai.v1beta3.Document.Entity.INormalizedValue} message NormalizedValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NormalizedValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NormalizedValue message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue} NormalizedValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NormalizedValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.moneyValue = $root.google.type.Money.decode(reader, reader.uint32()); + break; + case 3: + message.dateValue = $root.google.type.Date.decode(reader, reader.uint32()); + break; + case 4: + message.datetimeValue = $root.google.type.DateTime.decode(reader, reader.uint32()); + break; + case 5: + message.addressValue = $root.google.type.PostalAddress.decode(reader, reader.uint32()); + break; + case 1: + message.text = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NormalizedValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue} NormalizedValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NormalizedValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NormalizedValue message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NormalizedValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.moneyValue != null && message.hasOwnProperty("moneyValue")) { + properties.structuredValue = 1; + { + var error = $root.google.type.Money.verify(message.moneyValue); + if (error) + return "moneyValue." + error; + } + } + if (message.dateValue != null && message.hasOwnProperty("dateValue")) { + if (properties.structuredValue === 1) + return "structuredValue: multiple values"; + properties.structuredValue = 1; + { + var error = $root.google.type.Date.verify(message.dateValue); + if (error) + return "dateValue." + error; + } + } + if (message.datetimeValue != null && message.hasOwnProperty("datetimeValue")) { + if (properties.structuredValue === 1) + return "structuredValue: multiple values"; + properties.structuredValue = 1; + { + var error = $root.google.type.DateTime.verify(message.datetimeValue); + if (error) + return "datetimeValue." + error; + } + } + if (message.addressValue != null && message.hasOwnProperty("addressValue")) { + if (properties.structuredValue === 1) + return "structuredValue: multiple values"; + properties.structuredValue = 1; + { + var error = $root.google.type.PostalAddress.verify(message.addressValue); + if (error) + return "addressValue." + error; + } + } + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + return null; + }; + + /** + * Creates a NormalizedValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue} NormalizedValue + */ + NormalizedValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue(); + if (object.moneyValue != null) { + if (typeof object.moneyValue !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue.moneyValue: object expected"); + message.moneyValue = $root.google.type.Money.fromObject(object.moneyValue); + } + if (object.dateValue != null) { + if (typeof object.dateValue !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue.dateValue: object expected"); + message.dateValue = $root.google.type.Date.fromObject(object.dateValue); + } + if (object.datetimeValue != null) { + if (typeof object.datetimeValue !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue.datetimeValue: object expected"); + message.datetimeValue = $root.google.type.DateTime.fromObject(object.datetimeValue); + } + if (object.addressValue != null) { + if (typeof object.addressValue !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue.addressValue: object expected"); + message.addressValue = $root.google.type.PostalAddress.fromObject(object.addressValue); + } + if (object.text != null) + message.text = String(object.text); + return message; + }; + + /** + * Creates a plain object from a NormalizedValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue + * @static + * @param {google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue} message NormalizedValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NormalizedValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.text = ""; + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.moneyValue != null && message.hasOwnProperty("moneyValue")) { + object.moneyValue = $root.google.type.Money.toObject(message.moneyValue, options); + if (options.oneofs) + object.structuredValue = "moneyValue"; + } + if (message.dateValue != null && message.hasOwnProperty("dateValue")) { + object.dateValue = $root.google.type.Date.toObject(message.dateValue, options); + if (options.oneofs) + object.structuredValue = "dateValue"; + } + if (message.datetimeValue != null && message.hasOwnProperty("datetimeValue")) { + object.datetimeValue = $root.google.type.DateTime.toObject(message.datetimeValue, options); + if (options.oneofs) + object.structuredValue = "datetimeValue"; + } + if (message.addressValue != null && message.hasOwnProperty("addressValue")) { + object.addressValue = $root.google.type.PostalAddress.toObject(message.addressValue, options); + if (options.oneofs) + object.structuredValue = "addressValue"; + } + return object; + }; + + /** + * Converts this NormalizedValue to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue + * @instance + * @returns {Object.} JSON object + */ + NormalizedValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NormalizedValue; + })(); + + return Entity; + })(); + + Document.EntityRelation = (function() { + + /** + * Properties of an EntityRelation. + * @memberof google.cloud.documentai.v1beta3.Document + * @interface IEntityRelation + * @property {string|null} [subjectId] EntityRelation subjectId + * @property {string|null} [objectId] EntityRelation objectId + * @property {string|null} [relation] EntityRelation relation + */ + + /** + * Constructs a new EntityRelation. + * @memberof google.cloud.documentai.v1beta3.Document + * @classdesc Represents an EntityRelation. + * @implements IEntityRelation + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.IEntityRelation=} [properties] Properties to set + */ + function EntityRelation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EntityRelation subjectId. + * @member {string} subjectId + * @memberof google.cloud.documentai.v1beta3.Document.EntityRelation + * @instance + */ + EntityRelation.prototype.subjectId = ""; + + /** + * EntityRelation objectId. + * @member {string} objectId + * @memberof google.cloud.documentai.v1beta3.Document.EntityRelation + * @instance + */ + EntityRelation.prototype.objectId = ""; + + /** + * EntityRelation relation. + * @member {string} relation + * @memberof google.cloud.documentai.v1beta3.Document.EntityRelation + * @instance + */ + EntityRelation.prototype.relation = ""; + + /** + * Creates a new EntityRelation instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.EntityRelation + * @static + * @param {google.cloud.documentai.v1beta3.Document.IEntityRelation=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.EntityRelation} EntityRelation instance + */ + EntityRelation.create = function create(properties) { + return new EntityRelation(properties); + }; + + /** + * Encodes the specified EntityRelation message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.EntityRelation.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.EntityRelation + * @static + * @param {google.cloud.documentai.v1beta3.Document.IEntityRelation} message EntityRelation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityRelation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.subjectId != null && Object.hasOwnProperty.call(message, "subjectId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.subjectId); + if (message.objectId != null && Object.hasOwnProperty.call(message, "objectId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.objectId); + if (message.relation != null && Object.hasOwnProperty.call(message, "relation")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.relation); + return writer; + }; + + /** + * Encodes the specified EntityRelation message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.EntityRelation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.EntityRelation + * @static + * @param {google.cloud.documentai.v1beta3.Document.IEntityRelation} message EntityRelation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityRelation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EntityRelation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.EntityRelation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.EntityRelation} EntityRelation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityRelation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.EntityRelation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subjectId = reader.string(); + break; + case 2: + message.objectId = reader.string(); + break; + case 3: + message.relation = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EntityRelation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.EntityRelation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.EntityRelation} EntityRelation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityRelation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EntityRelation message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.EntityRelation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EntityRelation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.subjectId != null && message.hasOwnProperty("subjectId")) + if (!$util.isString(message.subjectId)) + return "subjectId: string expected"; + if (message.objectId != null && message.hasOwnProperty("objectId")) + if (!$util.isString(message.objectId)) + return "objectId: string expected"; + if (message.relation != null && message.hasOwnProperty("relation")) + if (!$util.isString(message.relation)) + return "relation: string expected"; + return null; + }; + + /** + * Creates an EntityRelation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.EntityRelation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.EntityRelation} EntityRelation + */ + EntityRelation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.EntityRelation) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.EntityRelation(); + if (object.subjectId != null) + message.subjectId = String(object.subjectId); + if (object.objectId != null) + message.objectId = String(object.objectId); + if (object.relation != null) + message.relation = String(object.relation); + return message; + }; + + /** + * Creates a plain object from an EntityRelation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.EntityRelation + * @static + * @param {google.cloud.documentai.v1beta3.Document.EntityRelation} message EntityRelation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EntityRelation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.subjectId = ""; + object.objectId = ""; + object.relation = ""; + } + if (message.subjectId != null && message.hasOwnProperty("subjectId")) + object.subjectId = message.subjectId; + if (message.objectId != null && message.hasOwnProperty("objectId")) + object.objectId = message.objectId; + if (message.relation != null && message.hasOwnProperty("relation")) + object.relation = message.relation; + return object; + }; + + /** + * Converts this EntityRelation to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.EntityRelation + * @instance + * @returns {Object.} JSON object + */ + EntityRelation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EntityRelation; + })(); + + Document.Translation = (function() { + + /** + * Properties of a Translation. + * @memberof google.cloud.documentai.v1beta3.Document + * @interface ITranslation + * @property {google.cloud.documentai.v1beta3.Document.ITextAnchor|null} [textAnchor] Translation textAnchor + * @property {string|null} [languageCode] Translation languageCode + * @property {string|null} [translatedText] Translation translatedText + * @property {Array.|null} [provenance] Translation provenance + */ + + /** + * Constructs a new Translation. + * @memberof google.cloud.documentai.v1beta3.Document + * @classdesc Represents a Translation. + * @implements ITranslation + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.ITranslation=} [properties] Properties to set + */ + function Translation(properties) { + this.provenance = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Translation textAnchor. + * @member {google.cloud.documentai.v1beta3.Document.ITextAnchor|null|undefined} textAnchor + * @memberof google.cloud.documentai.v1beta3.Document.Translation + * @instance + */ + Translation.prototype.textAnchor = null; + + /** + * Translation languageCode. + * @member {string} languageCode + * @memberof google.cloud.documentai.v1beta3.Document.Translation + * @instance + */ + Translation.prototype.languageCode = ""; + + /** + * Translation translatedText. + * @member {string} translatedText + * @memberof google.cloud.documentai.v1beta3.Document.Translation + * @instance + */ + Translation.prototype.translatedText = ""; + + /** + * Translation provenance. + * @member {Array.} provenance + * @memberof google.cloud.documentai.v1beta3.Document.Translation + * @instance + */ + Translation.prototype.provenance = $util.emptyArray; + + /** + * Creates a new Translation instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Translation + * @static + * @param {google.cloud.documentai.v1beta3.Document.ITranslation=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Translation} Translation instance + */ + Translation.create = function create(properties) { + return new Translation(properties); + }; + + /** + * Encodes the specified Translation message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Translation.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Translation + * @static + * @param {google.cloud.documentai.v1beta3.Document.ITranslation} message Translation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Translation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textAnchor != null && Object.hasOwnProperty.call(message, "textAnchor")) + $root.google.cloud.documentai.v1beta3.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.translatedText != null && Object.hasOwnProperty.call(message, "translatedText")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.translatedText); + if (message.provenance != null && message.provenance.length) + for (var i = 0; i < message.provenance.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Provenance.encode(message.provenance[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Translation message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Translation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Translation + * @static + * @param {google.cloud.documentai.v1beta3.Document.ITranslation} message Translation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Translation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Translation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Translation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Translation} Translation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Translation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Translation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.decode(reader, reader.uint32()); + break; + case 2: + message.languageCode = reader.string(); + break; + case 3: + message.translatedText = reader.string(); + break; + case 4: + if (!(message.provenance && message.provenance.length)) + message.provenance = []; + message.provenance.push($root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Translation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Translation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Translation} Translation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Translation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Translation message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Translation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Translation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) { + var error = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.verify(message.textAnchor); + if (error) + return "textAnchor." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.translatedText != null && message.hasOwnProperty("translatedText")) + if (!$util.isString(message.translatedText)) + return "translatedText: string expected"; + if (message.provenance != null && message.hasOwnProperty("provenance")) { + if (!Array.isArray(message.provenance)) + return "provenance: array expected"; + for (var i = 0; i < message.provenance.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Provenance.verify(message.provenance[i]); + if (error) + return "provenance." + error; + } + } + return null; + }; + + /** + * Creates a Translation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Translation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Translation} Translation + */ + Translation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Translation) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Translation(); + if (object.textAnchor != null) { + if (typeof object.textAnchor !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Translation.textAnchor: object expected"); + message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.fromObject(object.textAnchor); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.translatedText != null) + message.translatedText = String(object.translatedText); + if (object.provenance) { + if (!Array.isArray(object.provenance)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Translation.provenance: array expected"); + message.provenance = []; + for (var i = 0; i < object.provenance.length; ++i) { + if (typeof object.provenance[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Translation.provenance: object expected"); + message.provenance[i] = $root.google.cloud.documentai.v1beta3.Document.Provenance.fromObject(object.provenance[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Translation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Translation + * @static + * @param {google.cloud.documentai.v1beta3.Document.Translation} message Translation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Translation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.provenance = []; + if (options.defaults) { + object.textAnchor = null; + object.languageCode = ""; + object.translatedText = ""; + } + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + object.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.toObject(message.textAnchor, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.translatedText != null && message.hasOwnProperty("translatedText")) + object.translatedText = message.translatedText; + if (message.provenance && message.provenance.length) { + object.provenance = []; + for (var j = 0; j < message.provenance.length; ++j) + object.provenance[j] = $root.google.cloud.documentai.v1beta3.Document.Provenance.toObject(message.provenance[j], options); + } + return object; + }; + + /** + * Converts this Translation to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Translation + * @instance + * @returns {Object.} JSON object + */ + Translation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Translation; + })(); + + Document.TextAnchor = (function() { + + /** + * Properties of a TextAnchor. + * @memberof google.cloud.documentai.v1beta3.Document + * @interface ITextAnchor + * @property {Array.|null} [textSegments] TextAnchor textSegments + * @property {string|null} [content] TextAnchor content + */ + + /** + * Constructs a new TextAnchor. + * @memberof google.cloud.documentai.v1beta3.Document + * @classdesc Represents a TextAnchor. + * @implements ITextAnchor + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.ITextAnchor=} [properties] Properties to set + */ + function TextAnchor(properties) { + this.textSegments = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TextAnchor textSegments. + * @member {Array.} textSegments + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor + * @instance + */ + TextAnchor.prototype.textSegments = $util.emptyArray; + + /** + * TextAnchor content. + * @member {string} content + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor + * @instance + */ + TextAnchor.prototype.content = ""; + + /** + * Creates a new TextAnchor instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor + * @static + * @param {google.cloud.documentai.v1beta3.Document.ITextAnchor=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.TextAnchor} TextAnchor instance + */ + TextAnchor.create = function create(properties) { + return new TextAnchor(properties); + }; + + /** + * Encodes the specified TextAnchor message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.TextAnchor.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor + * @static + * @param {google.cloud.documentai.v1beta3.Document.ITextAnchor} message TextAnchor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextAnchor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textSegments != null && message.textSegments.length) + for (var i = 0; i < message.textSegments.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment.encode(message.textSegments[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.content != null && Object.hasOwnProperty.call(message, "content")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.content); + return writer; + }; + + /** + * Encodes the specified TextAnchor message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.TextAnchor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor + * @static + * @param {google.cloud.documentai.v1beta3.Document.ITextAnchor} message TextAnchor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextAnchor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextAnchor message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.TextAnchor} TextAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextAnchor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.TextAnchor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.textSegments && message.textSegments.length)) + message.textSegments = []; + message.textSegments.push($root.google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment.decode(reader, reader.uint32())); + break; + case 2: + message.content = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TextAnchor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.TextAnchor} TextAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextAnchor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextAnchor message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextAnchor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textSegments != null && message.hasOwnProperty("textSegments")) { + if (!Array.isArray(message.textSegments)) + return "textSegments: array expected"; + for (var i = 0; i < message.textSegments.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment.verify(message.textSegments[i]); + if (error) + return "textSegments." + error; + } + } + if (message.content != null && message.hasOwnProperty("content")) + if (!$util.isString(message.content)) + return "content: string expected"; + return null; + }; + + /** + * Creates a TextAnchor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.TextAnchor} TextAnchor + */ + TextAnchor.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.TextAnchor) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.TextAnchor(); + if (object.textSegments) { + if (!Array.isArray(object.textSegments)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.TextAnchor.textSegments: array expected"); + message.textSegments = []; + for (var i = 0; i < object.textSegments.length; ++i) { + if (typeof object.textSegments[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.TextAnchor.textSegments: object expected"); + message.textSegments[i] = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment.fromObject(object.textSegments[i]); + } + } + if (object.content != null) + message.content = String(object.content); + return message; + }; + + /** + * Creates a plain object from a TextAnchor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor + * @static + * @param {google.cloud.documentai.v1beta3.Document.TextAnchor} message TextAnchor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TextAnchor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.textSegments = []; + if (options.defaults) + object.content = ""; + if (message.textSegments && message.textSegments.length) { + object.textSegments = []; + for (var j = 0; j < message.textSegments.length; ++j) + object.textSegments[j] = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment.toObject(message.textSegments[j], options); + } + if (message.content != null && message.hasOwnProperty("content")) + object.content = message.content; + return object; + }; + + /** + * Converts this TextAnchor to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor + * @instance + * @returns {Object.} JSON object + */ + TextAnchor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + TextAnchor.TextSegment = (function() { + + /** + * Properties of a TextSegment. + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor + * @interface ITextSegment + * @property {number|Long|null} [startIndex] TextSegment startIndex + * @property {number|Long|null} [endIndex] TextSegment endIndex + */ + + /** + * Constructs a new TextSegment. + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor + * @classdesc Represents a TextSegment. + * @implements ITextSegment + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.TextAnchor.ITextSegment=} [properties] Properties to set + */ + function TextSegment(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TextSegment startIndex. + * @member {number|Long} startIndex + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment + * @instance + */ + TextSegment.prototype.startIndex = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * TextSegment endIndex. + * @member {number|Long} endIndex + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment + * @instance + */ + TextSegment.prototype.endIndex = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new TextSegment instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment + * @static + * @param {google.cloud.documentai.v1beta3.Document.TextAnchor.ITextSegment=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment} TextSegment instance + */ + TextSegment.create = function create(properties) { + return new TextSegment(properties); + }; + + /** + * Encodes the specified TextSegment message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment + * @static + * @param {google.cloud.documentai.v1beta3.Document.TextAnchor.ITextSegment} message TextSegment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextSegment.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startIndex != null && Object.hasOwnProperty.call(message, "startIndex")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.startIndex); + if (message.endIndex != null && Object.hasOwnProperty.call(message, "endIndex")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.endIndex); + return writer; + }; + + /** + * Encodes the specified TextSegment message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment + * @static + * @param {google.cloud.documentai.v1beta3.Document.TextAnchor.ITextSegment} message TextSegment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextSegment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextSegment message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment} TextSegment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextSegment.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.startIndex = reader.int64(); + break; + case 2: + message.endIndex = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TextSegment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment} TextSegment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextSegment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextSegment message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextSegment.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startIndex != null && message.hasOwnProperty("startIndex")) + if (!$util.isInteger(message.startIndex) && !(message.startIndex && $util.isInteger(message.startIndex.low) && $util.isInteger(message.startIndex.high))) + return "startIndex: integer|Long expected"; + if (message.endIndex != null && message.hasOwnProperty("endIndex")) + if (!$util.isInteger(message.endIndex) && !(message.endIndex && $util.isInteger(message.endIndex.low) && $util.isInteger(message.endIndex.high))) + return "endIndex: integer|Long expected"; + return null; + }; + + /** + * Creates a TextSegment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment} TextSegment + */ + TextSegment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment(); + if (object.startIndex != null) + if ($util.Long) + (message.startIndex = $util.Long.fromValue(object.startIndex)).unsigned = false; + else if (typeof object.startIndex === "string") + message.startIndex = parseInt(object.startIndex, 10); + else if (typeof object.startIndex === "number") + message.startIndex = object.startIndex; + else if (typeof object.startIndex === "object") + message.startIndex = new $util.LongBits(object.startIndex.low >>> 0, object.startIndex.high >>> 0).toNumber(); + if (object.endIndex != null) + if ($util.Long) + (message.endIndex = $util.Long.fromValue(object.endIndex)).unsigned = false; + else if (typeof object.endIndex === "string") + message.endIndex = parseInt(object.endIndex, 10); + else if (typeof object.endIndex === "number") + message.endIndex = object.endIndex; + else if (typeof object.endIndex === "object") + message.endIndex = new $util.LongBits(object.endIndex.low >>> 0, object.endIndex.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a TextSegment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment + * @static + * @param {google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment} message TextSegment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TextSegment.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.startIndex = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.startIndex = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.endIndex = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.endIndex = options.longs === String ? "0" : 0; + } + if (message.startIndex != null && message.hasOwnProperty("startIndex")) + if (typeof message.startIndex === "number") + object.startIndex = options.longs === String ? String(message.startIndex) : message.startIndex; + else + object.startIndex = options.longs === String ? $util.Long.prototype.toString.call(message.startIndex) : options.longs === Number ? new $util.LongBits(message.startIndex.low >>> 0, message.startIndex.high >>> 0).toNumber() : message.startIndex; + if (message.endIndex != null && message.hasOwnProperty("endIndex")) + if (typeof message.endIndex === "number") + object.endIndex = options.longs === String ? String(message.endIndex) : message.endIndex; + else + object.endIndex = options.longs === String ? $util.Long.prototype.toString.call(message.endIndex) : options.longs === Number ? new $util.LongBits(message.endIndex.low >>> 0, message.endIndex.high >>> 0).toNumber() : message.endIndex; + return object; + }; + + /** + * Converts this TextSegment to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment + * @instance + * @returns {Object.} JSON object + */ + TextSegment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TextSegment; + })(); + + return TextAnchor; + })(); + + Document.PageAnchor = (function() { + + /** + * Properties of a PageAnchor. + * @memberof google.cloud.documentai.v1beta3.Document + * @interface IPageAnchor + * @property {Array.|null} [pageRefs] PageAnchor pageRefs + */ + + /** + * Constructs a new PageAnchor. + * @memberof google.cloud.documentai.v1beta3.Document + * @classdesc Represents a PageAnchor. + * @implements IPageAnchor + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.IPageAnchor=} [properties] Properties to set + */ + function PageAnchor(properties) { + this.pageRefs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PageAnchor pageRefs. + * @member {Array.} pageRefs + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor + * @instance + */ + PageAnchor.prototype.pageRefs = $util.emptyArray; + + /** + * Creates a new PageAnchor instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor + * @static + * @param {google.cloud.documentai.v1beta3.Document.IPageAnchor=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.PageAnchor} PageAnchor instance + */ + PageAnchor.create = function create(properties) { + return new PageAnchor(properties); + }; + + /** + * Encodes the specified PageAnchor message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.PageAnchor.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor + * @static + * @param {google.cloud.documentai.v1beta3.Document.IPageAnchor} message PageAnchor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PageAnchor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageRefs != null && message.pageRefs.length) + for (var i = 0; i < message.pageRefs.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.encode(message.pageRefs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PageAnchor message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.PageAnchor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor + * @static + * @param {google.cloud.documentai.v1beta3.Document.IPageAnchor} message PageAnchor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PageAnchor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PageAnchor message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.PageAnchor} PageAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PageAnchor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.PageAnchor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.pageRefs && message.pageRefs.length)) + message.pageRefs = []; + message.pageRefs.push($root.google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PageAnchor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.PageAnchor} PageAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PageAnchor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PageAnchor message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PageAnchor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pageRefs != null && message.hasOwnProperty("pageRefs")) { + if (!Array.isArray(message.pageRefs)) + return "pageRefs: array expected"; + for (var i = 0; i < message.pageRefs.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.verify(message.pageRefs[i]); + if (error) + return "pageRefs." + error; + } + } + return null; + }; + + /** + * Creates a PageAnchor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.PageAnchor} PageAnchor + */ + PageAnchor.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.PageAnchor) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.PageAnchor(); + if (object.pageRefs) { + if (!Array.isArray(object.pageRefs)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.PageAnchor.pageRefs: array expected"); + message.pageRefs = []; + for (var i = 0; i < object.pageRefs.length; ++i) { + if (typeof object.pageRefs[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.PageAnchor.pageRefs: object expected"); + message.pageRefs[i] = $root.google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.fromObject(object.pageRefs[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a PageAnchor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor + * @static + * @param {google.cloud.documentai.v1beta3.Document.PageAnchor} message PageAnchor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PageAnchor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.pageRefs = []; + if (message.pageRefs && message.pageRefs.length) { + object.pageRefs = []; + for (var j = 0; j < message.pageRefs.length; ++j) + object.pageRefs[j] = $root.google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.toObject(message.pageRefs[j], options); + } + return object; + }; + + /** + * Converts this PageAnchor to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor + * @instance + * @returns {Object.} JSON object + */ + PageAnchor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + PageAnchor.PageRef = (function() { + + /** + * Properties of a PageRef. + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor + * @interface IPageRef + * @property {number|Long|null} [page] PageRef page + * @property {google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.LayoutType|null} [layoutType] PageRef layoutType + * @property {string|null} [layoutId] PageRef layoutId + * @property {google.cloud.documentai.v1beta3.IBoundingPoly|null} [boundingPoly] PageRef boundingPoly + */ + + /** + * Constructs a new PageRef. + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor + * @classdesc Represents a PageRef. + * @implements IPageRef + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.PageAnchor.IPageRef=} [properties] Properties to set + */ + function PageRef(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PageRef page. + * @member {number|Long} page + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef + * @instance + */ + PageRef.prototype.page = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * PageRef layoutType. + * @member {google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.LayoutType} layoutType + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef + * @instance + */ + PageRef.prototype.layoutType = 0; + + /** + * PageRef layoutId. + * @member {string} layoutId + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef + * @instance + */ + PageRef.prototype.layoutId = ""; + + /** + * PageRef boundingPoly. + * @member {google.cloud.documentai.v1beta3.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef + * @instance + */ + PageRef.prototype.boundingPoly = null; + + /** + * Creates a new PageRef instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef + * @static + * @param {google.cloud.documentai.v1beta3.Document.PageAnchor.IPageRef=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef} PageRef instance + */ + PageRef.create = function create(properties) { + return new PageRef(properties); + }; + + /** + * Encodes the specified PageRef message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef + * @static + * @param {google.cloud.documentai.v1beta3.Document.PageAnchor.IPageRef} message PageRef message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PageRef.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.page != null && Object.hasOwnProperty.call(message, "page")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.page); + if (message.layoutType != null && Object.hasOwnProperty.call(message, "layoutType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.layoutType); + if (message.layoutId != null && Object.hasOwnProperty.call(message, "layoutId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.layoutId); + if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) + $root.google.cloud.documentai.v1beta3.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PageRef message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef + * @static + * @param {google.cloud.documentai.v1beta3.Document.PageAnchor.IPageRef} message PageRef message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PageRef.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PageRef message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef} PageRef + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PageRef.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.page = reader.int64(); + break; + case 2: + message.layoutType = reader.int32(); + break; + case 3: + message.layoutId = reader.string(); + break; + case 4: + message.boundingPoly = $root.google.cloud.documentai.v1beta3.BoundingPoly.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PageRef message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef} PageRef + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PageRef.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PageRef message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PageRef.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.page != null && message.hasOwnProperty("page")) + if (!$util.isInteger(message.page) && !(message.page && $util.isInteger(message.page.low) && $util.isInteger(message.page.high))) + return "page: integer|Long expected"; + if (message.layoutType != null && message.hasOwnProperty("layoutType")) + switch (message.layoutType) { + default: + return "layoutType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.layoutId != null && message.hasOwnProperty("layoutId")) + if (!$util.isString(message.layoutId)) + return "layoutId: string expected"; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { + var error = $root.google.cloud.documentai.v1beta3.BoundingPoly.verify(message.boundingPoly); + if (error) + return "boundingPoly." + error; + } + return null; + }; + + /** + * Creates a PageRef message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef} PageRef + */ + PageRef.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef(); + if (object.page != null) + if ($util.Long) + (message.page = $util.Long.fromValue(object.page)).unsigned = false; + else if (typeof object.page === "string") + message.page = parseInt(object.page, 10); + else if (typeof object.page === "number") + message.page = object.page; + else if (typeof object.page === "object") + message.page = new $util.LongBits(object.page.low >>> 0, object.page.high >>> 0).toNumber(); + switch (object.layoutType) { + case "LAYOUT_TYPE_UNSPECIFIED": + case 0: + message.layoutType = 0; + break; + case "BLOCK": + case 1: + message.layoutType = 1; + break; + case "PARAGRAPH": + case 2: + message.layoutType = 2; + break; + case "LINE": + case 3: + message.layoutType = 3; + break; + case "TOKEN": + case 4: + message.layoutType = 4; + break; + case "VISUAL_ELEMENT": + case 5: + message.layoutType = 5; + break; + case "TABLE": + case 6: + message.layoutType = 6; + break; + case "FORM_FIELD": + case 7: + message.layoutType = 7; + break; + } + if (object.layoutId != null) + message.layoutId = String(object.layoutId); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.documentai.v1beta3.BoundingPoly.fromObject(object.boundingPoly); + } + return message; + }; + + /** + * Creates a plain object from a PageRef message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef + * @static + * @param {google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef} message PageRef + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PageRef.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.page = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.page = options.longs === String ? "0" : 0; + object.layoutType = options.enums === String ? "LAYOUT_TYPE_UNSPECIFIED" : 0; + object.layoutId = ""; + object.boundingPoly = null; + } + if (message.page != null && message.hasOwnProperty("page")) + if (typeof message.page === "number") + object.page = options.longs === String ? String(message.page) : message.page; + else + object.page = options.longs === String ? $util.Long.prototype.toString.call(message.page) : options.longs === Number ? new $util.LongBits(message.page.low >>> 0, message.page.high >>> 0).toNumber() : message.page; + if (message.layoutType != null && message.hasOwnProperty("layoutType")) + object.layoutType = options.enums === String ? $root.google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.LayoutType[message.layoutType] : message.layoutType; + if (message.layoutId != null && message.hasOwnProperty("layoutId")) + object.layoutId = message.layoutId; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.documentai.v1beta3.BoundingPoly.toObject(message.boundingPoly, options); + return object; + }; + + /** + * Converts this PageRef to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef + * @instance + * @returns {Object.} JSON object + */ + PageRef.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * LayoutType enum. + * @name google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.LayoutType + * @enum {number} + * @property {number} LAYOUT_TYPE_UNSPECIFIED=0 LAYOUT_TYPE_UNSPECIFIED value + * @property {number} BLOCK=1 BLOCK value + * @property {number} PARAGRAPH=2 PARAGRAPH value + * @property {number} LINE=3 LINE value + * @property {number} TOKEN=4 TOKEN value + * @property {number} VISUAL_ELEMENT=5 VISUAL_ELEMENT value + * @property {number} TABLE=6 TABLE value + * @property {number} FORM_FIELD=7 FORM_FIELD value + */ + PageRef.LayoutType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LAYOUT_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "BLOCK"] = 1; + values[valuesById[2] = "PARAGRAPH"] = 2; + values[valuesById[3] = "LINE"] = 3; + values[valuesById[4] = "TOKEN"] = 4; + values[valuesById[5] = "VISUAL_ELEMENT"] = 5; + values[valuesById[6] = "TABLE"] = 6; + values[valuesById[7] = "FORM_FIELD"] = 7; + return values; + })(); + + return PageRef; + })(); + + return PageAnchor; + })(); + + Document.Provenance = (function() { + + /** + * Properties of a Provenance. + * @memberof google.cloud.documentai.v1beta3.Document + * @interface IProvenance + * @property {number|null} [revision] Provenance revision + * @property {number|null} [id] Provenance id + * @property {Array.|null} [parents] Provenance parents + * @property {google.cloud.documentai.v1beta3.Document.Provenance.OperationType|null} [type] Provenance type + */ + + /** + * Constructs a new Provenance. + * @memberof google.cloud.documentai.v1beta3.Document + * @classdesc Represents a Provenance. + * @implements IProvenance + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.IProvenance=} [properties] Properties to set + */ + function Provenance(properties) { + this.parents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Provenance revision. + * @member {number} revision + * @memberof google.cloud.documentai.v1beta3.Document.Provenance + * @instance + */ + Provenance.prototype.revision = 0; + + /** + * Provenance id. + * @member {number} id + * @memberof google.cloud.documentai.v1beta3.Document.Provenance + * @instance + */ + Provenance.prototype.id = 0; + + /** + * Provenance parents. + * @member {Array.} parents + * @memberof google.cloud.documentai.v1beta3.Document.Provenance + * @instance + */ + Provenance.prototype.parents = $util.emptyArray; + + /** + * Provenance type. + * @member {google.cloud.documentai.v1beta3.Document.Provenance.OperationType} type + * @memberof google.cloud.documentai.v1beta3.Document.Provenance + * @instance + */ + Provenance.prototype.type = 0; + + /** + * Creates a new Provenance instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Provenance + * @static + * @param {google.cloud.documentai.v1beta3.Document.IProvenance=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Provenance} Provenance instance + */ + Provenance.create = function create(properties) { + return new Provenance(properties); + }; + + /** + * Encodes the specified Provenance message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Provenance.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Provenance + * @static + * @param {google.cloud.documentai.v1beta3.Document.IProvenance} message Provenance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Provenance.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.revision != null && Object.hasOwnProperty.call(message, "revision")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.revision); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.id); + if (message.parents != null && message.parents.length) + for (var i = 0; i < message.parents.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Provenance.Parent.encode(message.parents[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.type); + return writer; + }; + + /** + * Encodes the specified Provenance message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Provenance.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Provenance + * @static + * @param {google.cloud.documentai.v1beta3.Document.IProvenance} message Provenance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Provenance.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Provenance message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Provenance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Provenance} Provenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Provenance.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Provenance(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.revision = reader.int32(); + break; + case 2: + message.id = reader.int32(); + break; + case 3: + if (!(message.parents && message.parents.length)) + message.parents = []; + message.parents.push($root.google.cloud.documentai.v1beta3.Document.Provenance.Parent.decode(reader, reader.uint32())); + break; + case 4: + message.type = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Provenance message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Provenance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Provenance} Provenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Provenance.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Provenance message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Provenance + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Provenance.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.revision != null && message.hasOwnProperty("revision")) + if (!$util.isInteger(message.revision)) + return "revision: integer expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id)) + return "id: integer expected"; + if (message.parents != null && message.hasOwnProperty("parents")) { + if (!Array.isArray(message.parents)) + return "parents: array expected"; + for (var i = 0; i < message.parents.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Provenance.Parent.verify(message.parents[i]); + if (error) + return "parents." + error; + } + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + return null; + }; + + /** + * Creates a Provenance message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Provenance + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Provenance} Provenance + */ + Provenance.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Provenance) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Provenance(); + if (object.revision != null) + message.revision = object.revision | 0; + if (object.id != null) + message.id = object.id | 0; + if (object.parents) { + if (!Array.isArray(object.parents)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Provenance.parents: array expected"); + message.parents = []; + for (var i = 0; i < object.parents.length; ++i) { + if (typeof object.parents[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Provenance.parents: object expected"); + message.parents[i] = $root.google.cloud.documentai.v1beta3.Document.Provenance.Parent.fromObject(object.parents[i]); + } + } + switch (object.type) { + case "OPERATION_TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "ADD": + case 1: + message.type = 1; + break; + case "REMOVE": + case 2: + message.type = 2; + break; + case "REPLACE": + case 3: + message.type = 3; + break; + case "EVAL_REQUESTED": + case 4: + message.type = 4; + break; + case "EVAL_APPROVED": + case 5: + message.type = 5; + break; + } + return message; + }; + + /** + * Creates a plain object from a Provenance message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Provenance + * @static + * @param {google.cloud.documentai.v1beta3.Document.Provenance} message Provenance + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Provenance.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.parents = []; + if (options.defaults) { + object.revision = 0; + object.id = 0; + object.type = options.enums === String ? "OPERATION_TYPE_UNSPECIFIED" : 0; + } + if (message.revision != null && message.hasOwnProperty("revision")) + object.revision = message.revision; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.parents && message.parents.length) { + object.parents = []; + for (var j = 0; j < message.parents.length; ++j) + object.parents[j] = $root.google.cloud.documentai.v1beta3.Document.Provenance.Parent.toObject(message.parents[j], options); + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.documentai.v1beta3.Document.Provenance.OperationType[message.type] : message.type; + return object; + }; + + /** + * Converts this Provenance to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Provenance + * @instance + * @returns {Object.} JSON object + */ + Provenance.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Provenance.Parent = (function() { + + /** + * Properties of a Parent. + * @memberof google.cloud.documentai.v1beta3.Document.Provenance + * @interface IParent + * @property {number|null} [revision] Parent revision + * @property {number|null} [id] Parent id + */ + + /** + * Constructs a new Parent. + * @memberof google.cloud.documentai.v1beta3.Document.Provenance + * @classdesc Represents a Parent. + * @implements IParent + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Provenance.IParent=} [properties] Properties to set + */ + function Parent(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Parent revision. + * @member {number} revision + * @memberof google.cloud.documentai.v1beta3.Document.Provenance.Parent + * @instance + */ + Parent.prototype.revision = 0; + + /** + * Parent id. + * @member {number} id + * @memberof google.cloud.documentai.v1beta3.Document.Provenance.Parent + * @instance + */ + Parent.prototype.id = 0; + + /** + * Creates a new Parent instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Provenance.Parent + * @static + * @param {google.cloud.documentai.v1beta3.Document.Provenance.IParent=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Provenance.Parent} Parent instance + */ + Parent.create = function create(properties) { + return new Parent(properties); + }; + + /** + * Encodes the specified Parent message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Provenance.Parent.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Provenance.Parent + * @static + * @param {google.cloud.documentai.v1beta3.Document.Provenance.IParent} message Parent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Parent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.revision != null && Object.hasOwnProperty.call(message, "revision")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.revision); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.id); + return writer; + }; + + /** + * Encodes the specified Parent message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Provenance.Parent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Provenance.Parent + * @static + * @param {google.cloud.documentai.v1beta3.Document.Provenance.IParent} message Parent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Parent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Parent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Provenance.Parent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Provenance.Parent} Parent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Parent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Provenance.Parent(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.revision = reader.int32(); + break; + case 2: + message.id = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Parent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Provenance.Parent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Provenance.Parent} Parent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Parent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Parent message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Provenance.Parent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Parent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.revision != null && message.hasOwnProperty("revision")) + if (!$util.isInteger(message.revision)) + return "revision: integer expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id)) + return "id: integer expected"; + return null; + }; + + /** + * Creates a Parent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Provenance.Parent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Provenance.Parent} Parent + */ + Parent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Provenance.Parent) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Provenance.Parent(); + if (object.revision != null) + message.revision = object.revision | 0; + if (object.id != null) + message.id = object.id | 0; + return message; + }; + + /** + * Creates a plain object from a Parent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Provenance.Parent + * @static + * @param {google.cloud.documentai.v1beta3.Document.Provenance.Parent} message Parent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Parent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.revision = 0; + object.id = 0; + } + if (message.revision != null && message.hasOwnProperty("revision")) + object.revision = message.revision; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + return object; + }; + + /** + * Converts this Parent to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Provenance.Parent + * @instance + * @returns {Object.} JSON object + */ + Parent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Parent; + })(); + + /** + * OperationType enum. + * @name google.cloud.documentai.v1beta3.Document.Provenance.OperationType + * @enum {number} + * @property {number} OPERATION_TYPE_UNSPECIFIED=0 OPERATION_TYPE_UNSPECIFIED value + * @property {number} ADD=1 ADD value + * @property {number} REMOVE=2 REMOVE value + * @property {number} REPLACE=3 REPLACE value + * @property {number} EVAL_REQUESTED=4 EVAL_REQUESTED value + * @property {number} EVAL_APPROVED=5 EVAL_APPROVED value + */ + Provenance.OperationType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "OPERATION_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ADD"] = 1; + values[valuesById[2] = "REMOVE"] = 2; + values[valuesById[3] = "REPLACE"] = 3; + values[valuesById[4] = "EVAL_REQUESTED"] = 4; + values[valuesById[5] = "EVAL_APPROVED"] = 5; + return values; + })(); + + return Provenance; + })(); + + Document.Revision = (function() { + + /** + * Properties of a Revision. + * @memberof google.cloud.documentai.v1beta3.Document + * @interface IRevision + * @property {string|null} [agent] Revision agent + * @property {string|null} [processor] Revision processor + * @property {string|null} [id] Revision id + * @property {Array.|null} [parent] Revision parent + * @property {google.protobuf.ITimestamp|null} [createTime] Revision createTime + * @property {google.cloud.documentai.v1beta3.Document.Revision.IHumanReview|null} [humanReview] Revision humanReview + */ + + /** + * Constructs a new Revision. + * @memberof google.cloud.documentai.v1beta3.Document + * @classdesc Represents a Revision. + * @implements IRevision + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.IRevision=} [properties] Properties to set + */ + function Revision(properties) { + this.parent = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Revision agent. + * @member {string} agent + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @instance + */ + Revision.prototype.agent = ""; + + /** + * Revision processor. + * @member {string} processor + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @instance + */ + Revision.prototype.processor = ""; + + /** + * Revision id. + * @member {string} id + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @instance + */ + Revision.prototype.id = ""; + + /** + * Revision parent. + * @member {Array.} parent + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @instance + */ + Revision.prototype.parent = $util.emptyArray; + + /** + * Revision createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @instance + */ + Revision.prototype.createTime = null; + + /** + * Revision humanReview. + * @member {google.cloud.documentai.v1beta3.Document.Revision.IHumanReview|null|undefined} humanReview + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @instance + */ + Revision.prototype.humanReview = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Revision source. + * @member {"agent"|"processor"|undefined} source + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @instance + */ + Object.defineProperty(Revision.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["agent", "processor"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Revision instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @static + * @param {google.cloud.documentai.v1beta3.Document.IRevision=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Revision} Revision instance + */ + Revision.create = function create(properties) { + return new Revision(properties); + }; + + /** + * Encodes the specified Revision message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Revision.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @static + * @param {google.cloud.documentai.v1beta3.Document.IRevision} message Revision message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Revision.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.parent != null && message.parent.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.parent.length; ++i) + writer.int32(message.parent[i]); + writer.ldelim(); + } + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.agent != null && Object.hasOwnProperty.call(message, "agent")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.agent); + if (message.processor != null && Object.hasOwnProperty.call(message, "processor")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.processor); + if (message.humanReview != null && Object.hasOwnProperty.call(message, "humanReview")) + $root.google.cloud.documentai.v1beta3.Document.Revision.HumanReview.encode(message.humanReview, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Revision message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Revision.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @static + * @param {google.cloud.documentai.v1beta3.Document.IRevision} message Revision message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Revision.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Revision message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Revision} Revision + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Revision.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Revision(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + message.agent = reader.string(); + break; + case 5: + message.processor = reader.string(); + break; + case 1: + message.id = reader.string(); + break; + case 2: + if (!(message.parent && message.parent.length)) + message.parent = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.parent.push(reader.int32()); + } else + message.parent.push(reader.int32()); + break; + case 3: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.humanReview = $root.google.cloud.documentai.v1beta3.Document.Revision.HumanReview.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Revision message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Revision} Revision + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Revision.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Revision message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Revision.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.agent != null && message.hasOwnProperty("agent")) { + properties.source = 1; + if (!$util.isString(message.agent)) + return "agent: string expected"; + } + if (message.processor != null && message.hasOwnProperty("processor")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + if (!$util.isString(message.processor)) + return "processor: string expected"; + } + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.parent != null && message.hasOwnProperty("parent")) { + if (!Array.isArray(message.parent)) + return "parent: array expected"; + for (var i = 0; i < message.parent.length; ++i) + if (!$util.isInteger(message.parent[i])) + return "parent: integer[] expected"; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.humanReview != null && message.hasOwnProperty("humanReview")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Revision.HumanReview.verify(message.humanReview); + if (error) + return "humanReview." + error; + } + return null; + }; + + /** + * Creates a Revision message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Revision} Revision + */ + Revision.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Revision) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Revision(); + if (object.agent != null) + message.agent = String(object.agent); + if (object.processor != null) + message.processor = String(object.processor); + if (object.id != null) + message.id = String(object.id); + if (object.parent) { + if (!Array.isArray(object.parent)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Revision.parent: array expected"); + message.parent = []; + for (var i = 0; i < object.parent.length; ++i) + message.parent[i] = object.parent[i] | 0; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Revision.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.humanReview != null) { + if (typeof object.humanReview !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Revision.humanReview: object expected"); + message.humanReview = $root.google.cloud.documentai.v1beta3.Document.Revision.HumanReview.fromObject(object.humanReview); + } + return message; + }; + + /** + * Creates a plain object from a Revision message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @static + * @param {google.cloud.documentai.v1beta3.Document.Revision} message Revision + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Revision.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.parent = []; + if (options.defaults) { + object.id = ""; + object.createTime = null; + object.humanReview = null; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.parent && message.parent.length) { + object.parent = []; + for (var j = 0; j < message.parent.length; ++j) + object.parent[j] = message.parent[j]; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.agent != null && message.hasOwnProperty("agent")) { + object.agent = message.agent; + if (options.oneofs) + object.source = "agent"; + } + if (message.processor != null && message.hasOwnProperty("processor")) { + object.processor = message.processor; + if (options.oneofs) + object.source = "processor"; + } + if (message.humanReview != null && message.hasOwnProperty("humanReview")) + object.humanReview = $root.google.cloud.documentai.v1beta3.Document.Revision.HumanReview.toObject(message.humanReview, options); + return object; + }; + + /** + * Converts this Revision to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @instance + * @returns {Object.} JSON object + */ + Revision.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Revision.HumanReview = (function() { + + /** + * Properties of a HumanReview. + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @interface IHumanReview + * @property {string|null} [state] HumanReview state + * @property {string|null} [stateMessage] HumanReview stateMessage + */ + + /** + * Constructs a new HumanReview. + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @classdesc Represents a HumanReview. + * @implements IHumanReview + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Revision.IHumanReview=} [properties] Properties to set + */ + function HumanReview(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HumanReview state. + * @member {string} state + * @memberof google.cloud.documentai.v1beta3.Document.Revision.HumanReview + * @instance + */ + HumanReview.prototype.state = ""; + + /** + * HumanReview stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1beta3.Document.Revision.HumanReview + * @instance + */ + HumanReview.prototype.stateMessage = ""; + + /** + * Creates a new HumanReview instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Revision.HumanReview + * @static + * @param {google.cloud.documentai.v1beta3.Document.Revision.IHumanReview=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Revision.HumanReview} HumanReview instance + */ + HumanReview.create = function create(properties) { + return new HumanReview(properties); + }; + + /** + * Encodes the specified HumanReview message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Revision.HumanReview.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Revision.HumanReview + * @static + * @param {google.cloud.documentai.v1beta3.Document.Revision.IHumanReview} message HumanReview message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HumanReview.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.state); + if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); + return writer; + }; + + /** + * Encodes the specified HumanReview message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Revision.HumanReview.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Revision.HumanReview + * @static + * @param {google.cloud.documentai.v1beta3.Document.Revision.IHumanReview} message HumanReview message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HumanReview.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HumanReview message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Revision.HumanReview + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Revision.HumanReview} HumanReview + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HumanReview.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Revision.HumanReview(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.string(); + break; + case 2: + message.stateMessage = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HumanReview message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Revision.HumanReview + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Revision.HumanReview} HumanReview + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HumanReview.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HumanReview message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Revision.HumanReview + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HumanReview.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.state != null && message.hasOwnProperty("state")) + if (!$util.isString(message.state)) + return "state: string expected"; + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + if (!$util.isString(message.stateMessage)) + return "stateMessage: string expected"; + return null; + }; + + /** + * Creates a HumanReview message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Revision.HumanReview + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Revision.HumanReview} HumanReview + */ + HumanReview.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Revision.HumanReview) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Revision.HumanReview(); + if (object.state != null) + message.state = String(object.state); + if (object.stateMessage != null) + message.stateMessage = String(object.stateMessage); + return message; + }; + + /** + * Creates a plain object from a HumanReview message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Revision.HumanReview + * @static + * @param {google.cloud.documentai.v1beta3.Document.Revision.HumanReview} message HumanReview + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HumanReview.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = ""; + object.stateMessage = ""; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = message.state; + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + object.stateMessage = message.stateMessage; + return object; + }; + + /** + * Converts this HumanReview to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Revision.HumanReview + * @instance + * @returns {Object.} JSON object + */ + HumanReview.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HumanReview; + })(); + + return Revision; + })(); + + Document.TextChange = (function() { + + /** + * Properties of a TextChange. + * @memberof google.cloud.documentai.v1beta3.Document + * @interface ITextChange + * @property {google.cloud.documentai.v1beta3.Document.ITextAnchor|null} [textAnchor] TextChange textAnchor + * @property {string|null} [changedText] TextChange changedText + * @property {Array.|null} [provenance] TextChange provenance + */ + + /** + * Constructs a new TextChange. + * @memberof google.cloud.documentai.v1beta3.Document + * @classdesc Represents a TextChange. + * @implements ITextChange + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.ITextChange=} [properties] Properties to set + */ + function TextChange(properties) { + this.provenance = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TextChange textAnchor. + * @member {google.cloud.documentai.v1beta3.Document.ITextAnchor|null|undefined} textAnchor + * @memberof google.cloud.documentai.v1beta3.Document.TextChange + * @instance + */ + TextChange.prototype.textAnchor = null; + + /** + * TextChange changedText. + * @member {string} changedText + * @memberof google.cloud.documentai.v1beta3.Document.TextChange + * @instance + */ + TextChange.prototype.changedText = ""; + + /** + * TextChange provenance. + * @member {Array.} provenance + * @memberof google.cloud.documentai.v1beta3.Document.TextChange + * @instance + */ + TextChange.prototype.provenance = $util.emptyArray; + + /** + * Creates a new TextChange instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.TextChange + * @static + * @param {google.cloud.documentai.v1beta3.Document.ITextChange=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.TextChange} TextChange instance + */ + TextChange.create = function create(properties) { + return new TextChange(properties); + }; + + /** + * Encodes the specified TextChange message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.TextChange.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.TextChange + * @static + * @param {google.cloud.documentai.v1beta3.Document.ITextChange} message TextChange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextChange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textAnchor != null && Object.hasOwnProperty.call(message, "textAnchor")) + $root.google.cloud.documentai.v1beta3.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.changedText != null && Object.hasOwnProperty.call(message, "changedText")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.changedText); + if (message.provenance != null && message.provenance.length) + for (var i = 0; i < message.provenance.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Provenance.encode(message.provenance[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TextChange message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.TextChange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.TextChange + * @static + * @param {google.cloud.documentai.v1beta3.Document.ITextChange} message TextChange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextChange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextChange message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.TextChange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.TextChange} TextChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextChange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.TextChange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.decode(reader, reader.uint32()); + break; + case 2: + message.changedText = reader.string(); + break; + case 3: + if (!(message.provenance && message.provenance.length)) + message.provenance = []; + message.provenance.push($root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TextChange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.TextChange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.TextChange} TextChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextChange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextChange message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.TextChange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextChange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) { + var error = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.verify(message.textAnchor); + if (error) + return "textAnchor." + error; + } + if (message.changedText != null && message.hasOwnProperty("changedText")) + if (!$util.isString(message.changedText)) + return "changedText: string expected"; + if (message.provenance != null && message.hasOwnProperty("provenance")) { + if (!Array.isArray(message.provenance)) + return "provenance: array expected"; + for (var i = 0; i < message.provenance.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Provenance.verify(message.provenance[i]); + if (error) + return "provenance." + error; + } + } + return null; + }; + + /** + * Creates a TextChange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.TextChange + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.TextChange} TextChange + */ + TextChange.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.TextChange) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.TextChange(); + if (object.textAnchor != null) { + if (typeof object.textAnchor !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.TextChange.textAnchor: object expected"); + message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.fromObject(object.textAnchor); + } + if (object.changedText != null) + message.changedText = String(object.changedText); + if (object.provenance) { + if (!Array.isArray(object.provenance)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.TextChange.provenance: array expected"); + message.provenance = []; + for (var i = 0; i < object.provenance.length; ++i) { + if (typeof object.provenance[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.TextChange.provenance: object expected"); + message.provenance[i] = $root.google.cloud.documentai.v1beta3.Document.Provenance.fromObject(object.provenance[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TextChange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.TextChange + * @static + * @param {google.cloud.documentai.v1beta3.Document.TextChange} message TextChange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TextChange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.provenance = []; + if (options.defaults) { + object.textAnchor = null; + object.changedText = ""; + } + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + object.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.toObject(message.textAnchor, options); + if (message.changedText != null && message.hasOwnProperty("changedText")) + object.changedText = message.changedText; + if (message.provenance && message.provenance.length) { + object.provenance = []; + for (var j = 0; j < message.provenance.length; ++j) + object.provenance[j] = $root.google.cloud.documentai.v1beta3.Document.Provenance.toObject(message.provenance[j], options); + } + return object; + }; + + /** + * Converts this TextChange to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.TextChange + * @instance + * @returns {Object.} JSON object + */ + TextChange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TextChange; + })(); + + return Document; + })(); + + v1beta3.Vertex = (function() { + + /** + * Properties of a Vertex. + * @memberof google.cloud.documentai.v1beta3 + * @interface IVertex + * @property {number|null} [x] Vertex x + * @property {number|null} [y] Vertex y + */ + + /** + * Constructs a new Vertex. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a Vertex. + * @implements IVertex + * @constructor + * @param {google.cloud.documentai.v1beta3.IVertex=} [properties] Properties to set + */ + function Vertex(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Vertex x. + * @member {number} x + * @memberof google.cloud.documentai.v1beta3.Vertex + * @instance + */ + Vertex.prototype.x = 0; + + /** + * Vertex y. + * @member {number} y + * @memberof google.cloud.documentai.v1beta3.Vertex + * @instance + */ + Vertex.prototype.y = 0; + + /** + * Creates a new Vertex instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Vertex + * @static + * @param {google.cloud.documentai.v1beta3.IVertex=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Vertex} Vertex instance + */ + Vertex.create = function create(properties) { + return new Vertex(properties); + }; + + /** + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.documentai.v1beta3.Vertex.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Vertex + * @static + * @param {google.cloud.documentai.v1beta3.IVertex} message Vertex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Vertex.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.x != null && Object.hasOwnProperty.call(message, "x")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); + if (message.y != null && Object.hasOwnProperty.call(message, "y")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); + return writer; + }; + + /** + * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Vertex.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Vertex + * @static + * @param {google.cloud.documentai.v1beta3.IVertex} message Vertex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Vertex.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Vertex message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Vertex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Vertex} Vertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Vertex.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Vertex(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.x = reader.int32(); + break; + case 2: + message.y = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Vertex message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Vertex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Vertex} Vertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Vertex.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Vertex message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Vertex + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Vertex.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.x != null && message.hasOwnProperty("x")) + if (!$util.isInteger(message.x)) + return "x: integer expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (!$util.isInteger(message.y)) + return "y: integer expected"; + return null; + }; + + /** + * Creates a Vertex message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Vertex + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Vertex} Vertex + */ + Vertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Vertex) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Vertex(); + if (object.x != null) + message.x = object.x | 0; + if (object.y != null) + message.y = object.y | 0; + return message; + }; + + /** + * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Vertex + * @static + * @param {google.cloud.documentai.v1beta3.Vertex} message Vertex + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Vertex.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.x = 0; + object.y = 0; + } + if (message.x != null && message.hasOwnProperty("x")) + object.x = message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = message.y; + return object; + }; + + /** + * Converts this Vertex to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Vertex + * @instance + * @returns {Object.} JSON object + */ + Vertex.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Vertex; + })(); + + v1beta3.NormalizedVertex = (function() { + + /** + * Properties of a NormalizedVertex. + * @memberof google.cloud.documentai.v1beta3 + * @interface INormalizedVertex + * @property {number|null} [x] NormalizedVertex x + * @property {number|null} [y] NormalizedVertex y + */ + + /** + * Constructs a new NormalizedVertex. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a NormalizedVertex. + * @implements INormalizedVertex + * @constructor + * @param {google.cloud.documentai.v1beta3.INormalizedVertex=} [properties] Properties to set + */ + function NormalizedVertex(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NormalizedVertex x. + * @member {number} x + * @memberof google.cloud.documentai.v1beta3.NormalizedVertex + * @instance + */ + NormalizedVertex.prototype.x = 0; + + /** + * NormalizedVertex y. + * @member {number} y + * @memberof google.cloud.documentai.v1beta3.NormalizedVertex + * @instance + */ + NormalizedVertex.prototype.y = 0; + + /** + * Creates a new NormalizedVertex instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.NormalizedVertex + * @static + * @param {google.cloud.documentai.v1beta3.INormalizedVertex=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.NormalizedVertex} NormalizedVertex instance + */ + NormalizedVertex.create = function create(properties) { + return new NormalizedVertex(properties); + }; + + /** + * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.documentai.v1beta3.NormalizedVertex.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.NormalizedVertex + * @static + * @param {google.cloud.documentai.v1beta3.INormalizedVertex} message NormalizedVertex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NormalizedVertex.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.x != null && Object.hasOwnProperty.call(message, "x")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); + if (message.y != null && Object.hasOwnProperty.call(message, "y")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); + return writer; + }; + + /** + * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.NormalizedVertex.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.NormalizedVertex + * @static + * @param {google.cloud.documentai.v1beta3.INormalizedVertex} message NormalizedVertex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NormalizedVertex.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.NormalizedVertex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.NormalizedVertex} NormalizedVertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NormalizedVertex.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.NormalizedVertex(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.x = reader.float(); + break; + case 2: + message.y = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.NormalizedVertex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.NormalizedVertex} NormalizedVertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NormalizedVertex.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NormalizedVertex message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.NormalizedVertex + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NormalizedVertex.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.x != null && message.hasOwnProperty("x")) + if (typeof message.x !== "number") + return "x: number expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (typeof message.y !== "number") + return "y: number expected"; + return null; + }; + + /** + * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.NormalizedVertex + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.NormalizedVertex} NormalizedVertex + */ + NormalizedVertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.NormalizedVertex) + return object; + var message = new $root.google.cloud.documentai.v1beta3.NormalizedVertex(); + if (object.x != null) + message.x = Number(object.x); + if (object.y != null) + message.y = Number(object.y); + return message; + }; + + /** + * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.NormalizedVertex + * @static + * @param {google.cloud.documentai.v1beta3.NormalizedVertex} message NormalizedVertex + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NormalizedVertex.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.x = 0; + object.y = 0; + } + if (message.x != null && message.hasOwnProperty("x")) + object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; + return object; + }; + + /** + * Converts this NormalizedVertex to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.NormalizedVertex + * @instance + * @returns {Object.} JSON object + */ + NormalizedVertex.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NormalizedVertex; + })(); + + v1beta3.BoundingPoly = (function() { + + /** + * Properties of a BoundingPoly. + * @memberof google.cloud.documentai.v1beta3 + * @interface IBoundingPoly + * @property {Array.|null} [vertices] BoundingPoly vertices + * @property {Array.|null} [normalizedVertices] BoundingPoly normalizedVertices + */ + + /** + * Constructs a new BoundingPoly. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a BoundingPoly. + * @implements IBoundingPoly + * @constructor + * @param {google.cloud.documentai.v1beta3.IBoundingPoly=} [properties] Properties to set + */ + function BoundingPoly(properties) { + this.vertices = []; + this.normalizedVertices = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BoundingPoly vertices. + * @member {Array.} vertices + * @memberof google.cloud.documentai.v1beta3.BoundingPoly + * @instance + */ + BoundingPoly.prototype.vertices = $util.emptyArray; + + /** + * BoundingPoly normalizedVertices. + * @member {Array.} normalizedVertices + * @memberof google.cloud.documentai.v1beta3.BoundingPoly + * @instance + */ + BoundingPoly.prototype.normalizedVertices = $util.emptyArray; + + /** + * Creates a new BoundingPoly instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.BoundingPoly + * @static + * @param {google.cloud.documentai.v1beta3.IBoundingPoly=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.BoundingPoly} BoundingPoly instance + */ + BoundingPoly.create = function create(properties) { + return new BoundingPoly(properties); + }; + + /** + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.documentai.v1beta3.BoundingPoly.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.BoundingPoly + * @static + * @param {google.cloud.documentai.v1beta3.IBoundingPoly} message BoundingPoly message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoundingPoly.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.vertices != null && message.vertices.length) + for (var i = 0; i < message.vertices.length; ++i) + $root.google.cloud.documentai.v1beta3.Vertex.encode(message.vertices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.normalizedVertices != null && message.normalizedVertices.length) + for (var i = 0; i < message.normalizedVertices.length; ++i) + $root.google.cloud.documentai.v1beta3.NormalizedVertex.encode(message.normalizedVertices[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.BoundingPoly.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.BoundingPoly + * @static + * @param {google.cloud.documentai.v1beta3.IBoundingPoly} message BoundingPoly message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.BoundingPoly + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.BoundingPoly} BoundingPoly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoundingPoly.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.BoundingPoly(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.vertices && message.vertices.length)) + message.vertices = []; + message.vertices.push($root.google.cloud.documentai.v1beta3.Vertex.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.normalizedVertices && message.normalizedVertices.length)) + message.normalizedVertices = []; + message.normalizedVertices.push($root.google.cloud.documentai.v1beta3.NormalizedVertex.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.BoundingPoly + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.BoundingPoly} BoundingPoly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoundingPoly.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BoundingPoly message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.BoundingPoly + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoundingPoly.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.vertices != null && message.hasOwnProperty("vertices")) { + if (!Array.isArray(message.vertices)) + return "vertices: array expected"; + for (var i = 0; i < message.vertices.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Vertex.verify(message.vertices[i]); + if (error) + return "vertices." + error; + } + } + if (message.normalizedVertices != null && message.hasOwnProperty("normalizedVertices")) { + if (!Array.isArray(message.normalizedVertices)) + return "normalizedVertices: array expected"; + for (var i = 0; i < message.normalizedVertices.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.NormalizedVertex.verify(message.normalizedVertices[i]); + if (error) + return "normalizedVertices." + error; + } + } + return null; + }; + + /** + * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.BoundingPoly + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.BoundingPoly} BoundingPoly + */ + BoundingPoly.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.BoundingPoly) + return object; + var message = new $root.google.cloud.documentai.v1beta3.BoundingPoly(); + if (object.vertices) { + if (!Array.isArray(object.vertices)) + throw TypeError(".google.cloud.documentai.v1beta3.BoundingPoly.vertices: array expected"); + message.vertices = []; + for (var i = 0; i < object.vertices.length; ++i) { + if (typeof object.vertices[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.BoundingPoly.vertices: object expected"); + message.vertices[i] = $root.google.cloud.documentai.v1beta3.Vertex.fromObject(object.vertices[i]); + } + } + if (object.normalizedVertices) { + if (!Array.isArray(object.normalizedVertices)) + throw TypeError(".google.cloud.documentai.v1beta3.BoundingPoly.normalizedVertices: array expected"); + message.normalizedVertices = []; + for (var i = 0; i < object.normalizedVertices.length; ++i) { + if (typeof object.normalizedVertices[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.BoundingPoly.normalizedVertices: object expected"); + message.normalizedVertices[i] = $root.google.cloud.documentai.v1beta3.NormalizedVertex.fromObject(object.normalizedVertices[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.BoundingPoly + * @static + * @param {google.cloud.documentai.v1beta3.BoundingPoly} message BoundingPoly + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoundingPoly.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.vertices = []; + object.normalizedVertices = []; + } + if (message.vertices && message.vertices.length) { + object.vertices = []; + for (var j = 0; j < message.vertices.length; ++j) + object.vertices[j] = $root.google.cloud.documentai.v1beta3.Vertex.toObject(message.vertices[j], options); + } + if (message.normalizedVertices && message.normalizedVertices.length) { + object.normalizedVertices = []; + for (var j = 0; j < message.normalizedVertices.length; ++j) + object.normalizedVertices[j] = $root.google.cloud.documentai.v1beta3.NormalizedVertex.toObject(message.normalizedVertices[j], options); + } + return object; + }; + + /** + * Converts this BoundingPoly to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.BoundingPoly + * @instance + * @returns {Object.} JSON object + */ + BoundingPoly.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BoundingPoly; + })(); + + v1beta3.DocumentProcessorService = (function() { + + /** + * Constructs a new DocumentProcessorService service. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a DocumentProcessorService + * @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 DocumentProcessorService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (DocumentProcessorService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = DocumentProcessorService; + + /** + * Creates new DocumentProcessorService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @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 {DocumentProcessorService} RPC service. Useful where requests and/or responses are streamed. + */ + DocumentProcessorService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#processDocument}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef ProcessDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1beta3.ProcessResponse} [response] ProcessResponse + */ + + /** + * Calls ProcessDocument. + * @function processDocument + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IProcessRequest} request ProcessRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.ProcessDocumentCallback} callback Node-style callback called with the error, if any, and ProcessResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.processDocument = function processDocument(request, callback) { + return this.rpcCall(processDocument, $root.google.cloud.documentai.v1beta3.ProcessRequest, $root.google.cloud.documentai.v1beta3.ProcessResponse, request, callback); + }, "name", { value: "ProcessDocument" }); + + /** + * Calls ProcessDocument. + * @function processDocument + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IProcessRequest} request ProcessRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#batchProcessDocuments}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef BatchProcessDocumentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchProcessDocuments. + * @function batchProcessDocuments + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IBatchProcessRequest} request BatchProcessRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.BatchProcessDocumentsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.batchProcessDocuments = function batchProcessDocuments(request, callback) { + return this.rpcCall(batchProcessDocuments, $root.google.cloud.documentai.v1beta3.BatchProcessRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchProcessDocuments" }); + + /** + * Calls BatchProcessDocuments. + * @function batchProcessDocuments + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IBatchProcessRequest} request BatchProcessRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#reviewDocument}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef ReviewDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ReviewDocument. + * @function reviewDocument + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} request ReviewDocumentRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.ReviewDocumentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.reviewDocument = function reviewDocument(request, callback) { + return this.rpcCall(reviewDocument, $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ReviewDocument" }); + + /** + * Calls ReviewDocument. + * @function reviewDocument + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} request ReviewDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return DocumentProcessorService; + })(); + + v1beta3.ProcessRequest = (function() { + + /** + * Properties of a ProcessRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IProcessRequest + * @property {string|null} [name] ProcessRequest name + * @property {google.cloud.documentai.v1beta3.IDocument|null} [document] ProcessRequest document + * @property {boolean|null} [skipHumanReview] ProcessRequest skipHumanReview + */ + + /** + * Constructs a new ProcessRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ProcessRequest. + * @implements IProcessRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.IProcessRequest=} [properties] Properties to set + */ + function ProcessRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProcessRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @instance + */ + ProcessRequest.prototype.name = ""; + + /** + * ProcessRequest document. + * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} document + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @instance + */ + ProcessRequest.prototype.document = null; + + /** + * ProcessRequest skipHumanReview. + * @member {boolean} skipHumanReview + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @instance + */ + ProcessRequest.prototype.skipHumanReview = false; + + /** + * Creates a new ProcessRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @static + * @param {google.cloud.documentai.v1beta3.IProcessRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ProcessRequest} ProcessRequest instance + */ + ProcessRequest.create = function create(properties) { + return new ProcessRequest(properties); + }; + + /** + * Encodes the specified ProcessRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @static + * @param {google.cloud.documentai.v1beta3.IProcessRequest} message ProcessRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessRequest.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.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.cloud.documentai.v1beta3.Document.encode(message.document, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.skipHumanReview != null && Object.hasOwnProperty.call(message, "skipHumanReview")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.skipHumanReview); + return writer; + }; + + /** + * Encodes the specified ProcessRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @static + * @param {google.cloud.documentai.v1beta3.IProcessRequest} message ProcessRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProcessRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ProcessRequest} ProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ProcessRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.document = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); + break; + case 3: + message.skipHumanReview = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProcessRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ProcessRequest} ProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProcessRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProcessRequest.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.document != null && message.hasOwnProperty("document")) { + var error = $root.google.cloud.documentai.v1beta3.Document.verify(message.document); + if (error) + return "document." + error; + } + if (message.skipHumanReview != null && message.hasOwnProperty("skipHumanReview")) + if (typeof message.skipHumanReview !== "boolean") + return "skipHumanReview: boolean expected"; + return null; + }; + + /** + * Creates a ProcessRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ProcessRequest} ProcessRequest + */ + ProcessRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ProcessRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ProcessRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.document != null) { + if (typeof object.document !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ProcessRequest.document: object expected"); + message.document = $root.google.cloud.documentai.v1beta3.Document.fromObject(object.document); + } + if (object.skipHumanReview != null) + message.skipHumanReview = Boolean(object.skipHumanReview); + return message; + }; + + /** + * Creates a plain object from a ProcessRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @static + * @param {google.cloud.documentai.v1beta3.ProcessRequest} message ProcessRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProcessRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.document = null; + object.skipHumanReview = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.document != null && message.hasOwnProperty("document")) + object.document = $root.google.cloud.documentai.v1beta3.Document.toObject(message.document, options); + if (message.skipHumanReview != null && message.hasOwnProperty("skipHumanReview")) + object.skipHumanReview = message.skipHumanReview; + return object; + }; + + /** + * Converts this ProcessRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @instance + * @returns {Object.} JSON object + */ + ProcessRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProcessRequest; + })(); + + v1beta3.ProcessResponse = (function() { + + /** + * Properties of a ProcessResponse. + * @memberof google.cloud.documentai.v1beta3 + * @interface IProcessResponse + * @property {google.cloud.documentai.v1beta3.IDocument|null} [document] ProcessResponse document + * @property {string|null} [humanReviewOperation] ProcessResponse humanReviewOperation + */ + + /** + * Constructs a new ProcessResponse. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ProcessResponse. + * @implements IProcessResponse + * @constructor + * @param {google.cloud.documentai.v1beta3.IProcessResponse=} [properties] Properties to set + */ + function ProcessResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProcessResponse document. + * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} document + * @memberof google.cloud.documentai.v1beta3.ProcessResponse + * @instance + */ + ProcessResponse.prototype.document = null; + + /** + * ProcessResponse humanReviewOperation. + * @member {string} humanReviewOperation + * @memberof google.cloud.documentai.v1beta3.ProcessResponse + * @instance + */ + ProcessResponse.prototype.humanReviewOperation = ""; + + /** + * Creates a new ProcessResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ProcessResponse + * @static + * @param {google.cloud.documentai.v1beta3.IProcessResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ProcessResponse} ProcessResponse instance + */ + ProcessResponse.create = function create(properties) { + return new ProcessResponse(properties); + }; + + /** + * Encodes the specified ProcessResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ProcessResponse + * @static + * @param {google.cloud.documentai.v1beta3.IProcessResponse} message ProcessResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.cloud.documentai.v1beta3.Document.encode(message.document, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.humanReviewOperation != null && Object.hasOwnProperty.call(message, "humanReviewOperation")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.humanReviewOperation); + return writer; + }; + + /** + * Encodes the specified ProcessResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ProcessResponse + * @static + * @param {google.cloud.documentai.v1beta3.IProcessResponse} message ProcessResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProcessResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ProcessResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ProcessResponse} ProcessResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ProcessResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.document = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); + break; + case 2: + message.humanReviewOperation = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProcessResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ProcessResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ProcessResponse} ProcessResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProcessResponse message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ProcessResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProcessResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.document != null && message.hasOwnProperty("document")) { + var error = $root.google.cloud.documentai.v1beta3.Document.verify(message.document); + if (error) + return "document." + error; + } + if (message.humanReviewOperation != null && message.hasOwnProperty("humanReviewOperation")) + if (!$util.isString(message.humanReviewOperation)) + return "humanReviewOperation: string expected"; + return null; + }; + + /** + * Creates a ProcessResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ProcessResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ProcessResponse} ProcessResponse + */ + ProcessResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ProcessResponse) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ProcessResponse(); + if (object.document != null) { + if (typeof object.document !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ProcessResponse.document: object expected"); + message.document = $root.google.cloud.documentai.v1beta3.Document.fromObject(object.document); + } + if (object.humanReviewOperation != null) + message.humanReviewOperation = String(object.humanReviewOperation); + return message; + }; + + /** + * Creates a plain object from a ProcessResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ProcessResponse + * @static + * @param {google.cloud.documentai.v1beta3.ProcessResponse} message ProcessResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProcessResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.document = null; + object.humanReviewOperation = ""; + } + if (message.document != null && message.hasOwnProperty("document")) + object.document = $root.google.cloud.documentai.v1beta3.Document.toObject(message.document, options); + if (message.humanReviewOperation != null && message.hasOwnProperty("humanReviewOperation")) + object.humanReviewOperation = message.humanReviewOperation; + return object; + }; + + /** + * Converts this ProcessResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ProcessResponse + * @instance + * @returns {Object.} JSON object + */ + ProcessResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProcessResponse; + })(); + + v1beta3.BatchProcessRequest = (function() { + + /** + * Properties of a BatchProcessRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IBatchProcessRequest + * @property {string|null} [name] BatchProcessRequest name + * @property {Array.|null} [inputConfigs] BatchProcessRequest inputConfigs + * @property {google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchOutputConfig|null} [outputConfig] BatchProcessRequest outputConfig + */ + + /** + * Constructs a new BatchProcessRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a BatchProcessRequest. + * @implements IBatchProcessRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.IBatchProcessRequest=} [properties] Properties to set + */ + function BatchProcessRequest(properties) { + this.inputConfigs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchProcessRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest + * @instance + */ + BatchProcessRequest.prototype.name = ""; + + /** + * BatchProcessRequest inputConfigs. + * @member {Array.} inputConfigs + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest + * @instance + */ + BatchProcessRequest.prototype.inputConfigs = $util.emptyArray; + + /** + * BatchProcessRequest outputConfig. + * @member {google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest + * @instance + */ + BatchProcessRequest.prototype.outputConfig = null; + + /** + * Creates a new BatchProcessRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest + * @static + * @param {google.cloud.documentai.v1beta3.IBatchProcessRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.BatchProcessRequest} BatchProcessRequest instance + */ + BatchProcessRequest.create = function create(properties) { + return new BatchProcessRequest(properties); + }; + + /** + * Encodes the specified BatchProcessRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest + * @static + * @param {google.cloud.documentai.v1beta3.IBatchProcessRequest} message BatchProcessRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProcessRequest.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.inputConfigs != null && message.inputConfigs.length) + for (var i = 0; i < message.inputConfigs.length; ++i) + $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.encode(message.inputConfigs[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) + $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.encode(message.outputConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchProcessRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest + * @static + * @param {google.cloud.documentai.v1beta3.IBatchProcessRequest} message BatchProcessRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProcessRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchProcessRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.BatchProcessRequest} BatchProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProcessRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.BatchProcessRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + if (!(message.inputConfigs && message.inputConfigs.length)) + message.inputConfigs = []; + message.inputConfigs.push($root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.decode(reader, reader.uint32())); + break; + case 3: + message.outputConfig = $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchProcessRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.BatchProcessRequest} BatchProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProcessRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchProcessRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchProcessRequest.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.inputConfigs != null && message.hasOwnProperty("inputConfigs")) { + if (!Array.isArray(message.inputConfigs)) + return "inputConfigs: array expected"; + for (var i = 0; i < message.inputConfigs.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.verify(message.inputConfigs[i]); + if (error) + return "inputConfigs." + error; + } + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } + return null; + }; + + /** + * Creates a BatchProcessRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.BatchProcessRequest} BatchProcessRequest + */ + BatchProcessRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.BatchProcessRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta3.BatchProcessRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.inputConfigs) { + if (!Array.isArray(object.inputConfigs)) + throw TypeError(".google.cloud.documentai.v1beta3.BatchProcessRequest.inputConfigs: array expected"); + message.inputConfigs = []; + for (var i = 0; i < object.inputConfigs.length; ++i) { + if (typeof object.inputConfigs[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.BatchProcessRequest.inputConfigs: object expected"); + message.inputConfigs[i] = $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.fromObject(object.inputConfigs[i]); + } + } + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.BatchProcessRequest.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.fromObject(object.outputConfig); + } + return message; + }; + + /** + * Creates a plain object from a BatchProcessRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest + * @static + * @param {google.cloud.documentai.v1beta3.BatchProcessRequest} message BatchProcessRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchProcessRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.inputConfigs = []; + if (options.defaults) { + object.name = ""; + object.outputConfig = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.inputConfigs && message.inputConfigs.length) { + object.inputConfigs = []; + for (var j = 0; j < message.inputConfigs.length; ++j) + object.inputConfigs[j] = $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.toObject(message.inputConfigs[j], options); + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.toObject(message.outputConfig, options); + return object; + }; + + /** + * Converts this BatchProcessRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest + * @instance + * @returns {Object.} JSON object + */ + BatchProcessRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + BatchProcessRequest.BatchInputConfig = (function() { + + /** + * Properties of a BatchInputConfig. + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest + * @interface IBatchInputConfig + * @property {string|null} [gcsSource] BatchInputConfig gcsSource + * @property {string|null} [mimeType] BatchInputConfig mimeType + */ + + /** + * Constructs a new BatchInputConfig. + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest + * @classdesc Represents a BatchInputConfig. + * @implements IBatchInputConfig + * @constructor + * @param {google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchInputConfig=} [properties] Properties to set + */ + function BatchInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchInputConfig gcsSource. + * @member {string} gcsSource + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + * @instance + */ + BatchInputConfig.prototype.gcsSource = ""; + + /** + * BatchInputConfig mimeType. + * @member {string} mimeType + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + * @instance + */ + BatchInputConfig.prototype.mimeType = ""; + + /** + * Creates a new BatchInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + * @static + * @param {google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchInputConfig=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig} BatchInputConfig instance + */ + BatchInputConfig.create = function create(properties) { + return new BatchInputConfig(properties); + }; + + /** + * Encodes the specified BatchInputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + * @static + * @param {google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchInputConfig} message BatchInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsSource); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); + return writer; + }; + + /** + * Encodes the specified BatchInputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + * @static + * @param {google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchInputConfig} message BatchInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig} BatchInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsSource = reader.string(); + break; + case 2: + message.mimeType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig} BatchInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchInputConfig message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) + if (!$util.isString(message.gcsSource)) + return "gcsSource: string expected"; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + return null; + }; + + /** + * Creates a BatchInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig} BatchInputConfig + */ + BatchInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig) + return object; + var message = new $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig(); + if (object.gcsSource != null) + message.gcsSource = String(object.gcsSource); + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + return message; + }; + + /** + * Creates a plain object from a BatchInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + * @static + * @param {google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig} message BatchInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.gcsSource = ""; + object.mimeType = ""; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) + object.gcsSource = message.gcsSource; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + return object; + }; + + /** + * Converts this BatchInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + * @instance + * @returns {Object.} JSON object + */ + BatchInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BatchInputConfig; + })(); + + BatchProcessRequest.BatchOutputConfig = (function() { + + /** + * Properties of a BatchOutputConfig. + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest + * @interface IBatchOutputConfig + * @property {string|null} [gcsDestination] BatchOutputConfig gcsDestination + */ + + /** + * Constructs a new BatchOutputConfig. + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest + * @classdesc Represents a BatchOutputConfig. + * @implements IBatchOutputConfig + * @constructor + * @param {google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchOutputConfig=} [properties] Properties to set + */ + function BatchOutputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchOutputConfig gcsDestination. + * @member {string} gcsDestination + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + * @instance + */ + BatchOutputConfig.prototype.gcsDestination = ""; + + /** + * Creates a new BatchOutputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + * @static + * @param {google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchOutputConfig=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig} BatchOutputConfig instance + */ + BatchOutputConfig.create = function create(properties) { + return new BatchOutputConfig(properties); + }; + + /** + * Encodes the specified BatchOutputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + * @static + * @param {google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchOutputConfig} message BatchOutputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchOutputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsDestination); + return writer; + }; + + /** + * Encodes the specified BatchOutputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + * @static + * @param {google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchOutputConfig} message BatchOutputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchOutputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchOutputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig} BatchOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchOutputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsDestination = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchOutputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig} BatchOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchOutputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchOutputConfig message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchOutputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + if (!$util.isString(message.gcsDestination)) + return "gcsDestination: string expected"; + return null; + }; + + /** + * Creates a BatchOutputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig} BatchOutputConfig + */ + BatchOutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig) + return object; + var message = new $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig(); + if (object.gcsDestination != null) + message.gcsDestination = String(object.gcsDestination); + return message; + }; + + /** + * Creates a plain object from a BatchOutputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + * @static + * @param {google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig} message BatchOutputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchOutputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.gcsDestination = ""; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + object.gcsDestination = message.gcsDestination; + return object; + }; + + /** + * Converts this BatchOutputConfig to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + * @instance + * @returns {Object.} JSON object + */ + BatchOutputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BatchOutputConfig; + })(); + + return BatchProcessRequest; + })(); + + v1beta3.BatchProcessResponse = (function() { + + /** + * Properties of a BatchProcessResponse. + * @memberof google.cloud.documentai.v1beta3 + * @interface IBatchProcessResponse + */ + + /** + * Constructs a new BatchProcessResponse. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a BatchProcessResponse. + * @implements IBatchProcessResponse + * @constructor + * @param {google.cloud.documentai.v1beta3.IBatchProcessResponse=} [properties] Properties to set + */ + function BatchProcessResponse(properties) { + if (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 BatchProcessResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.BatchProcessResponse + * @static + * @param {google.cloud.documentai.v1beta3.IBatchProcessResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.BatchProcessResponse} BatchProcessResponse instance + */ + BatchProcessResponse.create = function create(properties) { + return new BatchProcessResponse(properties); + }; + + /** + * Encodes the specified BatchProcessResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.BatchProcessResponse + * @static + * @param {google.cloud.documentai.v1beta3.IBatchProcessResponse} message BatchProcessResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProcessResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified BatchProcessResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.BatchProcessResponse + * @static + * @param {google.cloud.documentai.v1beta3.IBatchProcessResponse} message BatchProcessResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProcessResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchProcessResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.BatchProcessResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.BatchProcessResponse} BatchProcessResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProcessResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.BatchProcessResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchProcessResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.BatchProcessResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.BatchProcessResponse} BatchProcessResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProcessResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchProcessResponse message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.BatchProcessResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchProcessResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a BatchProcessResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.BatchProcessResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.BatchProcessResponse} BatchProcessResponse + */ + BatchProcessResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.BatchProcessResponse) + return object; + return new $root.google.cloud.documentai.v1beta3.BatchProcessResponse(); + }; + + /** + * Creates a plain object from a BatchProcessResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.BatchProcessResponse + * @static + * @param {google.cloud.documentai.v1beta3.BatchProcessResponse} message BatchProcessResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchProcessResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this BatchProcessResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.BatchProcessResponse + * @instance + * @returns {Object.} JSON object + */ + BatchProcessResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BatchProcessResponse; + })(); + + v1beta3.BatchProcessMetadata = (function() { + + /** + * Properties of a BatchProcessMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @interface IBatchProcessMetadata + * @property {google.cloud.documentai.v1beta3.BatchProcessMetadata.State|null} [state] BatchProcessMetadata state + * @property {string|null} [stateMessage] BatchProcessMetadata stateMessage + * @property {google.protobuf.ITimestamp|null} [createTime] BatchProcessMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] BatchProcessMetadata updateTime + * @property {Array.|null} [individualProcessStatuses] BatchProcessMetadata individualProcessStatuses + */ + + /** + * Constructs a new BatchProcessMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a BatchProcessMetadata. + * @implements IBatchProcessMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.IBatchProcessMetadata=} [properties] Properties to set + */ + function BatchProcessMetadata(properties) { + this.individualProcessStatuses = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchProcessMetadata state. + * @member {google.cloud.documentai.v1beta3.BatchProcessMetadata.State} state + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata + * @instance + */ + BatchProcessMetadata.prototype.state = 0; + + /** + * BatchProcessMetadata stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata + * @instance + */ + BatchProcessMetadata.prototype.stateMessage = ""; + + /** + * BatchProcessMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata + * @instance + */ + BatchProcessMetadata.prototype.createTime = null; + + /** + * BatchProcessMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata + * @instance + */ + BatchProcessMetadata.prototype.updateTime = null; + + /** + * BatchProcessMetadata individualProcessStatuses. + * @member {Array.} individualProcessStatuses + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata + * @instance + */ + BatchProcessMetadata.prototype.individualProcessStatuses = $util.emptyArray; + + /** + * Creates a new BatchProcessMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IBatchProcessMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.BatchProcessMetadata} BatchProcessMetadata instance + */ + BatchProcessMetadata.create = function create(properties) { + return new BatchProcessMetadata(properties); + }; + + /** + * Encodes the specified BatchProcessMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IBatchProcessMetadata} message BatchProcessMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProcessMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.individualProcessStatuses != null && message.individualProcessStatuses.length) + for (var i = 0; i < message.individualProcessStatuses.length; ++i) + $root.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus.encode(message.individualProcessStatuses[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchProcessMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IBatchProcessMetadata} message BatchProcessMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProcessMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchProcessMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.BatchProcessMetadata} BatchProcessMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProcessMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.BatchProcessMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.int32(); + break; + case 2: + message.stateMessage = reader.string(); + break; + case 3: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + if (!(message.individualProcessStatuses && message.individualProcessStatuses.length)) + message.individualProcessStatuses = []; + message.individualProcessStatuses.push($root.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchProcessMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.BatchProcessMetadata} BatchProcessMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProcessMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchProcessMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchProcessMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + if (!$util.isString(message.stateMessage)) + return "stateMessage: string 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.individualProcessStatuses != null && message.hasOwnProperty("individualProcessStatuses")) { + if (!Array.isArray(message.individualProcessStatuses)) + return "individualProcessStatuses: array expected"; + for (var i = 0; i < message.individualProcessStatuses.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus.verify(message.individualProcessStatuses[i]); + if (error) + return "individualProcessStatuses." + error; + } + } + return null; + }; + + /** + * Creates a BatchProcessMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.BatchProcessMetadata} BatchProcessMetadata + */ + BatchProcessMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.BatchProcessMetadata) + return object; + var message = new $root.google.cloud.documentai.v1beta3.BatchProcessMetadata(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "WAITING": + case 1: + message.state = 1; + break; + case "RUNNING": + case 2: + message.state = 2; + break; + case "SUCCEEDED": + case 3: + message.state = 3; + break; + case "CANCELLING": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + case "FAILED": + case 6: + message.state = 6; + break; + } + if (object.stateMessage != null) + message.stateMessage = String(object.stateMessage); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.BatchProcessMetadata.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.documentai.v1beta3.BatchProcessMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.individualProcessStatuses) { + if (!Array.isArray(object.individualProcessStatuses)) + throw TypeError(".google.cloud.documentai.v1beta3.BatchProcessMetadata.individualProcessStatuses: array expected"); + message.individualProcessStatuses = []; + for (var i = 0; i < object.individualProcessStatuses.length; ++i) { + if (typeof object.individualProcessStatuses[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.BatchProcessMetadata.individualProcessStatuses: object expected"); + message.individualProcessStatuses[i] = $root.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus.fromObject(object.individualProcessStatuses[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BatchProcessMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata + * @static + * @param {google.cloud.documentai.v1beta3.BatchProcessMetadata} message BatchProcessMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchProcessMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.individualProcessStatuses = []; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.stateMessage = ""; + object.createTime = null; + object.updateTime = null; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.BatchProcessMetadata.State[message.state] : message.state; + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + object.stateMessage = message.stateMessage; + 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.individualProcessStatuses && message.individualProcessStatuses.length) { + object.individualProcessStatuses = []; + for (var j = 0; j < message.individualProcessStatuses.length; ++j) + object.individualProcessStatuses[j] = $root.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus.toObject(message.individualProcessStatuses[j], options); + } + return object; + }; + + /** + * Converts this BatchProcessMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata + * @instance + * @returns {Object.} JSON object + */ + BatchProcessMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + BatchProcessMetadata.IndividualProcessStatus = (function() { + + /** + * Properties of an IndividualProcessStatus. + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata + * @interface IIndividualProcessStatus + * @property {string|null} [inputGcsSource] IndividualProcessStatus inputGcsSource + * @property {google.rpc.IStatus|null} [status] IndividualProcessStatus status + * @property {string|null} [outputGcsDestination] IndividualProcessStatus outputGcsDestination + * @property {string|null} [humanReviewOperation] IndividualProcessStatus humanReviewOperation + */ + + /** + * Constructs a new IndividualProcessStatus. + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata + * @classdesc Represents an IndividualProcessStatus. + * @implements IIndividualProcessStatus + * @constructor + * @param {google.cloud.documentai.v1beta3.BatchProcessMetadata.IIndividualProcessStatus=} [properties] Properties to set + */ + function IndividualProcessStatus(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IndividualProcessStatus inputGcsSource. + * @member {string} inputGcsSource + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + * @instance + */ + IndividualProcessStatus.prototype.inputGcsSource = ""; + + /** + * IndividualProcessStatus status. + * @member {google.rpc.IStatus|null|undefined} status + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + * @instance + */ + IndividualProcessStatus.prototype.status = null; + + /** + * IndividualProcessStatus outputGcsDestination. + * @member {string} outputGcsDestination + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + * @instance + */ + IndividualProcessStatus.prototype.outputGcsDestination = ""; + + /** + * IndividualProcessStatus humanReviewOperation. + * @member {string} humanReviewOperation + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + * @instance + */ + IndividualProcessStatus.prototype.humanReviewOperation = ""; + + /** + * Creates a new IndividualProcessStatus instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + * @static + * @param {google.cloud.documentai.v1beta3.BatchProcessMetadata.IIndividualProcessStatus=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus} IndividualProcessStatus instance + */ + IndividualProcessStatus.create = function create(properties) { + return new IndividualProcessStatus(properties); + }; + + /** + * Encodes the specified IndividualProcessStatus message. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + * @static + * @param {google.cloud.documentai.v1beta3.BatchProcessMetadata.IIndividualProcessStatus} message IndividualProcessStatus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IndividualProcessStatus.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.inputGcsSource != null && Object.hasOwnProperty.call(message, "inputGcsSource")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputGcsSource); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + $root.google.rpc.Status.encode(message.status, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.outputGcsDestination != null && Object.hasOwnProperty.call(message, "outputGcsDestination")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputGcsDestination); + if (message.humanReviewOperation != null && Object.hasOwnProperty.call(message, "humanReviewOperation")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.humanReviewOperation); + return writer; + }; + + /** + * Encodes the specified IndividualProcessStatus message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + * @static + * @param {google.cloud.documentai.v1beta3.BatchProcessMetadata.IIndividualProcessStatus} message IndividualProcessStatus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IndividualProcessStatus.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IndividualProcessStatus message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus} IndividualProcessStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IndividualProcessStatus.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.inputGcsSource = reader.string(); + break; + case 2: + message.status = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + case 3: + message.outputGcsDestination = reader.string(); + break; + case 4: + message.humanReviewOperation = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IndividualProcessStatus message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus} IndividualProcessStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IndividualProcessStatus.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IndividualProcessStatus message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IndividualProcessStatus.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.inputGcsSource != null && message.hasOwnProperty("inputGcsSource")) + if (!$util.isString(message.inputGcsSource)) + return "inputGcsSource: string expected"; + if (message.status != null && message.hasOwnProperty("status")) { + var error = $root.google.rpc.Status.verify(message.status); + if (error) + return "status." + error; + } + if (message.outputGcsDestination != null && message.hasOwnProperty("outputGcsDestination")) + if (!$util.isString(message.outputGcsDestination)) + return "outputGcsDestination: string expected"; + if (message.humanReviewOperation != null && message.hasOwnProperty("humanReviewOperation")) + if (!$util.isString(message.humanReviewOperation)) + return "humanReviewOperation: string expected"; + return null; + }; + + /** + * Creates an IndividualProcessStatus message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus} IndividualProcessStatus + */ + IndividualProcessStatus.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus) + return object; + var message = new $root.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus(); + if (object.inputGcsSource != null) + message.inputGcsSource = String(object.inputGcsSource); + if (object.status != null) { + if (typeof object.status !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus.status: object expected"); + message.status = $root.google.rpc.Status.fromObject(object.status); + } + if (object.outputGcsDestination != null) + message.outputGcsDestination = String(object.outputGcsDestination); + if (object.humanReviewOperation != null) + message.humanReviewOperation = String(object.humanReviewOperation); + return message; + }; + + /** + * Creates a plain object from an IndividualProcessStatus message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + * @static + * @param {google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus} message IndividualProcessStatus + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IndividualProcessStatus.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.inputGcsSource = ""; + object.status = null; + object.outputGcsDestination = ""; + object.humanReviewOperation = ""; + } + if (message.inputGcsSource != null && message.hasOwnProperty("inputGcsSource")) + object.inputGcsSource = message.inputGcsSource; + if (message.status != null && message.hasOwnProperty("status")) + object.status = $root.google.rpc.Status.toObject(message.status, options); + if (message.outputGcsDestination != null && message.hasOwnProperty("outputGcsDestination")) + object.outputGcsDestination = message.outputGcsDestination; + if (message.humanReviewOperation != null && message.hasOwnProperty("humanReviewOperation")) + object.humanReviewOperation = message.humanReviewOperation; + return object; + }; + + /** + * Converts this IndividualProcessStatus to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + * @instance + * @returns {Object.} JSON object + */ + IndividualProcessStatus.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return IndividualProcessStatus; + })(); + + /** + * State enum. + * @name google.cloud.documentai.v1beta3.BatchProcessMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} WAITING=1 WAITING value + * @property {number} RUNNING=2 RUNNING value + * @property {number} SUCCEEDED=3 SUCCEEDED value + * @property {number} CANCELLING=4 CANCELLING value + * @property {number} CANCELLED=5 CANCELLED value + * @property {number} FAILED=6 FAILED value + */ + BatchProcessMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "WAITING"] = 1; + values[valuesById[2] = "RUNNING"] = 2; + values[valuesById[3] = "SUCCEEDED"] = 3; + values[valuesById[4] = "CANCELLING"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + values[valuesById[6] = "FAILED"] = 6; + return values; + })(); + + return BatchProcessMetadata; + })(); + + v1beta3.ReviewDocumentRequest = (function() { + + /** + * Properties of a ReviewDocumentRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IReviewDocumentRequest + * @property {string|null} [humanReviewConfig] ReviewDocumentRequest humanReviewConfig + * @property {google.cloud.documentai.v1beta3.IDocument|null} [document] ReviewDocumentRequest document + */ + + /** + * Constructs a new ReviewDocumentRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ReviewDocumentRequest. + * @implements IReviewDocumentRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest=} [properties] Properties to set + */ + function ReviewDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReviewDocumentRequest humanReviewConfig. + * @member {string} humanReviewConfig + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.humanReviewConfig = ""; + + /** + * ReviewDocumentRequest document. + * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} document + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.document = null; + + /** + * Creates a new ReviewDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest instance + */ + ReviewDocumentRequest.create = function create(properties) { + return new ReviewDocumentRequest(properties); + }; + + /** + * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.humanReviewConfig != null && Object.hasOwnProperty.call(message, "humanReviewConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.humanReviewConfig); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.cloud.documentai.v1beta3.Document.encode(message.document, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.humanReviewConfig = reader.string(); + break; + case 2: + message.document = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReviewDocumentRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReviewDocumentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) + if (!$util.isString(message.humanReviewConfig)) + return "humanReviewConfig: string expected"; + if (message.document != null && message.hasOwnProperty("document")) { + var error = $root.google.cloud.documentai.v1beta3.Document.verify(message.document); + if (error) + return "document." + error; + } + return null; + }; + + /** + * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + */ + ReviewDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest(); + if (object.humanReviewConfig != null) + message.humanReviewConfig = String(object.humanReviewConfig); + if (object.document != null) { + if (typeof object.document !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentRequest.document: object expected"); + message.document = $root.google.cloud.documentai.v1beta3.Document.fromObject(object.document); + } + return message; + }; + + /** + * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta3.ReviewDocumentRequest} message ReviewDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReviewDocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.humanReviewConfig = ""; + object.document = null; + } + if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) + object.humanReviewConfig = message.humanReviewConfig; + if (message.document != null && message.hasOwnProperty("document")) + object.document = $root.google.cloud.documentai.v1beta3.Document.toObject(message.document, options); + return object; + }; + + /** + * Converts this ReviewDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ReviewDocumentRequest; + })(); + + v1beta3.ReviewDocumentResponse = (function() { + + /** + * Properties of a ReviewDocumentResponse. + * @memberof google.cloud.documentai.v1beta3 + * @interface IReviewDocumentResponse + * @property {string|null} [gcsDestination] ReviewDocumentResponse gcsDestination + */ + + /** + * Constructs a new ReviewDocumentResponse. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ReviewDocumentResponse. + * @implements IReviewDocumentResponse + * @constructor + * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse=} [properties] Properties to set + */ + function ReviewDocumentResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReviewDocumentResponse gcsDestination. + * @member {string} gcsDestination + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @instance + */ + ReviewDocumentResponse.prototype.gcsDestination = ""; + + /** + * Creates a new ReviewDocumentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse instance + */ + ReviewDocumentResponse.create = function create(properties) { + return new ReviewDocumentResponse(properties); + }; + + /** + * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsDestination); + return writer; + }; + + /** + * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsDestination = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReviewDocumentResponse message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReviewDocumentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + if (!$util.isString(message.gcsDestination)) + return "gcsDestination: string expected"; + return null; + }; + + /** + * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + */ + ReviewDocumentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse(); + if (object.gcsDestination != null) + message.gcsDestination = String(object.gcsDestination); + return message; + }; + + /** + * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta3.ReviewDocumentResponse} message ReviewDocumentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReviewDocumentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.gcsDestination = ""; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + object.gcsDestination = message.gcsDestination; + return object; + }; + + /** + * Converts this ReviewDocumentResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ReviewDocumentResponse; + })(); + + v1beta3.ReviewDocumentOperationMetadata = (function() { + + /** + * Properties of a ReviewDocumentOperationMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @interface IReviewDocumentOperationMetadata + * @property {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|null} [state] ReviewDocumentOperationMetadata state + * @property {string|null} [stateMessage] ReviewDocumentOperationMetadata stateMessage + * @property {google.protobuf.ITimestamp|null} [createTime] ReviewDocumentOperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ReviewDocumentOperationMetadata updateTime + */ + + /** + * Constructs a new ReviewDocumentOperationMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ReviewDocumentOperationMetadata. + * @implements IReviewDocumentOperationMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata=} [properties] Properties to set + */ + function ReviewDocumentOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReviewDocumentOperationMetadata state. + * @member {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State} state + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.state = 0; + + /** + * ReviewDocumentOperationMetadata stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.stateMessage = ""; + + /** + * ReviewDocumentOperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.createTime = null; + + /** + * ReviewDocumentOperationMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.updateTime = null; + + /** + * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata instance + */ + ReviewDocumentOperationMetadata.create = function create(properties) { + return new ReviewDocumentOperationMetadata(properties); + }; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.int32(); + break; + case 2: + message.stateMessage = reader.string(); + break; + case 3: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReviewDocumentOperationMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReviewDocumentOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + if (!$util.isString(message.stateMessage)) + return "stateMessage: string 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 a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + */ + ReviewDocumentOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "RUNNING": + case 1: + message.state = 1; + break; + case "CANCELLING": + case 2: + message.state = 2; + break; + case "SUCCEEDED": + case 3: + message.state = 3; + break; + case "FAILED": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + } + if (object.stateMessage != null) + message.stateMessage = String(object.stateMessage); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.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.documentai.v1beta3.ReviewDocumentOperationMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + return message; + }; + + /** + * Creates a plain object from a ReviewDocumentOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReviewDocumentOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.stateMessage = ""; + object.createTime = null; + object.updateTime = null; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State[message.state] : message.state; + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + object.stateMessage = message.stateMessage; + 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 ReviewDocumentOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} CANCELLING=2 CANCELLING value + * @property {number} SUCCEEDED=3 SUCCEEDED value + * @property {number} FAILED=4 FAILED value + * @property {number} CANCELLED=5 CANCELLED value + */ + ReviewDocumentOperationMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "CANCELLING"] = 2; + values[valuesById[3] = "SUCCEEDED"] = 3; + values[valuesById[4] = "FAILED"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return ReviewDocumentOperationMetadata; + })(); + + return v1beta3; + })(); + + return documentai; + })(); + + return cloud; + })(); + + google.api = (function() { + + /** + * Namespace api. + * @memberof google + * @namespace + */ + var api = {}; + + /** + * 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.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.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; + })(); + + 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 + */ + + /** + * 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 = []; + if (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 = ""; + + /** + * 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); + 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; + 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"; + 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); + 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 = []; + 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; + 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; + })(); + + 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; + })(); + + 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; /** - * HttpRule delete. - * @member {string} delete - * @memberof google.api.HttpRule + * DescriptorProto nestedType. + * @member {Array.} nestedType + * @memberof google.protobuf.DescriptorProto * @instance */ - HttpRule.prototype["delete"] = ""; + DescriptorProto.prototype.nestedType = $util.emptyArray; /** - * HttpRule patch. - * @member {string} patch - * @memberof google.api.HttpRule + * DescriptorProto enumType. + * @member {Array.} enumType + * @memberof google.protobuf.DescriptorProto * @instance */ - HttpRule.prototype.patch = ""; + DescriptorProto.prototype.enumType = $util.emptyArray; /** - * HttpRule custom. - * @member {google.api.ICustomHttpPattern|null|undefined} custom - * @memberof google.api.HttpRule + * DescriptorProto extensionRange. + * @member {Array.} extensionRange + * @memberof google.protobuf.DescriptorProto * @instance */ - HttpRule.prototype.custom = null; + DescriptorProto.prototype.extensionRange = $util.emptyArray; /** - * HttpRule body. - * @member {string} body - * @memberof google.api.HttpRule + * DescriptorProto oneofDecl. + * @member {Array.} oneofDecl + * @memberof google.protobuf.DescriptorProto * @instance */ - HttpRule.prototype.body = ""; + DescriptorProto.prototype.oneofDecl = $util.emptyArray; /** - * HttpRule responseBody. - * @member {string} responseBody - * @memberof google.api.HttpRule + * DescriptorProto options. + * @member {google.protobuf.IMessageOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto * @instance */ - HttpRule.prototype.responseBody = ""; + DescriptorProto.prototype.options = null; /** - * HttpRule additionalBindings. - * @member {Array.} additionalBindings - * @memberof google.api.HttpRule + * DescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.DescriptorProto * @instance */ - HttpRule.prototype.additionalBindings = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + DescriptorProto.prototype.reservedRange = $util.emptyArray; /** - * HttpRule pattern. - * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern - * @memberof google.api.HttpRule + * DescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.DescriptorProto * @instance */ - Object.defineProperty(HttpRule.prototype, "pattern", { - get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), - set: $util.oneOfSetter($oneOfFields) - }); + DescriptorProto.prototype.reservedName = $util.emptyArray; /** - * Creates a new HttpRule instance using the specified properties. + * Creates a new DescriptorProto instance using the specified properties. * @function create - * @memberof google.api.HttpRule + * @memberof google.protobuf.DescriptorProto * @static - * @param {google.api.IHttpRule=} [properties] Properties to set - * @returns {google.api.HttpRule} HttpRule instance + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto} DescriptorProto instance */ - HttpRule.create = function create(properties) { - return new HttpRule(properties); + DescriptorProto.create = function create(properties) { + return new DescriptorProto(properties); }; /** - * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. * @function encode - * @memberof google.api.HttpRule + * @memberof google.protobuf.DescriptorProto * @static - * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - HttpRule.encode = function encode(message, writer) { + DescriptorProto.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.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 HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. * @function encodeDelimited - * @memberof google.api.HttpRule + * @memberof google.protobuf.DescriptorProto * @static - * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - HttpRule.encodeDelimited = function encodeDelimited(message, writer) { + DescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a HttpRule message from the specified reader or buffer. + * Decodes a DescriptorProto message from the specified reader or buffer. * @function decode - * @memberof google.api.HttpRule + * @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.api.HttpRule} HttpRule + * @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 */ - HttpRule.decode = function decode(reader, length) { + 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.api.HttpRule(); + 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.selector = reader.string(); + message.name = reader.string(); break; case 2: - message.get = reader.string(); + 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: - message.put = reader.string(); + if (!(message.nestedType && message.nestedType.length)) + message.nestedType = []; + message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); break; case 4: - message.post = reader.string(); + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); break; case 5: - message["delete"] = reader.string(); - break; - case 6: - message.patch = reader.string(); + if (!(message.extensionRange && message.extensionRange.length)) + message.extensionRange = []; + message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); break; case 8: - message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); + if (!(message.oneofDecl && message.oneofDecl.length)) + message.oneofDecl = []; + message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); break; case 7: - message.body = reader.string(); + message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); break; - case 12: - message.responseBody = reader.string(); + case 9: + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); break; - case 11: - if (!(message.additionalBindings && message.additionalBindings.length)) - message.additionalBindings = []; - message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + case 10: + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -12398,462 +27683,766 @@ }; /** - * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.api.HttpRule + * @memberof google.protobuf.DescriptorProto * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.HttpRule} HttpRule + * @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 */ - HttpRule.decodeDelimited = function decodeDelimited(reader) { + DescriptorProto.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a HttpRule message. + * Verifies a DescriptorProto message. * @function verify - * @memberof google.api.HttpRule + * @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 */ - HttpRule.verify = function verify(message) { + DescriptorProto.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.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.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.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.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.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["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.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.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.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.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 (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 "custom." + error; + return "oneofDecl." + 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 (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 "additionalBindings." + 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 HttpRule message from a plain object. Also converts values to their respective internal types. + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.api.HttpRule + * @memberof google.protobuf.DescriptorProto * @static * @param {Object.} object Plain object - * @returns {google.api.HttpRule} HttpRule + * @returns {google.protobuf.DescriptorProto} DescriptorProto */ - HttpRule.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.HttpRule) + DescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto) 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); + 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.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]); + 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 HttpRule message. Also converts values to other types if specified. + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. * @function toObject - * @memberof google.api.HttpRule + * @memberof google.protobuf.DescriptorProto * @static - * @param {google.api.HttpRule} message HttpRule + * @param {google.protobuf.DescriptorProto} message DescriptorProto * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - HttpRule.toObject = function toObject(message, options) { + DescriptorProto.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.additionalBindings = []; + 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.selector = ""; - object.body = ""; - object.responseBody = ""; + object.name = ""; + object.options = null; } - 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.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.put != null && message.hasOwnProperty("put")) { - object.put = message.put; - if (options.oneofs) - object.pattern = "put"; + 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.post != null && message.hasOwnProperty("post")) { - object.post = message.post; - if (options.oneofs) - object.pattern = "post"; + 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["delete"] != null && message.hasOwnProperty("delete")) { - object["delete"] = message["delete"]; - if (options.oneofs) - object.pattern = "delete"; + 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.patch != null && message.hasOwnProperty("patch")) { - object.patch = message.patch; - if (options.oneofs) - object.pattern = "patch"; + 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.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.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.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.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]; } - if (message.responseBody != null && message.hasOwnProperty("responseBody")) - object.responseBody = message.responseBody; return object; }; /** - * Converts this HttpRule to JSON. + * Converts this DescriptorProto to JSON. * @function toJSON - * @memberof google.api.HttpRule + * @memberof google.protobuf.DescriptorProto * @instance * @returns {Object.} JSON object */ - HttpRule.prototype.toJSON = function toJSON() { + DescriptorProto.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return HttpRule; - })(); + 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; + }; - api.CustomHttpPattern = (function() { + /** + * 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); + }; - /** - * Properties of a CustomHttpPattern. - * @memberof google.api - * @interface ICustomHttpPattern - * @property {string|null} [kind] CustomHttpPattern kind - * @property {string|null} [path] CustomHttpPattern path - */ + return ExtensionRange; + })(); - /** - * 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]]; - } + DescriptorProto.ReservedRange = (function() { - /** - * CustomHttpPattern kind. - * @member {string} kind - * @memberof google.api.CustomHttpPattern - * @instance - */ - CustomHttpPattern.prototype.kind = ""; + /** + * Properties of a ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @interface IReservedRange + * @property {number|null} [start] ReservedRange start + * @property {number|null} [end] ReservedRange end + */ - /** - * CustomHttpPattern path. - * @member {string} path - * @memberof google.api.CustomHttpPattern - * @instance - */ - CustomHttpPattern.prototype.path = ""; + /** + * 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]]; + } - /** - * 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); - }; + /** + * ReservedRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.start = 0; - /** - * 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; - }; + /** + * ReservedRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.end = 0; - /** - * 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(); - }; + /** + * 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); + }; - /** - * 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; - }; + /** + * 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; + }; - /** - * 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()); - }; + /** + * 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(); + }; - /** - * 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; - }; + /** + * 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; + }; - /** - * 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; - }; + /** + * 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()); + }; - /** - * 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; - }; + /** + * 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; + }; - /** - * 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); - }; + /** + * 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; + }; - return CustomHttpPattern; - })(); + /** + * 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; + }; - return api; - })(); + /** + * 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); + }; - google.protobuf = (function() { + return ReservedRange; + })(); - /** - * Namespace protobuf. - * @memberof google - * @namespace - */ - var protobuf = {}; + return DescriptorProto; + })(); - protobuf.FileDescriptorSet = (function() { + protobuf.ExtensionRangeOptions = (function() { /** - * Properties of a FileDescriptorSet. + * Properties of an ExtensionRangeOptions. * @memberof google.protobuf - * @interface IFileDescriptorSet - * @property {Array.|null} [file] FileDescriptorSet file + * @interface IExtensionRangeOptions + * @property {Array.|null} [uninterpretedOption] ExtensionRangeOptions uninterpretedOption */ /** - * Constructs a new FileDescriptorSet. + * Constructs a new ExtensionRangeOptions. * @memberof google.protobuf - * @classdesc Represents a FileDescriptorSet. - * @implements IFileDescriptorSet + * @classdesc Represents an ExtensionRangeOptions. + * @implements IExtensionRangeOptions * @constructor - * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set */ - function FileDescriptorSet(properties) { - this.file = []; + function ExtensionRangeOptions(properties) { + this.uninterpretedOption = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -12861,78 +28450,78 @@ } /** - * FileDescriptorSet file. - * @member {Array.} file - * @memberof google.protobuf.FileDescriptorSet + * ExtensionRangeOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ExtensionRangeOptions * @instance */ - FileDescriptorSet.prototype.file = $util.emptyArray; + ExtensionRangeOptions.prototype.uninterpretedOption = $util.emptyArray; /** - * Creates a new FileDescriptorSet instance using the specified properties. + * Creates a new ExtensionRangeOptions instance using the specified properties. * @function create - * @memberof google.protobuf.FileDescriptorSet + * @memberof google.protobuf.ExtensionRangeOptions * @static - * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet instance + * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions instance */ - FileDescriptorSet.create = function create(properties) { - return new FileDescriptorSet(properties); + ExtensionRangeOptions.create = function create(properties) { + return new ExtensionRangeOptions(properties); }; /** - * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. * @function encode - * @memberof google.protobuf.FileDescriptorSet + * @memberof google.protobuf.ExtensionRangeOptions * @static - * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FileDescriptorSet.encode = function encode(message, writer) { + ExtensionRangeOptions.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(); + 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 FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.FileDescriptorSet + * @memberof google.protobuf.ExtensionRangeOptions * @static - * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FileDescriptorSet.encodeDelimited = function encodeDelimited(message, writer) { + ExtensionRangeOptions.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FileDescriptorSet message from the specified reader or buffer. + * Decodes an ExtensionRangeOptions message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.FileDescriptorSet + * @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.FileDescriptorSet} FileDescriptorSet + * @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 */ - FileDescriptorSet.decode = function decode(reader, length) { + 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.FileDescriptorSet(); + 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 1: - if (!(message.file && message.file.length)) - message.file = []; - message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); + 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); @@ -12943,142 +28532,134 @@ }; /** - * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.FileDescriptorSet + * @memberof google.protobuf.ExtensionRangeOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @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 */ - FileDescriptorSet.decodeDelimited = function decodeDelimited(reader) { + ExtensionRangeOptions.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FileDescriptorSet message. + * Verifies an ExtensionRangeOptions message. * @function verify - * @memberof google.protobuf.FileDescriptorSet + * @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 */ - FileDescriptorSet.verify = function verify(message) { + ExtensionRangeOptions.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 (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 "file." + error; + return "uninterpretedOption." + error; } } return null; }; /** - * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.FileDescriptorSet + * @memberof google.protobuf.ExtensionRangeOptions * @static * @param {Object.} object Plain object - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions */ - FileDescriptorSet.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FileDescriptorSet) + ExtensionRangeOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ExtensionRangeOptions) 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]); + 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 a FileDescriptorSet message. Also converts values to other types if specified. + * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FileDescriptorSet + * @memberof google.protobuf.ExtensionRangeOptions * @static - * @param {google.protobuf.FileDescriptorSet} message FileDescriptorSet + * @param {google.protobuf.ExtensionRangeOptions} message ExtensionRangeOptions * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FileDescriptorSet.toObject = function toObject(message, options) { + ExtensionRangeOptions.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); + 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 FileDescriptorSet to JSON. + * Converts this ExtensionRangeOptions to JSON. * @function toJSON - * @memberof google.protobuf.FileDescriptorSet + * @memberof google.protobuf.ExtensionRangeOptions * @instance * @returns {Object.} JSON object */ - FileDescriptorSet.prototype.toJSON = function toJSON() { + ExtensionRangeOptions.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return FileDescriptorSet; + return ExtensionRangeOptions; })(); - protobuf.FileDescriptorProto = (function() { + protobuf.FieldDescriptorProto = (function() { /** - * Properties of a FileDescriptorProto. + * Properties of a FieldDescriptorProto. * @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 + * @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 FileDescriptorProto. + * Constructs a new FieldDescriptorProto. * @memberof google.protobuf - * @classdesc Represents a FileDescriptorProto. - * @implements IFileDescriptorProto + * @classdesc Represents a FieldDescriptorProto. + * @implements IFieldDescriptorProto * @constructor - * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set */ - function FileDescriptorProto(properties) { - this.dependency = []; - this.publicDependency = []; - this.weakDependency = []; - this.messageType = []; - this.enumType = []; - this.service = []; - this.extension = []; + function FieldDescriptorProto(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -13086,249 +28667,205 @@ } /** - * FileDescriptorProto name. + * FieldDescriptorProto name. * @member {string} name - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.name = ""; - - /** - * FileDescriptorProto package. - * @member {string} package - * @memberof google.protobuf.FileDescriptorProto + * @memberof google.protobuf.FieldDescriptorProto * @instance */ - FileDescriptorProto.prototype["package"] = ""; + FieldDescriptorProto.prototype.name = ""; /** - * FileDescriptorProto dependency. - * @member {Array.} dependency - * @memberof google.protobuf.FileDescriptorProto + * FieldDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.FieldDescriptorProto * @instance */ - FileDescriptorProto.prototype.dependency = $util.emptyArray; + FieldDescriptorProto.prototype.number = 0; /** - * FileDescriptorProto publicDependency. - * @member {Array.} publicDependency - * @memberof google.protobuf.FileDescriptorProto + * FieldDescriptorProto label. + * @member {google.protobuf.FieldDescriptorProto.Label} label + * @memberof google.protobuf.FieldDescriptorProto * @instance */ - FileDescriptorProto.prototype.publicDependency = $util.emptyArray; + FieldDescriptorProto.prototype.label = 1; /** - * FileDescriptorProto weakDependency. - * @member {Array.} weakDependency - * @memberof google.protobuf.FileDescriptorProto + * FieldDescriptorProto type. + * @member {google.protobuf.FieldDescriptorProto.Type} type + * @memberof google.protobuf.FieldDescriptorProto * @instance */ - FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + FieldDescriptorProto.prototype.type = 1; /** - * FileDescriptorProto messageType. - * @member {Array.} messageType - * @memberof google.protobuf.FileDescriptorProto + * FieldDescriptorProto typeName. + * @member {string} typeName + * @memberof google.protobuf.FieldDescriptorProto * @instance */ - FileDescriptorProto.prototype.messageType = $util.emptyArray; + FieldDescriptorProto.prototype.typeName = ""; /** - * FileDescriptorProto enumType. - * @member {Array.} enumType - * @memberof google.protobuf.FileDescriptorProto + * FieldDescriptorProto extendee. + * @member {string} extendee + * @memberof google.protobuf.FieldDescriptorProto * @instance */ - FileDescriptorProto.prototype.enumType = $util.emptyArray; + FieldDescriptorProto.prototype.extendee = ""; /** - * FileDescriptorProto service. - * @member {Array.} service - * @memberof google.protobuf.FileDescriptorProto + * FieldDescriptorProto defaultValue. + * @member {string} defaultValue + * @memberof google.protobuf.FieldDescriptorProto * @instance */ - FileDescriptorProto.prototype.service = $util.emptyArray; + FieldDescriptorProto.prototype.defaultValue = ""; /** - * FileDescriptorProto extension. - * @member {Array.} extension - * @memberof google.protobuf.FileDescriptorProto + * FieldDescriptorProto oneofIndex. + * @member {number} oneofIndex + * @memberof google.protobuf.FieldDescriptorProto * @instance */ - FileDescriptorProto.prototype.extension = $util.emptyArray; + FieldDescriptorProto.prototype.oneofIndex = 0; /** - * FileDescriptorProto options. - * @member {google.protobuf.IFileOptions|null|undefined} options - * @memberof google.protobuf.FileDescriptorProto + * FieldDescriptorProto jsonName. + * @member {string} jsonName + * @memberof google.protobuf.FieldDescriptorProto * @instance */ - FileDescriptorProto.prototype.options = null; + FieldDescriptorProto.prototype.jsonName = ""; /** - * FileDescriptorProto sourceCodeInfo. - * @member {google.protobuf.ISourceCodeInfo|null|undefined} sourceCodeInfo - * @memberof google.protobuf.FileDescriptorProto + * FieldDescriptorProto options. + * @member {google.protobuf.IFieldOptions|null|undefined} options + * @memberof google.protobuf.FieldDescriptorProto * @instance */ - FileDescriptorProto.prototype.sourceCodeInfo = null; + FieldDescriptorProto.prototype.options = null; /** - * FileDescriptorProto syntax. - * @member {string} syntax - * @memberof google.protobuf.FileDescriptorProto + * FieldDescriptorProto proto3Optional. + * @member {boolean} proto3Optional + * @memberof google.protobuf.FieldDescriptorProto * @instance */ - FileDescriptorProto.prototype.syntax = ""; + FieldDescriptorProto.prototype.proto3Optional = false; /** - * Creates a new FileDescriptorProto instance using the specified properties. + * Creates a new FieldDescriptorProto instance using the specified properties. * @function create - * @memberof google.protobuf.FileDescriptorProto + * @memberof google.protobuf.FieldDescriptorProto * @static - * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto instance + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto instance */ - FileDescriptorProto.create = function create(properties) { - return new FileDescriptorProto(properties); + FieldDescriptorProto.create = function create(properties) { + return new FieldDescriptorProto(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(); + + /** + * 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.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); + $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 FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.FileDescriptorProto + * @memberof google.protobuf.FieldDescriptorProto * @static - * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FileDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + FieldDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FileDescriptorProto message from the specified reader or buffer. + * Decodes a FieldDescriptorProto message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.FileDescriptorProto + * @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.FileDescriptorProto} FileDescriptorProto + * @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 */ - FileDescriptorProto.decode = function decode(reader, length) { + 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.FileDescriptorProto(); + 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 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()); + message.number = reader.int32(); break; case 4: - if (!(message.messageType && message.messageType.length)) - message.messageType = []; - message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + message.label = reader.int32(); break; case 5: - if (!(message.enumType && message.enumType.length)) - message.enumType = []; - message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + message.type = reader.int32(); break; case 6: - if (!(message.service && message.service.length)) - message.service = []; - message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); + message.typeName = reader.string(); break; - case 7: - if (!(message.extension && message.extension.length)) - message.extension = []; - message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + case 2: + message.extendee = reader.string(); break; - case 8: - message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); + case 7: + message.defaultValue = reader.string(); break; case 9: - message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); + message.oneofIndex = reader.int32(); break; - case 12: - message.syntax = reader.string(); + 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); @@ -13339,329 +28876,367 @@ }; /** - * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.FileDescriptorProto + * @memberof google.protobuf.FieldDescriptorProto * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @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 */ - FileDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + FieldDescriptorProto.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FileDescriptorProto message. + * Verifies a FieldDescriptorProto message. * @function verify - * @memberof google.protobuf.FileDescriptorProto + * @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 */ - FileDescriptorProto.verify = function verify(message) { + 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["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.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.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.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.FileOptions.verify(message.options); + var error = $root.google.protobuf.FieldOptions.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"; + } + if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + if (typeof message.proto3Optional !== "boolean") + return "proto3Optional: boolean expected"; return null; }; /** - * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.FileDescriptorProto + * @memberof google.protobuf.FieldDescriptorProto * @static * @param {Object.} object Plain object - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto */ - FileDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FileDescriptorProto) + FieldDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldDescriptorProto) return object; - var message = new $root.google.protobuf.FileDescriptorProto(); + var message = new $root.google.protobuf.FieldDescriptorProto(); 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.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; } - 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]); - } + 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.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]; + throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FieldOptions.fromObject(object.options); } - if (message.weakDependency && message.weakDependency.length) { - object.weakDependency = []; - for (var j = 0; j < message.weakDependency.length; ++j) - object.weakDependency[j] = message.weakDependency[j]; + 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.syntax != null && message.hasOwnProperty("syntax")) - object.syntax = message.syntax; + 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 FileDescriptorProto to JSON. + * Converts this FieldDescriptorProto to JSON. * @function toJSON - * @memberof google.protobuf.FileDescriptorProto + * @memberof google.protobuf.FieldDescriptorProto * @instance * @returns {Object.} JSON object */ - FileDescriptorProto.prototype.toJSON = function toJSON() { + FieldDescriptorProto.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return FileDescriptorProto; + /** + * 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.DescriptorProto = (function() { + protobuf.OneofDescriptorProto = (function() { /** - * Properties of a DescriptorProto. + * Properties of an OneofDescriptorProto. * @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 + * @interface IOneofDescriptorProto + * @property {string|null} [name] OneofDescriptorProto name + * @property {google.protobuf.IOneofOptions|null} [options] OneofDescriptorProto options */ /** - * Constructs a new DescriptorProto. + * Constructs a new OneofDescriptorProto. * @memberof google.protobuf - * @classdesc Represents a DescriptorProto. - * @implements IDescriptorProto + * @classdesc Represents an OneofDescriptorProto. + * @implements IOneofDescriptorProto * @constructor - * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set */ - function DescriptorProto(properties) { - this.field = []; - this.extension = []; - this.nestedType = []; - this.enumType = []; - this.extensionRange = []; - this.oneofDecl = []; - this.reservedRange = []; - this.reservedName = []; + function OneofDescriptorProto(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -13669,168 +29244,80 @@ } /** - * DescriptorProto name. + * OneofDescriptorProto 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 + * @memberof google.protobuf.OneofDescriptorProto * @instance */ - DescriptorProto.prototype.reservedRange = $util.emptyArray; + OneofDescriptorProto.prototype.name = ""; /** - * DescriptorProto reservedName. - * @member {Array.} reservedName - * @memberof google.protobuf.DescriptorProto + * OneofDescriptorProto options. + * @member {google.protobuf.IOneofOptions|null|undefined} options + * @memberof google.protobuf.OneofDescriptorProto * @instance */ - DescriptorProto.prototype.reservedName = $util.emptyArray; + OneofDescriptorProto.prototype.options = null; /** - * Creates a new DescriptorProto instance using the specified properties. + * Creates a new OneofDescriptorProto instance using the specified properties. * @function create - * @memberof google.protobuf.DescriptorProto + * @memberof google.protobuf.OneofDescriptorProto * @static - * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.DescriptorProto} DescriptorProto instance + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto instance */ - DescriptorProto.create = function create(properties) { - return new DescriptorProto(properties); + OneofDescriptorProto.create = function create(properties) { + return new OneofDescriptorProto(properties); }; /** - * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. * @function encode - * @memberof google.protobuf.DescriptorProto + * @memberof google.protobuf.OneofDescriptorProto * @static - * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DescriptorProto.encode = function encode(message, 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.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]); + $root.google.protobuf.OneofOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.DescriptorProto + * @memberof google.protobuf.OneofDescriptorProto * @static - * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + OneofDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DescriptorProto message from the specified reader or buffer. + * Decodes an OneofDescriptorProto message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.DescriptorProto + * @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.DescriptorProto} DescriptorProto + * @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 */ - DescriptorProto.decode = function decode(reader, length) { + 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.DescriptorProto(); + 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) { @@ -13838,47 +29325,7 @@ 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()); + message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -13889,553 +29336,460 @@ }; /** - * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.DescriptorProto + * @memberof google.protobuf.OneofDescriptorProto * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @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 */ - DescriptorProto.decodeDelimited = function decodeDelimited(reader) { + OneofDescriptorProto.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DescriptorProto message. + * Verifies an OneofDescriptorProto message. * @function verify - * @memberof google.protobuf.DescriptorProto + * @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 */ - DescriptorProto.verify = function verify(message) { + 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.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]); - } + 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.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]); + throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.OneofOptions.fromObject(object.options); } return message; }; /** - * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.DescriptorProto + * @memberof google.protobuf.OneofDescriptorProto * @static - * @param {google.protobuf.DescriptorProto} message DescriptorProto + * @param {google.protobuf.OneofDescriptorProto} message OneofDescriptorProto * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DescriptorProto.toObject = function toObject(message, options) { + OneofDescriptorProto.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]; + 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 object; + return message; }; /** - * Converts this DescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.DescriptorProto - * @instance - * @returns {Object.} JSON object + * 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 */ - DescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + EnumDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); }; - 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); + /** + * 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; } - 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.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.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); + } + 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; + }; - /** - * 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); - }; + /** + * 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; + }; - return ExtensionRange; - })(); + /** + * 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); + }; - DescriptorProto.ReservedRange = (function() { + EnumDescriptorProto.EnumReservedRange = (function() { /** - * Properties of a ReservedRange. - * @memberof google.protobuf.DescriptorProto - * @interface IReservedRange - * @property {number|null} [start] ReservedRange start - * @property {number|null} [end] ReservedRange end + * 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 ReservedRange. - * @memberof google.protobuf.DescriptorProto - * @classdesc Represents a ReservedRange. - * @implements IReservedRange + * Constructs a new EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @classdesc Represents an EnumReservedRange. + * @implements IEnumReservedRange * @constructor - * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set */ - function ReservedRange(properties) { + function EnumReservedRange(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14443,43 +29797,43 @@ } /** - * ReservedRange start. + * EnumReservedRange start. * @member {number} start - * @memberof google.protobuf.DescriptorProto.ReservedRange + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange * @instance */ - ReservedRange.prototype.start = 0; + EnumReservedRange.prototype.start = 0; /** - * ReservedRange end. + * EnumReservedRange end. * @member {number} end - * @memberof google.protobuf.DescriptorProto.ReservedRange + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange * @instance */ - ReservedRange.prototype.end = 0; + EnumReservedRange.prototype.end = 0; /** - * Creates a new ReservedRange instance using the specified properties. + * Creates a new EnumReservedRange instance using the specified properties. * @function create - * @memberof google.protobuf.DescriptorProto.ReservedRange + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange * @static - * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange instance + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange instance */ - ReservedRange.create = function create(properties) { - return new ReservedRange(properties); + EnumReservedRange.create = function create(properties) { + return new EnumReservedRange(properties); }; /** - * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. * @function encode - * @memberof google.protobuf.DescriptorProto.ReservedRange + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange * @static - * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @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 */ - ReservedRange.encode = function encode(message, writer) { + EnumReservedRange.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.start != null && Object.hasOwnProperty.call(message, "start")) @@ -14490,33 +29844,33 @@ }; /** - * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.DescriptorProto.ReservedRange + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange * @static - * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @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 */ - ReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + EnumReservedRange.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReservedRange message from the specified reader or buffer. + * Decodes an EnumReservedRange message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.DescriptorProto.ReservedRange + * @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.DescriptorProto.ReservedRange} ReservedRange + * @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 */ - ReservedRange.decode = function decode(reader, length) { + 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.DescriptorProto.ReservedRange(); + 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) { @@ -14535,30 +29889,30 @@ }; /** - * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.DescriptorProto.ReservedRange + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @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 */ - ReservedRange.decodeDelimited = function decodeDelimited(reader) { + EnumReservedRange.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReservedRange message. + * Verifies an EnumReservedRange message. * @function verify - * @memberof google.protobuf.DescriptorProto.ReservedRange + * @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 */ - ReservedRange.verify = function verify(message) { + EnumReservedRange.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.start != null && message.hasOwnProperty("start")) @@ -14571,17 +29925,17 @@ }; /** - * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.DescriptorProto.ReservedRange + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange * @static * @param {Object.} object Plain object - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange */ - ReservedRange.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.DescriptorProto.ReservedRange) + EnumReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto.EnumReservedRange) return object; - var message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + var message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); if (object.start != null) message.start = object.start | 0; if (object.end != null) @@ -14590,15 +29944,15 @@ }; /** - * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.DescriptorProto.ReservedRange + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange * @static - * @param {google.protobuf.DescriptorProto.ReservedRange} message ReservedRange + * @param {google.protobuf.EnumDescriptorProto.EnumReservedRange} message EnumReservedRange * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReservedRange.toObject = function toObject(message, options) { + EnumReservedRange.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -14614,258 +29968,42 @@ }; /** - * Converts this ReservedRange to JSON. + * Converts this EnumReservedRange to JSON. * @function toJSON - * @memberof google.protobuf.DescriptorProto.ReservedRange + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange * @instance * @returns {Object.} JSON object */ - ReservedRange.prototype.toJSON = function toJSON() { + EnumReservedRange.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ReservedRange; + return EnumReservedRange; })(); - 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; + return EnumDescriptorProto; })(); - protobuf.FieldDescriptorProto = (function() { + protobuf.EnumValueDescriptorProto = (function() { /** - * Properties of a FieldDescriptorProto. + * Properties of an EnumValueDescriptorProto. * @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 + * @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 FieldDescriptorProto. + * Constructs a new EnumValueDescriptorProto. * @memberof google.protobuf - * @classdesc Represents a FieldDescriptorProto. - * @implements IFieldDescriptorProto + * @classdesc Represents an EnumValueDescriptorProto. + * @implements IEnumValueDescriptorProto * @constructor - * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set */ - function FieldDescriptorProto(properties) { + function EnumValueDescriptorProto(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14873,205 +30011,101 @@ } /** - * FieldDescriptorProto name. + * EnumValueDescriptorProto name. * @member {string} name - * @memberof google.protobuf.FieldDescriptorProto + * @memberof google.protobuf.EnumValueDescriptorProto * @instance */ - FieldDescriptorProto.prototype.name = ""; + EnumValueDescriptorProto.prototype.name = ""; /** - * FieldDescriptorProto number. + * EnumValueDescriptorProto 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 + * @memberof google.protobuf.EnumValueDescriptorProto * @instance */ - FieldDescriptorProto.prototype.options = null; + EnumValueDescriptorProto.prototype.number = 0; /** - * FieldDescriptorProto proto3Optional. - * @member {boolean} proto3Optional - * @memberof google.protobuf.FieldDescriptorProto + * EnumValueDescriptorProto options. + * @member {google.protobuf.IEnumValueOptions|null|undefined} options + * @memberof google.protobuf.EnumValueDescriptorProto * @instance */ - FieldDescriptorProto.prototype.proto3Optional = false; + EnumValueDescriptorProto.prototype.options = null; /** - * Creates a new FieldDescriptorProto instance using the specified properties. + * Creates a new EnumValueDescriptorProto instance using the specified properties. * @function create - * @memberof google.protobuf.FieldDescriptorProto + * @memberof google.protobuf.EnumValueDescriptorProto * @static - * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto instance + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto instance */ - FieldDescriptorProto.create = function create(properties) { - return new FieldDescriptorProto(properties); + EnumValueDescriptorProto.create = function create(properties) { + return new EnumValueDescriptorProto(properties); }; /** - * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. * @function encode - * @memberof google.protobuf.FieldDescriptorProto + * @memberof google.protobuf.EnumValueDescriptorProto * @static - * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FieldDescriptorProto.encode = function encode(message, 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.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); + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); 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); + $root.google.protobuf.EnumValueOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.FieldDescriptorProto + * @memberof google.protobuf.EnumValueDescriptorProto * @static - * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FieldDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + EnumValueDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.FieldDescriptorProto + * @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.FieldDescriptorProto} FieldDescriptorProto + * @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 */ - FieldDescriptorProto.decode = function decode(reader, length) { + 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.FieldDescriptorProto(); + 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 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()); + message.number = reader.int32(); break; - case 17: - message.proto3Optional = reader.bool(); + case 3: + message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -15082,30 +30116,30 @@ }; /** - * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.FieldDescriptorProto + * @memberof google.protobuf.EnumValueDescriptorProto * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @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 */ - FieldDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + EnumValueDescriptorProto.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FieldDescriptorProto message. + * Verifies an EnumValueDescriptorProto message. * @function verify - * @memberof google.protobuf.FieldDescriptorProto + * @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 */ - FieldDescriptorProto.verify = function verify(message) { + EnumValueDescriptorProto.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.name != null && message.hasOwnProperty("name")) @@ -15114,335 +30148,100 @@ 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); + var error = $root.google.protobuf.EnumValueOptions.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. + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.FieldDescriptorProto + * @memberof google.protobuf.EnumValueDescriptorProto * @static * @param {Object.} object Plain object - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto */ - FieldDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldDescriptorProto) + EnumValueDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueDescriptorProto) return object; - var message = new $root.google.protobuf.FieldDescriptorProto(); + 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; - 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); + throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumValueOptions.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. + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FieldDescriptorProto + * @memberof google.protobuf.EnumValueDescriptorProto * @static - * @param {google.protobuf.FieldDescriptorProto} message FieldDescriptorProto + * @param {google.protobuf.EnumValueDescriptorProto} message EnumValueDescriptorProto * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FieldDescriptorProto.toObject = function toObject(message, options) { + EnumValueDescriptorProto.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; + object.options = $root.google.protobuf.EnumValueOptions.toObject(message.options, options); return object; }; /** - * Converts this FieldDescriptorProto to JSON. + * Converts this EnumValueDescriptorProto to JSON. * @function toJSON - * @memberof google.protobuf.FieldDescriptorProto + * @memberof google.protobuf.EnumValueDescriptorProto * @instance * @returns {Object.} JSON object */ - FieldDescriptorProto.prototype.toJSON = function toJSON() { + EnumValueDescriptorProto.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; + return EnumValueDescriptorProto; })(); - protobuf.OneofDescriptorProto = (function() { + protobuf.ServiceDescriptorProto = (function() { /** - * Properties of an OneofDescriptorProto. + * Properties of a ServiceDescriptorProto. * @memberof google.protobuf - * @interface IOneofDescriptorProto - * @property {string|null} [name] OneofDescriptorProto name - * @property {google.protobuf.IOneofOptions|null} [options] OneofDescriptorProto options + * @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 OneofDescriptorProto. + * Constructs a new ServiceDescriptorProto. * @memberof google.protobuf - * @classdesc Represents an OneofDescriptorProto. - * @implements IOneofDescriptorProto + * @classdesc Represents a ServiceDescriptorProto. + * @implements IServiceDescriptorProto * @constructor - * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set */ - function OneofDescriptorProto(properties) { + function ServiceDescriptorProto(properties) { + this.method = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15450,80 +30249,91 @@ } /** - * OneofDescriptorProto name. + * ServiceDescriptorProto name. * @member {string} name - * @memberof google.protobuf.OneofDescriptorProto + * @memberof google.protobuf.ServiceDescriptorProto * @instance */ - OneofDescriptorProto.prototype.name = ""; + ServiceDescriptorProto.prototype.name = ""; /** - * OneofDescriptorProto options. - * @member {google.protobuf.IOneofOptions|null|undefined} options - * @memberof google.protobuf.OneofDescriptorProto + * 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 */ - OneofDescriptorProto.prototype.options = null; + ServiceDescriptorProto.prototype.options = null; /** - * Creates a new OneofDescriptorProto instance using the specified properties. + * Creates a new ServiceDescriptorProto instance using the specified properties. * @function create - * @memberof google.protobuf.OneofDescriptorProto + * @memberof google.protobuf.ServiceDescriptorProto * @static - * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto instance + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto instance */ - OneofDescriptorProto.create = function create(properties) { - return new OneofDescriptorProto(properties); + ServiceDescriptorProto.create = function create(properties) { + return new ServiceDescriptorProto(properties); }; /** - * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. * @function encode - * @memberof google.protobuf.OneofDescriptorProto + * @memberof google.protobuf.ServiceDescriptorProto * @static - * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OneofDescriptorProto.encode = function encode(message, 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.OneofOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.protobuf.ServiceOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.OneofDescriptorProto + * @memberof google.protobuf.ServiceDescriptorProto * @static - * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OneofDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + ServiceDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.OneofDescriptorProto + * @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.OneofDescriptorProto} OneofDescriptorProto + * @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 */ - OneofDescriptorProto.decode = function decode(reader, length) { + 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.OneofDescriptorProto(); + 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) { @@ -15531,7 +30341,12 @@ message.name = reader.string(); break; case 2: - message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); + 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); @@ -15542,37 +30357,46 @@ }; /** - * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.OneofDescriptorProto + * @memberof google.protobuf.ServiceDescriptorProto * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @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 */ - OneofDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + ServiceDescriptorProto.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an OneofDescriptorProto message. + * Verifies a ServiceDescriptorProto message. * @function verify - * @memberof google.protobuf.OneofDescriptorProto + * @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 */ - OneofDescriptorProto.verify = function verify(message) { + 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.OneofOptions.verify(message.options); + var error = $root.google.protobuf.ServiceOptions.verify(message.options); if (error) return "options." + error; } @@ -15580,90 +30404,105 @@ }; /** - * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.OneofDescriptorProto + * @memberof google.protobuf.ServiceDescriptorProto * @static * @param {Object.} object Plain object - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto */ - OneofDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.OneofDescriptorProto) + ServiceDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceDescriptorProto) return object; - var message = new $root.google.protobuf.OneofDescriptorProto(); + 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.OneofDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.OneofOptions.fromObject(object.options); + throw TypeError(".google.protobuf.ServiceDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options); } return message; }; /** - * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.OneofDescriptorProto + * @memberof google.protobuf.ServiceDescriptorProto * @static - * @param {google.protobuf.OneofDescriptorProto} message OneofDescriptorProto + * @param {google.protobuf.ServiceDescriptorProto} message ServiceDescriptorProto * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - OneofDescriptorProto.toObject = function toObject(message, options) { + 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.OneofOptions.toObject(message.options, options); + object.options = $root.google.protobuf.ServiceOptions.toObject(message.options, options); return object; }; /** - * Converts this OneofDescriptorProto to JSON. + * Converts this ServiceDescriptorProto to JSON. * @function toJSON - * @memberof google.protobuf.OneofDescriptorProto + * @memberof google.protobuf.ServiceDescriptorProto * @instance * @returns {Object.} JSON object */ - OneofDescriptorProto.prototype.toJSON = function toJSON() { + ServiceDescriptorProto.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return OneofDescriptorProto; + return ServiceDescriptorProto; })(); - protobuf.EnumDescriptorProto = (function() { + protobuf.MethodDescriptorProto = (function() { /** - * Properties of an EnumDescriptorProto. + * Properties of a MethodDescriptorProto. * @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 + * @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 EnumDescriptorProto. + * Constructs a new MethodDescriptorProto. * @memberof google.protobuf - * @classdesc Represents an EnumDescriptorProto. - * @implements IEnumDescriptorProto + * @classdesc Represents a MethodDescriptorProto. + * @implements IMethodDescriptorProto * @constructor - * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set */ - function EnumDescriptorProto(properties) { - this.value = []; - this.reservedRange = []; - this.reservedName = []; + function MethodDescriptorProto(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15671,113 +30510,120 @@ } /** - * EnumDescriptorProto name. + * MethodDescriptorProto name. * @member {string} name - * @memberof google.protobuf.EnumDescriptorProto + * @memberof google.protobuf.MethodDescriptorProto * @instance */ - EnumDescriptorProto.prototype.name = ""; + MethodDescriptorProto.prototype.name = ""; /** - * EnumDescriptorProto value. - * @member {Array.} value - * @memberof google.protobuf.EnumDescriptorProto + * MethodDescriptorProto inputType. + * @member {string} inputType + * @memberof google.protobuf.MethodDescriptorProto * @instance */ - EnumDescriptorProto.prototype.value = $util.emptyArray; + MethodDescriptorProto.prototype.inputType = ""; /** - * EnumDescriptorProto options. - * @member {google.protobuf.IEnumOptions|null|undefined} options - * @memberof google.protobuf.EnumDescriptorProto + * MethodDescriptorProto outputType. + * @member {string} outputType + * @memberof google.protobuf.MethodDescriptorProto * @instance */ - EnumDescriptorProto.prototype.options = null; + MethodDescriptorProto.prototype.outputType = ""; /** - * EnumDescriptorProto reservedRange. - * @member {Array.} reservedRange - * @memberof google.protobuf.EnumDescriptorProto + * MethodDescriptorProto options. + * @member {google.protobuf.IMethodOptions|null|undefined} options + * @memberof google.protobuf.MethodDescriptorProto * @instance */ - EnumDescriptorProto.prototype.reservedRange = $util.emptyArray; + MethodDescriptorProto.prototype.options = null; /** - * EnumDescriptorProto reservedName. - * @member {Array.} reservedName - * @memberof google.protobuf.EnumDescriptorProto + * MethodDescriptorProto clientStreaming. + * @member {boolean} clientStreaming + * @memberof google.protobuf.MethodDescriptorProto * @instance */ - EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + MethodDescriptorProto.prototype.clientStreaming = false; /** - * Creates a new EnumDescriptorProto instance using the specified properties. + * 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.EnumDescriptorProto + * @memberof google.protobuf.MethodDescriptorProto * @static - * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto instance + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto instance */ - EnumDescriptorProto.create = function create(properties) { - return new EnumDescriptorProto(properties); + MethodDescriptorProto.create = function create(properties) { + return new MethodDescriptorProto(properties); }; /** - * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. * @function encode - * @memberof google.protobuf.EnumDescriptorProto + * @memberof google.protobuf.MethodDescriptorProto * @static - * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnumDescriptorProto.encode = function encode(message, 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.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.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.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]); + $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 EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.EnumDescriptorProto + * @memberof google.protobuf.MethodDescriptorProto * @static - * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnumDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + MethodDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * Decodes a MethodDescriptorProto message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.EnumDescriptorProto + * @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.EnumDescriptorProto} EnumDescriptorProto + * @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 */ - EnumDescriptorProto.decode = function decode(reader, length) { + 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.EnumDescriptorProto(); + 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) { @@ -15785,22 +30631,19 @@ 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())); + message.inputType = reader.string(); break; case 3: - message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); + message.outputType = reader.string(); break; case 4: - if (!(message.reservedRange && message.reservedRange.length)) - message.reservedRange = []; - message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32())); + message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); break; case 5: - if (!(message.reservedName && message.reservedName.length)) - message.reservedName = []; - message.reservedName.push(reader.string()); + message.clientStreaming = reader.bool(); + break; + case 6: + message.serverStreaming = reader.bool(); break; default: reader.skipType(tag & 7); @@ -15811,507 +30654,531 @@ }; /** - * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.EnumDescriptorProto + * @memberof google.protobuf.MethodDescriptorProto * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @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 */ - EnumDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + MethodDescriptorProto.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EnumDescriptorProto message. + * Verifies a MethodDescriptorProto message. * @function verify - * @memberof google.protobuf.EnumDescriptorProto + * @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 */ - EnumDescriptorProto.verify = function verify(message) { + 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.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.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.EnumOptions.verify(message.options); + var error = $root.google.protobuf.MethodOptions.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"; - } + 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 an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.EnumDescriptorProto + * @memberof google.protobuf.MethodDescriptorProto * @static * @param {Object.} object Plain object - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto */ - EnumDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumDescriptorProto) + MethodDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodDescriptorProto) return object; - var message = new $root.google.protobuf.EnumDescriptorProto(); + var message = new $root.google.protobuf.MethodDescriptorProto(); 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.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.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]); + 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 an EnumDescriptorProto message. Also converts values to other types if specified. + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.EnumDescriptorProto + * @memberof google.protobuf.MethodDescriptorProto * @static - * @param {google.protobuf.EnumDescriptorProto} message EnumDescriptorProto + * @param {google.protobuf.MethodDescriptorProto} message MethodDescriptorProto * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EnumDescriptorProto.toObject = function toObject(message, options) { + MethodDescriptorProto.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.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.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.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.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]; - } + 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 EnumDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.EnumDescriptorProto + * 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 - * @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; + FileOptions.prototype.javaStringCheckUtf8 = false; - /** - * 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); - }; + /** + * FileOptions optimizeFor. + * @member {google.protobuf.FileOptions.OptimizeMode} optimizeFor + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.optimizeFor = 1; - /** - * 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; - }; + /** + * FileOptions goPackage. + * @member {string} goPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.goPackage = ""; - /** - * 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(); - }; + /** + * FileOptions ccGenericServices. + * @member {boolean} ccGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccGenericServices = false; - /** - * 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; - }; + /** + * FileOptions javaGenericServices. + * @member {boolean} javaGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenericServices = false; - /** - * 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()); - }; + /** + * FileOptions pyGenericServices. + * @member {boolean} pyGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.pyGenericServices = false; - /** - * 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; - }; + /** + * FileOptions phpGenericServices. + * @member {boolean} phpGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpGenericServices = false; - /** - * 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; - }; + /** + * FileOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.deprecated = false; - /** - * 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; - }; + /** + * FileOptions ccEnableArenas. + * @member {boolean} ccEnableArenas + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccEnableArenas = true; - /** - * 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); - }; + /** + * FileOptions objcClassPrefix. + * @member {string} objcClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.objcClassPrefix = ""; - return EnumReservedRange; - })(); + /** + * FileOptions csharpNamespace. + * @member {string} csharpNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.csharpNamespace = ""; - return EnumDescriptorProto; - })(); + /** + * FileOptions swiftPrefix. + * @member {string} swiftPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.swiftPrefix = ""; - protobuf.EnumValueDescriptorProto = (function() { + /** + * FileOptions phpClassPrefix. + * @member {string} phpClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpClassPrefix = ""; /** - * 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 + * FileOptions phpNamespace. + * @member {string} phpNamespace + * @memberof google.protobuf.FileOptions + * @instance */ + FileOptions.prototype.phpNamespace = ""; /** - * Constructs a new EnumValueDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents an EnumValueDescriptorProto. - * @implements IEnumValueDescriptorProto - * @constructor - * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + * FileOptions phpMetadataNamespace. + * @member {string} phpMetadataNamespace + * @memberof google.protobuf.FileOptions + * @instance */ - 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]]; - } + FileOptions.prototype.phpMetadataNamespace = ""; /** - * EnumValueDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.EnumValueDescriptorProto + * FileOptions rubyPackage. + * @member {string} rubyPackage + * @memberof google.protobuf.FileOptions * @instance */ - EnumValueDescriptorProto.prototype.name = ""; + FileOptions.prototype.rubyPackage = ""; /** - * EnumValueDescriptorProto number. - * @member {number} number - * @memberof google.protobuf.EnumValueDescriptorProto + * FileOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.FileOptions * @instance */ - EnumValueDescriptorProto.prototype.number = 0; + FileOptions.prototype.uninterpretedOption = $util.emptyArray; /** - * EnumValueDescriptorProto options. - * @member {google.protobuf.IEnumValueOptions|null|undefined} options - * @memberof google.protobuf.EnumValueDescriptorProto + * FileOptions .google.api.resourceDefinition. + * @member {Array.} .google.api.resourceDefinition + * @memberof google.protobuf.FileOptions * @instance */ - EnumValueDescriptorProto.prototype.options = null; + FileOptions.prototype[".google.api.resourceDefinition"] = $util.emptyArray; /** - * Creates a new EnumValueDescriptorProto instance using the specified properties. + * Creates a new FileOptions instance using the specified properties. * @function create - * @memberof google.protobuf.EnumValueDescriptorProto + * @memberof google.protobuf.FileOptions * @static - * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto instance + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + * @returns {google.protobuf.FileOptions} FileOptions instance */ - EnumValueDescriptorProto.create = function create(properties) { - return new EnumValueDescriptorProto(properties); + FileOptions.create = function create(properties) { + return new FileOptions(properties); }; /** - * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. * @function encode - * @memberof google.protobuf.EnumValueDescriptorProto + * @memberof google.protobuf.FileOptions * @static - * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnumValueDescriptorProto.encode = function encode(message, writer) { + FileOptions.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(); + 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 EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.EnumValueDescriptorProto + * @memberof google.protobuf.FileOptions * @static - * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnumValueDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + FileOptions.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * Decodes a FileOptions message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.EnumValueDescriptorProto + * @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.EnumValueDescriptorProto} EnumValueDescriptorProto + * @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 */ - EnumValueDescriptorProto.decode = function decode(reader, length) { + 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.EnumValueDescriptorProto(); + 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.name = reader.string(); + message.javaPackage = reader.string(); break; - case 2: - message.number = reader.int32(); + case 8: + message.javaOuterClassname = reader.string(); break; - case 3: - message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); + 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); @@ -16322,132 +31189,352 @@ }; /** - * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * Decodes a FileOptions message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.EnumValueDescriptorProto + * @memberof google.protobuf.FileOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @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 */ - EnumValueDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + FileOptions.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EnumValueDescriptorProto message. + * Verifies a FileOptions message. * @function verify - * @memberof google.protobuf.EnumValueDescriptorProto + * @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 */ - EnumValueDescriptorProto.verify = function verify(message) { + FileOptions.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; + 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 an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.EnumValueDescriptorProto + * @memberof google.protobuf.FileOptions * @static * @param {Object.} object Plain object - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @returns {google.protobuf.FileOptions} FileOptions */ - EnumValueDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumValueDescriptorProto) + FileOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileOptions) 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); + 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); } - 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[".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); } - 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. + * Converts this FileOptions to JSON. * @function toJSON - * @memberof google.protobuf.EnumValueDescriptorProto + * @memberof google.protobuf.FileOptions * @instance * @returns {Object.} JSON object */ - EnumValueDescriptorProto.prototype.toJSON = function toJSON() { + FileOptions.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return EnumValueDescriptorProto; + /** + * 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.ServiceDescriptorProto = (function() { + protobuf.MessageOptions = (function() { /** - * Properties of a ServiceDescriptorProto. + * Properties of a MessageOptions. * @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 + * @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 ServiceDescriptorProto. + * Constructs a new MessageOptions. * @memberof google.protobuf - * @classdesc Represents a ServiceDescriptorProto. - * @implements IServiceDescriptorProto + * @classdesc Represents a MessageOptions. + * @implements IMessageOptions * @constructor - * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set */ - function ServiceDescriptorProto(properties) { - this.method = []; + function MessageOptions(properties) { + this.uninterpretedOption = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16455,104 +31542,143 @@ } /** - * ServiceDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.ServiceDescriptorProto + * MessageOptions messageSetWireFormat. + * @member {boolean} messageSetWireFormat + * @memberof google.protobuf.MessageOptions * @instance */ - ServiceDescriptorProto.prototype.name = ""; + MessageOptions.prototype.messageSetWireFormat = false; /** - * ServiceDescriptorProto method. - * @member {Array.} method - * @memberof google.protobuf.ServiceDescriptorProto + * MessageOptions noStandardDescriptorAccessor. + * @member {boolean} noStandardDescriptorAccessor + * @memberof google.protobuf.MessageOptions * @instance */ - ServiceDescriptorProto.prototype.method = $util.emptyArray; + MessageOptions.prototype.noStandardDescriptorAccessor = false; /** - * ServiceDescriptorProto options. - * @member {google.protobuf.IServiceOptions|null|undefined} options - * @memberof google.protobuf.ServiceDescriptorProto + * MessageOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.MessageOptions * @instance */ - ServiceDescriptorProto.prototype.options = null; + MessageOptions.prototype.deprecated = false; /** - * Creates a new ServiceDescriptorProto instance using the specified properties. + * 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.ServiceDescriptorProto + * @memberof google.protobuf.MessageOptions * @static - * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto instance + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + * @returns {google.protobuf.MessageOptions} MessageOptions instance */ - ServiceDescriptorProto.create = function create(properties) { - return new ServiceDescriptorProto(properties); + MessageOptions.create = function create(properties) { + return new MessageOptions(properties); }; /** - * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. * @function encode - * @memberof google.protobuf.ServiceDescriptorProto + * @memberof google.protobuf.MessageOptions * @static - * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ServiceDescriptorProto.encode = function encode(message, writer) { + MessageOptions.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(); + 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 ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.ServiceDescriptorProto + * @memberof google.protobuf.MessageOptions * @static - * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ServiceDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + MessageOptions.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * Decodes a MessageOptions message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.ServiceDescriptorProto + * @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.ServiceDescriptorProto} ServiceDescriptorProto + * @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 */ - ServiceDescriptorProto.decode = function decode(reader, length) { + 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.ServiceDescriptorProto(); + 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.name = reader.string(); + message.messageSetWireFormat = reader.bool(); break; case 2: - if (!(message.method && message.method.length)) - message.method = []; - message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); + message.noStandardDescriptorAccessor = reader.bool(); break; case 3: - message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); + 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); @@ -16563,152 +31689,181 @@ }; /** - * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.ServiceDescriptorProto + * @memberof google.protobuf.MessageOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @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 */ - ServiceDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + MessageOptions.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ServiceDescriptorProto message. + * Verifies a MessageOptions message. * @function verify - * @memberof google.protobuf.ServiceDescriptorProto + * @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 */ - ServiceDescriptorProto.verify = function verify(message) { + MessageOptions.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 (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 "method." + error; + return "uninterpretedOption." + error; } } - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.ServiceOptions.verify(message.options); + 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 "options." + error; + return ".google.api.resource." + error; } return null; }; /** - * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.ServiceDescriptorProto + * @memberof google.protobuf.MessageOptions * @static * @param {Object.} object Plain object - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @returns {google.protobuf.MessageOptions} MessageOptions */ - ServiceDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.ServiceDescriptorProto) + MessageOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MessageOptions) 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]); + 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.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.ServiceDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options); + 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 ServiceDescriptorProto message. Also converts values to other types if specified. + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.ServiceDescriptorProto + * @memberof google.protobuf.MessageOptions * @static - * @param {google.protobuf.ServiceDescriptorProto} message ServiceDescriptorProto + * @param {google.protobuf.MessageOptions} message MessageOptions * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ServiceDescriptorProto.toObject = function toObject(message, options) { + MessageOptions.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.method = []; + object.uninterpretedOption = []; if (options.defaults) { - object.name = ""; - object.options = null; + object.messageSetWireFormat = false; + object.noStandardDescriptorAccessor = false; + object.deprecated = false; + object.mapEntry = false; + object[".google.api.resource"] = 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.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.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.ServiceOptions.toObject(message.options, 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 ServiceDescriptorProto to JSON. + * Converts this MessageOptions to JSON. * @function toJSON - * @memberof google.protobuf.ServiceDescriptorProto + * @memberof google.protobuf.MessageOptions * @instance * @returns {Object.} JSON object */ - ServiceDescriptorProto.prototype.toJSON = function toJSON() { + MessageOptions.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ServiceDescriptorProto; + return MessageOptions; })(); - protobuf.MethodDescriptorProto = (function() { + protobuf.FieldOptions = (function() { /** - * Properties of a MethodDescriptorProto. + * Properties of a FieldOptions. * @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 + * @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 MethodDescriptorProto. + * Constructs a new FieldOptions. * @memberof google.protobuf - * @classdesc Represents a MethodDescriptorProto. - * @implements IMethodDescriptorProto + * @classdesc Represents a FieldOptions. + * @implements IFieldOptions * @constructor - * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set */ - function MethodDescriptorProto(properties) { + 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) @@ -16716,140 +31871,193 @@ } /** - * MethodDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.MethodDescriptorProto + * FieldOptions ctype. + * @member {google.protobuf.FieldOptions.CType} ctype + * @memberof google.protobuf.FieldOptions * @instance */ - MethodDescriptorProto.prototype.name = ""; + FieldOptions.prototype.ctype = 0; /** - * MethodDescriptorProto inputType. - * @member {string} inputType - * @memberof google.protobuf.MethodDescriptorProto + * FieldOptions packed. + * @member {boolean} packed + * @memberof google.protobuf.FieldOptions * @instance */ - MethodDescriptorProto.prototype.inputType = ""; + FieldOptions.prototype.packed = false; /** - * MethodDescriptorProto outputType. - * @member {string} outputType - * @memberof google.protobuf.MethodDescriptorProto + * FieldOptions jstype. + * @member {google.protobuf.FieldOptions.JSType} jstype + * @memberof google.protobuf.FieldOptions * @instance */ - MethodDescriptorProto.prototype.outputType = ""; + FieldOptions.prototype.jstype = 0; /** - * MethodDescriptorProto options. - * @member {google.protobuf.IMethodOptions|null|undefined} options - * @memberof google.protobuf.MethodDescriptorProto + * FieldOptions lazy. + * @member {boolean} lazy + * @memberof google.protobuf.FieldOptions * @instance */ - MethodDescriptorProto.prototype.options = null; + FieldOptions.prototype.lazy = false; /** - * MethodDescriptorProto clientStreaming. - * @member {boolean} clientStreaming - * @memberof google.protobuf.MethodDescriptorProto + * FieldOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FieldOptions * @instance */ - MethodDescriptorProto.prototype.clientStreaming = false; + FieldOptions.prototype.deprecated = false; /** - * MethodDescriptorProto serverStreaming. - * @member {boolean} serverStreaming - * @memberof google.protobuf.MethodDescriptorProto + * FieldOptions weak. + * @member {boolean} weak + * @memberof google.protobuf.FieldOptions * @instance */ - MethodDescriptorProto.prototype.serverStreaming = false; + FieldOptions.prototype.weak = false; /** - * Creates a new MethodDescriptorProto instance using the specified properties. + * 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.MethodDescriptorProto + * @memberof google.protobuf.FieldOptions * @static - * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto instance + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions} FieldOptions instance */ - MethodDescriptorProto.create = function create(properties) { - return new MethodDescriptorProto(properties); + FieldOptions.create = function create(properties) { + return new FieldOptions(properties); }; /** - * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. * @function encode - * @memberof google.protobuf.MethodDescriptorProto + * @memberof google.protobuf.FieldOptions * @static - * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MethodDescriptorProto.encode = function encode(message, writer) { + FieldOptions.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); + 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 MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.MethodDescriptorProto + * @memberof google.protobuf.FieldOptions * @static - * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MethodDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + FieldOptions.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * Decodes a FieldOptions message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.MethodDescriptorProto + * @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.MethodDescriptorProto} MethodDescriptorProto + * @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 */ - MethodDescriptorProto.decode = function decode(reader, length) { + 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.MethodDescriptorProto(); + 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.name = reader.string(); + message.ctype = reader.int32(); break; case 2: - message.inputType = reader.string(); + message.packed = reader.bool(); + break; + case 6: + message.jstype = reader.int32(); + break; + case 5: + message.lazy = reader.bool(); break; case 3: - message.outputType = reader.string(); + message.deprecated = reader.bool(); break; - case 4: - message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); + case 10: + message.weak = reader.bool(); break; - case 5: - message.clientStreaming = reader.bool(); + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); break; - case 6: - message.serverStreaming = reader.bool(); + 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); @@ -16860,173 +32068,311 @@ }; /** - * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.MethodDescriptorProto + * @memberof google.protobuf.FieldOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @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 */ - MethodDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + FieldOptions.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a MethodDescriptorProto message. + * Verifies a FieldOptions message. * @function verify - * @memberof google.protobuf.MethodDescriptorProto + * @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 */ - MethodDescriptorProto.verify = function verify(message) { + FieldOptions.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 (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 "options." + error; + return ".google.api.resourceReference." + 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. + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.MethodDescriptorProto + * @memberof google.protobuf.FieldOptions * @static * @param {Object.} object Plain object - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @returns {google.protobuf.FieldOptions} FieldOptions */ - MethodDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.MethodDescriptorProto) + FieldOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions) 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); + 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"]); } - 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. + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.MethodDescriptorProto + * @memberof google.protobuf.FieldOptions * @static - * @param {google.protobuf.MethodDescriptorProto} message MethodDescriptorProto + * @param {google.protobuf.FieldOptions} message FieldOptions * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - MethodDescriptorProto.toObject = function toObject(message, options) { + 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.name = ""; - object.inputType = ""; - object.outputType = ""; - object.options = null; - object.clientStreaming = false; - object.serverStreaming = false; + 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.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; + 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 MethodDescriptorProto to JSON. + * Converts this FieldOptions to JSON. * @function toJSON - * @memberof google.protobuf.MethodDescriptorProto + * @memberof google.protobuf.FieldOptions * @instance * @returns {Object.} JSON object */ - MethodDescriptorProto.prototype.toJSON = function toJSON() { + FieldOptions.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return MethodDescriptorProto; + /** + * 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.FileOptions = (function() { + protobuf.OneofOptions = (function() { /** - * Properties of a FileOptions. + * Properties of an OneofOptions. * @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 + * @interface IOneofOptions + * @property {Array.|null} [uninterpretedOption] OneofOptions uninterpretedOption */ /** - * Constructs a new FileOptions. + * Constructs a new OneofOptions. * @memberof google.protobuf - * @classdesc Represents a FileOptions. - * @implements IFileOptions + * @classdesc Represents an OneofOptions. + * @implements IOneofOptions * @constructor - * @param {google.protobuf.IFileOptions=} [properties] Properties to set + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set */ - function FileOptions(properties) { + function OneofOptions(properties) { this.uninterpretedOption = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) @@ -17035,237 +32381,267 @@ } /** - * 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 + * OneofOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.OneofOptions * @instance */ - FileOptions.prototype.optimizeFor = 1; + OneofOptions.prototype.uninterpretedOption = $util.emptyArray; /** - * FileOptions goPackage. - * @member {string} goPackage - * @memberof google.protobuf.FileOptions - * @instance + * 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 */ - FileOptions.prototype.goPackage = ""; + OneofOptions.create = function create(properties) { + return new OneofOptions(properties); + }; /** - * FileOptions ccGenericServices. - * @member {boolean} ccGenericServices - * @memberof google.protobuf.FileOptions - * @instance + * 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 */ - FileOptions.prototype.ccGenericServices = false; + 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; + }; /** - * FileOptions javaGenericServices. - * @member {boolean} javaGenericServices - * @memberof google.protobuf.FileOptions - * @instance + * 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 */ - FileOptions.prototype.javaGenericServices = false; + OneofOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * FileOptions pyGenericServices. - * @member {boolean} pyGenericServices - * @memberof google.protobuf.FileOptions - * @instance + * 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 */ - FileOptions.prototype.pyGenericServices = false; + 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; + }; /** - * FileOptions phpGenericServices. - * @member {boolean} phpGenericServices - * @memberof google.protobuf.FileOptions - * @instance + * 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 */ - FileOptions.prototype.phpGenericServices = false; + OneofOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * FileOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.FileOptions - * @instance + * 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 */ - FileOptions.prototype.deprecated = false; + 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; + }; /** - * FileOptions ccEnableArenas. - * @member {boolean} ccEnableArenas - * @memberof google.protobuf.FileOptions - * @instance + * 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 */ - FileOptions.prototype.ccEnableArenas = true; + 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; + }; /** - * FileOptions objcClassPrefix. - * @member {string} objcClassPrefix - * @memberof google.protobuf.FileOptions - * @instance + * 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 */ - FileOptions.prototype.objcClassPrefix = ""; + 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; + }; /** - * FileOptions csharpNamespace. - * @member {string} csharpNamespace - * @memberof google.protobuf.FileOptions + * Converts this OneofOptions to JSON. + * @function toJSON + * @memberof google.protobuf.OneofOptions * @instance + * @returns {Object.} JSON object */ - FileOptions.prototype.csharpNamespace = ""; + OneofOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * FileOptions swiftPrefix. - * @member {string} swiftPrefix - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.swiftPrefix = ""; + return OneofOptions; + })(); + + protobuf.EnumOptions = (function() { /** - * FileOptions phpClassPrefix. - * @member {string} phpClassPrefix - * @memberof google.protobuf.FileOptions - * @instance + * 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 */ - FileOptions.prototype.phpClassPrefix = ""; /** - * FileOptions phpNamespace. - * @member {string} phpNamespace - * @memberof google.protobuf.FileOptions - * @instance + * Constructs a new EnumOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumOptions. + * @implements IEnumOptions + * @constructor + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set */ - FileOptions.prototype.phpNamespace = ""; + 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]]; + } /** - * FileOptions phpMetadataNamespace. - * @member {string} phpMetadataNamespace - * @memberof google.protobuf.FileOptions + * EnumOptions allowAlias. + * @member {boolean} allowAlias + * @memberof google.protobuf.EnumOptions * @instance */ - FileOptions.prototype.phpMetadataNamespace = ""; + EnumOptions.prototype.allowAlias = false; /** - * FileOptions rubyPackage. - * @member {string} rubyPackage - * @memberof google.protobuf.FileOptions + * EnumOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumOptions * @instance */ - FileOptions.prototype.rubyPackage = ""; + EnumOptions.prototype.deprecated = false; /** - * FileOptions uninterpretedOption. + * EnumOptions uninterpretedOption. * @member {Array.} uninterpretedOption - * @memberof google.protobuf.FileOptions + * @memberof google.protobuf.EnumOptions * @instance */ - FileOptions.prototype.uninterpretedOption = $util.emptyArray; + EnumOptions.prototype.uninterpretedOption = $util.emptyArray; /** - * Creates a new FileOptions instance using the specified properties. + * Creates a new EnumOptions instance using the specified properties. * @function create - * @memberof google.protobuf.FileOptions + * @memberof google.protobuf.EnumOptions * @static - * @param {google.protobuf.IFileOptions=} [properties] Properties to set - * @returns {google.protobuf.FileOptions} FileOptions instance + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumOptions} EnumOptions instance */ - FileOptions.create = function create(properties) { - return new FileOptions(properties); + EnumOptions.create = function create(properties) { + return new EnumOptions(properties); }; /** - * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. * @function encode - * @memberof google.protobuf.FileOptions + * @memberof google.protobuf.EnumOptions * @static - * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FileOptions.encode = function encode(message, writer) { + EnumOptions.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.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 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); + 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(); @@ -17273,96 +32649,42 @@ }; /** - * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.FileOptions + * @memberof google.protobuf.EnumOptions * @static - * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FileOptions.encodeDelimited = function encodeDelimited(message, writer) { + EnumOptions.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FileOptions message from the specified reader or buffer. + * Decodes an EnumOptions message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.FileOptions + * @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.FileOptions} FileOptions + * @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 - */ - 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(); + */ + 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 23: + case 3: 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 = []; @@ -17377,98 +32699,38 @@ }; /** - * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.FileOptions + * @memberof google.protobuf.EnumOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FileOptions} FileOptions + * @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 */ - FileOptions.decodeDelimited = function decodeDelimited(reader) { + EnumOptions.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FileOptions message. + * Verifies an EnumOptions message. * @function verify - * @memberof google.protobuf.FileOptions + * @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 */ - FileOptions.verify = function verify(message) { + EnumOptions.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.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.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"; @@ -17482,76 +32744,28 @@ }; /** - * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.FileOptions + * @memberof google.protobuf.EnumOptions * @static * @param {Object.} object Plain object - * @returns {google.protobuf.FileOptions} FileOptions + * @returns {google.protobuf.EnumOptions} EnumOptions */ - FileOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FileOptions) + EnumOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumOptions) 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); + 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.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"); + 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.FileOptions.uninterpretedOption: object expected"); + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: object expected"); message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); } } @@ -17559,82 +32773,28 @@ }; /** - * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FileOptions + * @memberof google.protobuf.EnumOptions * @static - * @param {google.protobuf.FileOptions} message FileOptions + * @param {google.protobuf.EnumOptions} message EnumOptions * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FileOptions.toObject = function toObject(message, options) { + EnumOptions.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) object.uninterpretedOption = []; 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.allowAlias = 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.allowAlias != null && message.hasOwnProperty("allowAlias")) + object.allowAlias = message.allowAlias; 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) @@ -17644,57 +32804,38 @@ }; /** - * Converts this FileOptions to JSON. + * Converts this EnumOptions to JSON. * @function toJSON - * @memberof google.protobuf.FileOptions + * @memberof google.protobuf.EnumOptions * @instance * @returns {Object.} JSON object */ - FileOptions.prototype.toJSON = function toJSON() { + EnumOptions.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; + return EnumOptions; })(); - protobuf.MessageOptions = (function() { + protobuf.EnumValueOptions = (function() { /** - * Properties of a MessageOptions. + * Properties of an EnumValueOptions. * @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 + * @interface IEnumValueOptions + * @property {boolean|null} [deprecated] EnumValueOptions deprecated + * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption */ /** - * Constructs a new MessageOptions. + * Constructs a new EnumValueOptions. * @memberof google.protobuf - * @classdesc Represents a MessageOptions. - * @implements IMessageOptions + * @classdesc Represents an EnumValueOptions. + * @implements IEnumValueOptions * @constructor - * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set */ - function MessageOptions(properties) { + function EnumValueOptions(properties) { this.uninterpretedOption = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) @@ -17703,77 +32844,47 @@ } /** - * 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. + * EnumValueOptions deprecated. * @member {boolean} deprecated - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype.deprecated = false; - - /** - * MessageOptions mapEntry. - * @member {boolean} mapEntry - * @memberof google.protobuf.MessageOptions + * @memberof google.protobuf.EnumValueOptions * @instance */ - MessageOptions.prototype.mapEntry = false; + EnumValueOptions.prototype.deprecated = false; /** - * MessageOptions uninterpretedOption. + * EnumValueOptions uninterpretedOption. * @member {Array.} uninterpretedOption - * @memberof google.protobuf.MessageOptions + * @memberof google.protobuf.EnumValueOptions * @instance */ - MessageOptions.prototype.uninterpretedOption = $util.emptyArray; + EnumValueOptions.prototype.uninterpretedOption = $util.emptyArray; /** - * Creates a new MessageOptions instance using the specified properties. + * Creates a new EnumValueOptions instance using the specified properties. * @function create - * @memberof google.protobuf.MessageOptions + * @memberof google.protobuf.EnumValueOptions * @static - * @param {google.protobuf.IMessageOptions=} [properties] Properties to set - * @returns {google.protobuf.MessageOptions} MessageOptions instance + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions instance */ - MessageOptions.create = function create(properties) { - return new MessageOptions(properties); + EnumValueOptions.create = function create(properties) { + return new EnumValueOptions(properties); }; /** - * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. * @function encode - * @memberof google.protobuf.MessageOptions + * @memberof google.protobuf.EnumValueOptions * @static - * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MessageOptions.encode = function encode(message, writer) { + EnumValueOptions.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); + 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(); @@ -17781,48 +32892,39 @@ }; /** - * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.MessageOptions + * @memberof google.protobuf.EnumValueOptions * @static - * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MessageOptions.encodeDelimited = function encodeDelimited(message, writer) { + EnumValueOptions.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a MessageOptions message from the specified reader or buffer. + * Decodes an EnumValueOptions message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.MessageOptions + * @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.MessageOptions} MessageOptions + * @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 */ - MessageOptions.decode = function decode(reader, length) { + 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.MessageOptions(); + 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.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 = []; @@ -17837,44 +32939,35 @@ }; /** - * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.MessageOptions + * @memberof google.protobuf.EnumValueOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.MessageOptions} MessageOptions + * @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 */ - MessageOptions.decodeDelimited = function decodeDelimited(reader) { + EnumValueOptions.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a MessageOptions message. + * Verifies an EnumValueOptions message. * @function verify - * @memberof google.protobuf.MessageOptions + * @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 */ - MessageOptions.verify = function verify(message) { + EnumValueOptions.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"; @@ -17888,32 +32981,26 @@ }; /** - * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.MessageOptions + * @memberof google.protobuf.EnumValueOptions * @static * @param {Object.} object Plain object - * @returns {google.protobuf.MessageOptions} MessageOptions + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions */ - MessageOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.MessageOptions) + EnumValueOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueOptions) 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); + var message = new $root.google.protobuf.EnumValueOptions(); 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"); + 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.MessageOptions.uninterpretedOption: object expected"); + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: object expected"); message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); } } @@ -17921,34 +33008,24 @@ }; /** - * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.MessageOptions + * @memberof google.protobuf.EnumValueOptions * @static - * @param {google.protobuf.MessageOptions} message MessageOptions + * @param {google.protobuf.EnumValueOptions} message EnumValueOptions * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - MessageOptions.toObject = function toObject(message, options) { + EnumValueOptions.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; + if (options.defaults) object.deprecated = false; - object.mapEntry = false; - } - 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) @@ -17958,227 +33035,159 @@ }; /** - * Converts this MessageOptions to JSON. + * Converts this EnumValueOptions to JSON. * @function toJSON - * @memberof google.protobuf.MessageOptions + * @memberof google.protobuf.EnumValueOptions * @instance * @returns {Object.} JSON object */ - MessageOptions.prototype.toJSON = function toJSON() { + EnumValueOptions.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return MessageOptions; + return EnumValueOptions; })(); - 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 - */ - - /** - * 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; + protobuf.ServiceOptions = (function() { /** - * FieldOptions jstype. - * @member {google.protobuf.FieldOptions.JSType} jstype - * @memberof google.protobuf.FieldOptions - * @instance + * 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 */ - FieldOptions.prototype.jstype = 0; /** - * FieldOptions lazy. - * @member {boolean} lazy - * @memberof google.protobuf.FieldOptions - * @instance + * Constructs a new ServiceOptions. + * @memberof google.protobuf + * @classdesc Represents a ServiceOptions. + * @implements IServiceOptions + * @constructor + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set */ - FieldOptions.prototype.lazy = false; + 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]]; + } /** - * FieldOptions deprecated. + * ServiceOptions deprecated. * @member {boolean} deprecated - * @memberof google.protobuf.FieldOptions + * @memberof google.protobuf.ServiceOptions * @instance */ - FieldOptions.prototype.deprecated = false; + ServiceOptions.prototype.deprecated = false; /** - * FieldOptions weak. - * @member {boolean} weak - * @memberof google.protobuf.FieldOptions + * ServiceOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ServiceOptions * @instance */ - FieldOptions.prototype.weak = false; + ServiceOptions.prototype.uninterpretedOption = $util.emptyArray; /** - * FieldOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.FieldOptions + * ServiceOptions .google.api.defaultHost. + * @member {string} .google.api.defaultHost + * @memberof google.protobuf.ServiceOptions * @instance */ - FieldOptions.prototype.uninterpretedOption = $util.emptyArray; + ServiceOptions.prototype[".google.api.defaultHost"] = ""; /** - * FieldOptions .google.api.fieldBehavior. - * @member {Array.} .google.api.fieldBehavior - * @memberof google.protobuf.FieldOptions + * ServiceOptions .google.api.oauthScopes. + * @member {string} .google.api.oauthScopes + * @memberof google.protobuf.ServiceOptions * @instance */ - FieldOptions.prototype[".google.api.fieldBehavior"] = $util.emptyArray; + ServiceOptions.prototype[".google.api.oauthScopes"] = ""; /** - * Creates a new FieldOptions instance using the specified properties. + * Creates a new ServiceOptions instance using the specified properties. * @function create - * @memberof google.protobuf.FieldOptions + * @memberof google.protobuf.ServiceOptions * @static - * @param {google.protobuf.IFieldOptions=} [properties] Properties to set - * @returns {google.protobuf.FieldOptions} FieldOptions instance + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + * @returns {google.protobuf.ServiceOptions} ServiceOptions instance */ - FieldOptions.create = function create(properties) { - return new FieldOptions(properties); + ServiceOptions.create = function create(properties) { + return new ServiceOptions(properties); }; /** - * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. * @function encode - * @memberof google.protobuf.FieldOptions + * @memberof google.protobuf.ServiceOptions * @static - * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FieldOptions.encode = function encode(message, writer) { + ServiceOptions.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); + 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.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.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 FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.FieldOptions + * @memberof google.protobuf.ServiceOptions * @static - * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FieldOptions.encodeDelimited = function encodeDelimited(message, writer) { + ServiceOptions.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FieldOptions message from the specified reader or buffer. + * Decodes a ServiceOptions message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.FieldOptions + * @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.FieldOptions} FieldOptions + * @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 */ - FieldOptions.decode = function decode(reader, length) { + 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.FieldOptions(); + 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 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: + case 33: 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()); + case 1049: + message[".google.api.defaultHost"] = reader.string(); + break; + case 1050: + message[".google.api.oauthScopes"] = reader.string(); break; default: reader.skipType(tag & 7); @@ -18189,62 +33198,35 @@ }; /** - * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.FieldOptions + * @memberof google.protobuf.ServiceOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldOptions} FieldOptions + * @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 */ - FieldOptions.decodeDelimited = function decodeDelimited(reader) { + ServiceOptions.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FieldOptions message. + * Verifies a ServiceOptions message. * @function verify - * @memberof google.protobuf.FieldOptions + * @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 */ - FieldOptions.verify = function verify(message) { + ServiceOptions.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"; @@ -18254,234 +33236,119 @@ 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; - } - } - 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 (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.weak != null) - message.weak = Boolean(object.weak); if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); + 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.FieldOptions.uninterpretedOption: object expected"); + throw TypeError(".google.protobuf.ServiceOptions.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.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 FieldOptions message. Also converts values to other types if specified. + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FieldOptions + * @memberof google.protobuf.ServiceOptions * @static - * @param {google.protobuf.FieldOptions} message FieldOptions + * @param {google.protobuf.ServiceOptions} message ServiceOptions * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FieldOptions.toObject = function toObject(message, options) { + ServiceOptions.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { + 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.defaultHost"] = ""; + object[".google.api.oauthScopes"] = ""; } - 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.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 FieldOptions to JSON. + * Converts this ServiceOptions to JSON. * @function toJSON - * @memberof google.protobuf.FieldOptions + * @memberof google.protobuf.ServiceOptions * @instance * @returns {Object.} JSON object */ - FieldOptions.prototype.toJSON = function toJSON() { + ServiceOptions.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; + return ServiceOptions; })(); - protobuf.OneofOptions = (function() { + protobuf.MethodOptions = (function() { /** - * Properties of an OneofOptions. + * Properties of a MethodOptions. * @memberof google.protobuf - * @interface IOneofOptions - * @property {Array.|null} [uninterpretedOption] OneofOptions uninterpretedOption + * @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 OneofOptions. + * Constructs a new MethodOptions. * @memberof google.protobuf - * @classdesc Represents an OneofOptions. - * @implements IOneofOptions + * @classdesc Represents a MethodOptions. + * @implements IMethodOptions * @constructor - * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + * @param {google.protobuf.IMethodOptions=} [properties] Properties to set */ - function OneofOptions(properties) { + 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) @@ -18489,79 +33356,147 @@ } /** - * OneofOptions uninterpretedOption. + * 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.OneofOptions + * @memberof google.protobuf.MethodOptions * @instance */ - OneofOptions.prototype.uninterpretedOption = $util.emptyArray; + MethodOptions.prototype.uninterpretedOption = $util.emptyArray; /** - * Creates a new OneofOptions instance using the specified properties. + * 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.OneofOptions + * @memberof google.protobuf.MethodOptions * @static - * @param {google.protobuf.IOneofOptions=} [properties] Properties to set - * @returns {google.protobuf.OneofOptions} OneofOptions instance + * @param {google.protobuf.IMethodOptions=} [properties] Properties to set + * @returns {google.protobuf.MethodOptions} MethodOptions instance */ - OneofOptions.create = function create(properties) { - return new OneofOptions(properties); + MethodOptions.create = function create(properties) { + return new MethodOptions(properties); }; /** - * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. * @function encode - * @memberof google.protobuf.OneofOptions + * @memberof google.protobuf.MethodOptions * @static - * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OneofOptions.encode = function encode(message, 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 OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.OneofOptions + * @memberof google.protobuf.MethodOptions * @static - * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OneofOptions.encodeDelimited = function encodeDelimited(message, writer) { + MethodOptions.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an OneofOptions message from the specified reader or buffer. + * Decodes a MethodOptions message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.OneofOptions + * @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.OneofOptions} OneofOptions + * @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 */ - OneofOptions.decode = function decode(reader, length) { + 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.OneofOptions(); + 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; @@ -18571,32 +33506,44 @@ }; /** - * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * Decodes a MethodOptions message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.OneofOptions + * @memberof google.protobuf.MethodOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.OneofOptions} OneofOptions + * @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 */ - OneofOptions.decodeDelimited = function decodeDelimited(reader) { + MethodOptions.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an OneofOptions message. + * Verifies a MethodOptions message. * @function verify - * @memberof google.protobuf.OneofOptions + * @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 */ - OneofOptions.verify = function verify(message) { + 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"; @@ -18606,92 +33553,183 @@ 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 an OneofOptions message from a plain object. Also converts values to their respective internal types. + * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.OneofOptions + * @memberof google.protobuf.MethodOptions * @static * @param {Object.} object Plain object - * @returns {google.protobuf.OneofOptions} OneofOptions + * @returns {google.protobuf.MethodOptions} MethodOptions */ - OneofOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.OneofOptions) + MethodOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodOptions) return object; - var message = new $root.google.protobuf.OneofOptions(); + 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.OneofOptions.uninterpretedOption: array expected"); + 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.OneofOptions.uninterpretedOption: object expected"); + 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 an OneofOptions message. Also converts values to other types if specified. + * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.OneofOptions + * @memberof google.protobuf.MethodOptions * @static - * @param {google.protobuf.OneofOptions} message OneofOptions + * @param {google.protobuf.MethodOptions} message MethodOptions * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - OneofOptions.toObject = function toObject(message, options) { + MethodOptions.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) + 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 OneofOptions to JSON. + * Converts this MethodOptions to JSON. * @function toJSON - * @memberof google.protobuf.OneofOptions + * @memberof google.protobuf.MethodOptions * @instance * @returns {Object.} JSON object */ - OneofOptions.prototype.toJSON = function toJSON() { + MethodOptions.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return OneofOptions; + /** + * 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.EnumOptions = (function() { + protobuf.UninterpretedOption = (function() { /** - * Properties of an EnumOptions. + * Properties of an UninterpretedOption. * @memberof google.protobuf - * @interface IEnumOptions - * @property {boolean|null} [allowAlias] EnumOptions allowAlias - * @property {boolean|null} [deprecated] EnumOptions deprecated - * @property {Array.|null} [uninterpretedOption] EnumOptions uninterpretedOption + * @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 EnumOptions. + * Constructs a new UninterpretedOption. * @memberof google.protobuf - * @classdesc Represents an EnumOptions. - * @implements IEnumOptions + * @classdesc Represents an UninterpretedOption. + * @implements IUninterpretedOption * @constructor - * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set */ - function EnumOptions(properties) { - this.uninterpretedOption = []; + function UninterpretedOption(properties) { + this.name = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -18699,104 +33737,156 @@ } /** - * EnumOptions allowAlias. - * @member {boolean} allowAlias - * @memberof google.protobuf.EnumOptions + * UninterpretedOption name. + * @member {Array.} name + * @memberof google.protobuf.UninterpretedOption * @instance */ - EnumOptions.prototype.allowAlias = false; + UninterpretedOption.prototype.name = $util.emptyArray; /** - * EnumOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.EnumOptions + * UninterpretedOption identifierValue. + * @member {string} identifierValue + * @memberof google.protobuf.UninterpretedOption * @instance */ - EnumOptions.prototype.deprecated = false; + UninterpretedOption.prototype.identifierValue = ""; /** - * EnumOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.EnumOptions + * UninterpretedOption positiveIntValue. + * @member {number|Long} positiveIntValue + * @memberof google.protobuf.UninterpretedOption * @instance */ - EnumOptions.prototype.uninterpretedOption = $util.emptyArray; + UninterpretedOption.prototype.positiveIntValue = $util.Long ? $util.Long.fromBits(0,0,true) : 0; /** - * Creates a new EnumOptions instance using the specified properties. + * 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.EnumOptions + * @memberof google.protobuf.UninterpretedOption * @static - * @param {google.protobuf.IEnumOptions=} [properties] Properties to set - * @returns {google.protobuf.EnumOptions} EnumOptions instance + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption instance */ - EnumOptions.create = function create(properties) { - return new EnumOptions(properties); + UninterpretedOption.create = function create(properties) { + return new UninterpretedOption(properties); }; /** - * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. * @function encode - * @memberof google.protobuf.EnumOptions + * @memberof google.protobuf.UninterpretedOption * @static - * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnumOptions.encode = function encode(message, writer) { + UninterpretedOption.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(); + 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 EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.EnumOptions + * @memberof google.protobuf.UninterpretedOption * @static - * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnumOptions.encodeDelimited = function encodeDelimited(message, writer) { + UninterpretedOption.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EnumOptions message from the specified reader or buffer. + * Decodes an UninterpretedOption message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.EnumOptions + * @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.EnumOptions} EnumOptions + * @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 */ - EnumOptions.decode = function decode(reader, length) { + 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.EnumOptions(); + 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: - message.allowAlias = reader.bool(); + if (!(message.name && message.name.length)) + message.name = []; + message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); break; case 3: - message.deprecated = reader.bool(); + message.identifierValue = reader.string(); break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + 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); @@ -18807,377 +33897,422 @@ }; /** - * Decodes an EnumOptions message from the specified reader or buffer, length delimited. + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.EnumOptions + * @memberof google.protobuf.UninterpretedOption * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumOptions} EnumOptions + * @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 */ - EnumOptions.decodeDelimited = function decodeDelimited(reader) { + UninterpretedOption.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EnumOptions message. + * Verifies an UninterpretedOption message. * @function verify - * @memberof google.protobuf.EnumOptions + * @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 */ - EnumOptions.verify = function verify(message) { + UninterpretedOption.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 (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 "uninterpretedOption." + 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 EnumOptions message from a plain object. Also converts values to their respective internal types. + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.EnumOptions + * @memberof google.protobuf.UninterpretedOption * @static * @param {Object.} object Plain object - * @returns {google.protobuf.EnumOptions} EnumOptions + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption */ - EnumOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumOptions) + UninterpretedOption.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UninterpretedOption) 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]); + 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 EnumOptions message. Also converts values to other types if specified. + * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.EnumOptions + * @memberof google.protobuf.UninterpretedOption * @static - * @param {google.protobuf.EnumOptions} message EnumOptions + * @param {google.protobuf.UninterpretedOption} message UninterpretedOption * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EnumOptions.toObject = function toObject(message, options) { + UninterpretedOption.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.uninterpretedOption = []; + object.name = []; if (options.defaults) { - object.allowAlias = false; - object.deprecated = false; + 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.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); + 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 EnumOptions to JSON. + * Converts this UninterpretedOption to JSON. * @function toJSON - * @memberof google.protobuf.EnumOptions + * @memberof google.protobuf.UninterpretedOption * @instance * @returns {Object.} JSON object */ - EnumOptions.prototype.toJSON = function toJSON() { + UninterpretedOption.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return EnumOptions; - })(); - - protobuf.EnumValueOptions = (function() { + UninterpretedOption.NamePart = (function() { - /** - * Properties of an EnumValueOptions. - * @memberof google.protobuf - * @interface IEnumValueOptions - * @property {boolean|null} [deprecated] EnumValueOptions deprecated - * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption - */ + /** + * Properties of a NamePart. + * @memberof google.protobuf.UninterpretedOption + * @interface INamePart + * @property {string} namePart NamePart namePart + * @property {boolean} isExtension NamePart isExtension + */ - /** - * 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]]; - } + /** + * 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]]; + } - /** - * EnumValueOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.EnumValueOptions - * @instance - */ - EnumValueOptions.prototype.deprecated = false; + /** + * NamePart namePart. + * @member {string} namePart + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.namePart = ""; - /** - * EnumValueOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.EnumValueOptions - * @instance - */ - EnumValueOptions.prototype.uninterpretedOption = $util.emptyArray; + /** + * NamePart isExtension. + * @member {boolean} isExtension + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.isExtension = false; - /** - * 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); - }; + /** + * 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 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 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 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(); - }; + /** + * 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 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; + /** + * 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; + } } - } - return message; - }; + 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; + }; - /** - * 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()); - }; + /** + * 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; + }; - /** - * 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; + /** + * 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; } - } - 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) + if (message.namePart != null && message.hasOwnProperty("namePart")) + object.namePart = message.namePart; + if (message.isExtension != null && message.hasOwnProperty("isExtension")) + object.isExtension = message.isExtension; 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 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); + }; - /** - * 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 NamePart; + })(); - return EnumValueOptions; + return UninterpretedOption; })(); - protobuf.ServiceOptions = (function() { + protobuf.SourceCodeInfo = (function() { /** - * Properties of a ServiceOptions. + * Properties of a SourceCodeInfo. * @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 + * @interface ISourceCodeInfo + * @property {Array.|null} [location] SourceCodeInfo location */ /** - * Constructs a new ServiceOptions. + * Constructs a new SourceCodeInfo. * @memberof google.protobuf - * @classdesc Represents a ServiceOptions. - * @implements IServiceOptions + * @classdesc Represents a SourceCodeInfo. + * @implements ISourceCodeInfo * @constructor - * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set */ - function ServiceOptions(properties) { - this.uninterpretedOption = []; + function SourceCodeInfo(properties) { + this.location = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -19185,117 +34320,78 @@ } /** - * 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 + * SourceCodeInfo location. + * @member {Array.} location + * @memberof google.protobuf.SourceCodeInfo * @instance */ - ServiceOptions.prototype[".google.api.oauthScopes"] = ""; + SourceCodeInfo.prototype.location = $util.emptyArray; /** - * Creates a new ServiceOptions instance using the specified properties. + * Creates a new SourceCodeInfo instance using the specified properties. * @function create - * @memberof google.protobuf.ServiceOptions + * @memberof google.protobuf.SourceCodeInfo * @static - * @param {google.protobuf.IServiceOptions=} [properties] Properties to set - * @returns {google.protobuf.ServiceOptions} ServiceOptions instance + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo instance */ - ServiceOptions.create = function create(properties) { - return new ServiceOptions(properties); + SourceCodeInfo.create = function create(properties) { + return new SourceCodeInfo(properties); }; /** - * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. * @function encode - * @memberof google.protobuf.ServiceOptions + * @memberof google.protobuf.SourceCodeInfo * @static - * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ServiceOptions.encode = function encode(message, writer) { + SourceCodeInfo.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"]); + 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 ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.ServiceOptions + * @memberof google.protobuf.SourceCodeInfo * @static - * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ServiceOptions.encodeDelimited = function encodeDelimited(message, writer) { + SourceCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ServiceOptions message from the specified reader or buffer. + * Decodes a SourceCodeInfo message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.ServiceOptions + * @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.ServiceOptions} ServiceOptions + * @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 */ - ServiceOptions.decode = function decode(reader, length) { + 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.ServiceOptions(); + 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 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(); + 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); @@ -19306,304 +34402,546 @@ }; /** - * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. + * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.ServiceOptions + * @memberof google.protobuf.SourceCodeInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @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 */ - ServiceOptions.decodeDelimited = function decodeDelimited(reader) { + SourceCodeInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ServiceOptions message. + * Verifies a SourceCodeInfo message. * @function verify - * @memberof google.protobuf.ServiceOptions + * @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 */ - ServiceOptions.verify = function verify(message) { + SourceCodeInfo.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 (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 "uninterpretedOption." + error; + return "location." + 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. + * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.ServiceOptions + * @memberof google.protobuf.SourceCodeInfo * @static * @param {Object.} object Plain object - * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo */ - ServiceOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.ServiceOptions) + SourceCodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.SourceCodeInfo) 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]); + 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]); } } - 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. + * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.ServiceOptions + * @memberof google.protobuf.SourceCodeInfo * @static - * @param {google.protobuf.ServiceOptions} message ServiceOptions + * @param {google.protobuf.SourceCodeInfo} message SourceCodeInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ServiceOptions.toObject = function toObject(message, options) { + SourceCodeInfo.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); + 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); } - 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); - }; + /** + * 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; + }; - return ServiceOptions; - })(); + /** + * 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()); + }; - protobuf.MethodOptions = (function() { + /** + * 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; + }; - /** - * 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 - */ + /** + * 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; + }; - /** - * 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]]; - } + /** + * 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; + }; - /** - * MethodOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype.deprecated = false; + /** + * 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); + }; - /** - * MethodOptions idempotencyLevel. - * @member {google.protobuf.MethodOptions.IdempotencyLevel} idempotencyLevel - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype.idempotencyLevel = 0; + return Location; + })(); - /** - * MethodOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype.uninterpretedOption = $util.emptyArray; + return SourceCodeInfo; + })(); + + protobuf.GeneratedCodeInfo = (function() { /** - * MethodOptions .google.api.http. - * @member {google.api.IHttpRule|null|undefined} .google.api.http - * @memberof google.protobuf.MethodOptions - * @instance + * Properties of a GeneratedCodeInfo. + * @memberof google.protobuf + * @interface IGeneratedCodeInfo + * @property {Array.|null} [annotation] GeneratedCodeInfo annotation */ - MethodOptions.prototype[".google.api.http"] = null; /** - * MethodOptions .google.api.methodSignature. - * @member {Array.} .google.api.methodSignature - * @memberof google.protobuf.MethodOptions - * @instance + * Constructs a new GeneratedCodeInfo. + * @memberof google.protobuf + * @classdesc Represents a GeneratedCodeInfo. + * @implements IGeneratedCodeInfo + * @constructor + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set */ - MethodOptions.prototype[".google.api.methodSignature"] = $util.emptyArray; + 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]]; + } /** - * MethodOptions .google.longrunning.operationInfo. - * @member {google.longrunning.IOperationInfo|null|undefined} .google.longrunning.operationInfo - * @memberof google.protobuf.MethodOptions + * GeneratedCodeInfo annotation. + * @member {Array.} annotation + * @memberof google.protobuf.GeneratedCodeInfo * @instance */ - MethodOptions.prototype[".google.longrunning.operationInfo"] = null; + GeneratedCodeInfo.prototype.annotation = $util.emptyArray; /** - * Creates a new MethodOptions instance using the specified properties. + * Creates a new GeneratedCodeInfo instance using the specified properties. * @function create - * @memberof google.protobuf.MethodOptions + * @memberof google.protobuf.GeneratedCodeInfo * @static - * @param {google.protobuf.IMethodOptions=} [properties] Properties to set - * @returns {google.protobuf.MethodOptions} MethodOptions instance + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo instance */ - MethodOptions.create = function create(properties) { - return new MethodOptions(properties); + GeneratedCodeInfo.create = function create(properties) { + return new GeneratedCodeInfo(properties); }; /** - * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. * @function encode - * @memberof google.protobuf.MethodOptions + * @memberof google.protobuf.GeneratedCodeInfo * @static - * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MethodOptions.encode = function encode(message, writer) { + GeneratedCodeInfo.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(); + 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 MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.MethodOptions + * @memberof google.protobuf.GeneratedCodeInfo * @static - * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MethodOptions.encodeDelimited = function encodeDelimited(message, writer) { + GeneratedCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a MethodOptions message from the specified reader or buffer. + * Decodes a GeneratedCodeInfo message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.MethodOptions + * @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.MethodOptions} MethodOptions + * @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 */ - MethodOptions.decode = function decode(reader, length) { + 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.MethodOptions(); + 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 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()); + 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); @@ -19614,230 +34952,404 @@ }; /** - * Decodes a MethodOptions message from the specified reader or buffer, length delimited. + * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.MethodOptions + * @memberof google.protobuf.GeneratedCodeInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.MethodOptions} MethodOptions + * @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 */ - MethodOptions.decodeDelimited = function decodeDelimited(reader) { + GeneratedCodeInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a MethodOptions message. + * Verifies a GeneratedCodeInfo message. * @function verify - * @memberof google.protobuf.MethodOptions + * @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 */ - MethodOptions.verify = function verify(message) { + GeneratedCodeInfo.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 (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 "uninterpretedOption." + error; + return "annotation." + 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. + * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.MethodOptions + * @memberof google.protobuf.GeneratedCodeInfo * @static * @param {Object.} object Plain object - * @returns {google.protobuf.MethodOptions} MethodOptions + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo */ - MethodOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.MethodOptions) + GeneratedCodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo) 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]); + 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]); } } - 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. + * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.MethodOptions + * @memberof google.protobuf.GeneratedCodeInfo * @static - * @param {google.protobuf.MethodOptions} message MethodOptions + * @param {google.protobuf.GeneratedCodeInfo} message GeneratedCodeInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - MethodOptions.toObject = function toObject(message, options) { + GeneratedCodeInfo.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 (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); } - 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); - }; + /** + * 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; + }; - /** - * 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; + /** + * 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 MethodOptions; + return GeneratedCodeInfo; })(); - protobuf.UninterpretedOption = (function() { + protobuf.Any = (function() { /** - * Properties of an UninterpretedOption. + * Properties of an Any. * @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 + * @interface IAny + * @property {string|null} [type_url] Any type_url + * @property {Uint8Array|null} [value] Any value */ /** - * Constructs a new UninterpretedOption. + * Constructs a new Any. * @memberof google.protobuf - * @classdesc Represents an UninterpretedOption. - * @implements IUninterpretedOption + * @classdesc Represents an Any. + * @implements IAny * @constructor - * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + * @param {google.protobuf.IAny=} [properties] Properties to set */ - function UninterpretedOption(properties) { - this.name = []; + function Any(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -19845,156 +35357,88 @@ } /** - * 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 + * Any type_url. + * @member {string} type_url + * @memberof google.protobuf.Any * @instance */ - UninterpretedOption.prototype.stringValue = $util.newBuffer([]); + Any.prototype.type_url = ""; /** - * UninterpretedOption aggregateValue. - * @member {string} aggregateValue - * @memberof google.protobuf.UninterpretedOption + * Any value. + * @member {Uint8Array} value + * @memberof google.protobuf.Any * @instance */ - UninterpretedOption.prototype.aggregateValue = ""; + Any.prototype.value = $util.newBuffer([]); /** - * Creates a new UninterpretedOption instance using the specified properties. + * Creates a new Any instance using the specified properties. * @function create - * @memberof google.protobuf.UninterpretedOption + * @memberof google.protobuf.Any * @static - * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption instance + * @param {google.protobuf.IAny=} [properties] Properties to set + * @returns {google.protobuf.Any} Any instance */ - UninterpretedOption.create = function create(properties) { - return new UninterpretedOption(properties); + Any.create = function create(properties) { + return new Any(properties); }; /** - * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. * @function encode - * @memberof google.protobuf.UninterpretedOption + * @memberof google.protobuf.Any * @static - * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {google.protobuf.IAny} message Any message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UninterpretedOption.encode = function encode(message, writer) { + Any.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); + 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 UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.UninterpretedOption + * @memberof google.protobuf.Any * @static - * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {google.protobuf.IAny} message Any message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UninterpretedOption.encodeDelimited = function encodeDelimited(message, writer) { + Any.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an UninterpretedOption message from the specified reader or buffer. + * Decodes an Any message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.UninterpretedOption + * @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.UninterpretedOption} UninterpretedOption + * @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 - */ - 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(); + */ + 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 8: - message.aggregateValue = reader.string(); + case 2: + message.value = reader.bytes(); break; default: reader.skipType(tag & 7); @@ -20005,422 +35449,312 @@ }; /** - * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * Decodes an Any message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.UninterpretedOption + * @memberof google.protobuf.Any * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @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 */ - UninterpretedOption.decodeDelimited = function decodeDelimited(reader) { + Any.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an UninterpretedOption message. + * Verifies an Any message. * @function verify - * @memberof google.protobuf.UninterpretedOption + * @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 */ - UninterpretedOption.verify = function verify(message) { + Any.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"; + 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 UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * Creates an Any message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.UninterpretedOption + * @memberof google.protobuf.Any * @static * @param {Object.} object Plain object - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @returns {google.protobuf.Any} Any */ - UninterpretedOption.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.UninterpretedOption) + Any.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Any) 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); + 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 UninterpretedOption message. Also converts values to other types if specified. + * Creates a plain object from an Any message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.UninterpretedOption + * @memberof google.protobuf.Any * @static - * @param {google.protobuf.UninterpretedOption} message UninterpretedOption + * @param {google.protobuf.Any} message Any * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UninterpretedOption.toObject = function toObject(message, options) { + Any.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; + object.type_url = ""; if (options.bytes === String) - object.stringValue = ""; + object.value = ""; else { - object.stringValue = []; + object.value = []; if (options.bytes !== Array) - object.stringValue = $util.newBuffer(object.stringValue); + object.value = $util.newBuffer(object.value); } - 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; + 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 UninterpretedOption to JSON. + * Converts this Any to JSON. * @function toJSON - * @memberof google.protobuf.UninterpretedOption + * @memberof google.protobuf.Any * @instance * @returns {Object.} JSON object */ - UninterpretedOption.prototype.toJSON = function toJSON() { + Any.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; + return Any; + })(); - /** - * 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); - }; + protobuf.DoubleValue = (function() { - /** - * 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; - }; + /** + * Properties of a DoubleValue. + * @memberof google.protobuf + * @interface IDoubleValue + * @property {number|null} [value] DoubleValue value + */ - /** - * 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(); - }; + /** + * 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]]; + } - /** - * 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; - }; + /** + * DoubleValue value. + * @member {number} value + * @memberof google.protobuf.DoubleValue + * @instance + */ + DoubleValue.prototype.value = 0; - /** - * 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()); - }; + /** + * 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); + }; - /** - * 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; - }; + /** + * 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; + }; - /** - * 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; - }; + /** + * 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(); + }; - /** - * 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; + /** + * 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; } - if (message.namePart != null && message.hasOwnProperty("namePart")) - object.namePart = message.namePart; - if (message.isExtension != null && message.hasOwnProperty("isExtension")) - object.isExtension = message.isExtension; + } + 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; + }; - /** - * 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); - }; + /** + * 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; + }; - return NamePart; - })(); + /** + * 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 UninterpretedOption; + return DoubleValue; })(); - protobuf.SourceCodeInfo = (function() { + protobuf.FloatValue = (function() { /** - * Properties of a SourceCodeInfo. + * Properties of a FloatValue. * @memberof google.protobuf - * @interface ISourceCodeInfo - * @property {Array.|null} [location] SourceCodeInfo location + * @interface IFloatValue + * @property {number|null} [value] FloatValue value */ /** - * Constructs a new SourceCodeInfo. + * Constructs a new FloatValue. * @memberof google.protobuf - * @classdesc Represents a SourceCodeInfo. - * @implements ISourceCodeInfo + * @classdesc Represents a FloatValue. + * @implements IFloatValue * @constructor - * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + * @param {google.protobuf.IFloatValue=} [properties] Properties to set */ - function SourceCodeInfo(properties) { - this.location = []; + function FloatValue(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -20428,78 +35762,75 @@ } /** - * SourceCodeInfo location. - * @member {Array.} location - * @memberof google.protobuf.SourceCodeInfo + * FloatValue value. + * @member {number} value + * @memberof google.protobuf.FloatValue * @instance */ - SourceCodeInfo.prototype.location = $util.emptyArray; + FloatValue.prototype.value = 0; /** - * Creates a new SourceCodeInfo instance using the specified properties. + * Creates a new FloatValue instance using the specified properties. * @function create - * @memberof google.protobuf.SourceCodeInfo + * @memberof google.protobuf.FloatValue * @static - * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set - * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo instance + * @param {google.protobuf.IFloatValue=} [properties] Properties to set + * @returns {google.protobuf.FloatValue} FloatValue instance */ - SourceCodeInfo.create = function create(properties) { - return new SourceCodeInfo(properties); + FloatValue.create = function create(properties) { + return new FloatValue(properties); }; /** - * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * Encodes the specified FloatValue message. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. * @function encode - * @memberof google.protobuf.SourceCodeInfo + * @memberof google.protobuf.FloatValue * @static - * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {google.protobuf.IFloatValue} message FloatValue message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SourceCodeInfo.encode = function encode(message, writer) { + FloatValue.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(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.value); return writer; }; /** - * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * Encodes the specified FloatValue message, length delimited. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.SourceCodeInfo + * @memberof google.protobuf.FloatValue * @static - * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {google.protobuf.IFloatValue} message FloatValue message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SourceCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + FloatValue.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SourceCodeInfo message from the specified reader or buffer. + * Decodes a FloatValue message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.SourceCodeInfo + * @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.SourceCodeInfo} SourceCodeInfo + * @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 */ - SourceCodeInfo.decode = function decode(reader, length) { + 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.SourceCodeInfo(); + 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: - if (!(message.location && message.location.length)) - message.location = []; - message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); + message.value = reader.float(); break; default: reader.skipType(tag & 7); @@ -20510,467 +35841,308 @@ }; /** - * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. + * Decodes a FloatValue message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.SourceCodeInfo + * @memberof google.protobuf.FloatValue * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @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 */ - SourceCodeInfo.decodeDelimited = function decodeDelimited(reader) { + FloatValue.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SourceCodeInfo message. + * Verifies a FloatValue message. * @function verify - * @memberof google.protobuf.SourceCodeInfo + * @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 */ - SourceCodeInfo.verify = function verify(message) { + FloatValue.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; - } - } + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value !== "number") + return "value: number expected"; return null; }; /** - * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. + * Creates a FloatValue message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.SourceCodeInfo + * @memberof google.protobuf.FloatValue * @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 + * @returns {google.protobuf.FloatValue} FloatValue */ - 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 = ""; + 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; + }; - /** - * Location trailingComments. - * @member {string} trailingComments - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.trailingComments = ""; + /** + * 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; + }; - /** - * Location leadingDetachedComments. - * @member {Array.} leadingDetachedComments - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.leadingDetachedComments = $util.emptyArray; + /** + * 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); + }; - /** - * 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); - }; + return FloatValue; + })(); - /** - * 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; - }; + protobuf.Int64Value = (function() { - /** - * 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(); - }; + /** + * Properties of an Int64Value. + * @memberof google.protobuf + * @interface IInt64Value + * @property {number|Long|null} [value] Int64Value value + */ - /** - * 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; - }; + /** + * 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]]; + } - /** - * 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()); - }; + /** + * Int64Value value. + * @member {number|Long} value + * @memberof google.protobuf.Int64Value + * @instance + */ + Int64Value.prototype.value = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * 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 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); + }; - /** - * 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; - }; + /** + * 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; + }; - /** - * 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]; + /** + * 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; + }; - /** - * 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); - }; + /** + * 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; + }; - return Location; - })(); + /** + * 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 SourceCodeInfo; + return Int64Value; })(); - protobuf.GeneratedCodeInfo = (function() { + protobuf.UInt64Value = (function() { /** - * Properties of a GeneratedCodeInfo. + * Properties of a UInt64Value. * @memberof google.protobuf - * @interface IGeneratedCodeInfo - * @property {Array.|null} [annotation] GeneratedCodeInfo annotation + * @interface IUInt64Value + * @property {number|Long|null} [value] UInt64Value value */ /** - * Constructs a new GeneratedCodeInfo. + * Constructs a new UInt64Value. * @memberof google.protobuf - * @classdesc Represents a GeneratedCodeInfo. - * @implements IGeneratedCodeInfo + * @classdesc Represents a UInt64Value. + * @implements IUInt64Value * @constructor - * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + * @param {google.protobuf.IUInt64Value=} [properties] Properties to set */ - function GeneratedCodeInfo(properties) { - this.annotation = []; + function UInt64Value(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -20978,78 +36150,75 @@ } /** - * GeneratedCodeInfo annotation. - * @member {Array.} annotation - * @memberof google.protobuf.GeneratedCodeInfo + * UInt64Value value. + * @member {number|Long} value + * @memberof google.protobuf.UInt64Value * @instance */ - GeneratedCodeInfo.prototype.annotation = $util.emptyArray; + UInt64Value.prototype.value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; /** - * Creates a new GeneratedCodeInfo instance using the specified properties. + * Creates a new UInt64Value instance using the specified properties. * @function create - * @memberof google.protobuf.GeneratedCodeInfo + * @memberof google.protobuf.UInt64Value * @static - * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo instance + * @param {google.protobuf.IUInt64Value=} [properties] Properties to set + * @returns {google.protobuf.UInt64Value} UInt64Value instance */ - GeneratedCodeInfo.create = function create(properties) { - return new GeneratedCodeInfo(properties); + UInt64Value.create = function create(properties) { + return new UInt64Value(properties); }; /** - * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * Encodes the specified UInt64Value message. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. * @function encode - * @memberof google.protobuf.GeneratedCodeInfo + * @memberof google.protobuf.UInt64Value * @static - * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {google.protobuf.IUInt64Value} message UInt64Value message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GeneratedCodeInfo.encode = function encode(message, writer) { + UInt64Value.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(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.value); return writer; }; /** - * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * Encodes the specified UInt64Value message, length delimited. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.GeneratedCodeInfo + * @memberof google.protobuf.UInt64Value * @static - * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {google.protobuf.IUInt64Value} message UInt64Value message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GeneratedCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + UInt64Value.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GeneratedCodeInfo message from the specified reader or buffer. + * Decodes a UInt64Value message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.GeneratedCodeInfo + * @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.GeneratedCodeInfo} GeneratedCodeInfo + * @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 */ - GeneratedCodeInfo.decode = function decode(reader, length) { + 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.GeneratedCodeInfo(); + 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: - if (!(message.annotation && message.annotation.length)) - message.annotation = []; - message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); + message.value = reader.uint64(); break; default: reader.skipType(tag & 7); @@ -21060,404 +36229,308 @@ }; /** - * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. + * Decodes a UInt64Value message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.GeneratedCodeInfo + * @memberof google.protobuf.UInt64Value * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @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 */ - GeneratedCodeInfo.decodeDelimited = function decodeDelimited(reader) { + UInt64Value.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GeneratedCodeInfo message. + * Verifies a UInt64Value message. * @function verify - * @memberof google.protobuf.GeneratedCodeInfo + * @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 */ - GeneratedCodeInfo.verify = function verify(message) { + UInt64Value.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; - } - } + 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 GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. + * Creates a UInt64Value message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.GeneratedCodeInfo + * @memberof google.protobuf.UInt64Value * @static * @param {Object.} object Plain object - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @returns {google.protobuf.UInt64Value} UInt64Value */ - GeneratedCodeInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.GeneratedCodeInfo) + UInt64Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UInt64Value) 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]); - } - } + 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 GeneratedCodeInfo message. Also converts values to other types if specified. + * Creates a plain object from a UInt64Value message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.GeneratedCodeInfo + * @memberof google.protobuf.UInt64Value * @static - * @param {google.protobuf.GeneratedCodeInfo} message GeneratedCodeInfo + * @param {google.protobuf.UInt64Value} message UInt64Value * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GeneratedCodeInfo.toObject = function toObject(message, options) { + UInt64Value.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; - }; + 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; + }; - /** - * 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(); - }; + /** + * 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); + }; - /** - * 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; - }; + return UInt64Value; + })(); - /** - * 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()); - }; + protobuf.Int32Value = (function() { - /** - * 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; - }; + /** + * Properties of an Int32Value. + * @memberof google.protobuf + * @interface IInt32Value + * @property {number|null} [value] Int32Value value + */ - /** - * 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; - }; + /** + * 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]]; + } - /** - * 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]; + /** + * 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; } - 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 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; + }; - /** - * 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); - }; + /** + * 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; + }; - return Annotation; - })(); + /** + * 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 GeneratedCodeInfo; + return Int32Value; })(); - protobuf.Any = (function() { + protobuf.UInt32Value = (function() { /** - * Properties of an Any. + * Properties of a UInt32Value. * @memberof google.protobuf - * @interface IAny - * @property {string|null} [type_url] Any type_url - * @property {Uint8Array|null} [value] Any value + * @interface IUInt32Value + * @property {number|null} [value] UInt32Value value */ /** - * Constructs a new Any. + * Constructs a new UInt32Value. * @memberof google.protobuf - * @classdesc Represents an Any. - * @implements IAny + * @classdesc Represents a UInt32Value. + * @implements IUInt32Value * @constructor - * @param {google.protobuf.IAny=} [properties] Properties to set + * @param {google.protobuf.IUInt32Value=} [properties] Properties to set */ - function Any(properties) { + function UInt32Value(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21465,88 +36538,75 @@ } /** - * 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 + * UInt32Value value. + * @member {number} value + * @memberof google.protobuf.UInt32Value * @instance */ - Any.prototype.value = $util.newBuffer([]); + UInt32Value.prototype.value = 0; /** - * Creates a new Any instance using the specified properties. + * Creates a new UInt32Value instance using the specified properties. * @function create - * @memberof google.protobuf.Any + * @memberof google.protobuf.UInt32Value * @static - * @param {google.protobuf.IAny=} [properties] Properties to set - * @returns {google.protobuf.Any} Any instance + * @param {google.protobuf.IUInt32Value=} [properties] Properties to set + * @returns {google.protobuf.UInt32Value} UInt32Value instance */ - Any.create = function create(properties) { - return new Any(properties); + UInt32Value.create = function create(properties) { + return new UInt32Value(properties); }; /** - * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * Encodes the specified UInt32Value message. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. * @function encode - * @memberof google.protobuf.Any + * @memberof google.protobuf.UInt32Value * @static - * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {google.protobuf.IUInt32Value} message UInt32Value message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Any.encode = function encode(message, writer) { + UInt32Value.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); + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.value); return writer; }; /** - * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * Encodes the specified UInt32Value message, length delimited. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.Any + * @memberof google.protobuf.UInt32Value * @static - * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {google.protobuf.IUInt32Value} message UInt32Value message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Any.encodeDelimited = function encodeDelimited(message, writer) { + UInt32Value.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Any message from the specified reader or buffer. + * Decodes a UInt32Value message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.Any + * @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.Any} Any + * @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 */ - Any.decode = function decode(reader, length) { + 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.Any(); + 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.type_url = reader.string(); - break; - case 2: - message.value = reader.bytes(); + message.value = reader.uint32(); break; default: reader.skipType(tag & 7); @@ -21557,125 +36617,107 @@ }; /** - * Decodes an Any message from the specified reader or buffer, length delimited. + * Decodes a UInt32Value message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.Any + * @memberof google.protobuf.UInt32Value * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Any} Any + * @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 */ - Any.decodeDelimited = function decodeDelimited(reader) { + UInt32Value.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Any message. + * Verifies a UInt32Value message. * @function verify - * @memberof google.protobuf.Any + * @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 */ - Any.verify = function verify(message) { + UInt32Value.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"; + if (!$util.isInteger(message.value)) + return "value: integer expected"; return null; }; /** - * Creates an Any message from a plain object. Also converts values to their respective internal types. + * Creates a UInt32Value message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.Any + * @memberof google.protobuf.UInt32Value * @static * @param {Object.} object Plain object - * @returns {google.protobuf.Any} Any + * @returns {google.protobuf.UInt32Value} UInt32Value */ - Any.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Any) + UInt32Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UInt32Value) return object; - var message = new $root.google.protobuf.Any(); - if (object.type_url != null) - message.type_url = String(object.type_url); + var message = new $root.google.protobuf.UInt32Value(); 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; + message.value = object.value >>> 0; return message; }; /** - * Creates a plain object from an Any message. Also converts values to other types if specified. + * Creates a plain object from a UInt32Value message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.Any + * @memberof google.protobuf.UInt32Value * @static - * @param {google.protobuf.Any} message Any + * @param {google.protobuf.UInt32Value} message UInt32Value * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Any.toObject = function toObject(message, options) { + UInt32Value.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 (options.defaults) + object.value = 0; 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; + object.value = message.value; return object; }; /** - * Converts this Any to JSON. + * Converts this UInt32Value to JSON. * @function toJSON - * @memberof google.protobuf.Any + * @memberof google.protobuf.UInt32Value * @instance * @returns {Object.} JSON object */ - Any.prototype.toJSON = function toJSON() { + UInt32Value.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Any; + return UInt32Value; })(); - protobuf.DoubleValue = (function() { + protobuf.BoolValue = (function() { /** - * Properties of a DoubleValue. + * Properties of a BoolValue. * @memberof google.protobuf - * @interface IDoubleValue - * @property {number|null} [value] DoubleValue value + * @interface IBoolValue + * @property {boolean|null} [value] BoolValue value */ /** - * Constructs a new DoubleValue. + * Constructs a new BoolValue. * @memberof google.protobuf - * @classdesc Represents a DoubleValue. - * @implements IDoubleValue + * @classdesc Represents a BoolValue. + * @implements IBoolValue * @constructor - * @param {google.protobuf.IDoubleValue=} [properties] Properties to set + * @param {google.protobuf.IBoolValue=} [properties] Properties to set */ - function DoubleValue(properties) { + function BoolValue(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21683,75 +36725,75 @@ } /** - * DoubleValue value. - * @member {number} value - * @memberof google.protobuf.DoubleValue + * BoolValue value. + * @member {boolean} value + * @memberof google.protobuf.BoolValue * @instance */ - DoubleValue.prototype.value = 0; + BoolValue.prototype.value = false; /** - * Creates a new DoubleValue instance using the specified properties. + * Creates a new BoolValue instance using the specified properties. * @function create - * @memberof google.protobuf.DoubleValue + * @memberof google.protobuf.BoolValue * @static - * @param {google.protobuf.IDoubleValue=} [properties] Properties to set - * @returns {google.protobuf.DoubleValue} DoubleValue instance + * @param {google.protobuf.IBoolValue=} [properties] Properties to set + * @returns {google.protobuf.BoolValue} BoolValue instance */ - DoubleValue.create = function create(properties) { - return new DoubleValue(properties); + BoolValue.create = function create(properties) { + return new BoolValue(properties); }; /** - * Encodes the specified DoubleValue message. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * Encodes the specified BoolValue message. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. * @function encode - * @memberof google.protobuf.DoubleValue + * @memberof google.protobuf.BoolValue * @static - * @param {google.protobuf.IDoubleValue} message DoubleValue message or plain object to encode + * @param {google.protobuf.IBoolValue} message BoolValue message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DoubleValue.encode = function encode(message, 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 1 =*/9).double(message.value); + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.value); return writer; }; /** - * Encodes the specified DoubleValue message, length delimited. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * Encodes the specified BoolValue message, length delimited. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.DoubleValue + * @memberof google.protobuf.BoolValue * @static - * @param {google.protobuf.IDoubleValue} message DoubleValue message or plain object to encode + * @param {google.protobuf.IBoolValue} message BoolValue message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DoubleValue.encodeDelimited = function encodeDelimited(message, writer) { + BoolValue.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DoubleValue message from the specified reader or buffer. + * Decodes a BoolValue message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.DoubleValue + * @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.DoubleValue} DoubleValue + * @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 */ - DoubleValue.decode = function decode(reader, length) { + 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.DoubleValue(); + 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.double(); + message.value = reader.bool(); break; default: reader.skipType(tag & 7); @@ -21762,107 +36804,107 @@ }; /** - * Decodes a DoubleValue message from the specified reader or buffer, length delimited. + * Decodes a BoolValue message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.DoubleValue + * @memberof google.protobuf.BoolValue * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.DoubleValue} DoubleValue + * @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 */ - DoubleValue.decodeDelimited = function decodeDelimited(reader) { + BoolValue.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DoubleValue message. + * Verifies a BoolValue message. * @function verify - * @memberof google.protobuf.DoubleValue + * @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 */ - DoubleValue.verify = function verify(message) { + 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 !== "number") - return "value: number expected"; + if (typeof message.value !== "boolean") + return "value: boolean expected"; return null; }; /** - * Creates a DoubleValue message from a plain object. Also converts values to their respective internal types. + * Creates a BoolValue message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.DoubleValue + * @memberof google.protobuf.BoolValue * @static * @param {Object.} object Plain object - * @returns {google.protobuf.DoubleValue} DoubleValue + * @returns {google.protobuf.BoolValue} BoolValue */ - DoubleValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.DoubleValue) + BoolValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.BoolValue) return object; - var message = new $root.google.protobuf.DoubleValue(); + var message = new $root.google.protobuf.BoolValue(); if (object.value != null) - message.value = Number(object.value); + message.value = Boolean(object.value); return message; }; /** - * Creates a plain object from a DoubleValue message. Also converts values to other types if specified. + * Creates a plain object from a BoolValue message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.DoubleValue + * @memberof google.protobuf.BoolValue * @static - * @param {google.protobuf.DoubleValue} message DoubleValue + * @param {google.protobuf.BoolValue} message BoolValue * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DoubleValue.toObject = function toObject(message, options) { + BoolValue.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) - object.value = 0; + object.value = false; if (message.value != null && message.hasOwnProperty("value")) - object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; + object.value = message.value; return object; }; /** - * Converts this DoubleValue to JSON. + * Converts this BoolValue to JSON. * @function toJSON - * @memberof google.protobuf.DoubleValue + * @memberof google.protobuf.BoolValue * @instance * @returns {Object.} JSON object */ - DoubleValue.prototype.toJSON = function toJSON() { + BoolValue.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DoubleValue; + return BoolValue; })(); - protobuf.FloatValue = (function() { + protobuf.StringValue = (function() { /** - * Properties of a FloatValue. + * Properties of a StringValue. * @memberof google.protobuf - * @interface IFloatValue - * @property {number|null} [value] FloatValue value + * @interface IStringValue + * @property {string|null} [value] StringValue value */ /** - * Constructs a new FloatValue. + * Constructs a new StringValue. * @memberof google.protobuf - * @classdesc Represents a FloatValue. - * @implements IFloatValue + * @classdesc Represents a StringValue. + * @implements IStringValue * @constructor - * @param {google.protobuf.IFloatValue=} [properties] Properties to set + * @param {google.protobuf.IStringValue=} [properties] Properties to set */ - function FloatValue(properties) { + function StringValue(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21870,75 +36912,75 @@ } /** - * FloatValue value. - * @member {number} value - * @memberof google.protobuf.FloatValue + * StringValue value. + * @member {string} value + * @memberof google.protobuf.StringValue * @instance */ - FloatValue.prototype.value = 0; + StringValue.prototype.value = ""; /** - * Creates a new FloatValue instance using the specified properties. + * Creates a new StringValue instance using the specified properties. * @function create - * @memberof google.protobuf.FloatValue + * @memberof google.protobuf.StringValue * @static - * @param {google.protobuf.IFloatValue=} [properties] Properties to set - * @returns {google.protobuf.FloatValue} FloatValue instance + * @param {google.protobuf.IStringValue=} [properties] Properties to set + * @returns {google.protobuf.StringValue} StringValue instance */ - FloatValue.create = function create(properties) { - return new FloatValue(properties); + StringValue.create = function create(properties) { + return new StringValue(properties); }; /** - * Encodes the specified FloatValue message. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * Encodes the specified StringValue message. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. * @function encode - * @memberof google.protobuf.FloatValue + * @memberof google.protobuf.StringValue * @static - * @param {google.protobuf.IFloatValue} message FloatValue message or plain object to encode + * @param {google.protobuf.IStringValue} message StringValue message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FloatValue.encode = function encode(message, 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 5 =*/13).float(message.value); + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); return writer; }; /** - * Encodes the specified FloatValue message, length delimited. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * Encodes the specified StringValue message, length delimited. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.FloatValue + * @memberof google.protobuf.StringValue * @static - * @param {google.protobuf.IFloatValue} message FloatValue message or plain object to encode + * @param {google.protobuf.IStringValue} message StringValue message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FloatValue.encodeDelimited = function encodeDelimited(message, writer) { + StringValue.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FloatValue message from the specified reader or buffer. + * Decodes a StringValue message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.FloatValue + * @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.FloatValue} FloatValue + * @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 */ - FloatValue.decode = function decode(reader, length) { + 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.FloatValue(); + 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.float(); + message.value = reader.string(); break; default: reader.skipType(tag & 7); @@ -21949,107 +36991,107 @@ }; /** - * Decodes a FloatValue message from the specified reader or buffer, length delimited. + * Decodes a StringValue message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.FloatValue + * @memberof google.protobuf.StringValue * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FloatValue} FloatValue + * @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 */ - FloatValue.decodeDelimited = function decodeDelimited(reader) { + StringValue.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FloatValue message. + * Verifies a StringValue message. * @function verify - * @memberof google.protobuf.FloatValue + * @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 */ - FloatValue.verify = function verify(message) { + StringValue.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"; + if (!$util.isString(message.value)) + return "value: string expected"; return null; }; /** - * Creates a FloatValue message from a plain object. Also converts values to their respective internal types. + * Creates a StringValue message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.FloatValue + * @memberof google.protobuf.StringValue * @static * @param {Object.} object Plain object - * @returns {google.protobuf.FloatValue} FloatValue + * @returns {google.protobuf.StringValue} StringValue */ - FloatValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FloatValue) + StringValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.StringValue) return object; - var message = new $root.google.protobuf.FloatValue(); + var message = new $root.google.protobuf.StringValue(); if (object.value != null) - message.value = Number(object.value); + message.value = String(object.value); return message; }; /** - * Creates a plain object from a FloatValue message. Also converts values to other types if specified. + * Creates a plain object from a StringValue message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FloatValue + * @memberof google.protobuf.StringValue * @static - * @param {google.protobuf.FloatValue} message FloatValue + * @param {google.protobuf.StringValue} message StringValue * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FloatValue.toObject = function toObject(message, options) { + StringValue.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) - object.value = 0; + object.value = ""; if (message.value != null && message.hasOwnProperty("value")) - object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; + object.value = message.value; return object; }; /** - * Converts this FloatValue to JSON. + * Converts this StringValue to JSON. * @function toJSON - * @memberof google.protobuf.FloatValue + * @memberof google.protobuf.StringValue * @instance * @returns {Object.} JSON object */ - FloatValue.prototype.toJSON = function toJSON() { + StringValue.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return FloatValue; + return StringValue; })(); - protobuf.Int64Value = (function() { + protobuf.BytesValue = (function() { /** - * Properties of an Int64Value. + * Properties of a BytesValue. * @memberof google.protobuf - * @interface IInt64Value - * @property {number|Long|null} [value] Int64Value value + * @interface IBytesValue + * @property {Uint8Array|null} [value] BytesValue value */ /** - * Constructs a new Int64Value. + * Constructs a new BytesValue. * @memberof google.protobuf - * @classdesc Represents an Int64Value. - * @implements IInt64Value + * @classdesc Represents a BytesValue. + * @implements IBytesValue * @constructor - * @param {google.protobuf.IInt64Value=} [properties] Properties to set + * @param {google.protobuf.IBytesValue=} [properties] Properties to set */ - function Int64Value(properties) { + function BytesValue(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -22057,75 +37099,75 @@ } /** - * Int64Value value. - * @member {number|Long} value - * @memberof google.protobuf.Int64Value + * BytesValue value. + * @member {Uint8Array} value + * @memberof google.protobuf.BytesValue * @instance */ - Int64Value.prototype.value = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + BytesValue.prototype.value = $util.newBuffer([]); /** - * Creates a new Int64Value instance using the specified properties. + * Creates a new BytesValue instance using the specified properties. * @function create - * @memberof google.protobuf.Int64Value + * @memberof google.protobuf.BytesValue * @static - * @param {google.protobuf.IInt64Value=} [properties] Properties to set - * @returns {google.protobuf.Int64Value} Int64Value instance + * @param {google.protobuf.IBytesValue=} [properties] Properties to set + * @returns {google.protobuf.BytesValue} BytesValue instance */ - Int64Value.create = function create(properties) { - return new Int64Value(properties); + BytesValue.create = function create(properties) { + return new BytesValue(properties); }; /** - * Encodes the specified Int64Value message. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * Encodes the specified BytesValue message. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. * @function encode - * @memberof google.protobuf.Int64Value + * @memberof google.protobuf.BytesValue * @static - * @param {google.protobuf.IInt64Value} message Int64Value message or plain object to encode + * @param {google.protobuf.IBytesValue} message BytesValue message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Int64Value.encode = function encode(message, 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 0 =*/8).int64(message.value); + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.value); return writer; }; /** - * Encodes the specified Int64Value message, length delimited. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * Encodes the specified BytesValue message, length delimited. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.Int64Value + * @memberof google.protobuf.BytesValue * @static - * @param {google.protobuf.IInt64Value} message Int64Value message or plain object to encode + * @param {google.protobuf.IBytesValue} message BytesValue message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Int64Value.encodeDelimited = function encodeDelimited(message, writer) { + BytesValue.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Int64Value message from the specified reader or buffer. + * Decodes a BytesValue message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.Int64Value + * @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.Int64Value} Int64Value + * @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 */ - Int64Value.decode = function decode(reader, length) { + 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.Int64Value(); + 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.int64(); + message.value = reader.bytes(); break; default: reader.skipType(tag & 7); @@ -22136,121 +37178,117 @@ }; /** - * Decodes an Int64Value message from the specified reader or buffer, length delimited. + * Decodes a BytesValue message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.Int64Value + * @memberof google.protobuf.BytesValue * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Int64Value} Int64Value + * @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 */ - Int64Value.decodeDelimited = function decodeDelimited(reader) { + BytesValue.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Int64Value message. + * Verifies a BytesValue message. * @function verify - * @memberof google.protobuf.Int64Value + * @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 */ - Int64Value.verify = function verify(message) { + BytesValue.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"; + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; return null; }; /** - * Creates an Int64Value message from a plain object. Also converts values to their respective internal types. + * Creates a BytesValue message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.Int64Value + * @memberof google.protobuf.BytesValue * @static * @param {Object.} object Plain object - * @returns {google.protobuf.Int64Value} Int64Value + * @returns {google.protobuf.BytesValue} BytesValue */ - Int64Value.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Int64Value) + BytesValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.BytesValue) return object; - var message = new $root.google.protobuf.Int64Value(); + var message = new $root.google.protobuf.BytesValue(); 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") + 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; - 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. + * Creates a plain object from a BytesValue message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.Int64Value + * @memberof google.protobuf.BytesValue * @static - * @param {google.protobuf.Int64Value} message Int64Value + * @param {google.protobuf.BytesValue} message BytesValue * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Int64Value.toObject = function toObject(message, options) { + BytesValue.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 (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")) - 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; + 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 Int64Value to JSON. + * Converts this BytesValue to JSON. * @function toJSON - * @memberof google.protobuf.Int64Value + * @memberof google.protobuf.BytesValue * @instance * @returns {Object.} JSON object */ - Int64Value.prototype.toJSON = function toJSON() { + BytesValue.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Int64Value; + return BytesValue; })(); - protobuf.UInt64Value = (function() { + protobuf.Duration = (function() { /** - * Properties of a UInt64Value. + * Properties of a Duration. * @memberof google.protobuf - * @interface IUInt64Value - * @property {number|Long|null} [value] UInt64Value value + * @interface IDuration + * @property {number|Long|null} [seconds] Duration seconds + * @property {number|null} [nanos] Duration nanos */ /** - * Constructs a new UInt64Value. + * Constructs a new Duration. * @memberof google.protobuf - * @classdesc Represents a UInt64Value. - * @implements IUInt64Value + * @classdesc Represents a Duration. + * @implements IDuration * @constructor - * @param {google.protobuf.IUInt64Value=} [properties] Properties to set + * @param {google.protobuf.IDuration=} [properties] Properties to set */ - function UInt64Value(properties) { + function Duration(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -22258,75 +37296,88 @@ } /** - * UInt64Value value. - * @member {number|Long} value - * @memberof google.protobuf.UInt64Value + * Duration seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Duration * @instance */ - UInt64Value.prototype.value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Creates a new UInt64Value 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.UInt64Value + * @memberof google.protobuf.Duration * @static - * @param {google.protobuf.IUInt64Value=} [properties] Properties to set - * @returns {google.protobuf.UInt64Value} UInt64Value instance + * @param {google.protobuf.IDuration=} [properties] Properties to set + * @returns {google.protobuf.Duration} Duration instance */ - UInt64Value.create = function create(properties) { - return new UInt64Value(properties); + Duration.create = function create(properties) { + return new Duration(properties); }; /** - * Encodes the specified UInt64Value message. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. * @function encode - * @memberof google.protobuf.UInt64Value + * @memberof google.protobuf.Duration * @static - * @param {google.protobuf.IUInt64Value} message UInt64Value 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 */ - UInt64Value.encode = function encode(message, writer) { + Duration.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); + 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 UInt64Value message, length delimited. Does not implicitly {@link google.protobuf.UInt64Value.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.UInt64Value + * @memberof google.protobuf.Duration * @static - * @param {google.protobuf.IUInt64Value} message UInt64Value 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 */ - UInt64Value.encodeDelimited = function encodeDelimited(message, writer) { + Duration.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UInt64Value message from the specified reader or buffer. + * Decodes a Duration message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.UInt64Value + * @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.UInt64Value} UInt64Value + * @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 */ - UInt64Value.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.UInt64Value(); + 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.value = reader.uint64(); + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); break; default: reader.skipType(tag & 7); @@ -22337,121 +37388,129 @@ }; /** - * Decodes a UInt64Value 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.UInt64Value + * @memberof google.protobuf.Duration * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.UInt64Value} UInt64Value + * @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 */ - UInt64Value.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 UInt64Value message. + * Verifies a Duration message. * @function verify - * @memberof google.protobuf.UInt64Value + * @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 */ - UInt64Value.verify = function verify(message) { + Duration.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"; + 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 UInt64Value 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.UInt64Value + * @memberof google.protobuf.Duration * @static * @param {Object.} object Plain object - * @returns {google.protobuf.UInt64Value} UInt64Value + * @returns {google.protobuf.Duration} Duration */ - UInt64Value.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.UInt64Value) + Duration.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Duration) 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); + 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 UInt64Value 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.UInt64Value + * @memberof google.protobuf.Duration * @static - * @param {google.protobuf.UInt64Value} message UInt64Value + * @param {google.protobuf.Duration} message Duration * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UInt64Value.toObject = function toObject(message, options) { + Duration.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) + 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; + var long = new $util.Long(0, 0, false); + object.seconds = 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; + 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.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; + 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 UInt64Value to JSON. + * Converts this Duration to JSON. * @function toJSON - * @memberof google.protobuf.UInt64Value + * @memberof google.protobuf.Duration * @instance * @returns {Object.} JSON object */ - UInt64Value.prototype.toJSON = function toJSON() { + Duration.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UInt64Value; + return Duration; })(); - protobuf.Int32Value = (function() { + protobuf.Empty = (function() { /** - * Properties of an Int32Value. + * Properties of an Empty. * @memberof google.protobuf - * @interface IInt32Value - * @property {number|null} [value] Int32Value value + * @interface IEmpty */ /** - * Constructs a new Int32Value. + * Constructs a new Empty. * @memberof google.protobuf - * @classdesc Represents an Int32Value. - * @implements IInt32Value + * @classdesc Represents an Empty. + * @implements IEmpty * @constructor - * @param {google.protobuf.IInt32Value=} [properties] Properties to set + * @param {google.protobuf.IEmpty=} [properties] Properties to set */ - function Int32Value(properties) { + function Empty(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -22459,76 +37518,63 @@ } /** - * Int32Value value. - * @member {number} value - * @memberof google.protobuf.Int32Value - * @instance - */ - Int32Value.prototype.value = 0; - - /** - * Creates a new Int32Value instance using the specified properties. + * Creates a new Empty instance using the specified properties. * @function create - * @memberof google.protobuf.Int32Value + * @memberof google.protobuf.Empty * @static - * @param {google.protobuf.IInt32Value=} [properties] Properties to set - * @returns {google.protobuf.Int32Value} Int32Value instance + * @param {google.protobuf.IEmpty=} [properties] Properties to set + * @returns {google.protobuf.Empty} Empty instance */ - Int32Value.create = function create(properties) { - return new Int32Value(properties); + Empty.create = function create(properties) { + return new Empty(properties); }; /** - * Encodes the specified Int32Value message. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. * @function encode - * @memberof google.protobuf.Int32Value + * @memberof google.protobuf.Empty * @static - * @param {google.protobuf.IInt32Value} message Int32Value message or plain object to encode + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Int32Value.encode = function encode(message, writer) { + Empty.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. + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.Int32Value + * @memberof google.protobuf.Empty * @static - * @param {google.protobuf.IInt32Value} message Int32Value message or plain object to encode + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Int32Value.encodeDelimited = function encodeDelimited(message, writer) { + Empty.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Int32Value message from the specified reader or buffer. + * Decodes an Empty message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.Int32Value + * @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.Int32Value} Int32Value + * @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 */ - Int32Value.decode = function decode(reader, length) { + 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.Int32Value(); + 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) { - case 1: - message.value = reader.int32(); - break; default: reader.skipType(tag & 7); break; @@ -22538,107 +37584,95 @@ }; /** - * Decodes an Int32Value message from the specified reader or buffer, length delimited. + * Decodes an Empty message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.Int32Value + * @memberof google.protobuf.Empty * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Int32Value} Int32Value + * @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 */ - Int32Value.decodeDelimited = function decodeDelimited(reader) { + Empty.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Int32Value message. + * Verifies an Empty message. * @function verify - * @memberof google.protobuf.Int32Value + * @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 */ - Int32Value.verify = function verify(message) { + Empty.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. + * Creates an Empty message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.Int32Value + * @memberof google.protobuf.Empty * @static * @param {Object.} object Plain object - * @returns {google.protobuf.Int32Value} Int32Value + * @returns {google.protobuf.Empty} Empty */ - Int32Value.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Int32Value) + Empty.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Empty) return object; - var message = new $root.google.protobuf.Int32Value(); - if (object.value != null) - message.value = object.value | 0; - return message; + return new $root.google.protobuf.Empty(); }; /** - * Creates a plain object from an Int32Value message. Also converts values to other types if specified. + * Creates a plain object from an Empty message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.Int32Value + * @memberof google.protobuf.Empty * @static - * @param {google.protobuf.Int32Value} message Int32Value + * @param {google.protobuf.Empty} message Empty * @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; + Empty.toObject = function toObject() { + return {}; }; /** - * Converts this Int32Value to JSON. + * Converts this Empty to JSON. * @function toJSON - * @memberof google.protobuf.Int32Value + * @memberof google.protobuf.Empty * @instance * @returns {Object.} JSON object */ - Int32Value.prototype.toJSON = function toJSON() { + Empty.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Int32Value; + return Empty; })(); - protobuf.UInt32Value = (function() { + protobuf.Timestamp = (function() { /** - * Properties of a UInt32Value. + * Properties of a Timestamp. * @memberof google.protobuf - * @interface IUInt32Value - * @property {number|null} [value] UInt32Value value + * @interface ITimestamp + * @property {number|Long|null} [seconds] Timestamp seconds + * @property {number|null} [nanos] Timestamp nanos */ /** - * Constructs a new UInt32Value. + * Constructs a new Timestamp. * @memberof google.protobuf - * @classdesc Represents a UInt32Value. - * @implements IUInt32Value + * @classdesc Represents a Timestamp. + * @implements ITimestamp * @constructor - * @param {google.protobuf.IUInt32Value=} [properties] Properties to set + * @param {google.protobuf.ITimestamp=} [properties] Properties to set */ - function UInt32Value(properties) { + function Timestamp(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -22646,75 +37680,88 @@ } /** - * UInt32Value value. - * @member {number} value - * @memberof google.protobuf.UInt32Value + * Timestamp seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Timestamp * @instance */ - UInt32Value.prototype.value = 0; + Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Creates a new UInt32Value instance using the specified properties. + * 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.UInt32Value + * @memberof google.protobuf.Timestamp * @static - * @param {google.protobuf.IUInt32Value=} [properties] Properties to set - * @returns {google.protobuf.UInt32Value} UInt32Value instance + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + * @returns {google.protobuf.Timestamp} Timestamp instance */ - UInt32Value.create = function create(properties) { - return new UInt32Value(properties); + Timestamp.create = function create(properties) { + return new Timestamp(properties); }; /** - * Encodes the specified UInt32Value message. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. * @function encode - * @memberof google.protobuf.UInt32Value + * @memberof google.protobuf.Timestamp * @static - * @param {google.protobuf.IUInt32Value} message UInt32Value 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 */ - UInt32Value.encode = function encode(message, writer) { + Timestamp.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); + 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 UInt32Value message, length delimited. Does not implicitly {@link google.protobuf.UInt32Value.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.UInt32Value + * @memberof google.protobuf.Timestamp * @static - * @param {google.protobuf.IUInt32Value} message UInt32Value 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 */ - UInt32Value.encodeDelimited = function encodeDelimited(message, writer) { + Timestamp.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UInt32Value message from the specified reader or buffer. + * Decodes a Timestamp message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.UInt32Value + * @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.UInt32Value} UInt32Value + * @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 */ - UInt32Value.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.UInt32Value(); + 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.value = reader.uint32(); + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); break; default: reader.skipType(tag & 7); @@ -22725,107 +37772,131 @@ }; /** - * Decodes a UInt32Value 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.UInt32Value + * @memberof google.protobuf.Timestamp * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.UInt32Value} UInt32Value + * @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 */ - UInt32Value.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 UInt32Value message. + * Verifies a Timestamp message. * @function verify - * @memberof google.protobuf.UInt32Value + * @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 */ - UInt32Value.verify = function verify(message) { + Timestamp.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"; + 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 UInt32Value 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.UInt32Value + * @memberof google.protobuf.Timestamp * @static * @param {Object.} object Plain object - * @returns {google.protobuf.UInt32Value} UInt32Value + * @returns {google.protobuf.Timestamp} Timestamp */ - UInt32Value.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.UInt32Value) + Timestamp.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Timestamp) return object; - var message = new $root.google.protobuf.UInt32Value(); - if (object.value != null) - message.value = object.value >>> 0; + 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 UInt32Value 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.UInt32Value + * @memberof google.protobuf.Timestamp * @static - * @param {google.protobuf.UInt32Value} message UInt32Value + * @param {google.protobuf.Timestamp} message Timestamp * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UInt32Value.toObject = function toObject(message, options) { + Timestamp.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; + 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 UInt32Value to JSON. + * Converts this Timestamp to JSON. * @function toJSON - * @memberof google.protobuf.UInt32Value + * @memberof google.protobuf.Timestamp * @instance * @returns {Object.} JSON object */ - UInt32Value.prototype.toJSON = function toJSON() { + Timestamp.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UInt32Value; + return Timestamp; })(); - protobuf.BoolValue = (function() { + protobuf.FieldMask = (function() { /** - * Properties of a BoolValue. + * Properties of a FieldMask. * @memberof google.protobuf - * @interface IBoolValue - * @property {boolean|null} [value] BoolValue value + * @interface IFieldMask + * @property {Array.|null} [paths] FieldMask paths */ /** - * Constructs a new BoolValue. + * Constructs a new FieldMask. * @memberof google.protobuf - * @classdesc Represents a BoolValue. - * @implements IBoolValue + * @classdesc Represents a FieldMask. + * @implements IFieldMask * @constructor - * @param {google.protobuf.IBoolValue=} [properties] Properties to set + * @param {google.protobuf.IFieldMask=} [properties] Properties to set */ - function BoolValue(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) @@ -22833,75 +37904,78 @@ } /** - * BoolValue value. - * @member {boolean} value - * @memberof google.protobuf.BoolValue + * FieldMask paths. + * @member {Array.} paths + * @memberof google.protobuf.FieldMask * @instance */ - BoolValue.prototype.value = false; + FieldMask.prototype.paths = $util.emptyArray; /** - * Creates a new BoolValue instance using the specified properties. + * Creates a new FieldMask instance using the specified properties. * @function create - * @memberof google.protobuf.BoolValue + * @memberof google.protobuf.FieldMask * @static - * @param {google.protobuf.IBoolValue=} [properties] Properties to set - * @returns {google.protobuf.BoolValue} BoolValue instance + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @returns {google.protobuf.FieldMask} FieldMask instance */ - BoolValue.create = function create(properties) { - return new BoolValue(properties); + FieldMask.create = function create(properties) { + return new FieldMask(properties); }; /** - * Encodes the specified BoolValue message. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. * @function encode - * @memberof google.protobuf.BoolValue + * @memberof google.protobuf.FieldMask * @static - * @param {google.protobuf.IBoolValue} message BoolValue 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 */ - BoolValue.encode = function encode(message, writer) { + FieldMask.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); + 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 BoolValue message, length delimited. Does not implicitly {@link google.protobuf.BoolValue.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.BoolValue + * @memberof google.protobuf.FieldMask * @static - * @param {google.protobuf.IBoolValue} message BoolValue 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 */ - BoolValue.encodeDelimited = function encodeDelimited(message, writer) { + FieldMask.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BoolValue message from the specified reader or buffer. + * Decodes a FieldMask message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.BoolValue + * @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.BoolValue} BoolValue + * @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 */ - BoolValue.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.BoolValue(); + 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.value = reader.bool(); + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -22912,107 +37986,134 @@ }; /** - * Decodes a BoolValue 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.BoolValue + * @memberof google.protobuf.FieldMask * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.BoolValue} BoolValue + * @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 */ - BoolValue.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 BoolValue message. + * Verifies a FieldMask message. * @function verify - * @memberof google.protobuf.BoolValue + * @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 */ - BoolValue.verify = function verify(message) { + FieldMask.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"; + 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 BoolValue 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.BoolValue + * @memberof google.protobuf.FieldMask * @static * @param {Object.} object Plain object - * @returns {google.protobuf.BoolValue} BoolValue + * @returns {google.protobuf.FieldMask} FieldMask */ - BoolValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.BoolValue) + FieldMask.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldMask) return object; - var message = new $root.google.protobuf.BoolValue(); - if (object.value != null) - message.value = Boolean(object.value); + 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 BoolValue 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.BoolValue + * @memberof google.protobuf.FieldMask * @static - * @param {google.protobuf.BoolValue} message BoolValue + * @param {google.protobuf.FieldMask} message FieldMask * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BoolValue.toObject = function toObject(message, options) { + FieldMask.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; + 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 BoolValue to JSON. + * Converts this FieldMask to JSON. * @function toJSON - * @memberof google.protobuf.BoolValue + * @memberof google.protobuf.FieldMask * @instance * @returns {Object.} JSON object */ - BoolValue.prototype.toJSON = function toJSON() { + FieldMask.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BoolValue; + return FieldMask; })(); - protobuf.StringValue = (function() { + return protobuf; + })(); + + google.rpc = (function() { + + /** + * Namespace rpc. + * @memberof google + * @namespace + */ + var rpc = {}; + + rpc.Status = (function() { /** - * Properties of a StringValue. - * @memberof google.protobuf - * @interface IStringValue - * @property {string|null} [value] StringValue value + * 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 StringValue. - * @memberof google.protobuf - * @classdesc Represents a StringValue. - * @implements IStringValue + * Constructs a new Status. + * @memberof google.rpc + * @classdesc Represents a Status. + * @implements IStatus * @constructor - * @param {google.protobuf.IStringValue=} [properties] Properties to set + * @param {google.rpc.IStatus=} [properties] Properties to set */ - function StringValue(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) @@ -23020,75 +38121,104 @@ } /** - * StringValue value. - * @member {string} value - * @memberof google.protobuf.StringValue + * Status code. + * @member {number} code + * @memberof google.rpc.Status * @instance */ - StringValue.prototype.value = ""; + Status.prototype.code = 0; /** - * Creates a new StringValue instance using the specified properties. + * 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.protobuf.StringValue + * @memberof google.rpc.Status * @static - * @param {google.protobuf.IStringValue=} [properties] Properties to set - * @returns {google.protobuf.StringValue} StringValue instance + * @param {google.rpc.IStatus=} [properties] Properties to set + * @returns {google.rpc.Status} Status instance */ - StringValue.create = function create(properties) { - return new StringValue(properties); + Status.create = function create(properties) { + return new Status(properties); }; /** - * Encodes the specified StringValue message. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. * @function encode - * @memberof google.protobuf.StringValue + * @memberof google.rpc.Status * @static - * @param {google.protobuf.IStringValue} message StringValue 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 */ - StringValue.encode = function encode(message, writer) { + Status.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.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 StringValue message, length delimited. Does not implicitly {@link google.protobuf.StringValue.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.StringValue + * @memberof google.rpc.Status * @static - * @param {google.protobuf.IStringValue} message StringValue 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 */ - StringValue.encodeDelimited = function encodeDelimited(message, writer) { + Status.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a StringValue message from the specified reader or buffer. + * Decodes a Status message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.StringValue + * @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.StringValue} StringValue + * @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 */ - StringValue.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.StringValue(); + 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.value = reader.string(); + 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); @@ -23099,107 +38229,157 @@ }; /** - * Decodes a StringValue 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.StringValue + * @memberof google.rpc.Status * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.StringValue} StringValue + * @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 */ - StringValue.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 StringValue message. + * Verifies a Status message. * @function verify - * @memberof google.protobuf.StringValue + * @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 */ - StringValue.verify = function verify(message) { + Status.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.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 StringValue 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.StringValue + * @memberof google.rpc.Status * @static * @param {Object.} object Plain object - * @returns {google.protobuf.StringValue} StringValue + * @returns {google.rpc.Status} Status */ - StringValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.StringValue) + Status.fromObject = function fromObject(object) { + if (object instanceof $root.google.rpc.Status) return object; - var message = new $root.google.protobuf.StringValue(); - if (object.value != null) - message.value = String(object.value); + 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 StringValue 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.StringValue + * @memberof google.rpc.Status * @static - * @param {google.protobuf.StringValue} message StringValue + * @param {google.rpc.Status} message Status * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - StringValue.toObject = function toObject(message, options) { + Status.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; + 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 StringValue to JSON. + * Converts this Status to JSON. * @function toJSON - * @memberof google.protobuf.StringValue + * @memberof google.rpc.Status * @instance * @returns {Object.} JSON object */ - StringValue.prototype.toJSON = function toJSON() { + Status.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return StringValue; + return Status; })(); - protobuf.BytesValue = (function() { + return rpc; + })(); + + google.type = (function() { + + /** + * Namespace type. + * @memberof google + * @namespace + */ + var type = {}; + + type.Color = (function() { /** - * Properties of a BytesValue. - * @memberof google.protobuf - * @interface IBytesValue - * @property {Uint8Array|null} [value] BytesValue value + * Properties of a Color. + * @memberof google.type + * @interface IColor + * @property {number|null} [red] Color red + * @property {number|null} [green] Color green + * @property {number|null} [blue] Color blue + * @property {google.protobuf.IFloatValue|null} [alpha] Color alpha */ /** - * Constructs a new BytesValue. - * @memberof google.protobuf - * @classdesc Represents a BytesValue. - * @implements IBytesValue + * Constructs a new Color. + * @memberof google.type + * @classdesc Represents a Color. + * @implements IColor * @constructor - * @param {google.protobuf.IBytesValue=} [properties] Properties to set + * @param {google.type.IColor=} [properties] Properties to set */ - function BytesValue(properties) { + function Color(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -23207,75 +38387,114 @@ } /** - * BytesValue value. - * @member {Uint8Array} value - * @memberof google.protobuf.BytesValue + * Color red. + * @member {number} red + * @memberof google.type.Color * @instance */ - BytesValue.prototype.value = $util.newBuffer([]); + Color.prototype.red = 0; /** - * Creates a new BytesValue instance using the specified properties. + * Color green. + * @member {number} green + * @memberof google.type.Color + * @instance + */ + Color.prototype.green = 0; + + /** + * Color blue. + * @member {number} blue + * @memberof google.type.Color + * @instance + */ + Color.prototype.blue = 0; + + /** + * Color alpha. + * @member {google.protobuf.IFloatValue|null|undefined} alpha + * @memberof google.type.Color + * @instance + */ + Color.prototype.alpha = null; + + /** + * Creates a new Color instance using the specified properties. * @function create - * @memberof google.protobuf.BytesValue + * @memberof google.type.Color * @static - * @param {google.protobuf.IBytesValue=} [properties] Properties to set - * @returns {google.protobuf.BytesValue} BytesValue instance + * @param {google.type.IColor=} [properties] Properties to set + * @returns {google.type.Color} Color instance */ - BytesValue.create = function create(properties) { - return new BytesValue(properties); + Color.create = function create(properties) { + return new Color(properties); }; /** - * Encodes the specified BytesValue message. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * Encodes the specified Color message. Does not implicitly {@link google.type.Color.verify|verify} messages. * @function encode - * @memberof google.protobuf.BytesValue + * @memberof google.type.Color * @static - * @param {google.protobuf.IBytesValue} message BytesValue message or plain object to encode + * @param {google.type.IColor} message Color message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BytesValue.encode = function encode(message, writer) { + Color.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); + if (message.red != null && Object.hasOwnProperty.call(message, "red")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.red); + if (message.green != null && Object.hasOwnProperty.call(message, "green")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.green); + if (message.blue != null && Object.hasOwnProperty.call(message, "blue")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.blue); + if (message.alpha != null && Object.hasOwnProperty.call(message, "alpha")) + $root.google.protobuf.FloatValue.encode(message.alpha, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; /** - * Encodes the specified BytesValue message, length delimited. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * Encodes the specified Color message, length delimited. Does not implicitly {@link google.type.Color.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.BytesValue + * @memberof google.type.Color * @static - * @param {google.protobuf.IBytesValue} message BytesValue message or plain object to encode + * @param {google.type.IColor} message Color message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BytesValue.encodeDelimited = function encodeDelimited(message, writer) { + Color.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BytesValue message from the specified reader or buffer. + * Decodes a Color message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.BytesValue + * @memberof google.type.Color * @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 + * @returns {google.type.Color} Color * @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) { + Color.decode = function 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(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.type.Color(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.value = reader.bytes(); + message.red = reader.float(); + break; + case 2: + message.green = reader.float(); + break; + case 3: + message.blue = reader.float(); + break; + case 4: + message.alpha = $root.google.protobuf.FloatValue.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -23286,117 +38505,139 @@ }; /** - * Decodes a BytesValue message from the specified reader or buffer, length delimited. + * Decodes a Color message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.BytesValue + * @memberof google.type.Color * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.BytesValue} BytesValue + * @returns {google.type.Color} Color * @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) { + Color.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BytesValue message. + * Verifies a Color message. * @function verify - * @memberof google.protobuf.BytesValue + * @memberof google.type.Color * @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) { + Color.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 "object expected"; + if (message.red != null && message.hasOwnProperty("red")) + if (typeof message.red !== "number") + return "red: number expected"; + if (message.green != null && message.hasOwnProperty("green")) + if (typeof message.green !== "number") + return "green: number expected"; + if (message.blue != null && message.hasOwnProperty("blue")) + if (typeof message.blue !== "number") + return "blue: number expected"; + if (message.alpha != null && message.hasOwnProperty("alpha")) { + var error = $root.google.protobuf.FloatValue.verify(message.alpha); + if (error) + return "alpha." + error; + } return null; }; /** - * Creates a BytesValue message from a plain object. Also converts values to their respective internal types. + * Creates a Color message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.BytesValue + * @memberof google.type.Color * @static * @param {Object.} object Plain object - * @returns {google.protobuf.BytesValue} BytesValue + * @returns {google.type.Color} Color */ - BytesValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.BytesValue) + Color.fromObject = function fromObject(object) { + if (object instanceof $root.google.type.Color) 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; + var message = new $root.google.type.Color(); + if (object.red != null) + message.red = Number(object.red); + if (object.green != null) + message.green = Number(object.green); + if (object.blue != null) + message.blue = Number(object.blue); + if (object.alpha != null) { + if (typeof object.alpha !== "object") + throw TypeError(".google.type.Color.alpha: object expected"); + message.alpha = $root.google.protobuf.FloatValue.fromObject(object.alpha); + } return message; }; /** - * Creates a plain object from a BytesValue message. Also converts values to other types if specified. + * Creates a plain object from a Color message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.BytesValue + * @memberof google.type.Color * @static - * @param {google.protobuf.BytesValue} message BytesValue + * @param {google.type.Color} message Color * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BytesValue.toObject = function toObject(message, options) { + Color.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; + if (options.defaults) { + object.red = 0; + object.green = 0; + object.blue = 0; + object.alpha = null; + } + if (message.red != null && message.hasOwnProperty("red")) + object.red = options.json && !isFinite(message.red) ? String(message.red) : message.red; + if (message.green != null && message.hasOwnProperty("green")) + object.green = options.json && !isFinite(message.green) ? String(message.green) : message.green; + if (message.blue != null && message.hasOwnProperty("blue")) + object.blue = options.json && !isFinite(message.blue) ? String(message.blue) : message.blue; + if (message.alpha != null && message.hasOwnProperty("alpha")) + object.alpha = $root.google.protobuf.FloatValue.toObject(message.alpha, options); return object; }; /** - * Converts this BytesValue to JSON. + * Converts this Color to JSON. * @function toJSON - * @memberof google.protobuf.BytesValue + * @memberof google.type.Color * @instance * @returns {Object.} JSON object */ - BytesValue.prototype.toJSON = function toJSON() { + Color.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BytesValue; + return Color; })(); - protobuf.Duration = (function() { + type.Date = (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 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 Duration. - * @memberof google.protobuf - * @classdesc Represents a Duration. - * @implements IDuration + * Constructs a new Date. + * @memberof google.type + * @classdesc Represents a Date. + * @implements IDate * @constructor - * @param {google.protobuf.IDuration=} [properties] Properties to set + * @param {google.type.IDate=} [properties] Properties to set */ - function Duration(properties) { + function Date(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -23404,88 +38645,101 @@ } /** - * Duration seconds. - * @member {number|Long} seconds - * @memberof google.protobuf.Duration + * Date year. + * @member {number} year + * @memberof google.type.Date * @instance */ - Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + Date.prototype.year = 0; /** - * Duration nanos. - * @member {number} nanos - * @memberof google.protobuf.Duration + * Date month. + * @member {number} month + * @memberof google.type.Date * @instance */ - Duration.prototype.nanos = 0; + Date.prototype.month = 0; /** - * Creates a new Duration instance using the specified properties. + * Date day. + * @member {number} day + * @memberof google.type.Date + * @instance + */ + Date.prototype.day = 0; + + /** + * Creates a new Date instance using the specified properties. * @function create - * @memberof google.protobuf.Duration + * @memberof google.type.Date * @static - * @param {google.protobuf.IDuration=} [properties] Properties to set - * @returns {google.protobuf.Duration} Duration instance + * @param {google.type.IDate=} [properties] Properties to set + * @returns {google.type.Date} Date instance */ - Duration.create = function create(properties) { - return new Duration(properties); + Date.create = function create(properties) { + return new Date(properties); }; /** - * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * Encodes the specified Date message. Does not implicitly {@link google.type.Date.verify|verify} messages. * @function encode - * @memberof google.protobuf.Duration + * @memberof google.type.Date * @static - * @param {google.protobuf.IDuration} message Duration 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 */ - Duration.encode = function encode(message, writer) { + Date.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.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 Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * Encodes the specified Date message, length delimited. Does not implicitly {@link google.type.Date.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.Duration + * @memberof google.type.Date * @static - * @param {google.protobuf.IDuration} message Duration 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 */ - Duration.encodeDelimited = function encodeDelimited(message, writer) { + Date.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Duration message from the specified reader or buffer. + * Decodes a Date message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.Duration + * @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.protobuf.Duration} Duration + * @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 */ - Duration.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.protobuf.Duration(); + 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.seconds = reader.int64(); + message.year = reader.int32(); break; case 2: - message.nanos = reader.int32(); + message.month = reader.int32(); + break; + case 3: + message.day = reader.int32(); break; default: reader.skipType(tag & 7); @@ -23496,129 +38750,132 @@ }; /** - * Decodes a Duration 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.protobuf.Duration + * @memberof google.type.Date * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Duration} Duration + * @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 */ - Duration.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 Duration message. + * Verifies a Date message. * @function verify - * @memberof google.protobuf.Duration + * @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 */ - Duration.verify = function verify(message) { + Date.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.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 Duration 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.protobuf.Duration + * @memberof google.type.Date * @static * @param {Object.} object Plain object - * @returns {google.protobuf.Duration} Duration + * @returns {google.type.Date} Date */ - Duration.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Duration) + Date.fromObject = function fromObject(object) { + if (object instanceof $root.google.type.Date) 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.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 Duration 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.protobuf.Duration + * @memberof google.type.Date * @static - * @param {google.protobuf.Duration} message Duration + * @param {google.type.Date} message Date * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Duration.toObject = function toObject(message, options) { + Date.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; + object.year = 0; + object.month = 0; + object.day = 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; + 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 Duration to JSON. + * Converts this Date to JSON. * @function toJSON - * @memberof google.protobuf.Duration + * @memberof google.type.Date * @instance * @returns {Object.} JSON object */ - Duration.prototype.toJSON = function toJSON() { + Date.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Duration; + return Date; })(); - protobuf.Empty = (function() { + type.DateTime = (function() { /** - * Properties of an Empty. - * @memberof google.protobuf - * @interface IEmpty + * Properties of a DateTime. + * @memberof google.type + * @interface IDateTime + * @property {number|null} [year] DateTime year + * @property {number|null} [month] DateTime month + * @property {number|null} [day] DateTime day + * @property {number|null} [hours] DateTime hours + * @property {number|null} [minutes] DateTime minutes + * @property {number|null} [seconds] DateTime seconds + * @property {number|null} [nanos] DateTime nanos + * @property {google.protobuf.IDuration|null} [utcOffset] DateTime utcOffset + * @property {google.type.ITimeZone|null} [timeZone] DateTime timeZone */ /** - * Constructs a new Empty. - * @memberof google.protobuf - * @classdesc Represents an Empty. - * @implements IEmpty + * Constructs a new DateTime. + * @memberof google.type + * @classdesc Represents a DateTime. + * @implements IDateTime * @constructor - * @param {google.protobuf.IEmpty=} [properties] Properties to set + * @param {google.type.IDateTime=} [properties] Properties to set */ - function Empty(properties) { + function DateTime(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -23626,63 +38883,194 @@ } /** - * Creates a new Empty instance using the specified properties. + * DateTime year. + * @member {number} year + * @memberof google.type.DateTime + * @instance + */ + DateTime.prototype.year = 0; + + /** + * DateTime month. + * @member {number} month + * @memberof google.type.DateTime + * @instance + */ + DateTime.prototype.month = 0; + + /** + * DateTime day. + * @member {number} day + * @memberof google.type.DateTime + * @instance + */ + DateTime.prototype.day = 0; + + /** + * DateTime hours. + * @member {number} hours + * @memberof google.type.DateTime + * @instance + */ + DateTime.prototype.hours = 0; + + /** + * DateTime minutes. + * @member {number} minutes + * @memberof google.type.DateTime + * @instance + */ + DateTime.prototype.minutes = 0; + + /** + * DateTime seconds. + * @member {number} seconds + * @memberof google.type.DateTime + * @instance + */ + DateTime.prototype.seconds = 0; + + /** + * DateTime nanos. + * @member {number} nanos + * @memberof google.type.DateTime + * @instance + */ + DateTime.prototype.nanos = 0; + + /** + * DateTime utcOffset. + * @member {google.protobuf.IDuration|null|undefined} utcOffset + * @memberof google.type.DateTime + * @instance + */ + DateTime.prototype.utcOffset = null; + + /** + * DateTime timeZone. + * @member {google.type.ITimeZone|null|undefined} timeZone + * @memberof google.type.DateTime + * @instance + */ + DateTime.prototype.timeZone = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * DateTime timeOffset. + * @member {"utcOffset"|"timeZone"|undefined} timeOffset + * @memberof google.type.DateTime + * @instance + */ + Object.defineProperty(DateTime.prototype, "timeOffset", { + get: $util.oneOfGetter($oneOfFields = ["utcOffset", "timeZone"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new DateTime instance using the specified properties. * @function create - * @memberof google.protobuf.Empty + * @memberof google.type.DateTime * @static - * @param {google.protobuf.IEmpty=} [properties] Properties to set - * @returns {google.protobuf.Empty} Empty instance + * @param {google.type.IDateTime=} [properties] Properties to set + * @returns {google.type.DateTime} DateTime instance */ - Empty.create = function create(properties) { - return new Empty(properties); + DateTime.create = function create(properties) { + return new DateTime(properties); }; /** - * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * Encodes the specified DateTime message. Does not implicitly {@link google.type.DateTime.verify|verify} messages. * @function encode - * @memberof google.protobuf.Empty + * @memberof google.type.DateTime * @static - * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {google.type.IDateTime} message DateTime message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Empty.encode = function encode(message, writer) { + DateTime.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + 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); + if (message.hours != null && Object.hasOwnProperty.call(message, "hours")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.hours); + if (message.minutes != null && Object.hasOwnProperty.call(message, "minutes")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.minutes); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.nanos); + if (message.utcOffset != null && Object.hasOwnProperty.call(message, "utcOffset")) + $root.google.protobuf.Duration.encode(message.utcOffset, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) + $root.google.type.TimeZone.encode(message.timeZone, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); return writer; }; /** - * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * Encodes the specified DateTime message, length delimited. Does not implicitly {@link google.type.DateTime.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.Empty + * @memberof google.type.DateTime * @static - * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {google.type.IDateTime} message DateTime message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Empty.encodeDelimited = function encodeDelimited(message, writer) { + DateTime.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Empty message from the specified reader or buffer. + * Decodes a DateTime message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.Empty + * @memberof google.type.DateTime * @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.type.DateTime} DateTime * @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) { + DateTime.decode = function 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.type.DateTime(); 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 4: + message.hours = reader.int32(); + break; + case 5: + message.minutes = reader.int32(); + break; + case 6: + message.seconds = reader.int32(); + break; + case 7: + message.nanos = reader.int32(); + break; + case 8: + message.utcOffset = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + case 9: + message.timeZone = $root.google.type.TimeZone.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -23692,95 +39080,196 @@ }; /** - * Decodes an Empty message from the specified reader or buffer, length delimited. + * Decodes a DateTime message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.Empty + * @memberof google.type.DateTime * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Empty} Empty + * @returns {google.type.DateTime} DateTime * @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) { + DateTime.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Empty message. + * Verifies a DateTime message. * @function verify - * @memberof google.protobuf.Empty + * @memberof google.type.DateTime * @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) { + DateTime.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; + 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"; + if (message.hours != null && message.hasOwnProperty("hours")) + if (!$util.isInteger(message.hours)) + return "hours: integer expected"; + if (message.minutes != null && message.hasOwnProperty("minutes")) + if (!$util.isInteger(message.minutes)) + return "minutes: integer expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds)) + return "seconds: integer expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + if (message.utcOffset != null && message.hasOwnProperty("utcOffset")) { + properties.timeOffset = 1; + { + var error = $root.google.protobuf.Duration.verify(message.utcOffset); + if (error) + return "utcOffset." + error; + } + } + if (message.timeZone != null && message.hasOwnProperty("timeZone")) { + if (properties.timeOffset === 1) + return "timeOffset: multiple values"; + properties.timeOffset = 1; + { + var error = $root.google.type.TimeZone.verify(message.timeZone); + if (error) + return "timeZone." + error; + } + } return null; }; /** - * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * Creates a DateTime message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.Empty + * @memberof google.type.DateTime * @static * @param {Object.} object Plain object - * @returns {google.protobuf.Empty} Empty + * @returns {google.type.DateTime} DateTime */ - Empty.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Empty) + DateTime.fromObject = function fromObject(object) { + if (object instanceof $root.google.type.DateTime) return object; - return new $root.google.protobuf.Empty(); + var message = new $root.google.type.DateTime(); + 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; + if (object.hours != null) + message.hours = object.hours | 0; + if (object.minutes != null) + message.minutes = object.minutes | 0; + if (object.seconds != null) + message.seconds = object.seconds | 0; + if (object.nanos != null) + message.nanos = object.nanos | 0; + if (object.utcOffset != null) { + if (typeof object.utcOffset !== "object") + throw TypeError(".google.type.DateTime.utcOffset: object expected"); + message.utcOffset = $root.google.protobuf.Duration.fromObject(object.utcOffset); + } + if (object.timeZone != null) { + if (typeof object.timeZone !== "object") + throw TypeError(".google.type.DateTime.timeZone: object expected"); + message.timeZone = $root.google.type.TimeZone.fromObject(object.timeZone); + } + return message; }; /** - * Creates a plain object from an Empty message. Also converts values to other types if specified. + * Creates a plain object from a DateTime message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.Empty + * @memberof google.type.DateTime * @static - * @param {google.protobuf.Empty} message Empty + * @param {google.type.DateTime} message DateTime * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Empty.toObject = function toObject() { - return {}; + DateTime.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.year = 0; + object.month = 0; + object.day = 0; + object.hours = 0; + object.minutes = 0; + object.seconds = 0; + object.nanos = 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; + if (message.hours != null && message.hasOwnProperty("hours")) + object.hours = message.hours; + if (message.minutes != null && message.hasOwnProperty("minutes")) + object.minutes = message.minutes; + if (message.seconds != null && message.hasOwnProperty("seconds")) + object.seconds = message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + if (message.utcOffset != null && message.hasOwnProperty("utcOffset")) { + object.utcOffset = $root.google.protobuf.Duration.toObject(message.utcOffset, options); + if (options.oneofs) + object.timeOffset = "utcOffset"; + } + if (message.timeZone != null && message.hasOwnProperty("timeZone")) { + object.timeZone = $root.google.type.TimeZone.toObject(message.timeZone, options); + if (options.oneofs) + object.timeOffset = "timeZone"; + } + return object; }; /** - * Converts this Empty to JSON. + * Converts this DateTime to JSON. * @function toJSON - * @memberof google.protobuf.Empty + * @memberof google.type.DateTime * @instance * @returns {Object.} JSON object */ - Empty.prototype.toJSON = function toJSON() { + DateTime.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Empty; + return DateTime; })(); - protobuf.Timestamp = (function() { + type.TimeZone = (function() { /** - * Properties of a Timestamp. - * @memberof google.protobuf - * @interface ITimestamp - * @property {number|Long|null} [seconds] Timestamp seconds - * @property {number|null} [nanos] Timestamp nanos + * Properties of a TimeZone. + * @memberof google.type + * @interface ITimeZone + * @property {string|null} [id] TimeZone id + * @property {string|null} [version] TimeZone version */ /** - * Constructs a new Timestamp. - * @memberof google.protobuf - * @classdesc Represents a Timestamp. - * @implements ITimestamp + * Constructs a new TimeZone. + * @memberof google.type + * @classdesc Represents a TimeZone. + * @implements ITimeZone * @constructor - * @param {google.protobuf.ITimestamp=} [properties] Properties to set + * @param {google.type.ITimeZone=} [properties] Properties to set */ - function Timestamp(properties) { + function TimeZone(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -23788,88 +39277,88 @@ } /** - * Timestamp seconds. - * @member {number|Long} seconds - * @memberof google.protobuf.Timestamp + * TimeZone id. + * @member {string} id + * @memberof google.type.TimeZone * @instance */ - Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + TimeZone.prototype.id = ""; /** - * Timestamp nanos. - * @member {number} nanos - * @memberof google.protobuf.Timestamp + * TimeZone version. + * @member {string} version + * @memberof google.type.TimeZone * @instance */ - Timestamp.prototype.nanos = 0; + TimeZone.prototype.version = ""; /** - * Creates a new Timestamp instance using the specified properties. + * Creates a new TimeZone instance using the specified properties. * @function create - * @memberof google.protobuf.Timestamp + * @memberof google.type.TimeZone * @static - * @param {google.protobuf.ITimestamp=} [properties] Properties to set - * @returns {google.protobuf.Timestamp} Timestamp instance + * @param {google.type.ITimeZone=} [properties] Properties to set + * @returns {google.type.TimeZone} TimeZone instance */ - Timestamp.create = function create(properties) { - return new Timestamp(properties); + TimeZone.create = function create(properties) { + return new TimeZone(properties); }; /** - * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * Encodes the specified TimeZone message. Does not implicitly {@link google.type.TimeZone.verify|verify} messages. * @function encode - * @memberof google.protobuf.Timestamp + * @memberof google.type.TimeZone * @static - * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {google.type.ITimeZone} message TimeZone message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Timestamp.encode = function encode(message, writer) { + TimeZone.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.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.version); return writer; }; /** - * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * Encodes the specified TimeZone message, length delimited. Does not implicitly {@link google.type.TimeZone.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.Timestamp + * @memberof google.type.TimeZone * @static - * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {google.type.ITimeZone} message TimeZone message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Timestamp.encodeDelimited = function encodeDelimited(message, writer) { + TimeZone.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Timestamp message from the specified reader or buffer. + * Decodes a TimeZone message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.Timestamp + * @memberof google.type.TimeZone * @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.type.TimeZone} TimeZone * @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) { + TimeZone.decode = function 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.type.TimeZone(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.seconds = reader.int64(); + message.id = reader.string(); break; case 2: - message.nanos = reader.int32(); + message.version = reader.string(); break; default: reader.skipType(tag & 7); @@ -23880,145 +39369,118 @@ }; /** - * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * Decodes a TimeZone message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.Timestamp + * @memberof google.type.TimeZone * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Timestamp} Timestamp + * @returns {google.type.TimeZone} TimeZone * @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) { + TimeZone.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Timestamp message. + * Verifies a TimeZone message. * @function verify - * @memberof google.protobuf.Timestamp + * @memberof google.type.TimeZone * @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) { + TimeZone.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.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; return null; }; /** - * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * Creates a TimeZone message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.Timestamp + * @memberof google.type.TimeZone * @static * @param {Object.} object Plain object - * @returns {google.protobuf.Timestamp} Timestamp + * @returns {google.type.TimeZone} TimeZone */ - Timestamp.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Timestamp) + TimeZone.fromObject = function fromObject(object) { + if (object instanceof $root.google.type.TimeZone) 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.type.TimeZone(); + if (object.id != null) + message.id = String(object.id); + if (object.version != null) + message.version = String(object.version); return message; }; /** - * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * Creates a plain object from a TimeZone message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.Timestamp + * @memberof google.type.TimeZone * @static - * @param {google.protobuf.Timestamp} message Timestamp + * @param {google.type.TimeZone} message TimeZone * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Timestamp.toObject = function toObject(message, options) { + TimeZone.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; + object.id = ""; + object.version = ""; } - 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; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; return object; }; /** - * Converts this Timestamp to JSON. + * Converts this TimeZone to JSON. * @function toJSON - * @memberof google.protobuf.Timestamp + * @memberof google.type.TimeZone * @instance * @returns {Object.} JSON object */ - Timestamp.prototype.toJSON = function toJSON() { + TimeZone.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Timestamp; + return TimeZone; })(); - return protobuf; - })(); - - google.rpc = (function() { - - /** - * Namespace rpc. - * @memberof google - * @namespace - */ - var rpc = {}; - - rpc.Status = (function() { + type.Money = (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 Money. + * @memberof google.type + * @interface IMoney + * @property {string|null} [currencyCode] Money currencyCode + * @property {number|Long|null} [units] Money units + * @property {number|null} [nanos] Money nanos */ /** - * Constructs a new Status. - * @memberof google.rpc - * @classdesc Represents a Status. - * @implements IStatus + * Constructs a new Money. + * @memberof google.type + * @classdesc Represents a Money. + * @implements IMoney * @constructor - * @param {google.rpc.IStatus=} [properties] Properties to set + * @param {google.type.IMoney=} [properties] Properties to set */ - function Status(properties) { - this.details = []; + function Money(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -24026,104 +39488,101 @@ } /** - * Status code. - * @member {number} code - * @memberof google.rpc.Status + * Money currencyCode. + * @member {string} currencyCode + * @memberof google.type.Money * @instance */ - Status.prototype.code = 0; + Money.prototype.currencyCode = ""; /** - * Status message. - * @member {string} message - * @memberof google.rpc.Status + * Money units. + * @member {number|Long} units + * @memberof google.type.Money * @instance */ - Status.prototype.message = ""; + Money.prototype.units = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Status details. - * @member {Array.} details - * @memberof google.rpc.Status + * Money nanos. + * @member {number} nanos + * @memberof google.type.Money * @instance */ - Status.prototype.details = $util.emptyArray; + Money.prototype.nanos = 0; /** - * Creates a new Status instance using the specified properties. + * Creates a new Money instance using the specified properties. * @function create - * @memberof google.rpc.Status + * @memberof google.type.Money * @static - * @param {google.rpc.IStatus=} [properties] Properties to set - * @returns {google.rpc.Status} Status instance + * @param {google.type.IMoney=} [properties] Properties to set + * @returns {google.type.Money} Money instance */ - Status.create = function create(properties) { - return new Status(properties); + Money.create = function create(properties) { + return new Money(properties); }; /** - * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * Encodes the specified Money message. Does not implicitly {@link google.type.Money.verify|verify} messages. * @function encode - * @memberof google.rpc.Status + * @memberof google.type.Money * @static - * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {google.type.IMoney} message Money message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Status.encode = function encode(message, writer) { + Money.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.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCode); + if (message.units != null && Object.hasOwnProperty.call(message, "units")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.units); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.nanos); return writer; }; /** - * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * Encodes the specified Money message, length delimited. Does not implicitly {@link google.type.Money.verify|verify} messages. * @function encodeDelimited - * @memberof google.rpc.Status + * @memberof google.type.Money * @static - * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {google.type.IMoney} message Money message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Status.encodeDelimited = function encodeDelimited(message, writer) { + Money.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Status message from the specified reader or buffer. + * Decodes a Money message from the specified reader or buffer. * @function decode - * @memberof google.rpc.Status + * @memberof google.type.Money * @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.Money} Money * @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) { + Money.decode = function 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.Money(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.code = reader.int32(); + message.currencyCode = reader.string(); break; case 2: - message.message = reader.string(); + message.units = reader.int64(); break; - case 3: - if (!(message.details && message.details.length)) - message.details = []; - message.details.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + case 3: + message.nanos = reader.int32(); break; default: reader.skipType(tag & 7); @@ -24134,157 +39593,150 @@ }; /** - * Decodes a Status message from the specified reader or buffer, length delimited. + * Decodes a Money message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.rpc.Status + * @memberof google.type.Money * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.rpc.Status} Status + * @returns {google.type.Money} Money * @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) { + Money.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Status message. + * Verifies a Money message. * @function verify - * @memberof google.rpc.Status + * @memberof google.type.Money * @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) { + Money.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.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + if (message.units != null && message.hasOwnProperty("units")) + if (!$util.isInteger(message.units) && !(message.units && $util.isInteger(message.units.low) && $util.isInteger(message.units.high))) + return "units: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; return null; }; /** - * Creates a Status message from a plain object. Also converts values to their respective internal types. + * Creates a Money message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.rpc.Status + * @memberof google.type.Money * @static * @param {Object.} object Plain object - * @returns {google.rpc.Status} Status + * @returns {google.type.Money} Money */ - Status.fromObject = function fromObject(object) { - if (object instanceof $root.google.rpc.Status) + Money.fromObject = function fromObject(object) { + if (object instanceof $root.google.type.Money) 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.Money(); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + if (object.units != null) + if ($util.Long) + (message.units = $util.Long.fromValue(object.units)).unsigned = false; + else if (typeof object.units === "string") + message.units = parseInt(object.units, 10); + else if (typeof object.units === "number") + message.units = object.units; + else if (typeof object.units === "object") + message.units = new $util.LongBits(object.units.low >>> 0, object.units.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 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 Money message. Also converts values to other types if specified. * @function toObject - * @memberof google.rpc.Status + * @memberof google.type.Money * @static - * @param {google.rpc.Status} message Status + * @param {google.type.Money} message Money * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Status.toObject = function toObject(message, options) { + Money.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.currencyCode = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.units = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.units = options.longs === String ? "0" : 0; + object.nanos = 0; } + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + if (message.units != null && message.hasOwnProperty("units")) + if (typeof message.units === "number") + object.units = options.longs === String ? String(message.units) : message.units; + else + object.units = options.longs === String ? $util.Long.prototype.toString.call(message.units) : options.longs === Number ? new $util.LongBits(message.units.low >>> 0, message.units.high >>> 0).toNumber() : message.units; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; return object; }; /** - * Converts this Status to JSON. + * Converts this Money to JSON. * @function toJSON - * @memberof google.rpc.Status + * @memberof google.type.Money * @instance * @returns {Object.} JSON object */ - Status.prototype.toJSON = function toJSON() { + Money.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Status; + return Money; })(); - return rpc; - })(); - - google.type = (function() { - - /** - * Namespace type. - * @memberof google - * @namespace - */ - var type = {}; - - type.Color = (function() { + type.PostalAddress = (function() { /** - * Properties of a Color. + * Properties of a PostalAddress. * @memberof google.type - * @interface IColor - * @property {number|null} [red] Color red - * @property {number|null} [green] Color green - * @property {number|null} [blue] Color blue - * @property {google.protobuf.IFloatValue|null} [alpha] Color alpha - */ - - /** - * Constructs a new Color. + * @interface IPostalAddress + * @property {number|null} [revision] PostalAddress revision + * @property {string|null} [regionCode] PostalAddress regionCode + * @property {string|null} [languageCode] PostalAddress languageCode + * @property {string|null} [postalCode] PostalAddress postalCode + * @property {string|null} [sortingCode] PostalAddress sortingCode + * @property {string|null} [administrativeArea] PostalAddress administrativeArea + * @property {string|null} [locality] PostalAddress locality + * @property {string|null} [sublocality] PostalAddress sublocality + * @property {Array.|null} [addressLines] PostalAddress addressLines + * @property {Array.|null} [recipients] PostalAddress recipients + * @property {string|null} [organization] PostalAddress organization + */ + + /** + * Constructs a new PostalAddress. * @memberof google.type - * @classdesc Represents a Color. - * @implements IColor + * @classdesc Represents a PostalAddress. + * @implements IPostalAddress * @constructor - * @param {google.type.IColor=} [properties] Properties to set + * @param {google.type.IPostalAddress=} [properties] Properties to set */ - function Color(properties) { + function PostalAddress(properties) { + this.addressLines = []; + this.recipients = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -24292,114 +39744,211 @@ } /** - * Color red. - * @member {number} red - * @memberof google.type.Color + * PostalAddress revision. + * @member {number} revision + * @memberof google.type.PostalAddress * @instance */ - Color.prototype.red = 0; + PostalAddress.prototype.revision = 0; /** - * Color green. - * @member {number} green - * @memberof google.type.Color + * PostalAddress regionCode. + * @member {string} regionCode + * @memberof google.type.PostalAddress * @instance */ - Color.prototype.green = 0; + PostalAddress.prototype.regionCode = ""; /** - * Color blue. - * @member {number} blue - * @memberof google.type.Color + * PostalAddress languageCode. + * @member {string} languageCode + * @memberof google.type.PostalAddress * @instance */ - Color.prototype.blue = 0; + PostalAddress.prototype.languageCode = ""; /** - * Color alpha. - * @member {google.protobuf.IFloatValue|null|undefined} alpha - * @memberof google.type.Color + * PostalAddress postalCode. + * @member {string} postalCode + * @memberof google.type.PostalAddress * @instance */ - Color.prototype.alpha = null; + PostalAddress.prototype.postalCode = ""; /** - * Creates a new Color instance using the specified properties. + * PostalAddress sortingCode. + * @member {string} sortingCode + * @memberof google.type.PostalAddress + * @instance + */ + PostalAddress.prototype.sortingCode = ""; + + /** + * PostalAddress administrativeArea. + * @member {string} administrativeArea + * @memberof google.type.PostalAddress + * @instance + */ + PostalAddress.prototype.administrativeArea = ""; + + /** + * PostalAddress locality. + * @member {string} locality + * @memberof google.type.PostalAddress + * @instance + */ + PostalAddress.prototype.locality = ""; + + /** + * PostalAddress sublocality. + * @member {string} sublocality + * @memberof google.type.PostalAddress + * @instance + */ + PostalAddress.prototype.sublocality = ""; + + /** + * PostalAddress addressLines. + * @member {Array.} addressLines + * @memberof google.type.PostalAddress + * @instance + */ + PostalAddress.prototype.addressLines = $util.emptyArray; + + /** + * PostalAddress recipients. + * @member {Array.} recipients + * @memberof google.type.PostalAddress + * @instance + */ + PostalAddress.prototype.recipients = $util.emptyArray; + + /** + * PostalAddress organization. + * @member {string} organization + * @memberof google.type.PostalAddress + * @instance + */ + PostalAddress.prototype.organization = ""; + + /** + * Creates a new PostalAddress instance using the specified properties. * @function create - * @memberof google.type.Color + * @memberof google.type.PostalAddress * @static - * @param {google.type.IColor=} [properties] Properties to set - * @returns {google.type.Color} Color instance + * @param {google.type.IPostalAddress=} [properties] Properties to set + * @returns {google.type.PostalAddress} PostalAddress instance */ - Color.create = function create(properties) { - return new Color(properties); + PostalAddress.create = function create(properties) { + return new PostalAddress(properties); }; /** - * Encodes the specified Color message. Does not implicitly {@link google.type.Color.verify|verify} messages. + * Encodes the specified PostalAddress message. Does not implicitly {@link google.type.PostalAddress.verify|verify} messages. * @function encode - * @memberof google.type.Color + * @memberof google.type.PostalAddress * @static - * @param {google.type.IColor} message Color message or plain object to encode + * @param {google.type.IPostalAddress} message PostalAddress message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Color.encode = function encode(message, writer) { + PostalAddress.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.red != null && Object.hasOwnProperty.call(message, "red")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.red); - if (message.green != null && Object.hasOwnProperty.call(message, "green")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.green); - if (message.blue != null && Object.hasOwnProperty.call(message, "blue")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.blue); - if (message.alpha != null && Object.hasOwnProperty.call(message, "alpha")) - $root.google.protobuf.FloatValue.encode(message.alpha, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.revision != null && Object.hasOwnProperty.call(message, "revision")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.revision); + if (message.regionCode != null && Object.hasOwnProperty.call(message, "regionCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.regionCode); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + if (message.postalCode != null && Object.hasOwnProperty.call(message, "postalCode")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.postalCode); + if (message.sortingCode != null && Object.hasOwnProperty.call(message, "sortingCode")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.sortingCode); + if (message.administrativeArea != null && Object.hasOwnProperty.call(message, "administrativeArea")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.administrativeArea); + if (message.locality != null && Object.hasOwnProperty.call(message, "locality")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.locality); + if (message.sublocality != null && Object.hasOwnProperty.call(message, "sublocality")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.sublocality); + if (message.addressLines != null && message.addressLines.length) + for (var i = 0; i < message.addressLines.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.addressLines[i]); + if (message.recipients != null && message.recipients.length) + for (var i = 0; i < message.recipients.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.recipients[i]); + if (message.organization != null && Object.hasOwnProperty.call(message, "organization")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.organization); return writer; }; /** - * Encodes the specified Color message, length delimited. Does not implicitly {@link google.type.Color.verify|verify} messages. + * Encodes the specified PostalAddress message, length delimited. Does not implicitly {@link google.type.PostalAddress.verify|verify} messages. * @function encodeDelimited - * @memberof google.type.Color + * @memberof google.type.PostalAddress * @static - * @param {google.type.IColor} message Color message or plain object to encode + * @param {google.type.IPostalAddress} message PostalAddress message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Color.encodeDelimited = function encodeDelimited(message, writer) { + PostalAddress.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Color message from the specified reader or buffer. + * Decodes a PostalAddress message from the specified reader or buffer. * @function decode - * @memberof google.type.Color + * @memberof google.type.PostalAddress * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.type.Color} Color + * @returns {google.type.PostalAddress} PostalAddress * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Color.decode = function decode(reader, length) { + PostalAddress.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.type.Color(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.type.PostalAddress(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.red = reader.float(); + message.revision = reader.int32(); break; case 2: - message.green = reader.float(); + message.regionCode = reader.string(); break; case 3: - message.blue = reader.float(); + message.languageCode = reader.string(); break; case 4: - message.alpha = $root.google.protobuf.FloatValue.decode(reader, reader.uint32()); + message.postalCode = reader.string(); + break; + case 5: + message.sortingCode = reader.string(); + break; + case 6: + message.administrativeArea = reader.string(); + break; + case 7: + message.locality = reader.string(); + break; + case 8: + message.sublocality = reader.string(); + break; + case 9: + if (!(message.addressLines && message.addressLines.length)) + message.addressLines = []; + message.addressLines.push(reader.string()); + break; + case 10: + if (!(message.recipients && message.recipients.length)) + message.recipients = []; + message.recipients.push(reader.string()); + break; + case 11: + message.organization = reader.string(); break; default: reader.skipType(tag & 7); @@ -24410,117 +39959,194 @@ }; /** - * Decodes a Color message from the specified reader or buffer, length delimited. + * Decodes a PostalAddress message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.type.Color + * @memberof google.type.PostalAddress * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.type.Color} Color + * @returns {google.type.PostalAddress} PostalAddress * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Color.decodeDelimited = function decodeDelimited(reader) { + PostalAddress.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Color message. + * Verifies a PostalAddress message. * @function verify - * @memberof google.type.Color + * @memberof google.type.PostalAddress * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Color.verify = function verify(message) { + PostalAddress.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.red != null && message.hasOwnProperty("red")) - if (typeof message.red !== "number") - return "red: number expected"; - if (message.green != null && message.hasOwnProperty("green")) - if (typeof message.green !== "number") - return "green: number expected"; - if (message.blue != null && message.hasOwnProperty("blue")) - if (typeof message.blue !== "number") - return "blue: number expected"; - if (message.alpha != null && message.hasOwnProperty("alpha")) { - var error = $root.google.protobuf.FloatValue.verify(message.alpha); - if (error) - return "alpha." + error; + if (message.revision != null && message.hasOwnProperty("revision")) + if (!$util.isInteger(message.revision)) + return "revision: integer 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.postalCode != null && message.hasOwnProperty("postalCode")) + if (!$util.isString(message.postalCode)) + return "postalCode: string expected"; + if (message.sortingCode != null && message.hasOwnProperty("sortingCode")) + if (!$util.isString(message.sortingCode)) + return "sortingCode: string expected"; + if (message.administrativeArea != null && message.hasOwnProperty("administrativeArea")) + if (!$util.isString(message.administrativeArea)) + return "administrativeArea: string expected"; + if (message.locality != null && message.hasOwnProperty("locality")) + if (!$util.isString(message.locality)) + return "locality: string expected"; + if (message.sublocality != null && message.hasOwnProperty("sublocality")) + if (!$util.isString(message.sublocality)) + return "sublocality: string expected"; + if (message.addressLines != null && message.hasOwnProperty("addressLines")) { + if (!Array.isArray(message.addressLines)) + return "addressLines: array expected"; + for (var i = 0; i < message.addressLines.length; ++i) + if (!$util.isString(message.addressLines[i])) + return "addressLines: string[] expected"; } + if (message.recipients != null && message.hasOwnProperty("recipients")) { + if (!Array.isArray(message.recipients)) + return "recipients: array expected"; + for (var i = 0; i < message.recipients.length; ++i) + if (!$util.isString(message.recipients[i])) + return "recipients: string[] expected"; + } + if (message.organization != null && message.hasOwnProperty("organization")) + if (!$util.isString(message.organization)) + return "organization: string expected"; return null; }; /** - * Creates a Color message from a plain object. Also converts values to their respective internal types. + * Creates a PostalAddress message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.type.Color + * @memberof google.type.PostalAddress * @static * @param {Object.} object Plain object - * @returns {google.type.Color} Color + * @returns {google.type.PostalAddress} PostalAddress */ - Color.fromObject = function fromObject(object) { - if (object instanceof $root.google.type.Color) + PostalAddress.fromObject = function fromObject(object) { + if (object instanceof $root.google.type.PostalAddress) return object; - var message = new $root.google.type.Color(); - if (object.red != null) - message.red = Number(object.red); - if (object.green != null) - message.green = Number(object.green); - if (object.blue != null) - message.blue = Number(object.blue); - if (object.alpha != null) { - if (typeof object.alpha !== "object") - throw TypeError(".google.type.Color.alpha: object expected"); - message.alpha = $root.google.protobuf.FloatValue.fromObject(object.alpha); + var message = new $root.google.type.PostalAddress(); + if (object.revision != null) + message.revision = object.revision | 0; + if (object.regionCode != null) + message.regionCode = String(object.regionCode); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.postalCode != null) + message.postalCode = String(object.postalCode); + if (object.sortingCode != null) + message.sortingCode = String(object.sortingCode); + if (object.administrativeArea != null) + message.administrativeArea = String(object.administrativeArea); + if (object.locality != null) + message.locality = String(object.locality); + if (object.sublocality != null) + message.sublocality = String(object.sublocality); + if (object.addressLines) { + if (!Array.isArray(object.addressLines)) + throw TypeError(".google.type.PostalAddress.addressLines: array expected"); + message.addressLines = []; + for (var i = 0; i < object.addressLines.length; ++i) + message.addressLines[i] = String(object.addressLines[i]); + } + if (object.recipients) { + if (!Array.isArray(object.recipients)) + throw TypeError(".google.type.PostalAddress.recipients: array expected"); + message.recipients = []; + for (var i = 0; i < object.recipients.length; ++i) + message.recipients[i] = String(object.recipients[i]); } + if (object.organization != null) + message.organization = String(object.organization); return message; }; /** - * Creates a plain object from a Color message. Also converts values to other types if specified. + * Creates a plain object from a PostalAddress message. Also converts values to other types if specified. * @function toObject - * @memberof google.type.Color + * @memberof google.type.PostalAddress * @static - * @param {google.type.Color} message Color + * @param {google.type.PostalAddress} message PostalAddress * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Color.toObject = function toObject(message, options) { + PostalAddress.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.addressLines = []; + object.recipients = []; + } if (options.defaults) { - object.red = 0; - object.green = 0; - object.blue = 0; - object.alpha = null; + object.revision = 0; + object.regionCode = ""; + object.languageCode = ""; + object.postalCode = ""; + object.sortingCode = ""; + object.administrativeArea = ""; + object.locality = ""; + object.sublocality = ""; + object.organization = ""; } - if (message.red != null && message.hasOwnProperty("red")) - object.red = options.json && !isFinite(message.red) ? String(message.red) : message.red; - if (message.green != null && message.hasOwnProperty("green")) - object.green = options.json && !isFinite(message.green) ? String(message.green) : message.green; - if (message.blue != null && message.hasOwnProperty("blue")) - object.blue = options.json && !isFinite(message.blue) ? String(message.blue) : message.blue; - if (message.alpha != null && message.hasOwnProperty("alpha")) - object.alpha = $root.google.protobuf.FloatValue.toObject(message.alpha, options); + if (message.revision != null && message.hasOwnProperty("revision")) + object.revision = message.revision; + if (message.regionCode != null && message.hasOwnProperty("regionCode")) + object.regionCode = message.regionCode; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.postalCode != null && message.hasOwnProperty("postalCode")) + object.postalCode = message.postalCode; + if (message.sortingCode != null && message.hasOwnProperty("sortingCode")) + object.sortingCode = message.sortingCode; + if (message.administrativeArea != null && message.hasOwnProperty("administrativeArea")) + object.administrativeArea = message.administrativeArea; + if (message.locality != null && message.hasOwnProperty("locality")) + object.locality = message.locality; + if (message.sublocality != null && message.hasOwnProperty("sublocality")) + object.sublocality = message.sublocality; + if (message.addressLines && message.addressLines.length) { + object.addressLines = []; + for (var j = 0; j < message.addressLines.length; ++j) + object.addressLines[j] = message.addressLines[j]; + } + if (message.recipients && message.recipients.length) { + object.recipients = []; + for (var j = 0; j < message.recipients.length; ++j) + object.recipients[j] = message.recipients[j]; + } + if (message.organization != null && message.hasOwnProperty("organization")) + object.organization = message.organization; return object; }; /** - * Converts this Color to JSON. + * Converts this PostalAddress to JSON. * @function toJSON - * @memberof google.type.Color + * @memberof google.type.PostalAddress * @instance * @returns {Object.} JSON object */ - Color.prototype.toJSON = function toJSON() { + PostalAddress.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Color; + return PostalAddress; })(); return type; diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index ddee9b5036c..a97cd87e373 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -964,6 +964,1122 @@ } } } + }, + "v1beta3": { + "options": { + "csharp_namespace": "Google.Cloud.DocumentAI.v1beta3", + "go_package": "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai", + "java_multiple_files": true, + "java_outer_classname": "DocumentAiProcessorService", + "java_package": "com.google.cloud.documentai.v1beta3", + "php_namespace": "Google\\Cloud\\DocumentAi\\v1beta3", + "ruby_package": "Google::Cloud::DocumentAI::master", + "(google.api.resource_definition).type": "documentai.googleapis.com/HumanReviewConfig", + "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig" + }, + "nested": { + "Document": { + "oneofs": { + "source": { + "oneof": [ + "uri", + "content" + ] + } + }, + "fields": { + "uri": { + "type": "string", + "id": 1 + }, + "content": { + "type": "bytes", + "id": 2 + }, + "mimeType": { + "type": "string", + "id": 3 + }, + "text": { + "type": "string", + "id": 4 + }, + "textStyles": { + "rule": "repeated", + "type": "Style", + "id": 5 + }, + "pages": { + "rule": "repeated", + "type": "Page", + "id": 6 + }, + "entities": { + "rule": "repeated", + "type": "Entity", + "id": 7 + }, + "entityRelations": { + "rule": "repeated", + "type": "EntityRelation", + "id": 8 + }, + "translations": { + "rule": "repeated", + "type": "Translation", + "id": 12 + }, + "textChanges": { + "rule": "repeated", + "type": "TextChange", + "id": 14 + }, + "shardInfo": { + "type": "ShardInfo", + "id": 9 + }, + "error": { + "type": "google.rpc.Status", + "id": 10 + }, + "revisions": { + "rule": "repeated", + "type": "Revision", + "id": 13 + } + }, + "nested": { + "ShardInfo": { + "fields": { + "shardIndex": { + "type": "int64", + "id": 1 + }, + "shardCount": { + "type": "int64", + "id": 2 + }, + "textOffset": { + "type": "int64", + "id": 3 + } + } + }, + "Style": { + "fields": { + "textAnchor": { + "type": "TextAnchor", + "id": 1 + }, + "color": { + "type": "google.type.Color", + "id": 2 + }, + "backgroundColor": { + "type": "google.type.Color", + "id": 3 + }, + "fontWeight": { + "type": "string", + "id": 4 + }, + "textStyle": { + "type": "string", + "id": 5 + }, + "textDecoration": { + "type": "string", + "id": 6 + }, + "fontSize": { + "type": "FontSize", + "id": 7 + } + }, + "nested": { + "FontSize": { + "fields": { + "size": { + "type": "float", + "id": 1 + }, + "unit": { + "type": "string", + "id": 2 + } + } + } + } + }, + "Page": { + "fields": { + "pageNumber": { + "type": "int32", + "id": 1 + }, + "image": { + "type": "Image", + "id": 13 + }, + "transforms": { + "rule": "repeated", + "type": "Matrix", + "id": 14 + }, + "dimension": { + "type": "Dimension", + "id": 2 + }, + "layout": { + "type": "Layout", + "id": 3 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 4 + }, + "blocks": { + "rule": "repeated", + "type": "Block", + "id": 5 + }, + "paragraphs": { + "rule": "repeated", + "type": "Paragraph", + "id": 6 + }, + "lines": { + "rule": "repeated", + "type": "Line", + "id": 7 + }, + "tokens": { + "rule": "repeated", + "type": "Token", + "id": 8 + }, + "visualElements": { + "rule": "repeated", + "type": "VisualElement", + "id": 9 + }, + "tables": { + "rule": "repeated", + "type": "Table", + "id": 10 + }, + "formFields": { + "rule": "repeated", + "type": "FormField", + "id": 11 + } + }, + "nested": { + "Dimension": { + "fields": { + "width": { + "type": "float", + "id": 1 + }, + "height": { + "type": "float", + "id": 2 + }, + "unit": { + "type": "string", + "id": 3 + } + } + }, + "Image": { + "fields": { + "content": { + "type": "bytes", + "id": 1 + }, + "mimeType": { + "type": "string", + "id": 2 + }, + "width": { + "type": "int32", + "id": 3 + }, + "height": { + "type": "int32", + "id": 4 + } + } + }, + "Matrix": { + "fields": { + "rows": { + "type": "int32", + "id": 1 + }, + "cols": { + "type": "int32", + "id": 2 + }, + "type": { + "type": "int32", + "id": 3 + }, + "data": { + "type": "bytes", + "id": 4 + } + } + }, + "Layout": { + "fields": { + "textAnchor": { + "type": "TextAnchor", + "id": 1 + }, + "confidence": { + "type": "float", + "id": 2 + }, + "boundingPoly": { + "type": "BoundingPoly", + "id": 3 + }, + "orientation": { + "type": "Orientation", + "id": 4 + } + }, + "nested": { + "Orientation": { + "values": { + "ORIENTATION_UNSPECIFIED": 0, + "PAGE_UP": 1, + "PAGE_RIGHT": 2, + "PAGE_DOWN": 3, + "PAGE_LEFT": 4 + } + } + } + }, + "Block": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 2 + }, + "provenance": { + "type": "Provenance", + "id": 3 + } + } + }, + "Paragraph": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 2 + }, + "provenance": { + "type": "Provenance", + "id": 3 + } + } + }, + "Line": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 2 + }, + "provenance": { + "type": "Provenance", + "id": 3 + } + } + }, + "Token": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedBreak": { + "type": "DetectedBreak", + "id": 2 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 3 + }, + "provenance": { + "type": "Provenance", + "id": 4 + } + }, + "nested": { + "DetectedBreak": { + "fields": { + "type": { + "type": "Type", + "id": 1 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_UNSPECIFIED": 0, + "SPACE": 1, + "WIDE_SPACE": 2, + "HYPHEN": 3 + } + } + } + } + } + }, + "VisualElement": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "type": { + "type": "string", + "id": 2 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 3 + } + } + }, + "Table": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "headerRows": { + "rule": "repeated", + "type": "TableRow", + "id": 2 + }, + "bodyRows": { + "rule": "repeated", + "type": "TableRow", + "id": 3 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 4 + } + }, + "nested": { + "TableRow": { + "fields": { + "cells": { + "rule": "repeated", + "type": "TableCell", + "id": 1 + } + } + }, + "TableCell": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "rowSpan": { + "type": "int32", + "id": 2 + }, + "colSpan": { + "type": "int32", + "id": 3 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 4 + } + } + } + } + }, + "FormField": { + "fields": { + "fieldName": { + "type": "Layout", + "id": 1 + }, + "fieldValue": { + "type": "Layout", + "id": 2 + }, + "nameDetectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 3 + }, + "valueDetectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 4 + }, + "valueType": { + "type": "string", + "id": 5 + } + } + }, + "DetectedLanguage": { + "fields": { + "languageCode": { + "type": "string", + "id": 1 + }, + "confidence": { + "type": "float", + "id": 2 + } + } + } + } + }, + "Entity": { + "fields": { + "textAnchor": { + "type": "TextAnchor", + "id": 1 + }, + "type": { + "type": "string", + "id": 2 + }, + "mentionText": { + "type": "string", + "id": 3 + }, + "mentionId": { + "type": "string", + "id": 4 + }, + "confidence": { + "type": "float", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageAnchor": { + "type": "PageAnchor", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "id": { + "type": "string", + "id": 7 + }, + "normalizedValue": { + "type": "NormalizedValue", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "properties": { + "rule": "repeated", + "type": "Entity", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "provenance": { + "type": "Provenance", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "redacted": { + "type": "bool", + "id": 12, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "NormalizedValue": { + "oneofs": { + "structuredValue": { + "oneof": [ + "moneyValue", + "dateValue", + "datetimeValue", + "addressValue" + ] + } + }, + "fields": { + "moneyValue": { + "type": "google.type.Money", + "id": 2 + }, + "dateValue": { + "type": "google.type.Date", + "id": 3 + }, + "datetimeValue": { + "type": "google.type.DateTime", + "id": 4 + }, + "addressValue": { + "type": "google.type.PostalAddress", + "id": 5 + }, + "text": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + } + } + }, + "EntityRelation": { + "fields": { + "subjectId": { + "type": "string", + "id": 1 + }, + "objectId": { + "type": "string", + "id": 2 + }, + "relation": { + "type": "string", + "id": 3 + } + } + }, + "Translation": { + "fields": { + "textAnchor": { + "type": "TextAnchor", + "id": 1 + }, + "languageCode": { + "type": "string", + "id": 2 + }, + "translatedText": { + "type": "string", + "id": 3 + }, + "provenance": { + "rule": "repeated", + "type": "Provenance", + "id": 4 + } + } + }, + "TextAnchor": { + "fields": { + "textSegments": { + "rule": "repeated", + "type": "TextSegment", + "id": 1 + }, + "content": { + "type": "string", + "id": 2 + } + }, + "nested": { + "TextSegment": { + "fields": { + "startIndex": { + "type": "int64", + "id": 1 + }, + "endIndex": { + "type": "int64", + "id": 2 + } + } + } + } + }, + "PageAnchor": { + "fields": { + "pageRefs": { + "rule": "repeated", + "type": "PageRef", + "id": 1 + } + }, + "nested": { + "PageRef": { + "fields": { + "page": { + "type": "int64", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "layoutType": { + "type": "LayoutType", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "layoutId": { + "type": "string", + "id": 3, + "options": { + "deprecated": true, + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "boundingPoly": { + "type": "BoundingPoly", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "LayoutType": { + "values": { + "LAYOUT_TYPE_UNSPECIFIED": 0, + "BLOCK": 1, + "PARAGRAPH": 2, + "LINE": 3, + "TOKEN": 4, + "VISUAL_ELEMENT": 5, + "TABLE": 6, + "FORM_FIELD": 7 + } + } + } + } + } + }, + "Provenance": { + "fields": { + "revision": { + "type": "int32", + "id": 1 + }, + "id": { + "type": "int32", + "id": 2 + }, + "parents": { + "rule": "repeated", + "type": "Parent", + "id": 3 + }, + "type": { + "type": "OperationType", + "id": 4 + } + }, + "nested": { + "Parent": { + "fields": { + "revision": { + "type": "int32", + "id": 1 + }, + "id": { + "type": "int32", + "id": 2 + } + } + }, + "OperationType": { + "values": { + "OPERATION_TYPE_UNSPECIFIED": 0, + "ADD": 1, + "REMOVE": 2, + "REPLACE": 3, + "EVAL_REQUESTED": 4, + "EVAL_APPROVED": 5 + } + } + } + }, + "Revision": { + "oneofs": { + "source": { + "oneof": [ + "agent", + "processor" + ] + } + }, + "fields": { + "agent": { + "type": "string", + "id": 4 + }, + "processor": { + "type": "string", + "id": 5 + }, + "id": { + "type": "string", + "id": 1 + }, + "parent": { + "rule": "repeated", + "type": "int32", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "humanReview": { + "type": "HumanReview", + "id": 6 + } + }, + "nested": { + "HumanReview": { + "fields": { + "state": { + "type": "string", + "id": 1 + }, + "stateMessage": { + "type": "string", + "id": 2 + } + } + } + } + }, + "TextChange": { + "fields": { + "textAnchor": { + "type": "TextAnchor", + "id": 1 + }, + "changedText": { + "type": "string", + "id": 2 + }, + "provenance": { + "rule": "repeated", + "type": "Provenance", + "id": 3 + } + } + } + } + }, + "Vertex": { + "fields": { + "x": { + "type": "int32", + "id": 1 + }, + "y": { + "type": "int32", + "id": 2 + } + } + }, + "NormalizedVertex": { + "fields": { + "x": { + "type": "float", + "id": 1 + }, + "y": { + "type": "float", + "id": 2 + } + } + }, + "BoundingPoly": { + "fields": { + "vertices": { + "rule": "repeated", + "type": "Vertex", + "id": 1 + }, + "normalizedVertices": { + "rule": "repeated", + "type": "NormalizedVertex", + "id": 2 + } + } + }, + "DocumentProcessorService": { + "options": { + "(google.api.default_host)": "us-documentai.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ProcessDocument": { + "requestType": "ProcessRequest", + "responseType": "ProcessResponse", + "options": { + "(google.api.http).post": "/v1beta3/{name=projects/*/locations/*/processors/*}:process", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name" + } + }, + "BatchProcessDocuments": { + "requestType": "BatchProcessRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1beta3/{name=projects/*/locations/*/processors/*}:batchProcess", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "BatchProcessResponse", + "(google.longrunning.operation_info).metadata_type": "BatchProcessMetadata" + } + }, + "ReviewDocument": { + "requestType": "ReviewDocumentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1beta3/{human_review_config=projects/*/locations/*/processors/*/humanReviewConfig}:reviewDocument", + "(google.api.http).body": "*", + "(google.api.method_signature)": "human_review_config", + "(google.longrunning.operation_info).response_type": "ReviewDocumentResponse", + "(google.longrunning.operation_info).metadata_type": "ReviewDocumentOperationMetadata" + } + } + } + }, + "ProcessRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + } + }, + "document": { + "type": "Document", + "id": 2 + }, + "skipHumanReview": { + "type": "bool", + "id": 3 + } + } + }, + "ProcessResponse": { + "fields": { + "document": { + "type": "Document", + "id": 1 + }, + "humanReviewOperation": { + "type": "string", + "id": 2 + } + } + }, + "BatchProcessRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + } + }, + "inputConfigs": { + "rule": "repeated", + "type": "BatchInputConfig", + "id": 2 + }, + "outputConfig": { + "type": "BatchOutputConfig", + "id": 3 + } + }, + "nested": { + "BatchInputConfig": { + "fields": { + "gcsSource": { + "type": "string", + "id": 1 + }, + "mimeType": { + "type": "string", + "id": 2 + } + } + }, + "BatchOutputConfig": { + "fields": { + "gcsDestination": { + "type": "string", + "id": 1 + } + } + } + } + }, + "BatchProcessResponse": { + "fields": {} + }, + "BatchProcessMetadata": { + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "stateMessage": { + "type": "string", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + }, + "individualProcessStatuses": { + "rule": "repeated", + "type": "IndividualProcessStatus", + "id": 5 + } + }, + "nested": { + "IndividualProcessStatus": { + "fields": { + "inputGcsSource": { + "type": "string", + "id": 1 + }, + "status": { + "type": "google.rpc.Status", + "id": 2 + }, + "outputGcsDestination": { + "type": "string", + "id": 3 + }, + "humanReviewOperation": { + "type": "string", + "id": 4 + } + } + }, + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "WAITING": 1, + "RUNNING": 2, + "SUCCEEDED": 3, + "CANCELLING": 4, + "CANCELLED": 5, + "FAILED": 6 + } + } + } + }, + "ReviewDocumentRequest": { + "fields": { + "humanReviewConfig": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/HumanReviewConfig" + } + }, + "document": { + "type": "Document", + "id": 2 + } + } + }, + "ReviewDocumentResponse": { + "fields": { + "gcsDestination": { + "type": "string", + "id": 1 + } + } + }, + "ReviewDocumentOperationMetadata": { + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "stateMessage": { + "type": "string", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "RUNNING": 1, + "CANCELLING": 2, + "SUCCEEDED": 3, + "FAILED": 4, + "CANCELLED": 5 + } + } + } + } + } } } } @@ -973,7 +2089,7 @@ "options": { "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", "java_multiple_files": true, - "java_outer_classname": "ClientProto", + "java_outer_classname": "ResourceProto", "java_package": "com.google.api", "objc_class_prefix": "GAPI", "cc_enable_arenas": true @@ -1097,6 +2213,72 @@ "type": "string", "id": 1050, "extend": "google.protobuf.ServiceOptions" + }, + "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 + } + }, + "nested": { + "History": { + "values": { + "HISTORY_UNSPECIFIED": 0, + "ORIGINALLY_SINGLE_PATTERN": 1, + "FUTURE_MULTI_PATTERN": 2 + } + } + } + }, + "ResourceReference": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "childType": { + "type": "string", + "id": 2 + } + } } } }, @@ -2105,6 +3287,15 @@ "id": 2 } } + }, + "FieldMask": { + "fields": { + "paths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } } } }, @@ -2140,9 +3331,9 @@ "type": { "options": { "cc_enable_arenas": true, - "go_package": "google.golang.org/genproto/googleapis/type/color;color", + "go_package": "google.golang.org/genproto/googleapis/type/postaladdress;postaladdress", "java_multiple_files": true, - "java_outer_classname": "ColorProto", + "java_outer_classname": "PostalAddressProto", "java_package": "com.google.type", "objc_class_prefix": "GTP" }, @@ -2166,6 +3357,148 @@ "id": 4 } } + }, + "Date": { + "fields": { + "year": { + "type": "int32", + "id": 1 + }, + "month": { + "type": "int32", + "id": 2 + }, + "day": { + "type": "int32", + "id": 3 + } + } + }, + "DateTime": { + "oneofs": { + "timeOffset": { + "oneof": [ + "utcOffset", + "timeZone" + ] + } + }, + "fields": { + "year": { + "type": "int32", + "id": 1 + }, + "month": { + "type": "int32", + "id": 2 + }, + "day": { + "type": "int32", + "id": 3 + }, + "hours": { + "type": "int32", + "id": 4 + }, + "minutes": { + "type": "int32", + "id": 5 + }, + "seconds": { + "type": "int32", + "id": 6 + }, + "nanos": { + "type": "int32", + "id": 7 + }, + "utcOffset": { + "type": "google.protobuf.Duration", + "id": 8 + }, + "timeZone": { + "type": "TimeZone", + "id": 9 + } + } + }, + "TimeZone": { + "fields": { + "id": { + "type": "string", + "id": 1 + }, + "version": { + "type": "string", + "id": 2 + } + } + }, + "Money": { + "fields": { + "currencyCode": { + "type": "string", + "id": 1 + }, + "units": { + "type": "int64", + "id": 2 + }, + "nanos": { + "type": "int32", + "id": 3 + } + } + }, + "PostalAddress": { + "fields": { + "revision": { + "type": "int32", + "id": 1 + }, + "regionCode": { + "type": "string", + "id": 2 + }, + "languageCode": { + "type": "string", + "id": 3 + }, + "postalCode": { + "type": "string", + "id": 4 + }, + "sortingCode": { + "type": "string", + "id": 5 + }, + "administrativeArea": { + "type": "string", + "id": 6 + }, + "locality": { + "type": "string", + "id": 7 + }, + "sublocality": { + "type": "string", + "id": 8 + }, + "addressLines": { + "rule": "repeated", + "type": "string", + "id": 9 + }, + "recipients": { + "rule": "repeated", + "type": "string", + "id": 10 + }, + "organization": { + "type": "string", + "id": 11 + } + } } } }, diff --git a/packages/google-cloud-documentai/src/index.ts b/packages/google-cloud-documentai/src/index.ts index 7632bae77b0..7272a5273d7 100644 --- a/packages/google-cloud-documentai/src/index.ts +++ b/packages/google-cloud-documentai/src/index.ts @@ -12,14 +12,17 @@ // 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 ** +// ** This file is automatically generated by synthtool. ** +// ** https://github.com/googleapis/synthtool ** // ** All changes to this file may be overwritten. ** import * as v1beta2 from './v1beta2'; +import * as v1beta3 from './v1beta3'; + const DocumentUnderstandingServiceClient = v1beta2.DocumentUnderstandingServiceClient; -export {v1beta2, DocumentUnderstandingServiceClient}; -export default {v1beta2, DocumentUnderstandingServiceClient}; + +export {v1beta2, v1beta3, DocumentUnderstandingServiceClient}; +export default {v1beta2, v1beta3, DocumentUnderstandingServiceClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts new file mode 100644 index 00000000000..868dc31de2b --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts @@ -0,0 +1,837 @@ +// 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 gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +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'; +import * as gapicConfig from './document_processor_service_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service to call Cloud DocumentAI to process documents according to the + * processor's definition. Processors are built using state-of-the-art Google + * AI such as natural language, computer vision, and translation to extract + * structured information from unstructured or semi-structured documents. + * @class + * @memberof v1beta3 + */ +export class DocumentProcessorServiceClient { + 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; + documentProcessorServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DocumentProcessorServiceClient. + * + * @param {object} [options] - The configuration object. See the subsequent + * parameters for more details. + * @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. + */ + + constructor(opts?: ClientOptions) { + // Ensure that options include the service address and port. + const staticMembers = this + .constructor as typeof DocumentProcessorServiceClient; + const servicePath = + opts && opts.servicePath + ? opts.servicePath + : opts && opts.apiEndpoint + ? opts.apiEndpoint + : staticMembers.servicePath; + const port = opts && opts.port ? opts.port : staticMembers.port; + + if (!opts) { + opts = {servicePath, port}; + } + opts.servicePath = opts.servicePath || servicePath; + opts.port = opts.port || port; + + // users can override the config from client side, like retry codes name. + // The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/master/src/gax.ts#L546 + // The way to override client config for Showcase API: + // + // const customConfig = {"interfaces": {"google.showcase.v1beta1.Echo": {"methods": {"Echo": {"retry_codes_name": "idempotent", "retry_params_name": "default"}}}}} + // const showcaseClient = new showcaseClient({ projectId, customConfig }); + opts.clientConfig = opts.clientConfig || {}; + + // If we're running in browser, it's OK to omit `fallback` since + // google-gax has `browser` field in its `package.json`. + // For Electron (which does not respect `browser` field), + // pass `{fallback: true}` to the DocumentProcessorServiceClient constructor. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options + // sent to the client. + opts.scopes = (this + .constructor as typeof DocumentProcessorServiceClient).scopes; + 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; + + // 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 = { + humanReviewConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig' + ), + processorPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/processors/{processor}' + ), + }; + + // 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 batchProcessDocumentsResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta3.BatchProcessResponse' + ) as gax.protobuf.Type; + const batchProcessDocumentsMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta3.BatchProcessMetadata' + ) as gax.protobuf.Type; + const reviewDocumentResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta3.ReviewDocumentResponse' + ) as gax.protobuf.Type; + const reviewDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + batchProcessDocuments: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchProcessDocumentsResponse.decode.bind( + batchProcessDocumentsResponse + ), + batchProcessDocumentsMetadata.decode.bind(batchProcessDocumentsMetadata) + ), + reviewDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + reviewDocumentResponse.decode.bind(reviewDocumentResponse), + reviewDocumentMetadata.decode.bind(reviewDocumentMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.documentai.v1beta3.DocumentProcessorService', + 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.documentProcessorServiceStub) { + return this.documentProcessorServiceStub; + } + + // Put together the "service stub" for + // google.cloud.documentai.v1beta3.DocumentProcessorService. + this.documentProcessorServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.documentai.v1beta3.DocumentProcessorService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.documentai.v1beta3 + .DocumentProcessorService, + 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 documentProcessorServiceStubMethods = [ + 'processDocument', + 'batchProcessDocuments', + 'reviewDocument', + ]; + for (const methodName of documentProcessorServiceStubMethods) { + const callPromise = this.documentProcessorServiceStub.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.documentProcessorServiceStub; + } + + /** + * The DNS address for this API service. + */ + static get servicePath() { + return 'us-documentai.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'us-documentai.googleapis.com'; + } + + /** + * The port for this API service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + */ + 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. + * @param {function(Error, string)} callback - the callback to + * be called with the current project Id. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + processDocument( + request: protos.google.cloud.documentai.v1beta3.IProcessRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IProcessResponse, + protos.google.cloud.documentai.v1beta3.IProcessRequest | undefined, + {} | undefined + ] + >; + processDocument( + request: protos.google.cloud.documentai.v1beta3.IProcessRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.cloud.documentai.v1beta3.IProcessResponse, + protos.google.cloud.documentai.v1beta3.IProcessRequest | null | undefined, + {} | null | undefined + > + ): void; + processDocument( + request: protos.google.cloud.documentai.v1beta3.IProcessRequest, + callback: Callback< + protos.google.cloud.documentai.v1beta3.IProcessResponse, + protos.google.cloud.documentai.v1beta3.IProcessRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Processes a single document. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name. + * @param {google.cloud.documentai.v1beta3.Document} request.document + * The document payload, the [content] and [mime_type] fields must be set. + * @param {boolean} request.skipHumanReview + * Whether Human Review feature should be skipped for this request. Default to + * false. + * @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 [ProcessResponse]{@link google.cloud.documentai.v1beta3.ProcessResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + processDocument( + request: protos.google.cloud.documentai.v1beta3.IProcessRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protos.google.cloud.documentai.v1beta3.IProcessResponse, + | protos.google.cloud.documentai.v1beta3.IProcessRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.documentai.v1beta3.IProcessResponse, + protos.google.cloud.documentai.v1beta3.IProcessRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IProcessResponse, + protos.google.cloud.documentai.v1beta3.IProcessRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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.processDocument(request, options, callback); + } + + batchProcessDocuments( + request: protos.google.cloud.documentai.v1beta3.IBatchProcessRequest, + options?: gax.CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IBatchProcessResponse, + protos.google.cloud.documentai.v1beta3.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchProcessDocuments( + request: protos.google.cloud.documentai.v1beta3.IBatchProcessRequest, + options: gax.CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IBatchProcessResponse, + protos.google.cloud.documentai.v1beta3.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchProcessDocuments( + request: protos.google.cloud.documentai.v1beta3.IBatchProcessRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IBatchProcessResponse, + protos.google.cloud.documentai.v1beta3.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * LRO endpoint to batch process many documents. The output is written + * to Cloud Storage as JSON in the [Document] format. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name. + * @param {number[]} request.inputConfigs + * The input config for each single document in the batch process. + * @param {google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig} request.outputConfig + * The overall output config for batch process. + * @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 [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + batchProcessDocuments( + request: protos.google.cloud.documentai.v1beta3.IBatchProcessRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IBatchProcessResponse, + protos.google.cloud.documentai.v1beta3.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IBatchProcessResponse, + protos.google.cloud.documentai.v1beta3.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IBatchProcessResponse, + protos.google.cloud.documentai.v1beta3.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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.batchProcessDocuments(request, options, callback); + } + /** + * Check the status of the long running operation returned by the batchProcessDocuments() method. + * @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. + * + * @example: + * const decodedOperation = await checkBatchProcessDocumentsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + * + */ + async checkBatchProcessDocumentsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1beta3.BatchProcessResponse, + protos.google.cloud.documentai.v1beta3.BatchProcessMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.batchProcessDocuments, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1beta3.BatchProcessResponse, + protos.google.cloud.documentai.v1beta3.BatchProcessMetadata + >; + } + reviewDocument( + request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + options?: gax.CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + reviewDocument( + request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + options: gax.CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + reviewDocument( + request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Send a document for Human Review. The input document should be processed by + * the specified processor. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.humanReviewConfig + * Required. The resource name of the HumanReviewConfig that the document will be + * reviewed with. + * @param {google.cloud.documentai.v1beta3.Document} request.document + * The document that needs human review. + * @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 [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + reviewDocument( + request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + human_review_config: request.humanReviewConfig || '', + }); + this.initialize(); + return this.innerApiCalls.reviewDocument(request, options, callback); + } + /** + * Check the status of the long running operation returned by the reviewDocument() method. + * @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. + * + * @example: + * const decodedOperation = await checkReviewDocumentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + * + */ + async checkReviewDocumentProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1beta3.ReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.reviewDocument, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1beta3.ReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + >; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified humanReviewConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} processor + * @returns {string} Resource name string. + */ + humanReviewConfigPath(project: string, location: string, processor: string) { + return this.pathTemplates.humanReviewConfigPathTemplate.render({ + project: project, + location: location, + processor: processor, + }); + } + + /** + * Parse the project from HumanReviewConfig resource. + * + * @param {string} humanReviewConfigName + * A fully-qualified path representing HumanReviewConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromHumanReviewConfigName(humanReviewConfigName: string) { + return this.pathTemplates.humanReviewConfigPathTemplate.match( + humanReviewConfigName + ).project; + } + + /** + * Parse the location from HumanReviewConfig resource. + * + * @param {string} humanReviewConfigName + * A fully-qualified path representing HumanReviewConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromHumanReviewConfigName(humanReviewConfigName: string) { + return this.pathTemplates.humanReviewConfigPathTemplate.match( + humanReviewConfigName + ).location; + } + + /** + * Parse the processor from HumanReviewConfig resource. + * + * @param {string} humanReviewConfigName + * A fully-qualified path representing HumanReviewConfig resource. + * @returns {string} A string representing the processor. + */ + matchProcessorFromHumanReviewConfigName(humanReviewConfigName: string) { + return this.pathTemplates.humanReviewConfigPathTemplate.match( + humanReviewConfigName + ).processor; + } + + /** + * Return a fully-qualified processor resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} processor + * @returns {string} Resource name string. + */ + processorPath(project: string, location: string, processor: string) { + return this.pathTemplates.processorPathTemplate.render({ + project: project, + location: location, + processor: processor, + }); + } + + /** + * Parse the project from Processor resource. + * + * @param {string} processorName + * A fully-qualified path representing Processor resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProcessorName(processorName: string) { + return this.pathTemplates.processorPathTemplate.match(processorName) + .project; + } + + /** + * Parse the location from Processor resource. + * + * @param {string} processorName + * A fully-qualified path representing Processor resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProcessorName(processorName: string) { + return this.pathTemplates.processorPathTemplate.match(processorName) + .location; + } + + /** + * Parse the processor from Processor resource. + * + * @param {string} processorName + * A fully-qualified path representing Processor resource. + * @returns {string} A string representing the processor. + */ + matchProcessorFromProcessorName(processorName: string) { + return this.pathTemplates.processorPathTemplate.match(processorName) + .processor; + } + + /** + * Terminate the GRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.documentProcessorServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client_config.json b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client_config.json new file mode 100644 index 00000000000..1aac4003ded --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client_config.json @@ -0,0 +1,41 @@ +{ + "interfaces": { + "google.cloud.documentai.v1beta3.DocumentProcessorService": { + "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": { + "ProcessDocument": { + "timeout_millis": 120000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "BatchProcessDocuments": { + "timeout_millis": 120000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ReviewDocument": { + "timeout_millis": 120000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json new file mode 100644 index 00000000000..66fbd4e2aaa --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json @@ -0,0 +1,5 @@ +[ + "../../protos/google/cloud/documentai/v1beta3/document.proto", + "../../protos/google/cloud/documentai/v1beta3/document_processor_service.proto", + "../../protos/google/cloud/documentai/v1beta3/geometry.proto" +] diff --git a/packages/google-cloud-documentai/src/v1beta3/index.ts b/packages/google-cloud-documentai/src/v1beta3/index.ts new file mode 100644 index 00000000000..b8f789abb74 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta3/index.ts @@ -0,0 +1,19 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 {DocumentProcessorServiceClient} from './document_processor_service_client'; diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index d8251c403b7..c375cf41e0d 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -3,23 +3,23 @@ { "git": { "name": ".", - "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "44bb7b9f25e436dc8857b62993201ea17d5e4c1f" + "remote": "git@github.com:googleapis/nodejs-document-ai.git", + "sha": "dad35ff47a263244ae7b662880a763621fb66839" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "4c5071b615d96ef9dfd6a63d8429090f1f2872bb", - "internalRef": "327369997" + "sha": "80eada6dbc452b58b4663fa3ab4f0b6746f49f80", + "internalRef": "335745163" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "0c868d49b8e05bc1f299bc773df9eb4ef9ed96e9" + "sha": "487eba79f8260e34205d8ceb1ebcc65685085e19" } } ], @@ -32,7 +32,16 @@ "language": "nodejs", "generator": "bazel" } - } + }, + { + "client": { + "source": "googleapis", + "apiName": "documentai", + "apiVersion": "v1beta3", + "language": "nodejs", + "generator": "bazel" + } + }, ], "generatedFiles": [ ".eslintignore", diff --git a/packages/google-cloud-documentai/synth.py b/packages/google-cloud-documentai/synth.py index ac68087031f..63cb5fa67fb 100644 --- a/packages/google-cloud-documentai/synth.py +++ b/packages/google-cloud-documentai/synth.py @@ -25,7 +25,7 @@ # run the gapic generator gapic = gcp.GAPICBazel() -versions = ['v1beta2'] +versions = ['v1beta2', 'v1beta3'] name = 'documentai' for version in versions: library = gapic.node_library(name, version) @@ -33,7 +33,7 @@ # Copy common templates common_templates = gcp.CommonTemplates() -templates = common_templates.node_library(source_location='build/src') +templates = common_templates.node_library(source_location='build/src', versions=versions, default_version='v1beta2') s.copy(templates, excludes=[]) node.postprocess_gapic_library() diff --git a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js index 6a68e96358b..b8b010e09ea 100644 --- a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js @@ -20,7 +20,7 @@ const documentai = require('@google-cloud/documentai'); function main() { - const documentUnderstandingServiceClient = new documentai.DocumentUnderstandingServiceClient(); + const DocumentUnderstandingServiceClient = new documentai.DocumentUnderstandingServiceClient(); } main(); diff --git a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts new file mode 100644 index 00000000000..4a6576f9015 --- /dev/null +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts @@ -0,0 +1,856 @@ +// 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 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 documentprocessorserviceModule 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('v1beta3.DocumentProcessorServiceClient', () => { + it('has servicePath', () => { + const servicePath = + documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient + .servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient + .apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = + documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient + .port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + fallback: true, + } + ); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.documentProcessorServiceStub, undefined); + await client.initialize(); + assert(client.documentProcessorServiceStub); + }); + + it('has close method', () => { + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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 documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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('processDocument', () => { + it('invokes processDocument without error', async () => { + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessResponse() + ); + client.innerApiCalls.processDocument = stubSimpleCall(expectedResponse); + const [response] = await client.processDocument(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.processDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes processDocument without error using callback', async () => { + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessResponse() + ); + client.innerApiCalls.processDocument = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.processDocument( + request, + ( + err?: Error | null, + result?: protos.google.cloud.documentai.v1beta3.IProcessResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.processDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes processDocument with error', async () => { + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.processDocument = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.processDocument(request), expectedError); + assert( + (client.innerApiCalls.processDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('batchProcessDocuments', () => { + it('invokes batchProcessDocuments without error', async () => { + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.BatchProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.batchProcessDocuments(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes batchProcessDocuments without error using callback', async () => { + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.BatchProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchProcessDocuments = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.batchProcessDocuments( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1beta3.IBatchProcessResponse, + protos.google.cloud.documentai.v1beta3.IBatchProcessMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1beta3.IBatchProcessResponse, + protos.google.cloud.documentai.v1beta3.IBatchProcessMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes batchProcessDocuments with call error', async () => { + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.BatchProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.batchProcessDocuments(request), + expectedError + ); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes batchProcessDocuments with LRO error', async () => { + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.BatchProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchProcessDocuments(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkBatchProcessDocumentsProgress without error', async () => { + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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.checkBatchProcessDocumentsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchProcessDocumentsProgress with error', async () => { + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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.checkBatchProcessDocumentsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('reviewDocument', () => { + it('invokes reviewDocument without error', async () => { + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reviewDocument = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.reviewDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes reviewDocument without error using callback', async () => { + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reviewDocument = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.reviewDocument( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes reviewDocument with call error', async () => { + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.reviewDocument = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.reviewDocument(request), expectedError); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes reviewDocument with LRO error', async () => { + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.reviewDocument = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.reviewDocument(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkReviewDocumentProgress without error', async () => { + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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.checkReviewDocumentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkReviewDocumentProgress with error', async () => { + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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.checkReviewDocumentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('Path templates', () => { + describe('humanReviewConfig', () => { + const fakePath = '/rendered/path/humanReviewConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + processor: 'processorValue', + }; + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.humanReviewConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.humanReviewConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('humanReviewConfigPath', () => { + const result = client.humanReviewConfigPath( + 'projectValue', + 'locationValue', + 'processorValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.humanReviewConfigPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromHumanReviewConfigName', () => { + const result = client.matchProjectFromHumanReviewConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.humanReviewConfigPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromHumanReviewConfigName', () => { + const result = client.matchLocationFromHumanReviewConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.humanReviewConfigPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProcessorFromHumanReviewConfigName', () => { + const result = client.matchProcessorFromHumanReviewConfigName(fakePath); + assert.strictEqual(result, 'processorValue'); + assert( + (client.pathTemplates.humanReviewConfigPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('processor', () => { + const fakePath = '/rendered/path/processor'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + processor: 'processorValue', + }; + const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.processorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.processorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('processorPath', () => { + const result = client.processorPath( + 'projectValue', + 'locationValue', + 'processorValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.processorPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProcessorName', () => { + const result = client.matchProjectFromProcessorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProcessorName', () => { + const result = client.matchLocationFromProcessorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProcessorFromProcessorName', () => { + const result = client.matchProcessorFromProcessorName(fakePath); + assert.strictEqual(result, 'processorValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-documentai/webpack.config.js b/packages/google-cloud-documentai/webpack.config.js index cd5a3fe7a3c..2f5cbda98e1 100644 --- a/packages/google-cloud-documentai/webpack.config.js +++ b/packages/google-cloud-documentai/webpack.config.js @@ -17,8 +17,8 @@ const path = require('path'); module.exports = { entry: './src/index.ts', output: { - library: 'DocumentUnderstandingService', - filename: './document-understanding-service.js', + library: 'DocumentProcessorService', + filename: './document-processor-service.js', }, node: { child_process: 'empty', From 5660c818686c9ba03d777dcaa0e78d03c7471b9e Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 12 Oct 2020 21:54:33 +0200 Subject: [PATCH 070/213] chore(deps): update dependency webpack-cli to v4 (#111) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [webpack-cli](https://togithub.com/webpack/webpack-cli) | devDependencies | major | [`^3.3.11` -> `^4.0.0`](https://renovatebot.com/diffs/npm/webpack-cli/3.3.12/4.0.0) | --- ### Release Notes
webpack/webpack-cli ### [`v4.0.0`](https://togithub.com/webpack/webpack-cli/blob/master/CHANGELOG.md#​400-httpsgithubcomwebpackwebpack-clicomparewebpack-cli400-rc1webpack-cli400-2020-10-10) [Compare Source](https://togithub.com/webpack/webpack-cli/compare/v3.3.12...webpack-cli@4.0.0) ##### Bug Fixes - add compilation lifecycle in watch instance ([#​1903](https://togithub.com/webpack/webpack-cli/issues/1903)) ([02b6d21](https://togithub.com/webpack/webpack-cli/commit/02b6d21eaa20166a7ed37816de716b8fc22b756a)) - cleanup `package-utils` package ([#​1822](https://togithub.com/webpack/webpack-cli/issues/1822)) ([fd5b92b](https://togithub.com/webpack/webpack-cli/commit/fd5b92b3cd40361daec5bf4486e455a41f4c9738)) - cli-executer supplies args further up ([#​1904](https://togithub.com/webpack/webpack-cli/issues/1904)) ([097564a](https://togithub.com/webpack/webpack-cli/commit/097564a851b36b63e0a6bf88144997ef65aa057a)) - exit code for validation errors ([59f6303](https://togithub.com/webpack/webpack-cli/commit/59f63037fcbdbb8934b578b9adf5725bc4ae1235)) - exit process in case of schema errors ([71e89b4](https://togithub.com/webpack/webpack-cli/commit/71e89b4092d953ea587cc4f606451ab78cbcdb93)) ##### Features - assign config paths in build dependencies in cache config ([#​1900](https://togithub.com/webpack/webpack-cli/issues/1900)) ([7e90f11](https://togithub.com/webpack/webpack-cli/commit/7e90f110b119f36ef9def4f66cf4e17ccf1438cd))
--- ### 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-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 81a1b5b445a..c66b2207025 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -49,7 +49,7 @@ "ts-loader": "^8.0.0", "typescript": "^3.8.3", "webpack": "^4.42.0", - "webpack-cli": "^3.3.11", + "webpack-cli": "^4.0.0", "@microsoft/api-documenter": "^7.8.10", "@microsoft/api-extractor": "^7.8.10" }, From b85edb5a90137670caf6a960ac88a2949b985b46 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 14 Oct 2020 23:04:07 +0200 Subject: [PATCH 071/213] chore(deps): update dependency webpack to v5 (#110) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [webpack](https://togithub.com/webpack/webpack) | devDependencies | major | [`^4.42.0` -> `^5.0.0`](https://renovatebot.com/diffs/npm/webpack/4.44.2/5.1.0) | --- ### Release Notes
webpack/webpack ### [`v5.1.0`](https://togithub.com/webpack/webpack/releases/v5.1.0) [Compare Source](https://togithub.com/webpack/webpack/compare/v5.0.0...v5.1.0) ### Features - expose `webpack` property from `Compiler` - expose `cleverMerge`, `EntryOptionPlugin`, `DynamicEntryPlugin` ### Bugfixes - missing `require("..").xxx` in try-catch produces a warning instead of an error now - handle reexports in concatenated modules correctly when they are side-effect-free - fix incorrect deprecation message for ModuleTemplate.hooks.hash ### [`v5.0.0`](https://togithub.com/webpack/webpack/releases/v5.0.0) [Compare Source](https://togithub.com/webpack/webpack/compare/v4.44.2...v5.0.0) [Announcement and changelog](https://webpack.js.org/blog/2020-10-10-webpack-5-release/)
--- ### 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-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index c66b2207025..615a3e029f6 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -48,7 +48,7 @@ "sinon": "^9.0.1", "ts-loader": "^8.0.0", "typescript": "^3.8.3", - "webpack": "^4.42.0", + "webpack": "^5.0.0", "webpack-cli": "^4.0.0", "@microsoft/api-documenter": "^7.8.10", "@microsoft/api-extractor": "^7.8.10" From b0b8433a15335d62721f049c37e3adfc0264b8fd Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Thu, 15 Oct 2020 00:33:16 -0700 Subject: [PATCH 072/213] feat: generation error and set v1beta3 as default (#112) * feat: set v1beta3 as default --- packages/google-cloud-documentai/.jsdoc.js | 2 +- packages/google-cloud-documentai/samples/quickstart.js | 2 +- packages/google-cloud-documentai/src/index.ts | 7 +++---- packages/google-cloud-documentai/synth.metadata | 10 +++++----- packages/google-cloud-documentai/synth.py | 3 ++- .../system-test/fixtures/sample/src/index.js | 2 +- .../system-test/fixtures/sample/src/index.ts | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/google-cloud-documentai/.jsdoc.js b/packages/google-cloud-documentai/.jsdoc.js index 8b9a4964b53..f8ba1e55491 100644 --- a/packages/google-cloud-documentai/.jsdoc.js +++ b/packages/google-cloud-documentai/.jsdoc.js @@ -43,7 +43,7 @@ module.exports = { copyright: 'Copyright 2020 Google LLC', includeDate: false, sourceFiles: false, - systemName: '@google-cloud/documentai', + systemName: 'documentai', theme: 'lumen', default: { outputSourceFiles: false diff --git a/packages/google-cloud-documentai/samples/quickstart.js b/packages/google-cloud-documentai/samples/quickstart.js index 4ac5bf66991..de56ea45976 100644 --- a/packages/google-cloud-documentai/samples/quickstart.js +++ b/packages/google-cloud-documentai/samples/quickstart.js @@ -30,7 +30,7 @@ async function main( const { DocumentUnderstandingServiceClient, - } = require('@google-cloud/documentai'); + } = require('@google-cloud/documentai').v1beta2; const client = new DocumentUnderstandingServiceClient(); async function quickstart() { diff --git a/packages/google-cloud-documentai/src/index.ts b/packages/google-cloud-documentai/src/index.ts index 7272a5273d7..2483b30f5bb 100644 --- a/packages/google-cloud-documentai/src/index.ts +++ b/packages/google-cloud-documentai/src/index.ts @@ -19,10 +19,9 @@ import * as v1beta2 from './v1beta2'; import * as v1beta3 from './v1beta3'; -const DocumentUnderstandingServiceClient = - v1beta2.DocumentUnderstandingServiceClient; +const DocumentProcessorServiceClient = v1beta3.DocumentProcessorServiceClient; -export {v1beta2, v1beta3, DocumentUnderstandingServiceClient}; -export default {v1beta2, v1beta3, DocumentUnderstandingServiceClient}; +export {v1beta2, v1beta3, DocumentProcessorServiceClient}; +export default {v1beta2, v1beta3, DocumentProcessorServiceClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index c375cf41e0d..4d8b5524590 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,22 +4,22 @@ "git": { "name": ".", "remote": "git@github.com:googleapis/nodejs-document-ai.git", - "sha": "dad35ff47a263244ae7b662880a763621fb66839" + "sha": "bdd070467079aa7a075c9756d7445493685a8e7e" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "80eada6dbc452b58b4663fa3ab4f0b6746f49f80", - "internalRef": "335745163" + "sha": "215c12ade72d9d9616457d9b8b2f8a37f38e79f3", + "internalRef": "337113354" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "487eba79f8260e34205d8ceb1ebcc65685085e19" + "sha": "477764cc4ee6db346d3febef2bb1ea0abf27de52" } } ], @@ -41,7 +41,7 @@ "language": "nodejs", "generator": "bazel" } - }, + } ], "generatedFiles": [ ".eslintignore", diff --git a/packages/google-cloud-documentai/synth.py b/packages/google-cloud-documentai/synth.py index 63cb5fa67fb..a9db1d123bd 100644 --- a/packages/google-cloud-documentai/synth.py +++ b/packages/google-cloud-documentai/synth.py @@ -23,6 +23,7 @@ AUTOSYNTH_MULTIPLE_COMMITS = True + # run the gapic generator gapic = gcp.GAPICBazel() versions = ['v1beta2', 'v1beta3'] @@ -33,7 +34,7 @@ # Copy common templates common_templates = gcp.CommonTemplates() -templates = common_templates.node_library(source_location='build/src', versions=versions, default_version='v1beta2') +templates = common_templates.node_library(source_location='build/src', versions=versions, default_version='v1beta3') s.copy(templates, excludes=[]) node.postprocess_gapic_library() diff --git a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js index b8b010e09ea..f16d23c1e65 100644 --- a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js @@ -20,7 +20,7 @@ const documentai = require('@google-cloud/documentai'); function main() { - const DocumentUnderstandingServiceClient = new documentai.DocumentUnderstandingServiceClient(); + const documentProcessorServiceClient = new documentai.DocumentProcessorServiceClient(); } main(); diff --git a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts index 042f6d5bd49..041a7e24d5d 100644 --- a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts @@ -16,10 +16,10 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {DocumentUnderstandingServiceClient} from '@google-cloud/documentai'; +import {DocumentProcessorServiceClient} from '@google-cloud/documentai'; function main() { - new DocumentUnderstandingServiceClient(); + new DocumentProcessorServiceClient(); } main(); From aaf8d20ba4b9cd92d093f408a238f94e1f3985ed Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Thu, 15 Oct 2020 12:18:40 -0700 Subject: [PATCH 073/213] docs(samples): new Doc AI samples for v1beta3 (#101) * docs(samples): new Doc AI samples for v1beta3 * feat: add a new version to the library * fix: adds processor ID as literal in tests * fix: removed apiEndpoint from client instantiation Co-authored-by: Sofia Leon Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com> Co-authored-by: Justin Beckwith --- .../samples/.eslintrc.yml | 4 +- .../samples/package.json | 6 +- .../samples/quickstart.js | 62 ++++++++++++------- .../samples/test/quickstart.test.js | 30 +++++++-- 4 files changed, 68 insertions(+), 34 deletions(-) diff --git a/packages/google-cloud-documentai/samples/.eslintrc.yml b/packages/google-cloud-documentai/samples/.eslintrc.yml index eef2752ae86..98634adbeff 100644 --- a/packages/google-cloud-documentai/samples/.eslintrc.yml +++ b/packages/google-cloud-documentai/samples/.eslintrc.yml @@ -1,6 +1,4 @@ --- rules: no-console: off - node/no-missing-require: off - node/no-extraneous-require: off - \ No newline at end of file + node/no-unsupported-features/node-builtins: off diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index e84be17d21a..8d166d1dd48 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -4,7 +4,7 @@ "license": "Apache-2.0", "author": "Google LLC", "engines": { - "node": ">=8" + "node": ">= 10.17.0" }, "files": [ "*.js" @@ -14,7 +14,9 @@ }, "dependencies": { "@google-cloud/documentai": "^2.1.1", - "@google-cloud/storage": "^5.0.0" + "@google-cloud/storage": "^5.0.0", + "p-queue": "^6.6.2", + "uuid": "^8.3.1" }, "devDependencies": { "chai": "^4.2.0", diff --git a/packages/google-cloud-documentai/samples/quickstart.js b/packages/google-cloud-documentai/samples/quickstart.js index de56ea45976..2d6c4a6fbb7 100644 --- a/packages/google-cloud-documentai/samples/quickstart.js +++ b/packages/google-cloud-documentai/samples/quickstart.js @@ -15,56 +15,72 @@ 'use strict'; -async function main( - projectId, - location, - gcsInputUri = 'gs://cloud-samples-data/documentai/invoice.pdf' -) { +async function main(projectId, location, processorId, filePath) { // [START documentai_quickstart] /** * TODO(developer): Uncomment these variables before running the sample. */ // const projectId = 'YOUR_PROJECT_ID'; // const location = 'YOUR_PROJECT_LOCATION'; // Format is 'us' or 'eu' - // const gcsInputUri = 'YOUR_SOURCE_PDF'; + // const processor = 'YOUR_PROCESSOR_ID'; // Create processor in Cloud Console + // const filePath = '/path/to/local/pdf'; const { - DocumentUnderstandingServiceClient, - } = require('@google-cloud/documentai').v1beta2; - const client = new DocumentUnderstandingServiceClient(); + DocumentProcessorServiceClient, + } = require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const client = new DocumentProcessorServiceClient(); async function quickstart() { - // Configure the request for processing the PDF - const parent = `projects/${projectId}/locations/${location}`; + // The full resource name of the processor, e.g.: + // projects/project-id/locations/location/processor/processor-id + // You must create new processors in the Cloud Console first + const name = `projects/${projectId}/locations/${location}/processors/${processorId}`; + + // Read the file into memory. + const fs = require('fs').promises; + const imageFile = await fs.readFile(filePath); + + // Convert the image data to a Buffer and base64 encode it. + const encodedImage = Buffer.from(imageFile).toString('base64'); + const request = { - parent, - inputConfig: { - gcsSource: { - uri: gcsInputUri, - }, + name, + document: { + content: encodedImage, mimeType: 'application/pdf', }, }; // Recognizes text entities in the PDF document const [result] = await client.processDocument(request); + const {document} = result; // Get all of the document text as one big string - const {text} = result; + const {text} = document; // Extract shards from the text field - function extractText(textAnchor) { + const getText = textAnchor => { + if (!textAnchor.textSegments || textAnchor.textSegments.length === 0) { + return ''; + } + // First shard in document doesn't have startIndex property const startIndex = textAnchor.textSegments[0].startIndex || 0; const endIndex = textAnchor.textSegments[0].endIndex; return text.substring(startIndex, endIndex); - } + }; + + // Read the text recognition output from the processor + console.log('The document contains the following paragraphs:'); + const [page1] = document.pages; + const {paragraphs} = page1; - for (const entity of result.entities) { - console.log(`\nEntity text: ${extractText(entity.textAnchor)}`); - console.log(`Entity type: ${entity.type}`); - console.log(`Entity mention text: ${entity.mentionText}`); + for (const paragraph of paragraphs) { + const paragraphText = getText(paragraph.layout.textAnchor); + console.log(`Paragraph text:\n${paragraphText}`); } } // [END documentai_quickstart] diff --git a/packages/google-cloud-documentai/samples/test/quickstart.test.js b/packages/google-cloud-documentai/samples/test/quickstart.test.js index 8a44c2d6c8d..d26e563275d 100644 --- a/packages/google-cloud-documentai/samples/test/quickstart.test.js +++ b/packages/google-cloud-documentai/samples/test/quickstart.test.js @@ -16,20 +16,38 @@ 'use strict'; const path = require('path'); -const {assert} = require('chai'); +const assert = require('assert'); const cp = require('child_process'); +const { + DocumentProcessorServiceClient, +} = require('@google-cloud/documentai').v1beta3; +const client = new DocumentProcessorServiceClient({ + apiEndpoint: 'us-documentai.googleapis.com', +}); + const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const cwd = path.join(__dirname, '..'); -const projectId = process.env.GCLOUD_PROJECT; const LOCATION = 'us'; +const PROCESSOR_ID = '8f1123c1b125e0b7'; + +const fileName = 'invoice.pdf'; +const filePath = path.resolve(path.join(__dirname, `../resources/${fileName}`)); describe('Quickstart', () => { + let projectId; + before(async () => { + projectId = await client.getProjectId(); + }); + it('should run quickstart', async () => { - const stdout = execSync(`node ./quickstart.js ${projectId} ${LOCATION}`, { - cwd, - }); - assert.match(stdout, /Entity/); + const stdout = execSync( + `node ./quickstart.js ${projectId} ${LOCATION} ${PROCESSOR_ID} ${filePath}`, + { + cwd, + } + ); + assert.notStrictEqual(stdout.indexOf('Paragraph'), -1); }); }); From d39e52bb76c24ac1c2ce45440de4c09afb714f56 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 16 Oct 2020 12:38:15 -0700 Subject: [PATCH 074/213] chore: update packageName and README (#115) * chore: adding package name for v1beta3 PiperOrigin-RevId: 337403851 Source-Author: Google APIs Source-Date: Thu Oct 15 16:16:02 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: 54331a6ab9960ee5776d123284da6cd50f8337f3 Source-Link: https://github.com/googleapis/googleapis/commit/54331a6ab9960ee5776d123284da6cd50f8337f3 --- packages/google-cloud-documentai/.jsdoc.js | 2 +- packages/google-cloud-documentai/README.md | 58 +++++++++++++------ .../google-cloud-documentai/samples/README.md | 36 ++++++++++++ .../google-cloud-documentai/synth.metadata | 16 +++-- 4 files changed, 89 insertions(+), 23 deletions(-) diff --git a/packages/google-cloud-documentai/.jsdoc.js b/packages/google-cloud-documentai/.jsdoc.js index f8ba1e55491..8b9a4964b53 100644 --- a/packages/google-cloud-documentai/.jsdoc.js +++ b/packages/google-cloud-documentai/.jsdoc.js @@ -43,7 +43,7 @@ module.exports = { copyright: 'Copyright 2020 Google LLC', includeDate: false, sourceFiles: false, - systemName: 'documentai', + systemName: '@google-cloud/documentai', theme: 'lumen', default: { outputSourceFiles: false diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index f72f3c7aa00..dc14099163c 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -63,45 +63,65 @@ npm install @google-cloud/documentai */ // const projectId = 'YOUR_PROJECT_ID'; // const location = 'YOUR_PROJECT_LOCATION'; // Format is 'us' or 'eu' -// const gcsInputUri = 'YOUR_SOURCE_PDF'; +// const processor = 'YOUR_PROCESSOR_ID'; // Create processor in Cloud Console +// const filePath = '/path/to/local/pdf'; const { - DocumentUnderstandingServiceClient, -} = require('@google-cloud/documentai'); -const client = new DocumentUnderstandingServiceClient(); + DocumentProcessorServiceClient, +} = require('@google-cloud/documentai').v1beta3; + +// Instantiates a client +const client = new DocumentProcessorServiceClient(); async function quickstart() { - // Configure the request for processing the PDF - const parent = `projects/${projectId}/locations/${location}`; + // The full resource name of the processor, e.g.: + // projects/project-id/locations/location/processor/processor-id + // You must create new processors in the Cloud Console first + const name = `projects/${projectId}/locations/${location}/processors/${processorId}`; + + // Read the file into memory. + const fs = require('fs').promises; + const imageFile = await fs.readFile(filePath); + + // Convert the image data to a Buffer and base64 encode it. + const encodedImage = Buffer.from(imageFile).toString('base64'); + const request = { - parent, - inputConfig: { - gcsSource: { - uri: gcsInputUri, - }, + name, + document: { + content: encodedImage, mimeType: 'application/pdf', }, }; // Recognizes text entities in the PDF document const [result] = await client.processDocument(request); + const {document} = result; // Get all of the document text as one big string - const {text} = result; + const {text} = document; // Extract shards from the text field - function extractText(textAnchor) { + const getText = textAnchor => { + if (!textAnchor.textSegments || textAnchor.textSegments.length === 0) { + return ''; + } + // First shard in document doesn't have startIndex property const startIndex = textAnchor.textSegments[0].startIndex || 0; const endIndex = textAnchor.textSegments[0].endIndex; return text.substring(startIndex, endIndex); - } + }; + + // Read the text recognition output from the processor + console.log('The document contains the following paragraphs:'); + const [page1] = document.pages; + const {paragraphs} = page1; - for (const entity of result.entities) { - console.log(`\nEntity text: ${extractText(entity.textAnchor)}`); - console.log(`Entity type: ${entity.type}`); - console.log(`Entity mention text: ${entity.mentionText}`); + for (const paragraph of paragraphs) { + const paragraphText = getText(paragraph.layout.textAnchor); + console.log(`Paragraph text:\n${paragraphText}`); } } @@ -116,11 +136,13 @@ has instructions for running the samples. | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | +| Batch-process-document.v1beta3 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch-process-document.v1beta3.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-process-document.v1beta3.js,samples/README.md) | | Batch_parse_form | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch_parse_form.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch_parse_form.js,samples/README.md) | | Batch_parse_table | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch_parse_table.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch_parse_table.js,samples/README.md) | | Parse_form | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse_form.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse_form.js,samples/README.md) | | Parse_table | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse_table.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse_table.js,samples/README.md) | | Parse_with_model | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse_with_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse_with_model.js,samples/README.md) | +| Process-document.v1beta3 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/process-document.v1beta3.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document.v1beta3.js,samples/README.md) | | Quickstart | [source code](https://github.com/googleapis/nodejs-document-ai/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-document-ai&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | | Set_endpoint | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/set_endpoint.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/set_endpoint.js,samples/README.md) | diff --git a/packages/google-cloud-documentai/samples/README.md b/packages/google-cloud-documentai/samples/README.md index 07794075d0d..b84721691b1 100644 --- a/packages/google-cloud-documentai/samples/README.md +++ b/packages/google-cloud-documentai/samples/README.md @@ -12,11 +12,13 @@ * [Before you begin](#before-you-begin) * [Samples](#samples) + * [Batch-process-document.v1beta3](#batch-process-document.v1beta3) * [Batch_parse_form](#batch_parse_form) * [Batch_parse_table](#batch_parse_table) * [Parse_form](#parse_form) * [Parse_table](#parse_table) * [Parse_with_model](#parse_with_model) + * [Process-document.v1beta3](#process-document.v1beta3) * [Quickstart](#quickstart) * [Set_endpoint](#set_endpoint) @@ -35,6 +37,23 @@ Before running the samples, make sure you've followed the steps outlined in +### Batch-process-document.v1beta3 + +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch-process-document.v1beta3.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-process-document.v1beta3.js,samples/README.md) + +__Usage:__ + + +`node samples/batch-process-document.v1beta3.js` + + +----- + + + + ### Batch_parse_form View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch_parse_form.js). @@ -120,6 +139,23 @@ __Usage:__ +### Process-document.v1beta3 + +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/process-document.v1beta3.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document.v1beta3.js,samples/README.md) + +__Usage:__ + + +`node samples/process-document.v1beta3.js` + + +----- + + + + ### Quickstart View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/quickstart.js). diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 4d8b5524590..1a7b2ae99fb 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -3,16 +3,16 @@ { "git": { "name": ".", - "remote": "git@github.com:googleapis/nodejs-document-ai.git", - "sha": "bdd070467079aa7a075c9756d7445493685a8e7e" + "remote": "https://github.com/googleapis/nodejs-document-ai.git", + "sha": "e65fc94ab9dc1f75d8e0f95c1e2558a9dbcf7e0d" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "215c12ade72d9d9616457d9b8b2f8a37f38e79f3", - "internalRef": "337113354" + "sha": "54331a6ab9960ee5776d123284da6cd50f8337f3", + "internalRef": "337403851" } }, { @@ -99,6 +99,9 @@ "protos/google/cloud/documentai/v1beta2/document.proto", "protos/google/cloud/documentai/v1beta2/document_understanding.proto", "protos/google/cloud/documentai/v1beta2/geometry.proto", + "protos/google/cloud/documentai/v1beta3/document.proto", + "protos/google/cloud/documentai/v1beta3/document_processor_service.proto", + "protos/google/cloud/documentai/v1beta3/geometry.proto", "protos/protos.d.ts", "protos/protos.js", "protos/protos.json", @@ -109,9 +112,14 @@ "src/v1beta2/document_understanding_service_client_config.json", "src/v1beta2/document_understanding_service_proto_list.json", "src/v1beta2/index.ts", + "src/v1beta3/document_processor_service_client.ts", + "src/v1beta3/document_processor_service_client_config.json", + "src/v1beta3/document_processor_service_proto_list.json", + "src/v1beta3/index.ts", "system-test/fixtures/sample/src/index.js", "system-test/fixtures/sample/src/index.ts", "system-test/install.ts", + "test/gapic_document_processor_service_v1beta3.ts", "test/gapic_document_understanding_service_v1beta2.ts", "tsconfig.json", "webpack.config.js" From 27511b779f32d19c698b5555a3288b3ce824fe05 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Sat, 17 Oct 2020 12:28:04 -0700 Subject: [PATCH 075/213] build: only check --engine-strict for production deps Co-authored-by: Justin Beckwith Source-Author: Benjamin E. Coe Source-Date: Thu Oct 15 17:40:52 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 5451633881133e5573cc271a18e73b18caca8b1b Source-Link: https://github.com/googleapis/synthtool/commit/5451633881133e5573cc271a18e73b18caca8b1b --- packages/google-cloud-documentai/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 1a7b2ae99fb..34ccc53d884 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "e65fc94ab9dc1f75d8e0f95c1e2558a9dbcf7e0d" + "sha": "3e9338694be56df65fb9207db27908402ec9072d" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "477764cc4ee6db346d3febef2bb1ea0abf27de52" + "sha": "5451633881133e5573cc271a18e73b18caca8b1b" } } ], From b054469c2ba89309ca7b9b6e887d01fd83fe9d68 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 20 Oct 2020 10:32:06 -0700 Subject: [PATCH 076/213] chore: release 2.2.0 (#106) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-documentai/CHANGELOG.md | 8 ++++++++ packages/google-cloud-documentai/package.json | 2 +- packages/google-cloud-documentai/samples/package.json | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index e8fcb42b2ca..e062f1c109f 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [2.2.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.1.1...v2.2.0) (2020-10-17) + + +### Features + +* add v1beta3 version ([#105](https://www.github.com/googleapis/nodejs-document-ai/issues/105)) ([b419994](https://www.github.com/googleapis/nodejs-document-ai/commit/b4199943d8678b9bcaa324e94540652dff40d4e0)) +* generation error and set v1beta3 as default ([#112](https://www.github.com/googleapis/nodejs-document-ai/issues/112)) ([83ca094](https://www.github.com/googleapis/nodejs-document-ai/commit/83ca09497a4803e566c58a9a88e5bdac04585743)) + ### [2.1.1](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.1.0...v2.1.1) (2020-07-09) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 615a3e029f6..8f222097c17 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "2.1.1", + "version": "2.2.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 8d166d1dd48..2e26f1e7590 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^2.1.1", + "@google-cloud/documentai": "^2.2.0", "@google-cloud/storage": "^5.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" From ee7d239100f00099114727bec301ce6d47ea0d99 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 21 Oct 2020 15:19:09 -0700 Subject: [PATCH 077/213] chore: clean up Node.js TOC for cloud-rad (#118) * chore: clean up Node.js TOC for cloud-rad Source-Author: F. Hinkelmann Source-Date: Wed Oct 21 09:26:04 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: f96d3b455fe27c3dc7bc37c3c9cd27b1c6d269c8 Source-Link: https://github.com/googleapis/synthtool/commit/f96d3b455fe27c3dc7bc37c3c9cd27b1c6d269c8 * chore: fix Node.js TOC for cloud-rad Source-Author: F. Hinkelmann Source-Date: Wed Oct 21 12:01:24 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: 901ddd44e9ef7887ee681b9183bbdea99437fdcc Source-Link: https://github.com/googleapis/synthtool/commit/901ddd44e9ef7887ee681b9183bbdea99437fdcc --- packages/google-cloud-documentai/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 34ccc53d884..410ab43e7f1 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "3e9338694be56df65fb9207db27908402ec9072d" + "sha": "6611526bb7e6c246825ec38567a75858722658ba" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "5451633881133e5573cc271a18e73b18caca8b1b" + "sha": "901ddd44e9ef7887ee681b9183bbdea99437fdcc" } } ], From db30e20a0eaefd5381b3b95826a9e0d0c984ecbc Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 27 Oct 2020 11:12:04 -0700 Subject: [PATCH 078/213] docs: updated code of conduct (includes update to actions) (#121) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/6be78fc1-147d-40e3-a003-ed65fa912e63/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/89c849ba5013e45e8fb688b138f33c2ec6083dc5 Source-Link: https://github.com/googleapis/synthtool/commit/a783321fd55f010709294455584a553f4b24b944 Source-Link: https://github.com/googleapis/synthtool/commit/b7413d38b763827c72c0360f0a3d286c84656eeb Source-Link: https://github.com/googleapis/synthtool/commit/5f6ef0ec5501d33c4667885b37a7685a30d41a76 --- .../CODE_OF_CONDUCT.md | 123 +++++++++++++----- .../google-cloud-documentai/synth.metadata | 4 +- 2 files changed, 89 insertions(+), 38 deletions(-) diff --git a/packages/google-cloud-documentai/CODE_OF_CONDUCT.md b/packages/google-cloud-documentai/CODE_OF_CONDUCT.md index 46b2a08ea6d..2add2547a81 100644 --- a/packages/google-cloud-documentai/CODE_OF_CONDUCT.md +++ b/packages/google-cloud-documentai/CODE_OF_CONDUCT.md @@ -1,43 +1,94 @@ -# Contributor Code of Conduct + +# Code of Conduct -As contributors and maintainers of this project, -and in the interest of fostering an open and welcoming community, -we pledge to respect all people who contribute through reporting issues, -posting feature requests, updating documentation, -submitting pull requests or patches, and other activities. +## Our Pledge -We are committed to making participation in this project -a harassment-free experience for everyone, -regardless of level of experience, gender, gender identity and expression, -sexual orientation, disability, personal appearance, -body size, race, ethnicity, age, religion, or nationality. +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 -* Personal attacks -* Trolling or insulting/derogatory comments -* Public or private harassment -* Publishing other's private information, -such as physical or electronic -addresses, without explicit permission -* Other unethical or unprofessional conduct. +* 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. -By adopting this Code of Conduct, -project maintainers commit themselves to fairly and consistently -applying these principles to every aspect of managing this project. -Project maintainers who do not follow or enforce the Code of Conduct -may be permanently removed from the project team. - -This code of conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. - -Instances of abusive, harassing, or otherwise unacceptable behavior -may be reported by opening an issue -or contacting one or more of the project maintainers. - -This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, -available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) +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-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 410ab43e7f1..8e168e17b06 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "6611526bb7e6c246825ec38567a75858722658ba" + "sha": "0020dc7d967ed55c47540ba6f6f89ee277126c52" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "901ddd44e9ef7887ee681b9183bbdea99437fdcc" + "sha": "89c849ba5013e45e8fb688b138f33c2ec6083dc5" } } ], From fc60b1270ce96d9c684c55a48f38c8aab188eebb Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 2 Nov 2020 15:58:24 -0800 Subject: [PATCH 079/213] build(node): add KOKORO_BUILD_ARTIFACTS_SUBDIR to env (#122) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/6fe1a2b3-59cc-42e8-a9d9-5ebb537fe61c/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/ba9918cd22874245b55734f57470c719b577e591 --- packages/google-cloud-documentai/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 8e168e17b06..d17caaa0858 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "0020dc7d967ed55c47540ba6f6f89ee277126c52" + "sha": "35078efcf3d995a48f56f12f0db46b98f20e37fc" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "89c849ba5013e45e8fb688b138f33c2ec6083dc5" + "sha": "ba9918cd22874245b55734f57470c719b577e591" } } ], From 48efe30ff048a391fe663118a7fafb780694837b Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 5 Nov 2020 09:53:58 -0800 Subject: [PATCH 080/213] chore: fix namespaces for ruby, php, and C# clients, add package name for v1beta3 (#123) * 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. * chore: adding package name for v1beta3 PiperOrigin-RevId: 337403851 Source-Author: Google APIs Source-Date: Thu Oct 15 16:16:02 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: 54331a6ab9960ee5776d123284da6cd50f8337f3 Source-Link: https://github.com/googleapis/googleapis/commit/54331a6ab9960ee5776d123284da6cd50f8337f3 * chore: Fix namespaces for Ruby, PHP, and C# clients PiperOrigin-RevId: 340710837 Source-Author: Google APIs Source-Date: Wed Nov 4 12:55:47 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: 709aaa0bf92147ff67de52e1b7371bc596603842 Source-Link: https://github.com/googleapis/googleapis/commit/709aaa0bf92147ff67de52e1b7371bc596603842 --- .../protos/google/cloud/documentai/v1beta2/document.proto | 2 +- .../cloud/documentai/v1beta2/document_understanding.proto | 2 +- .../protos/google/cloud/documentai/v1beta2/geometry.proto | 2 +- .../protos/google/cloud/documentai/v1beta3/document.proto | 6 +++--- .../documentai/v1beta3/document_processor_service.proto | 6 +++--- .../protos/google/cloud/documentai/v1beta3/geometry.proto | 6 +++--- packages/google-cloud-documentai/protos/protos.json | 8 ++++---- packages/google-cloud-documentai/synth.metadata | 6 +++--- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto index 327473048b1..bb3b58bade9 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto @@ -27,7 +27,7 @@ option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1be option java_multiple_files = true; option java_outer_classname = "DocumentProto"; option java_package = "com.google.cloud.documentai.v1beta2"; -option php_namespace = "Google\\Cloud\\DocumentAi\\V1beta2"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta2"; option ruby_package = "Google::Cloud::DocumentAI::V1beta2"; // Document represents the canonical document resource in Document Understanding diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document_understanding.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document_understanding.proto index 9d3c8d9416a..cf336f014cc 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document_understanding.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document_understanding.proto @@ -29,7 +29,7 @@ option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1be option java_multiple_files = true; option java_outer_classname = "DocumentAiProto"; option java_package = "com.google.cloud.documentai.v1beta2"; -option php_namespace = "Google\\Cloud\\DocumentAi\\V1beta2"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta2"; option ruby_package = "Google::Cloud::DocumentAI::V1beta2"; // Service to parse structured information from unstructured or semi-structured diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/geometry.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/geometry.proto index 21584ecfe2a..6aff4db8ce0 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/geometry.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/geometry.proto @@ -23,7 +23,7 @@ option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1be option java_multiple_files = true; option java_outer_classname = "GeometryProto"; option java_package = "com.google.cloud.documentai.v1beta2"; -option php_namespace = "Google\\Cloud\\DocumentAi\\V1beta2"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta2"; option ruby_package = "Google::Cloud::DocumentAI::V1beta2"; // A vertex represents a 2D point in the image. diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto index 2498eb473fd..31642871c4c 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto @@ -27,13 +27,13 @@ import "google/type/money.proto"; import "google/type/postal_address.proto"; import "google/api/annotations.proto"; -option csharp_namespace = "Google.Cloud.DocumentAI.v1beta3"; +option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; option java_multiple_files = true; option java_outer_classname = "DocumentProto"; option java_package = "com.google.cloud.documentai.v1beta3"; -option php_namespace = "Google\\Cloud\\DocumentAi\\v1beta3"; -option ruby_package = "Google::Cloud::DocumentAI::master"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta3"; +option ruby_package = "Google::Cloud::DocumentAI::V1beta3"; // Document represents the canonical document resource in Document Understanding // AI. diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto index 7784da3ecec..f90d7d04d04 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto @@ -26,13 +26,13 @@ import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/status.proto"; -option csharp_namespace = "Google.Cloud.DocumentAI.v1beta3"; +option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; option java_multiple_files = true; option java_outer_classname = "DocumentAiProcessorService"; option java_package = "com.google.cloud.documentai.v1beta3"; -option php_namespace = "Google\\Cloud\\DocumentAi\\v1beta3"; -option ruby_package = "Google::Cloud::DocumentAI::master"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta3"; +option ruby_package = "Google::Cloud::DocumentAI::V1beta3"; // (-- aip.dev/not-precedent: This is needed because we have references to // these resources in our public API, but the resource management is not diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/geometry.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/geometry.proto index c70ae0c0d51..8ac46643f4b 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/geometry.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/geometry.proto @@ -18,13 +18,13 @@ package google.cloud.documentai.v1beta3; import "google/api/annotations.proto"; -option csharp_namespace = "Google.Cloud.DocumentAI.v1beta3"; +option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; option java_multiple_files = true; option java_outer_classname = "GeometryProto"; option java_package = "com.google.cloud.documentai.v1beta3"; -option php_namespace = "Google\\Cloud\\DocumentAi\\v1beta3"; -option ruby_package = "Google::Cloud::DocumentAI::master"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta3"; +option ruby_package = "Google::Cloud::DocumentAI::V1beta3"; // A vertex represents a 2D point in the image. // NOTE: the vertex coordinates are in the same scale as the original image. diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index a97cd87e373..7b8a50cceef 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -13,7 +13,7 @@ "java_multiple_files": true, "java_outer_classname": "DocumentAiProto", "java_package": "com.google.cloud.documentai.v1beta2", - "php_namespace": "Google\\Cloud\\DocumentAi\\V1beta2", + "php_namespace": "Google\\Cloud\\DocumentAI\\V1beta2", "ruby_package": "Google::Cloud::DocumentAI::V1beta2" }, "nested": { @@ -967,13 +967,13 @@ }, "v1beta3": { "options": { - "csharp_namespace": "Google.Cloud.DocumentAI.v1beta3", + "csharp_namespace": "Google.Cloud.DocumentAI.V1Beta3", "go_package": "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai", "java_multiple_files": true, "java_outer_classname": "DocumentAiProcessorService", "java_package": "com.google.cloud.documentai.v1beta3", - "php_namespace": "Google\\Cloud\\DocumentAi\\v1beta3", - "ruby_package": "Google::Cloud::DocumentAI::master", + "php_namespace": "Google\\Cloud\\DocumentAI\\V1beta3", + "ruby_package": "Google::Cloud::DocumentAI::V1beta3", "(google.api.resource_definition).type": "documentai.googleapis.com/HumanReviewConfig", "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig" }, diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index d17caaa0858..8607a3b109d 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "35078efcf3d995a48f56f12f0db46b98f20e37fc" + "sha": "340d8949c526aab71e2726f1a2aad2e8440f8b10" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "54331a6ab9960ee5776d123284da6cd50f8337f3", - "internalRef": "337403851" + "sha": "709aaa0bf92147ff67de52e1b7371bc596603842", + "internalRef": "340710837" } }, { From 228056e6885b53405ab511dcfd58aa2097231dfc Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 6 Nov 2020 14:58:33 -0800 Subject: [PATCH 081/213] build: add type for ClusterManagerClient (#124) --- packages/google-cloud-documentai/src/index.ts | 1 + packages/google-cloud-documentai/synth.metadata | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/src/index.ts b/packages/google-cloud-documentai/src/index.ts index 2483b30f5bb..3d86b2bd3a0 100644 --- a/packages/google-cloud-documentai/src/index.ts +++ b/packages/google-cloud-documentai/src/index.ts @@ -20,6 +20,7 @@ import * as v1beta2 from './v1beta2'; import * as v1beta3 from './v1beta3'; const DocumentProcessorServiceClient = v1beta3.DocumentProcessorServiceClient; +type DocumentProcessorServiceClient = v1beta3.DocumentProcessorServiceClient; export {v1beta2, v1beta3, DocumentProcessorServiceClient}; export default {v1beta2, v1beta3, DocumentProcessorServiceClient}; diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 8607a3b109d..cc07c332090 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "340d8949c526aab71e2726f1a2aad2e8440f8b10" + "sha": "f27b0b95bdba335207b33dbc4e58d692265fd6de" } }, { From f099c15777ab872966e33ace7a5f41b143f54257 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Tue, 10 Nov 2020 15:32:23 -0800 Subject: [PATCH 082/213] fix: do not modify options object (#125) * fix: do not modify options object, use defaultScopes Regenerated the library using gapic-generator-typescript v1.2.1. * fix(deps): require google-gax ^2.9.2 * fix: synth.py fix to disable defaultScopes --- packages/google-cloud-documentai/package.json | 2 +- .../document_understanding_service_client.ts | 98 ++++++++------ .../document_processor_service_client.ts | 128 ++++++++++-------- .../google-cloud-documentai/synth.metadata | 12 +- packages/google-cloud-documentai/synth.py | 18 ++- .../system-test/fixtures/sample/src/index.ts | 11 +- .../system-test/install.ts | 18 +-- 7 files changed, 167 insertions(+), 120 deletions(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 8f222097c17..35454946c18 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -29,7 +29,7 @@ "api-documenter": "api-documenter yaml --input-folder=temp" }, "dependencies": { - "google-gax": "^2.1.0" + "google-gax": "^2.9.2" }, "devDependencies": { "@types/mocha": "^8.0.0", diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index 284fa87ead6..e8dafa951f2 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -59,8 +59,10 @@ export class DocumentUnderstandingServiceClient { /** * Construct an instance of DocumentUnderstandingServiceClient. * - * @param {object} [options] - The configuration object. See the subsequent - * parameters for more details. + * @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] @@ -80,44 +82,34 @@ export class DocumentUnderstandingServiceClient { * 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. + * TODO(@alexander-fenster): link to gax documentation. + * @param {boolean} 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 the service address and port. + // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof DocumentUnderstandingServiceClient; const servicePath = - opts && opts.servicePath - ? opts.servicePath - : opts && opts.apiEndpoint - ? opts.apiEndpoint - : staticMembers.servicePath; - const port = opts && opts.port ? opts.port : staticMembers.port; - - if (!opts) { - opts = {servicePath, port}; + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? typeof window !== 'undefined'; + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options set scopes. + if (!('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; } - opts.servicePath = opts.servicePath || servicePath; - opts.port = opts.port || port; - - // users can override the config from client side, like retry codes name. - // The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/master/src/gax.ts#L546 - // The way to override client config for Showcase API: - // - // const customConfig = {"interfaces": {"google.showcase.v1beta1.Echo": {"methods": {"Echo": {"retry_codes_name": "idempotent", "retry_params_name": "default"}}}}} - // const showcaseClient = new showcaseClient({ projectId, customConfig }); - opts.clientConfig = opts.clientConfig || {}; - // If we're running in browser, it's OK to omit `fallback` since - // google-gax has `browser` field in its `package.json`. - // For Electron (which does not respect `browser` field), - // pass `{fallback: true}` to the DocumentUnderstandingServiceClient constructor. + // 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. - opts.scopes = (this - .constructor as typeof DocumentUnderstandingServiceClient).scopes; + // 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. @@ -269,6 +261,7 @@ export class DocumentUnderstandingServiceClient { /** * The DNS address for this API service. + * @returns {string} The DNS address for this service. */ static get servicePath() { return 'us-documentai.googleapis.com'; @@ -277,6 +270,7 @@ export class DocumentUnderstandingServiceClient { /** * 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 'us-documentai.googleapis.com'; @@ -284,6 +278,7 @@ export class DocumentUnderstandingServiceClient { /** * The port for this API service. + * @returns {number} The default port for this service. */ static get port() { return 443; @@ -292,6 +287,7 @@ export class DocumentUnderstandingServiceClient { /** * 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']; @@ -301,8 +297,7 @@ export class DocumentUnderstandingServiceClient { getProjectId(callback: Callback): void; /** * Return the project ID used by this class. - * @param {function(Error, string)} callback - the callback to - * be called with the current project Id. + * @returns {Promise} A promise that resolves to string containing the project ID. */ getProjectId( callback?: Callback @@ -391,7 +386,11 @@ export class DocumentUnderstandingServiceClient { * 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 [Document]{@link google.cloud.documentai.v1beta2.Document}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * 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.processDocument(request); */ processDocument( request: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest, @@ -494,8 +493,15 @@ export class DocumentUnderstandingServiceClient { * @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 [Operation]{@link google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * 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.batchProcessDocuments(request); + * const [response] = await operation.promise(); */ batchProcessDocuments( request: protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, @@ -547,18 +553,19 @@ export class DocumentUnderstandingServiceClient { return this.innerApiCalls.batchProcessDocuments(request, options, callback); } /** - * Check the status of the long running operation returned by the batchProcessDocuments() method. + * Check the status of the long running operation returned by `batchProcessDocuments()`. * @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. - * - * @example: - * const decodedOperation = await checkBatchProcessDocumentsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - * + * 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 checkBatchProcessDocumentsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); */ async checkBatchProcessDocumentsProgress( name: string @@ -584,9 +591,10 @@ export class DocumentUnderstandingServiceClient { } /** - * Terminate the GRPC channel and close the client. + * 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(); diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index 868dc31de2b..bd5f0073df5 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts @@ -61,8 +61,10 @@ export class DocumentProcessorServiceClient { /** * Construct an instance of DocumentProcessorServiceClient. * - * @param {object} [options] - The configuration object. See the subsequent - * parameters for more details. + * @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] @@ -82,44 +84,34 @@ export class DocumentProcessorServiceClient { * 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. + * TODO(@alexander-fenster): link to gax documentation. + * @param {boolean} 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 the service address and port. + // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof DocumentProcessorServiceClient; const servicePath = - opts && opts.servicePath - ? opts.servicePath - : opts && opts.apiEndpoint - ? opts.apiEndpoint - : staticMembers.servicePath; - const port = opts && opts.port ? opts.port : staticMembers.port; - - if (!opts) { - opts = {servicePath, port}; + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? typeof window !== 'undefined'; + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options set scopes. + if (!('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; } - opts.servicePath = opts.servicePath || servicePath; - opts.port = opts.port || port; - - // users can override the config from client side, like retry codes name. - // The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/master/src/gax.ts#L546 - // The way to override client config for Showcase API: - // - // const customConfig = {"interfaces": {"google.showcase.v1beta1.Echo": {"methods": {"Echo": {"retry_codes_name": "idempotent", "retry_params_name": "default"}}}}} - // const showcaseClient = new showcaseClient({ projectId, customConfig }); - opts.clientConfig = opts.clientConfig || {}; - - // If we're running in browser, it's OK to omit `fallback` since - // google-gax has `browser` field in its `package.json`. - // For Electron (which does not respect `browser` field), - // pass `{fallback: true}` to the DocumentProcessorServiceClient constructor. + + // 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. - opts.scopes = (this - .constructor as typeof DocumentProcessorServiceClient).scopes; + // 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. @@ -295,6 +287,7 @@ export class DocumentProcessorServiceClient { /** * The DNS address for this API service. + * @returns {string} The DNS address for this service. */ static get servicePath() { return 'us-documentai.googleapis.com'; @@ -303,6 +296,7 @@ export class DocumentProcessorServiceClient { /** * 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 'us-documentai.googleapis.com'; @@ -310,6 +304,7 @@ export class DocumentProcessorServiceClient { /** * The port for this API service. + * @returns {number} The default port for this service. */ static get port() { return 443; @@ -318,6 +313,7 @@ export class DocumentProcessorServiceClient { /** * 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']; @@ -327,8 +323,7 @@ export class DocumentProcessorServiceClient { getProjectId(callback: Callback): void; /** * Return the project ID used by this class. - * @param {function(Error, string)} callback - the callback to - * be called with the current project Id. + * @returns {Promise} A promise that resolves to string containing the project ID. */ getProjectId( callback?: Callback @@ -386,7 +381,11 @@ export class DocumentProcessorServiceClient { * 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 [ProcessResponse]{@link google.cloud.documentai.v1beta3.ProcessResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * 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.processDocument(request); */ processDocument( request: protos.google.cloud.documentai.v1beta3.IProcessRequest, @@ -482,8 +481,15 @@ export class DocumentProcessorServiceClient { * @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 [Operation]{@link google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * 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.batchProcessDocuments(request); + * const [response] = await operation.promise(); */ batchProcessDocuments( request: protos.google.cloud.documentai.v1beta3.IBatchProcessRequest, @@ -535,18 +541,19 @@ export class DocumentProcessorServiceClient { return this.innerApiCalls.batchProcessDocuments(request, options, callback); } /** - * Check the status of the long running operation returned by the batchProcessDocuments() method. + * Check the status of the long running operation returned by `batchProcessDocuments()`. * @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. - * - * @example: - * const decodedOperation = await checkBatchProcessDocumentsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - * + * 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 checkBatchProcessDocumentsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); */ async checkBatchProcessDocumentsProgress( name: string @@ -620,8 +627,15 @@ export class DocumentProcessorServiceClient { * @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 [Operation]{@link google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * 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.reviewDocument(request); + * const [response] = await operation.promise(); */ reviewDocument( request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, @@ -673,18 +687,19 @@ export class DocumentProcessorServiceClient { return this.innerApiCalls.reviewDocument(request, options, callback); } /** - * Check the status of the long running operation returned by the reviewDocument() method. + * Check the status of the long running operation returned by `reviewDocument()`. * @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. - * - * @example: - * const decodedOperation = await checkReviewDocumentProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - * + * 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 checkReviewDocumentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); */ async checkReviewDocumentProgress( name: string @@ -820,9 +835,10 @@ export class DocumentProcessorServiceClient { } /** - * Terminate the GRPC channel and close the client. + * 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(); diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index cc07c332090..3daf7af190c 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -3,23 +3,23 @@ { "git": { "name": ".", - "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "f27b0b95bdba335207b33dbc4e58d692265fd6de" + "remote": "git@github.com:googleapis/nodejs-document-ai.git", + "sha": "74520d6a9c6bc8781c28c198f47babb3d373aa44" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "709aaa0bf92147ff67de52e1b7371bc596603842", - "internalRef": "340710837" + "sha": "8b159675150e6d8b149bc4db4540e574462bc4a2", + "internalRef": "341678368" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "ba9918cd22874245b55734f57470c719b577e591" + "sha": "7db8a6c5ffb12a6e4c2f799c18f00f7f3d60e279" } } ], @@ -124,4 +124,4 @@ "tsconfig.json", "webpack.config.js" ] -} \ No newline at end of file +} diff --git a/packages/google-cloud-documentai/synth.py b/packages/google-cloud-documentai/synth.py index a9db1d123bd..0b27eb3cc73 100644 --- a/packages/google-cloud-documentai/synth.py +++ b/packages/google-cloud-documentai/synth.py @@ -29,8 +29,22 @@ versions = ['v1beta2', 'v1beta3'] name = 'documentai' for version in versions: - library = gapic.node_library(name, version) - s.copy(library, excludes=['README.md', 'package.json']) + library = gapic.node_library(name, version) + s.copy(library, excludes=['README.md', 'package.json']) + +## Note: this API only supports regional endpoints and does not support default scopes. +s.replace(f"src/*/document_*_service_client.ts", + "servicePath !== staticMembers.servicePath && ", + "" + ) +s.replace(f"src/*/document_*_service_client.ts", + "and we're connecting to a non-default endpoint, set scopes just in case", + "set scopes" + ) +s.replace(f"src/*/document_*_service_client.ts", + r"// Set the default scopes in auth client if needed(.|\n)*?}", + "" + ) # Copy common templates common_templates = gcp.CommonTemplates() diff --git a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts index 041a7e24d5d..5ab111e114d 100644 --- a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts @@ -18,8 +18,17 @@ import {DocumentProcessorServiceClient} from '@google-cloud/documentai'; +// check that the client class type name can be used +function doStuffWithDocumentProcessorServiceClient( + client: DocumentProcessorServiceClient +) { + client.close(); +} + function main() { - new DocumentProcessorServiceClient(); + // check that the client instance can be created + const documentProcessorServiceClient = new DocumentProcessorServiceClient(); + doStuffWithDocumentProcessorServiceClient(documentProcessorServiceClient); } main(); diff --git a/packages/google-cloud-documentai/system-test/install.ts b/packages/google-cloud-documentai/system-test/install.ts index 4c1ba3eb79a..39d90f771de 100644 --- a/packages/google-cloud-documentai/system-test/install.ts +++ b/packages/google-cloud-documentai/system-test/install.ts @@ -20,32 +20,32 @@ import {packNTest} from 'pack-n-play'; import {readFileSync} from 'fs'; import {describe, it} from 'mocha'; -describe('typescript consumer tests', () => { - it('should have correct type signature for typescript users', async function () { +describe('📦 pack-n-play test', () => { + it('TypeScript code', async function () { this.timeout(300000); const options = { - packageDir: process.cwd(), // path to your module. + packageDir: process.cwd(), sample: { - description: 'typescript based user can use the type definitions', + description: 'TypeScript user can use the type definitions', ts: readFileSync( './system-test/fixtures/sample/src/index.ts' ).toString(), }, }; - await packNTest(options); // will throw upon error. + await packNTest(options); }); - it('should have correct type signature for javascript users', async function () { + it('JavaScript code', async function () { this.timeout(300000); const options = { - packageDir: process.cwd(), // path to your module. + packageDir: process.cwd(), sample: { - description: 'typescript based user can use the type definitions', + description: 'JavaScript user can use the library', ts: readFileSync( './system-test/fixtures/sample/src/index.js' ).toString(), }, }; - await packNTest(options); // will throw upon error. + await packNTest(options); }); }); From 3d2ae05e4254d62fe081dbf1bbe326695751768a Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 11 Nov 2020 12:16:07 -0800 Subject: [PATCH 083/213] chore: release 2.2.1 (#128) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-documentai/CHANGELOG.md | 7 +++++++ packages/google-cloud-documentai/package.json | 2 +- packages/google-cloud-documentai/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index e062f1c109f..50d3d43e03a 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [2.2.1](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.2.0...v2.2.1) (2020-11-10) + + +### Bug Fixes + +* do not modify options object ([#125](https://www.github.com/googleapis/nodejs-document-ai/issues/125)) ([acd166f](https://www.github.com/googleapis/nodejs-document-ai/commit/acd166fab67c77101e6d0168d0a74a420fc3df6f)) + ## [2.2.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.1.1...v2.2.0) (2020-10-17) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 35454946c18..79873aa86d3 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "2.2.0", + "version": "2.2.1", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 2e26f1e7590..167966a7def 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^2.2.0", + "@google-cloud/documentai": "^2.2.1", "@google-cloud/storage": "^5.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" From 66470379ac5e3af7012f25477e0b05129b99563b Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 23 Nov 2020 12:41:12 -0800 Subject: [PATCH 084/213] fix(browser): check for fetch on window (#131) --- .../protos/protos.json | 137 ++++++++++++++++-- .../document_understanding_service_client.ts | 36 +++-- .../document_processor_service_client.ts | 46 +++--- .../google-cloud-documentai/synth.metadata | 10 +- 4 files changed, 182 insertions(+), 47 deletions(-) diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 7b8a50cceef..cb22a480e89 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -663,7 +663,28 @@ "(google.api.method_signature)": "requests", "(google.longrunning.operation_info).response_type": "BatchProcessDocumentsResponse", "(google.longrunning.operation_info).metadata_type": "OperationMetadata" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta2/{parent=projects/*/locations/*}/documents:batchProcess", + "body": "*", + "additional_bindings": { + "post": "/v1beta2/{parent=projects/*}/documents:batchProcess", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "requests" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "BatchProcessDocumentsResponse", + "metadata_type": "OperationMetadata" + } + } + ] }, "ProcessDocument": { "requestType": "ProcessDocumentRequest", @@ -673,7 +694,19 @@ "(google.api.http).body": "*", "(google.api.http).additional_bindings.post": "/v1beta2/{parent=projects/*}/documents:process", "(google.api.http).additional_bindings.body": "*" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta2/{parent=projects/*/locations/*}/documents:process", + "body": "*", + "additional_bindings": { + "post": "/v1beta2/{parent=projects/*}/documents:process", + "body": "*" + } + } + } + ] } } }, @@ -1861,7 +1894,18 @@ "(google.api.http).post": "/v1beta3/{name=projects/*/locations/*/processors/*}:process", "(google.api.http).body": "*", "(google.api.method_signature)": "name" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta3/{name=projects/*/locations/*/processors/*}:process", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + } + ] }, "BatchProcessDocuments": { "requestType": "BatchProcessRequest", @@ -1872,7 +1916,24 @@ "(google.api.method_signature)": "name", "(google.longrunning.operation_info).response_type": "BatchProcessResponse", "(google.longrunning.operation_info).metadata_type": "BatchProcessMetadata" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta3/{name=projects/*/locations/*/processors/*}:batchProcess", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "BatchProcessResponse", + "metadata_type": "BatchProcessMetadata" + } + } + ] }, "ReviewDocument": { "requestType": "ReviewDocumentRequest", @@ -1883,7 +1944,24 @@ "(google.api.method_signature)": "human_review_config", "(google.longrunning.operation_info).response_type": "ReviewDocumentResponse", "(google.longrunning.operation_info).metadata_type": "ReviewDocumentOperationMetadata" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta3/{human_review_config=projects/*/locations/*/processors/*/humanReviewConfig}:reviewDocument", + "body": "*" + } + }, + { + "(google.api.method_signature)": "human_review_config" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "ReviewDocumentResponse", + "metadata_type": "ReviewDocumentOperationMetadata" + } + } + ] } } }, @@ -3529,7 +3607,17 @@ "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", @@ -3537,7 +3625,17 @@ "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", @@ -3545,7 +3643,17 @@ "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", @@ -3554,7 +3662,18 @@ "(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", diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index e8dafa951f2..caf54b8c2d4 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -16,6 +16,7 @@ // ** 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, @@ -27,6 +28,11 @@ import { import * as path from 'path'; import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v1beta2/document_understanding_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ import * as gapicConfig from './document_understanding_service_client_config.json'; import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; @@ -82,9 +88,9 @@ export class DocumentUnderstandingServiceClient { * 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. - * TODO(@alexander-fenster): link to gax documentation. - * @param {boolean} fallback - Use HTTP fallback mode. + * @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` @@ -98,7 +104,9 @@ export class DocumentUnderstandingServiceClient { opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? typeof window !== 'undefined'; + 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 set scopes. @@ -314,7 +322,7 @@ export class DocumentUnderstandingServiceClient { // ------------------- processDocument( request: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.documentai.v1beta2.IDocument, @@ -327,7 +335,7 @@ export class DocumentUnderstandingServiceClient { >; processDocument( request: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.documentai.v1beta2.IDocument, | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest @@ -395,7 +403,7 @@ export class DocumentUnderstandingServiceClient { processDocument( request: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.documentai.v1beta2.IDocument, | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest @@ -421,12 +429,12 @@ export class DocumentUnderstandingServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -442,7 +450,7 @@ export class DocumentUnderstandingServiceClient { batchProcessDocuments( request: protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ LROperation< @@ -455,7 +463,7 @@ export class DocumentUnderstandingServiceClient { >; batchProcessDocuments( request: protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< LROperation< protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, @@ -506,7 +514,7 @@ export class DocumentUnderstandingServiceClient { batchProcessDocuments( request: protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< LROperation< protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, @@ -534,12 +542,12 @@ export class DocumentUnderstandingServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index bd5f0073df5..2c65f930d3c 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts @@ -16,6 +16,7 @@ // ** 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, @@ -27,6 +28,11 @@ import { import * as path from 'path'; import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v1beta3/document_processor_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ import * as gapicConfig from './document_processor_service_client_config.json'; import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; @@ -84,9 +90,9 @@ export class DocumentProcessorServiceClient { * 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. - * TODO(@alexander-fenster): link to gax documentation. - * @param {boolean} fallback - Use HTTP fallback mode. + * @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` @@ -100,7 +106,9 @@ export class DocumentProcessorServiceClient { opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? typeof window !== 'undefined'; + 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 set scopes. @@ -340,7 +348,7 @@ export class DocumentProcessorServiceClient { // ------------------- processDocument( request: protos.google.cloud.documentai.v1beta3.IProcessRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.documentai.v1beta3.IProcessResponse, @@ -350,7 +358,7 @@ export class DocumentProcessorServiceClient { >; processDocument( request: protos.google.cloud.documentai.v1beta3.IProcessRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.documentai.v1beta3.IProcessResponse, protos.google.cloud.documentai.v1beta3.IProcessRequest | null | undefined, @@ -390,7 +398,7 @@ export class DocumentProcessorServiceClient { processDocument( request: protos.google.cloud.documentai.v1beta3.IProcessRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.documentai.v1beta3.IProcessResponse, | protos.google.cloud.documentai.v1beta3.IProcessRequest @@ -411,12 +419,12 @@ export class DocumentProcessorServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -432,7 +440,7 @@ export class DocumentProcessorServiceClient { batchProcessDocuments( request: protos.google.cloud.documentai.v1beta3.IBatchProcessRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ LROperation< @@ -445,7 +453,7 @@ export class DocumentProcessorServiceClient { >; batchProcessDocuments( request: protos.google.cloud.documentai.v1beta3.IBatchProcessRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< LROperation< protos.google.cloud.documentai.v1beta3.IBatchProcessResponse, @@ -494,7 +502,7 @@ export class DocumentProcessorServiceClient { batchProcessDocuments( request: protos.google.cloud.documentai.v1beta3.IBatchProcessRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< LROperation< protos.google.cloud.documentai.v1beta3.IBatchProcessResponse, @@ -522,12 +530,12 @@ export class DocumentProcessorServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -579,7 +587,7 @@ export class DocumentProcessorServiceClient { } reviewDocument( request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ LROperation< @@ -592,7 +600,7 @@ export class DocumentProcessorServiceClient { >; reviewDocument( request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< LROperation< protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, @@ -640,7 +648,7 @@ export class DocumentProcessorServiceClient { reviewDocument( request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< LROperation< protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, @@ -668,12 +676,12 @@ export class DocumentProcessorServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 3daf7af190c..89b6cbdf068 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -3,16 +3,16 @@ { "git": { "name": ".", - "remote": "git@github.com:googleapis/nodejs-document-ai.git", - "sha": "74520d6a9c6bc8781c28c198f47babb3d373aa44" + "remote": "https://github.com/googleapis/nodejs-document-ai.git", + "sha": "dccd43e42c3fb8d0ae3a47b54c0c31cf434fe99d" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "8b159675150e6d8b149bc4db4540e574462bc4a2", - "internalRef": "341678368" + "sha": "5587028631d4d743fd906c4eb4e4e4649a7ee5ce", + "internalRef": "343187793" } }, { @@ -124,4 +124,4 @@ "tsconfig.json", "webpack.config.js" ] -} +} \ No newline at end of file From b152c3a929a027485b8e5059edeced1cce55fa2f Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 25 Nov 2020 08:34:40 -0800 Subject: [PATCH 085/213] docs: spelling correction for "targetting" (#133) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/5eabbdbe-8996-4c29-9e16-a28495ddf684/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/15013eff642a7e7e855aed5a29e6e83c39beba2a --- packages/google-cloud-documentai/README.md | 2 +- .../google-cloud-documentai/synth.metadata | 85 +------------------ 2 files changed, 3 insertions(+), 84 deletions(-) diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index dc14099163c..14fc15bd796 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -157,7 +157,7 @@ Our client libraries follow the [Node.js release schedule](https://nodejs.org/en Libraries are compatible with all current _active_ and _maintenance_ versions of Node.js. -Client libraries targetting some end-of-life versions of Node.js are available, and +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)`. diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 89b6cbdf068..2c672ca8b80 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "dccd43e42c3fb8d0ae3a47b54c0c31cf434fe99d" + "sha": "b7b016ed8c45c4da57cbe3eb652cd6b27f3be0f0" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "7db8a6c5ffb12a6e4c2f799c18f00f7f3d60e279" + "sha": "15013eff642a7e7e855aed5a29e6e83c39beba2a" } } ], @@ -42,86 +42,5 @@ "generator": "bazel" } } - ], - "generatedFiles": [ - ".eslintignore", - ".eslintrc.json", - ".gitattributes", - ".github/ISSUE_TEMPLATE/bug_report.md", - ".github/ISSUE_TEMPLATE/feature_request.md", - ".github/ISSUE_TEMPLATE/support_request.md", - ".github/PULL_REQUEST_TEMPLATE.md", - ".github/release-please.yml", - ".github/workflows/ci.yaml", - ".gitignore", - ".jsdoc.js", - ".kokoro/.gitattributes", - ".kokoro/common.cfg", - ".kokoro/continuous/node10/common.cfg", - ".kokoro/continuous/node10/docs.cfg", - ".kokoro/continuous/node10/test.cfg", - ".kokoro/continuous/node12/common.cfg", - ".kokoro/continuous/node12/lint.cfg", - ".kokoro/continuous/node12/samples-test.cfg", - ".kokoro/continuous/node12/system-test.cfg", - ".kokoro/continuous/node12/test.cfg", - ".kokoro/docs.sh", - ".kokoro/lint.sh", - ".kokoro/populate-secrets.sh", - ".kokoro/presubmit/node10/common.cfg", - ".kokoro/presubmit/node12/common.cfg", - ".kokoro/presubmit/node12/samples-test.cfg", - ".kokoro/presubmit/node12/system-test.cfg", - ".kokoro/presubmit/node12/test.cfg", - ".kokoro/publish.sh", - ".kokoro/release/docs-devsite.cfg", - ".kokoro/release/docs-devsite.sh", - ".kokoro/release/docs.cfg", - ".kokoro/release/docs.sh", - ".kokoro/release/publish.cfg", - ".kokoro/samples-test.sh", - ".kokoro/system-test.sh", - ".kokoro/test.bat", - ".kokoro/test.sh", - ".kokoro/trampoline.sh", - ".kokoro/trampoline_v2.sh", - ".mocharc.js", - ".nycrc", - ".prettierignore", - ".prettierrc.js", - ".trampolinerc", - "CODE_OF_CONDUCT.md", - "CONTRIBUTING.md", - "LICENSE", - "README.md", - "api-extractor.json", - "linkinator.config.json", - "protos/google/cloud/documentai/v1beta2/document.proto", - "protos/google/cloud/documentai/v1beta2/document_understanding.proto", - "protos/google/cloud/documentai/v1beta2/geometry.proto", - "protos/google/cloud/documentai/v1beta3/document.proto", - "protos/google/cloud/documentai/v1beta3/document_processor_service.proto", - "protos/google/cloud/documentai/v1beta3/geometry.proto", - "protos/protos.d.ts", - "protos/protos.js", - "protos/protos.json", - "renovate.json", - "samples/README.md", - "src/index.ts", - "src/v1beta2/document_understanding_service_client.ts", - "src/v1beta2/document_understanding_service_client_config.json", - "src/v1beta2/document_understanding_service_proto_list.json", - "src/v1beta2/index.ts", - "src/v1beta3/document_processor_service_client.ts", - "src/v1beta3/document_processor_service_client_config.json", - "src/v1beta3/document_processor_service_proto_list.json", - "src/v1beta3/index.ts", - "system-test/fixtures/sample/src/index.js", - "system-test/fixtures/sample/src/index.ts", - "system-test/install.ts", - "test/gapic_document_processor_service_v1beta3.ts", - "test/gapic_document_understanding_service_v1beta2.ts", - "tsconfig.json", - "webpack.config.js" ] } \ No newline at end of file From 0c7e2cd50896f69cb9a875e7fd50630838f254c4 Mon Sep 17 00:00:00 2001 From: Anu Date: Mon, 30 Nov 2020 15:57:17 +0000 Subject: [PATCH 086/213] docs: make projectId variable consistent in quickstart.js comments --- packages/google-cloud-documentai/samples/quickstart.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/samples/quickstart.js b/packages/google-cloud-documentai/samples/quickstart.js index 2d6c4a6fbb7..6f135c72bc4 100644 --- a/packages/google-cloud-documentai/samples/quickstart.js +++ b/packages/google-cloud-documentai/samples/quickstart.js @@ -22,7 +22,7 @@ async function main(projectId, location, processorId, filePath) { */ // const projectId = 'YOUR_PROJECT_ID'; // const location = 'YOUR_PROJECT_LOCATION'; // Format is 'us' or 'eu' - // const processor = 'YOUR_PROCESSOR_ID'; // Create processor in Cloud Console + // const processorId = 'YOUR_PROCESSOR_ID'; // Create processor in Cloud Console // const filePath = '/path/to/local/pdf'; const { From 9c24ff046600ecd1c6a410a76ff62180a07e3ddb Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 1 Dec 2020 09:32:01 -0800 Subject: [PATCH 087/213] docs: update README to reflect corrected variable name --- packages/google-cloud-documentai/README.md | 2 +- packages/google-cloud-documentai/synth.metadata | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index 14fc15bd796..c81dd1c37e8 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -63,7 +63,7 @@ npm install @google-cloud/documentai */ // const projectId = 'YOUR_PROJECT_ID'; // const location = 'YOUR_PROJECT_LOCATION'; // Format is 'us' or 'eu' -// const processor = 'YOUR_PROCESSOR_ID'; // Create processor in Cloud Console +// const processorId = 'YOUR_PROCESSOR_ID'; // Create processor in Cloud Console // const filePath = '/path/to/local/pdf'; const { diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 2c672ca8b80..8f0076aef18 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "b7b016ed8c45c4da57cbe3eb652cd6b27f3be0f0" + "sha": "aaedcdf5ffcc622b4ef65889f68f7f2719b7f5c8" } }, { From 405939cadbdad4242cee15f46133f39073eecbb3 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 2 Dec 2020 19:40:36 +0000 Subject: [PATCH 088/213] chore: release 2.2.2 (#132) :robot: I have created a release \*beep\* \*boop\* --- ### [2.2.2](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.2.1...v2.2.2) (2020-12-01) ### Bug Fixes * **browser:** check for fetch on window ([#131](https://www.github.com/googleapis/nodejs-document-ai/issues/131)) ([b7b016e](https://www.github.com/googleapis/nodejs-document-ai/commit/b7b016ed8c45c4da57cbe3eb652cd6b27f3be0f0)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). --- packages/google-cloud-documentai/CHANGELOG.md | 7 +++++++ packages/google-cloud-documentai/package.json | 2 +- packages/google-cloud-documentai/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index 50d3d43e03a..9f77f2659fd 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [2.2.2](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.2.1...v2.2.2) (2020-12-01) + + +### Bug Fixes + +* **browser:** check for fetch on window ([#131](https://www.github.com/googleapis/nodejs-document-ai/issues/131)) ([b7b016e](https://www.github.com/googleapis/nodejs-document-ai/commit/b7b016ed8c45c4da57cbe3eb652cd6b27f3be0f0)) + ### [2.2.1](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.2.0...v2.2.1) (2020-11-10) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 79873aa86d3..8f8851c0fdd 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "2.2.1", + "version": "2.2.2", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 167966a7def..1000e56b980 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^2.2.1", + "@google-cloud/documentai": "^2.2.2", "@google-cloud/storage": "^5.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" From 5175c0061d97d0e70131cada6fd8fa2738871b12 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 4 Dec 2020 08:56:12 -0800 Subject: [PATCH 089/213] chore: generate GAPIC metadata JSON file (#139) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/bca0aeb7-d7c6-4e0a-a65e-f13ab3f23aa9/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 345596855 Source-Link: https://github.com/googleapis/googleapis/commit/d189e871205fea665a9648f7c4676f027495ccaf --- .../src/v1beta2/gapic_metadata.json | 43 +++++++++++++++ .../src/v1beta3/gapic_metadata.json | 53 +++++++++++++++++++ .../google-cloud-documentai/synth.metadata | 6 +-- 3 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 packages/google-cloud-documentai/src/v1beta2/gapic_metadata.json create mode 100644 packages/google-cloud-documentai/src/v1beta3/gapic_metadata.json diff --git a/packages/google-cloud-documentai/src/v1beta2/gapic_metadata.json b/packages/google-cloud-documentai/src/v1beta2/gapic_metadata.json new file mode 100644 index 00000000000..49efed8a754 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta2/gapic_metadata.json @@ -0,0 +1,43 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.documentai.v1beta2", + "libraryPackage": "@google-cloud/documentai", + "services": { + "DocumentUnderstandingService": { + "clients": { + "grpc": { + "libraryClient": "DocumentUnderstandingServiceClient", + "rpcs": { + "ProcessDocument": { + "methods": [ + "processDocument" + ] + }, + "BatchProcessDocuments": { + "methods": [ + "batchProcessDocuments" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DocumentUnderstandingServiceClient", + "rpcs": { + "ProcessDocument": { + "methods": [ + "processDocument" + ] + }, + "BatchProcessDocuments": { + "methods": [ + "batchProcessDocuments" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-documentai/src/v1beta3/gapic_metadata.json b/packages/google-cloud-documentai/src/v1beta3/gapic_metadata.json new file mode 100644 index 00000000000..ce8f20a97ae --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta3/gapic_metadata.json @@ -0,0 +1,53 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.documentai.v1beta3", + "libraryPackage": "@google-cloud/documentai", + "services": { + "DocumentProcessorService": { + "clients": { + "grpc": { + "libraryClient": "DocumentProcessorServiceClient", + "rpcs": { + "ProcessDocument": { + "methods": [ + "processDocument" + ] + }, + "BatchProcessDocuments": { + "methods": [ + "batchProcessDocuments" + ] + }, + "ReviewDocument": { + "methods": [ + "reviewDocument" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DocumentProcessorServiceClient", + "rpcs": { + "ProcessDocument": { + "methods": [ + "processDocument" + ] + }, + "BatchProcessDocuments": { + "methods": [ + "batchProcessDocuments" + ] + }, + "ReviewDocument": { + "methods": [ + "reviewDocument" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 8f0076aef18..7be7647c9ea 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "aaedcdf5ffcc622b4ef65889f68f7f2719b7f5c8" + "sha": "b413eb95583b220032bcead161935fa2a5e929e8" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "5587028631d4d743fd906c4eb4e4e4649a7ee5ce", - "internalRef": "343187793" + "sha": "d189e871205fea665a9648f7c4676f027495ccaf", + "internalRef": "345596855" } }, { From 82b1f26d092c1c2185a228175ef7048162390ca6 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 22 Dec 2020 11:46:02 -0800 Subject: [PATCH 090/213] docs: add instructions for authenticating for system tests (#140) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/9610e861-65a2-4035-85ab-1303620c4597/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/363fe305e9ce34a6cd53951c6ee5f997094b54ee --- packages/google-cloud-documentai/CONTRIBUTING.md | 15 +++++++++++++-- packages/google-cloud-documentai/README.md | 3 +-- packages/google-cloud-documentai/synth.metadata | 4 ++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-documentai/CONTRIBUTING.md b/packages/google-cloud-documentai/CONTRIBUTING.md index f6c4cf010e3..7bd13312a09 100644 --- a/packages/google-cloud-documentai/CONTRIBUTING.md +++ b/packages/google-cloud-documentai/CONTRIBUTING.md @@ -37,6 +37,15 @@ accept your pull requests. 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. [Enable billing for your project][billing]. +1. [Enable the Document AI API][enable_api]. +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]. @@ -51,11 +60,9 @@ accept your pull requests. npm test # Run sample integration tests. - gcloud auth application-default login npm run samples-test # Run all system tests. - gcloud auth application-default login npm run system-test 1. Lint (and maybe fix) any changes: @@ -63,3 +70,7 @@ accept your pull requests. 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 +[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=documentai.googleapis.com +[auth]: https://cloud.google.com/docs/authentication/getting-started \ No newline at end of file diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index c81dd1c37e8..e02be017d68 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -131,8 +131,7 @@ async function quickstart() { ## Samples -Samples are in the [`samples/`](https://github.com/googleapis/nodejs-document-ai/tree/master/samples) directory. The samples' `README.md` -has instructions for running the samples. +Samples are in the [`samples/`](https://github.com/googleapis/nodejs-document-ai/tree/master/samples) directory. Each sample's `README.md` has instructions for running its sample. | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 7be7647c9ea..c28982d7632 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "b413eb95583b220032bcead161935fa2a5e929e8" + "sha": "9afc09090affb6f67774f3f4f962b2db1e2300f1" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "15013eff642a7e7e855aed5a29e6e83c39beba2a" + "sha": "363fe305e9ce34a6cd53951c6ee5f997094b54ee" } } ], From 521e027c5694223e29c4857f3e7f15eea33b033c Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 7 Jan 2021 11:42:20 -0800 Subject: [PATCH 091/213] docs: update dates (#142) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/39538a75-dd2e-4f49-b972-60368d19d19d/targets - [ ] To automatically regenerate this PR, check this box. --- packages/google-cloud-documentai/.jsdoc.js | 4 ++-- packages/google-cloud-documentai/protos/protos.d.ts | 2 +- packages/google-cloud-documentai/protos/protos.js | 2 +- .../src/v1beta2/document_understanding_service_client.ts | 2 +- packages/google-cloud-documentai/src/v1beta2/index.ts | 2 +- .../src/v1beta3/document_processor_service_client.ts | 2 +- packages/google-cloud-documentai/src/v1beta3/index.ts | 2 +- packages/google-cloud-documentai/synth.metadata | 2 +- .../system-test/fixtures/sample/src/index.js | 2 +- .../system-test/fixtures/sample/src/index.ts | 2 +- packages/google-cloud-documentai/system-test/install.ts | 2 +- .../test/gapic_document_processor_service_v1beta3.ts | 2 +- .../test/gapic_document_understanding_service_v1beta2.ts | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/google-cloud-documentai/.jsdoc.js b/packages/google-cloud-documentai/.jsdoc.js index 8b9a4964b53..a00b08ce270 100644 --- a/packages/google-cloud-documentai/.jsdoc.js +++ b/packages/google-cloud-documentai/.jsdoc.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. @@ -40,7 +40,7 @@ module.exports = { includePattern: '\\.js$' }, templates: { - copyright: 'Copyright 2020 Google LLC', + copyright: 'Copyright 2021 Google LLC', includeDate: false, sourceFiles: false, systemName: '@google-cloud/documentai', diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index dc18024d083..9721ab2b9f2 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -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-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 9d33bcf99f0..48a3287fe07 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.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. diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index caf54b8c2d4..efda8586957 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -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-documentai/src/v1beta2/index.ts b/packages/google-cloud-documentai/src/v1beta2/index.ts index 7ee10dea286..1a00861f815 100644 --- a/packages/google-cloud-documentai/src/v1beta2/index.ts +++ b/packages/google-cloud-documentai/src/v1beta2/index.ts @@ -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-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index 2c65f930d3c..4916c0eca73 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts @@ -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-documentai/src/v1beta3/index.ts b/packages/google-cloud-documentai/src/v1beta3/index.ts index b8f789abb74..2f6c91a4251 100644 --- a/packages/google-cloud-documentai/src/v1beta3/index.ts +++ b/packages/google-cloud-documentai/src/v1beta3/index.ts @@ -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-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index c28982d7632..0edae5a2668 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "9afc09090affb6f67774f3f4f962b2db1e2300f1" + "sha": "84b57bb4c960a5298e3820661464ff0324d8f819" } }, { diff --git a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js index f16d23c1e65..cb78c76f928 100644 --- a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.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. diff --git a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts index 5ab111e114d..d5d3a39fcdf 100644 --- a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts @@ -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-documentai/system-test/install.ts b/packages/google-cloud-documentai/system-test/install.ts index 39d90f771de..d2d61c0396f 100644 --- a/packages/google-cloud-documentai/system-test/install.ts +++ b/packages/google-cloud-documentai/system-test/install.ts @@ -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-documentai/test/gapic_document_processor_service_v1beta3.ts b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts index 4a6576f9015..b6dfbd2502c 100644 --- a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts @@ -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-documentai/test/gapic_document_understanding_service_v1beta2.ts b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts index d63dd5be679..c047c152e42 100644 --- a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts +++ b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts @@ -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 d3647b1fb38793af1d65909fcd815de5a934a6b7 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 8 Jan 2021 18:40:31 -0800 Subject: [PATCH 092/213] feat: adds style enumeration (#143) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/15862244-2697-4da9-a237-b292c9805d53/targets - [ ] To automatically regenerate this PR, check this box. --- .../protos/protos.d.ts | 12 +++ .../google-cloud-documentai/protos/protos.js | 78 ++++++++++++++++++- .../protos/protos.json | 13 +++- .../google-cloud-documentai/synth.metadata | 2 +- 4 files changed, 102 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 9721ab2b9f2..869e2e6deb4 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -10252,6 +10252,9 @@ export namespace google { /** ResourceDescriptor singular */ singular?: (string|null); + + /** ResourceDescriptor style */ + style?: (google.api.ResourceDescriptor.Style[]|null); } /** Represents a ResourceDescriptor. */ @@ -10281,6 +10284,9 @@ export namespace google { /** 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 @@ -10360,6 +10366,12 @@ export namespace google { ORIGINALLY_SINGLE_PATTERN = 1, FUTURE_MULTI_PATTERN = 2 } + + /** Style enum. */ + enum Style { + STYLE_UNSPECIFIED = 0, + DECLARATIVE_FRIENDLY = 1 + } } /** Properties of a ResourceReference. */ diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 48a3287fe07..36bb0e45687 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -26070,6 +26070,7 @@ * @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 */ /** @@ -26082,6 +26083,7 @@ */ 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) @@ -26136,6 +26138,14 @@ */ 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 @@ -26173,6 +26183,12 @@ 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; }; @@ -26227,6 +26243,16 @@ 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; @@ -26290,6 +26316,18 @@ 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; }; @@ -26334,6 +26372,23 @@ 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; }; @@ -26350,8 +26405,10 @@ if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) + if (options.arrays || options.defaults) { object.pattern = []; + object.style = []; + } if (options.defaults) { object.type = ""; object.nameField = ""; @@ -26374,6 +26431,11 @@ 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; }; @@ -26404,6 +26466,20 @@ 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; })(); diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index cb22a480e89..cb284148fff 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -2334,6 +2334,11 @@ "singular": { "type": "string", "id": 6 + }, + "style": { + "rule": "repeated", + "type": "Style", + "id": 10 } }, "nested": { @@ -2343,6 +2348,12 @@ "ORIGINALLY_SINGLE_PATTERN": 1, "FUTURE_MULTI_PATTERN": 2 } + }, + "Style": { + "values": { + "STYLE_UNSPECIFIED": 0, + "DECLARATIVE_FRIENDLY": 1 + } } } }, @@ -2362,7 +2373,7 @@ }, "protobuf": { "options": { - "go_package": "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor", + "go_package": "google.golang.org/protobuf/types/descriptorpb", "java_package": "com.google.protobuf", "java_outer_classname": "DescriptorProtos", "csharp_namespace": "Google.Protobuf.Reflection", diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 0edae5a2668..cfa1316011d 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "84b57bb4c960a5298e3820661464ff0324d8f819" + "sha": "ee23f21541437421f6bdc4d81086cbabf395bbe8" } }, { From 825c499a6c2568da187fe0005be21d2d8123ccb1 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 12 Jan 2021 18:36:27 +0000 Subject: [PATCH 093/213] chore: release 2.3.0 (#144) :robot: I have created a release \*beep\* \*boop\* --- ## [2.3.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.2.2...v2.3.0) (2021-01-09) ### Features * adds style enumeration ([#143](https://www.github.com/googleapis/nodejs-document-ai/issues/143)) ([0ed64c4](https://www.github.com/googleapis/nodejs-document-ai/commit/0ed64c40cb5908838348cb9c968841941114473c)) --- 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-documentai/CHANGELOG.md | 7 +++++++ packages/google-cloud-documentai/package.json | 2 +- packages/google-cloud-documentai/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index 9f77f2659fd..2d6b5175b8d 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [2.3.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.2.2...v2.3.0) (2021-01-09) + + +### Features + +* adds style enumeration ([#143](https://www.github.com/googleapis/nodejs-document-ai/issues/143)) ([0ed64c4](https://www.github.com/googleapis/nodejs-document-ai/commit/0ed64c40cb5908838348cb9c968841941114473c)) + ### [2.2.2](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.2.1...v2.2.2) (2020-12-01) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 8f8851c0fdd..b718c7f2e77 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "2.2.2", + "version": "2.3.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 1000e56b980..ee5d81f09a5 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^2.2.2", + "@google-cloud/documentai": "^2.3.0", "@google-cloud/storage": "^5.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" From a2e2dc13987434dc1014cd5308ce7050f915f3b9 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 27 Jan 2021 08:40:27 -0800 Subject: [PATCH 094/213] refactor(nodejs): move build cop to flakybot (#146) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/9fbf1b59-3d8b-4e65-9627-15e1bd83c6bf/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/57c23fa5705499a4181095ced81f0ee0933b64f6 --- packages/google-cloud-documentai/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index cfa1316011d..0a765a41b72 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "ee23f21541437421f6bdc4d81086cbabf395bbe8" + "sha": "1447d9169f6fee04d4aa0f733bd89d8f02d57280" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "363fe305e9ce34a6cd53951c6ee5f997094b54ee" + "sha": "57c23fa5705499a4181095ced81f0ee0933b64f6" } } ], From aa0eb1d3f8654a5644dd353283eb489d9ad62976 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Fri, 29 Jan 2021 11:40:41 -0800 Subject: [PATCH 095/213] build: update package name (#148) * fix name * build: update .repo-metadata name --- packages/google-cloud-documentai/.repo-metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/.repo-metadata.json b/packages/google-cloud-documentai/.repo-metadata.json index f9a566b5816..0ecb51b49de 100644 --- a/packages/google-cloud-documentai/.repo-metadata.json +++ b/packages/google-cloud-documentai/.repo-metadata.json @@ -1,5 +1,5 @@ { - "name": "@google-cloud/documentai", + "name": "documentai", "name_pretty": "Document AI", "product_documentation": "https://cloud.google.com/document-understanding/docs/", "client_documentation": "https://googleapis.dev/nodejs/documentai/latest/index.html", From 859f20041468987e4891c2d4f46611337371cadc Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Tue, 2 Feb 2021 17:54:19 -0800 Subject: [PATCH 096/213] chore: update CODEOWNERS config (#149) --- packages/google-cloud-documentai/.repo-metadata.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/.repo-metadata.json b/packages/google-cloud-documentai/.repo-metadata.json index 0ecb51b49de..f3f37281f69 100644 --- a/packages/google-cloud-documentai/.repo-metadata.json +++ b/packages/google-cloud-documentai/.repo-metadata.json @@ -9,5 +9,6 @@ "repo": "googleapis/nodejs-document-ai", "distribution_name": "@google-cloud/documentai", "api_id": "documentai.googleapis.com", - "requires_billing": true -} \ No newline at end of file + "requires_billing": true, + "codeowner_team": "@googleapis/ml-apis" +} From b3d650e59a1ef9b548df327b9939726b493e2425 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 3 Feb 2021 18:06:09 -0800 Subject: [PATCH 097/213] build: adds UNORDERED_LIST enum (#150) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/d54a068d-61f9-4f27-b46c-edc44b827fbe/targets - [ ] To automatically regenerate this PR, check this box. --- packages/google-cloud-documentai/protos/protos.d.ts | 3 ++- packages/google-cloud-documentai/protos/protos.js | 7 +++++++ packages/google-cloud-documentai/protos/protos.json | 3 ++- packages/google-cloud-documentai/synth.metadata | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 869e2e6deb4..8a9c0616b04 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -9890,7 +9890,8 @@ export namespace google { REQUIRED = 2, OUTPUT_ONLY = 3, INPUT_ONLY = 4, - IMMUTABLE = 5 + IMMUTABLE = 5, + UNORDERED_LIST = 6 } /** Properties of a Http. */ diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 36bb0e45687..c5a631999da 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -25142,6 +25142,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); @@ -25151,6 +25152,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; })(); @@ -32222,6 +32224,7 @@ case 3: case 4: case 5: + case 6: break; } } @@ -32322,6 +32325,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-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index cb284148fff..f8bca06b121 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -2186,7 +2186,8 @@ "REQUIRED": 2, "OUTPUT_ONLY": 3, "INPUT_ONLY": 4, - "IMMUTABLE": 5 + "IMMUTABLE": 5, + "UNORDERED_LIST": 6 } }, "http": { diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 0a765a41b72..3c4cb676b39 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "1447d9169f6fee04d4aa0f733bd89d8f02d57280" + "sha": "3f79ed0df10834530d0a8da77f25eb91654ebc57" } }, { From 22b6c3af09f6268148d4c0e25a86dbee92332632 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 17 Feb 2021 10:42:23 -0800 Subject: [PATCH 098/213] feat: Update documentai/v1beta3 protos (#152) PiperOrigin-RevId: 357825340 Source-Author: Google APIs Source-Date: Tue Feb 16 16:03:56 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 1f68cd0c02d6925e97aa5bbb153d70a70554dab0 Source-Link: https://github.com/googleapis/googleapis/commit/1f68cd0c02d6925e97aa5bbb153d70a70554dab0 --- .../documentai/v1beta3/document_io.proto | 86 + .../v1beta3/document_processor_service.proto | 125 +- .../protos/protos.d.ts | 952 ++++++ .../google-cloud-documentai/protos/protos.js | 2947 +++++++++++++++-- .../protos/protos.json | 232 +- .../document_processor_service_client.ts | 13 + ...document_processor_service_proto_list.json | 1 + .../google-cloud-documentai/synth.metadata | 6 +- 8 files changed, 4048 insertions(+), 314 deletions(-) create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.proto diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.proto new file mode 100644 index 00000000000..4b5439617e0 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.proto @@ -0,0 +1,86 @@ +// 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.documentai.v1beta3; + +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; +option java_multiple_files = true; +option java_outer_classname = "DocumentIoProto"; +option java_package = "com.google.cloud.documentai.v1beta3"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta3"; +option ruby_package = "Google::Cloud::DocumentAI::V1beta3"; + +// Payload message of raw document content (bytes). +message RawDocument { + // Inline document content. + bytes content = 1; + + // An IANA MIME type (RFC6838) indicating the nature and format of the + // [content]. + string mime_type = 2; +} + +// Specifies a document stored on Cloud Storage. +message GcsDocument { + // The Cloud Storage object uri. + string gcs_uri = 1; + + // An IANA MIME type (RFC6838) of the content. + string mime_type = 2; +} + +// Specifies a set of documents on Cloud Storage. +message GcsDocuments { + // The list of documents. + repeated GcsDocument documents = 1; +} + +// Specifies all documents on Cloud Storage with a common prefix. +message GcsPrefix { + // The URI prefix. + string gcs_uri_prefix = 1; +} + +// The common config to specify a set of documents used as input. +message BatchDocumentsInputConfig { + // The source. + oneof source { + // The set of documents that match the specified Cloud Storage [gcs_prefix]. + GcsPrefix gcs_prefix = 1; + + // The set of documents individually specified on Cloud Storage. + GcsDocuments gcs_documents = 2; + } +} + +// Config that controls the output of documents. All documents will be written +// as a JSON file. +message DocumentOutputConfig { + // The configuration used when outputting documents. + message GcsOutputConfig { + // The Cloud Storage uri (a directory) of the output. + string gcs_uri = 1; + } + + // The destination of the results. + oneof destination { + // Output config to write the results to Cloud Storage. + GcsOutputConfig gcs_output_config = 1; + } +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto index f90d7d04d04..7c37b406b35 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_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. @@ -21,6 +21,7 @@ import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/documentai/v1beta3/document.proto"; +import "google/cloud/documentai/v1beta3/document_io.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; @@ -99,6 +100,15 @@ service DocumentProcessorService { // Request message for the process document method. message ProcessRequest { + // The document payload. + oneof source { + // An inline document proto. + Document inline_document = 4; + + // A raw document content (bytes). + RawDocument raw_document = 5; + } + // Required. The processor resource name. string name = 1 [ (google.api.field_behavior) = REQUIRED, @@ -108,13 +118,49 @@ message ProcessRequest { ]; // The document payload, the [content] and [mime_type] fields must be set. - Document document = 2; + Document document = 2 [deprecated = true]; // Whether Human Review feature should be skipped for this request. Default to // false. bool skip_human_review = 3; } +// The status of human review on a processed document. +message HumanReviewStatus { + // The final state of human review on a processed document. + enum State { + // Human review state is unspecified. Most likely due to an internal error. + STATE_UNSPECIFIED = 0; + + // Human review is skipped for the document. This can happen because human + // review is not enabled on the processor or the processing request has + // been set to skip this document. + SKIPPED = 1; + + // Human review validation is triggered and passed, so no review is needed. + VALIDATION_PASSED = 2; + + // Human review validation is triggered and the document is under review. + IN_PROGRESS = 3; + + // Some error happened during triggering human review, see the + // [state_message] for details. + ERROR = 4; + } + + // The state of human review on the processing request. + State state = 1; + + // A message providing more details about the human review state. + string state_message = 2; + + // The name of the operation triggered by the processed document. This field + // is populated only when the [state] is [HUMAN_REVIEW_IN_PROGRESS]. It has + // the same response type and metadata as the long running operation returned + // by [ReviewDocument] method. + string human_review_operation = 3; +} + // Response message for the process document method. message ProcessResponse { // The document payload, will populate fields based on the processor's @@ -125,13 +171,18 @@ message ProcessResponse { // review process is not triggered, this field will be empty. It has the same // response type and metadata as the long running operation returned by // ReviewDocument method. - string human_review_operation = 2; + string human_review_operation = 2 [deprecated = true]; + + // The status of human review on the processed document. + HumanReviewStatus human_review_status = 3; } // Request message for batch process document method. message BatchProcessRequest { // The message for input config in batch process. message BatchInputConfig { + option deprecated = true; + // The Cloud Storage location as the source of the document. string gcs_source = 1; @@ -143,6 +194,8 @@ message BatchProcessRequest { // The message for output config in batch process. message BatchOutputConfig { + option deprecated = true; + // The output Cloud Storage directory to put the processed documents. string gcs_destination = 1; } @@ -156,10 +209,20 @@ message BatchProcessRequest { ]; // The input config for each single document in the batch process. - repeated BatchInputConfig input_configs = 2; + repeated BatchInputConfig input_configs = 2 [deprecated = true]; // The overall output config for batch process. - BatchOutputConfig output_config = 3; + BatchOutputConfig output_config = 3 [deprecated = true]; + + // The input documents for batch process. + BatchDocumentsInputConfig input_documents = 5; + + // The overall output config for batch process. + DocumentOutputConfig document_output_config = 6; + + // Whether Human Review feature should be skipped for this request. Default to + // false. + bool skip_human_review = 4; } // Response message for batch process document method. @@ -188,7 +251,10 @@ message BatchProcessMetadata { // human review process is not triggered, this field will be empty. It has // the same response type and metadata as the long running operation // returned by ReviewDocument method. - string human_review_operation = 4; + string human_review_operation = 4 [deprecated = true]; + + // The status of human review on the processed document. + HumanReviewStatus human_review_status = 5; } // Possible states of the batch processing operation. @@ -234,6 +300,12 @@ message BatchProcessMetadata { // Request message for review document method. message ReviewDocumentRequest { + // The document payload. + oneof source { + // An inline document proto. + Document inline_document = 4; + } + // Required. The resource name of the HumanReviewConfig that the document will be // reviewed with. string human_review_config = 1 [ @@ -244,7 +316,7 @@ message ReviewDocumentRequest { ]; // The document that needs human review. - Document document = 2; + Document document = 2 [deprecated = true]; } // Response message for review document method. @@ -288,4 +360,43 @@ message ReviewDocumentOperationMetadata { // The last update time of the operation. google.protobuf.Timestamp update_time = 4; + + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 5; +} + +// The common metadata for long running operations. +message CommonOperationMetadata { + // State of the longrunning operation. + enum State { + // Unspecified state. + STATE_UNSPECIFIED = 0; + + // Operation is still running. + RUNNING = 1; + + // Operation is being cancelled. + CANCELLING = 2; + + // Operation succeeded. + SUCCEEDED = 3; + + // Operation failed. + FAILED = 4; + + // Operation is cancelled. + CANCELLED = 5; + } + + // The state of the operation. + State state = 1; + + // A message providing more details about the current state of processing. + string state_message = 2; + + // The creation time of the operation. + google.protobuf.Timestamp create_time = 3; + + // The last update time of the operation. + google.protobuf.Timestamp update_time = 4; } diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 8a9c0616b04..e6bce5d70a3 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -8674,6 +8674,663 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of a RawDocument. */ + interface IRawDocument { + + /** RawDocument content */ + content?: (Uint8Array|string|null); + + /** RawDocument mimeType */ + mimeType?: (string|null); + } + + /** Represents a RawDocument. */ + class RawDocument implements IRawDocument { + + /** + * Constructs a new RawDocument. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IRawDocument); + + /** RawDocument content. */ + public content: (Uint8Array|string); + + /** RawDocument mimeType. */ + public mimeType: string; + + /** + * Creates a new RawDocument instance using the specified properties. + * @param [properties] Properties to set + * @returns RawDocument instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IRawDocument): google.cloud.documentai.v1beta3.RawDocument; + + /** + * Encodes the specified RawDocument message. Does not implicitly {@link google.cloud.documentai.v1beta3.RawDocument.verify|verify} messages. + * @param message RawDocument message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IRawDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RawDocument message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.RawDocument.verify|verify} messages. + * @param message RawDocument message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IRawDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RawDocument message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RawDocument + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.RawDocument; + + /** + * Decodes a RawDocument message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RawDocument + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.RawDocument; + + /** + * Verifies a RawDocument message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RawDocument message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RawDocument + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.RawDocument; + + /** + * Creates a plain object from a RawDocument message. Also converts values to other types if specified. + * @param message RawDocument + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.RawDocument, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RawDocument to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GcsDocument. */ + interface IGcsDocument { + + /** GcsDocument gcsUri */ + gcsUri?: (string|null); + + /** GcsDocument mimeType */ + mimeType?: (string|null); + } + + /** Represents a GcsDocument. */ + class GcsDocument implements IGcsDocument { + + /** + * Constructs a new GcsDocument. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IGcsDocument); + + /** GcsDocument gcsUri. */ + public gcsUri: string; + + /** GcsDocument mimeType. */ + public mimeType: string; + + /** + * Creates a new GcsDocument instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsDocument instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IGcsDocument): google.cloud.documentai.v1beta3.GcsDocument; + + /** + * Encodes the specified GcsDocument message. Does not implicitly {@link google.cloud.documentai.v1beta3.GcsDocument.verify|verify} messages. + * @param message GcsDocument message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IGcsDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsDocument message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.GcsDocument.verify|verify} messages. + * @param message GcsDocument message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IGcsDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsDocument message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsDocument + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.GcsDocument; + + /** + * Decodes a GcsDocument message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsDocument + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.GcsDocument; + + /** + * Verifies a GcsDocument message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GcsDocument message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsDocument + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.GcsDocument; + + /** + * Creates a plain object from a GcsDocument message. Also converts values to other types if specified. + * @param message GcsDocument + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.GcsDocument, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsDocument to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GcsDocuments. */ + interface IGcsDocuments { + + /** GcsDocuments documents */ + documents?: (google.cloud.documentai.v1beta3.IGcsDocument[]|null); + } + + /** Represents a GcsDocuments. */ + class GcsDocuments implements IGcsDocuments { + + /** + * Constructs a new GcsDocuments. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IGcsDocuments); + + /** GcsDocuments documents. */ + public documents: google.cloud.documentai.v1beta3.IGcsDocument[]; + + /** + * Creates a new GcsDocuments instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsDocuments instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IGcsDocuments): google.cloud.documentai.v1beta3.GcsDocuments; + + /** + * Encodes the specified GcsDocuments message. Does not implicitly {@link google.cloud.documentai.v1beta3.GcsDocuments.verify|verify} messages. + * @param message GcsDocuments message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IGcsDocuments, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsDocuments message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.GcsDocuments.verify|verify} messages. + * @param message GcsDocuments message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IGcsDocuments, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsDocuments message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsDocuments + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.GcsDocuments; + + /** + * Decodes a GcsDocuments message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsDocuments + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.GcsDocuments; + + /** + * Verifies a GcsDocuments message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GcsDocuments message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsDocuments + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.GcsDocuments; + + /** + * Creates a plain object from a GcsDocuments message. Also converts values to other types if specified. + * @param message GcsDocuments + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.GcsDocuments, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsDocuments to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GcsPrefix. */ + interface IGcsPrefix { + + /** GcsPrefix gcsUriPrefix */ + gcsUriPrefix?: (string|null); + } + + /** Represents a GcsPrefix. */ + class GcsPrefix implements IGcsPrefix { + + /** + * Constructs a new GcsPrefix. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IGcsPrefix); + + /** GcsPrefix gcsUriPrefix. */ + public gcsUriPrefix: string; + + /** + * Creates a new GcsPrefix instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsPrefix instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IGcsPrefix): google.cloud.documentai.v1beta3.GcsPrefix; + + /** + * Encodes the specified GcsPrefix message. Does not implicitly {@link google.cloud.documentai.v1beta3.GcsPrefix.verify|verify} messages. + * @param message GcsPrefix message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IGcsPrefix, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsPrefix message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.GcsPrefix.verify|verify} messages. + * @param message GcsPrefix message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IGcsPrefix, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsPrefix message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsPrefix + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.GcsPrefix; + + /** + * Decodes a GcsPrefix message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsPrefix + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.GcsPrefix; + + /** + * Verifies a GcsPrefix message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GcsPrefix message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsPrefix + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.GcsPrefix; + + /** + * Creates a plain object from a GcsPrefix message. Also converts values to other types if specified. + * @param message GcsPrefix + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.GcsPrefix, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsPrefix to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BatchDocumentsInputConfig. */ + interface IBatchDocumentsInputConfig { + + /** BatchDocumentsInputConfig gcsPrefix */ + gcsPrefix?: (google.cloud.documentai.v1beta3.IGcsPrefix|null); + + /** BatchDocumentsInputConfig gcsDocuments */ + gcsDocuments?: (google.cloud.documentai.v1beta3.IGcsDocuments|null); + } + + /** Represents a BatchDocumentsInputConfig. */ + class BatchDocumentsInputConfig implements IBatchDocumentsInputConfig { + + /** + * Constructs a new BatchDocumentsInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig); + + /** BatchDocumentsInputConfig gcsPrefix. */ + public gcsPrefix?: (google.cloud.documentai.v1beta3.IGcsPrefix|null); + + /** BatchDocumentsInputConfig gcsDocuments. */ + public gcsDocuments?: (google.cloud.documentai.v1beta3.IGcsDocuments|null); + + /** BatchDocumentsInputConfig source. */ + public source?: ("gcsPrefix"|"gcsDocuments"); + + /** + * Creates a new BatchDocumentsInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchDocumentsInputConfig instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig): google.cloud.documentai.v1beta3.BatchDocumentsInputConfig; + + /** + * Encodes the specified BatchDocumentsInputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.verify|verify} messages. + * @param message BatchDocumentsInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchDocumentsInputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.verify|verify} messages. + * @param message BatchDocumentsInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchDocumentsInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchDocumentsInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.BatchDocumentsInputConfig; + + /** + * Decodes a BatchDocumentsInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchDocumentsInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.BatchDocumentsInputConfig; + + /** + * Verifies a BatchDocumentsInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchDocumentsInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchDocumentsInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.BatchDocumentsInputConfig; + + /** + * Creates a plain object from a BatchDocumentsInputConfig message. Also converts values to other types if specified. + * @param message BatchDocumentsInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.BatchDocumentsInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchDocumentsInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DocumentOutputConfig. */ + interface IDocumentOutputConfig { + + /** DocumentOutputConfig gcsOutputConfig */ + gcsOutputConfig?: (google.cloud.documentai.v1beta3.DocumentOutputConfig.IGcsOutputConfig|null); + } + + /** Represents a DocumentOutputConfig. */ + class DocumentOutputConfig implements IDocumentOutputConfig { + + /** + * Constructs a new DocumentOutputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IDocumentOutputConfig); + + /** DocumentOutputConfig gcsOutputConfig. */ + public gcsOutputConfig?: (google.cloud.documentai.v1beta3.DocumentOutputConfig.IGcsOutputConfig|null); + + /** DocumentOutputConfig destination. */ + public destination?: "gcsOutputConfig"; + + /** + * Creates a new DocumentOutputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentOutputConfig instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IDocumentOutputConfig): google.cloud.documentai.v1beta3.DocumentOutputConfig; + + /** + * Encodes the specified DocumentOutputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentOutputConfig.verify|verify} messages. + * @param message DocumentOutputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IDocumentOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentOutputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentOutputConfig.verify|verify} messages. + * @param message DocumentOutputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDocumentOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentOutputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DocumentOutputConfig; + + /** + * Decodes a DocumentOutputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DocumentOutputConfig; + + /** + * Verifies a DocumentOutputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentOutputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentOutputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DocumentOutputConfig; + + /** + * Creates a plain object from a DocumentOutputConfig message. Also converts values to other types if specified. + * @param message DocumentOutputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DocumentOutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentOutputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace DocumentOutputConfig { + + /** Properties of a GcsOutputConfig. */ + interface IGcsOutputConfig { + + /** GcsOutputConfig gcsUri */ + gcsUri?: (string|null); + } + + /** Represents a GcsOutputConfig. */ + class GcsOutputConfig implements IGcsOutputConfig { + + /** + * Constructs a new GcsOutputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.DocumentOutputConfig.IGcsOutputConfig); + + /** GcsOutputConfig gcsUri. */ + public gcsUri: string; + + /** + * Creates a new GcsOutputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsOutputConfig instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.DocumentOutputConfig.IGcsOutputConfig): google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig; + + /** + * Encodes the specified GcsOutputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.verify|verify} messages. + * @param message GcsOutputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.DocumentOutputConfig.IGcsOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsOutputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.verify|verify} messages. + * @param message GcsOutputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.DocumentOutputConfig.IGcsOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsOutputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig; + + /** + * Decodes a GcsOutputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig; + + /** + * Verifies a GcsOutputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GcsOutputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsOutputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig; + + /** + * Creates a plain object from a GcsOutputConfig message. Also converts values to other types if specified. + * @param message GcsOutputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsOutputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + /** Represents a DocumentProcessorService */ class DocumentProcessorService extends $protobuf.rpc.Service { @@ -8764,6 +9421,12 @@ export namespace google { /** Properties of a ProcessRequest. */ interface IProcessRequest { + /** ProcessRequest inlineDocument */ + inlineDocument?: (google.cloud.documentai.v1beta3.IDocument|null); + + /** ProcessRequest rawDocument */ + rawDocument?: (google.cloud.documentai.v1beta3.IRawDocument|null); + /** ProcessRequest name */ name?: (string|null); @@ -8783,6 +9446,12 @@ export namespace google { */ constructor(properties?: google.cloud.documentai.v1beta3.IProcessRequest); + /** ProcessRequest inlineDocument. */ + public inlineDocument?: (google.cloud.documentai.v1beta3.IDocument|null); + + /** ProcessRequest rawDocument. */ + public rawDocument?: (google.cloud.documentai.v1beta3.IRawDocument|null); + /** ProcessRequest name. */ public name: string; @@ -8792,6 +9461,9 @@ export namespace google { /** ProcessRequest skipHumanReview. */ public skipHumanReview: boolean; + /** ProcessRequest source. */ + public source?: ("inlineDocument"|"rawDocument"); + /** * Creates a new ProcessRequest instance using the specified properties. * @param [properties] Properties to set @@ -8863,6 +9535,120 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of a HumanReviewStatus. */ + interface IHumanReviewStatus { + + /** HumanReviewStatus state */ + state?: (google.cloud.documentai.v1beta3.HumanReviewStatus.State|keyof typeof google.cloud.documentai.v1beta3.HumanReviewStatus.State|null); + + /** HumanReviewStatus stateMessage */ + stateMessage?: (string|null); + + /** HumanReviewStatus humanReviewOperation */ + humanReviewOperation?: (string|null); + } + + /** Represents a HumanReviewStatus. */ + class HumanReviewStatus implements IHumanReviewStatus { + + /** + * Constructs a new HumanReviewStatus. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IHumanReviewStatus); + + /** HumanReviewStatus state. */ + public state: (google.cloud.documentai.v1beta3.HumanReviewStatus.State|keyof typeof google.cloud.documentai.v1beta3.HumanReviewStatus.State); + + /** HumanReviewStatus stateMessage. */ + public stateMessage: string; + + /** HumanReviewStatus humanReviewOperation. */ + public humanReviewOperation: string; + + /** + * Creates a new HumanReviewStatus instance using the specified properties. + * @param [properties] Properties to set + * @returns HumanReviewStatus instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IHumanReviewStatus): google.cloud.documentai.v1beta3.HumanReviewStatus; + + /** + * Encodes the specified HumanReviewStatus message. Does not implicitly {@link google.cloud.documentai.v1beta3.HumanReviewStatus.verify|verify} messages. + * @param message HumanReviewStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IHumanReviewStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HumanReviewStatus message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.HumanReviewStatus.verify|verify} messages. + * @param message HumanReviewStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IHumanReviewStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HumanReviewStatus message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HumanReviewStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.HumanReviewStatus; + + /** + * Decodes a HumanReviewStatus message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HumanReviewStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.HumanReviewStatus; + + /** + * Verifies a HumanReviewStatus message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HumanReviewStatus message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HumanReviewStatus + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.HumanReviewStatus; + + /** + * Creates a plain object from a HumanReviewStatus message. Also converts values to other types if specified. + * @param message HumanReviewStatus + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.HumanReviewStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HumanReviewStatus to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace HumanReviewStatus { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + SKIPPED = 1, + VALIDATION_PASSED = 2, + IN_PROGRESS = 3, + ERROR = 4 + } + } + /** Properties of a ProcessResponse. */ interface IProcessResponse { @@ -8871,6 +9657,9 @@ export namespace google { /** ProcessResponse humanReviewOperation */ humanReviewOperation?: (string|null); + + /** ProcessResponse humanReviewStatus */ + humanReviewStatus?: (google.cloud.documentai.v1beta3.IHumanReviewStatus|null); } /** Represents a ProcessResponse. */ @@ -8888,6 +9677,9 @@ export namespace google { /** ProcessResponse humanReviewOperation. */ public humanReviewOperation: string; + /** ProcessResponse humanReviewStatus. */ + public humanReviewStatus?: (google.cloud.documentai.v1beta3.IHumanReviewStatus|null); + /** * Creates a new ProcessResponse instance using the specified properties. * @param [properties] Properties to set @@ -8970,6 +9762,15 @@ export namespace google { /** BatchProcessRequest outputConfig */ outputConfig?: (google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchOutputConfig|null); + + /** BatchProcessRequest inputDocuments */ + inputDocuments?: (google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig|null); + + /** BatchProcessRequest documentOutputConfig */ + documentOutputConfig?: (google.cloud.documentai.v1beta3.IDocumentOutputConfig|null); + + /** BatchProcessRequest skipHumanReview */ + skipHumanReview?: (boolean|null); } /** Represents a BatchProcessRequest. */ @@ -8990,6 +9791,15 @@ export namespace google { /** BatchProcessRequest outputConfig. */ public outputConfig?: (google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchOutputConfig|null); + /** BatchProcessRequest inputDocuments. */ + public inputDocuments?: (google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig|null); + + /** BatchProcessRequest documentOutputConfig. */ + public documentOutputConfig?: (google.cloud.documentai.v1beta3.IDocumentOutputConfig|null); + + /** BatchProcessRequest skipHumanReview. */ + public skipHumanReview: boolean; + /** * Creates a new BatchProcessRequest instance using the specified properties. * @param [properties] Properties to set @@ -9464,6 +10274,9 @@ export namespace google { /** IndividualProcessStatus humanReviewOperation */ humanReviewOperation?: (string|null); + + /** IndividualProcessStatus humanReviewStatus */ + humanReviewStatus?: (google.cloud.documentai.v1beta3.IHumanReviewStatus|null); } /** Represents an IndividualProcessStatus. */ @@ -9487,6 +10300,9 @@ export namespace google { /** IndividualProcessStatus humanReviewOperation. */ public humanReviewOperation: string; + /** IndividualProcessStatus humanReviewStatus. */ + public humanReviewStatus?: (google.cloud.documentai.v1beta3.IHumanReviewStatus|null); + /** * Creates a new IndividualProcessStatus instance using the specified properties. * @param [properties] Properties to set @@ -9573,6 +10389,9 @@ export namespace google { /** Properties of a ReviewDocumentRequest. */ interface IReviewDocumentRequest { + /** ReviewDocumentRequest inlineDocument */ + inlineDocument?: (google.cloud.documentai.v1beta3.IDocument|null); + /** ReviewDocumentRequest humanReviewConfig */ humanReviewConfig?: (string|null); @@ -9589,12 +10408,18 @@ export namespace google { */ constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentRequest); + /** ReviewDocumentRequest inlineDocument. */ + public inlineDocument?: (google.cloud.documentai.v1beta3.IDocument|null); + /** ReviewDocumentRequest humanReviewConfig. */ public humanReviewConfig: string; /** ReviewDocumentRequest document. */ public document?: (google.cloud.documentai.v1beta3.IDocument|null); + /** ReviewDocumentRequest source. */ + public source?: "inlineDocument"; + /** * Creates a new ReviewDocumentRequest instance using the specified properties. * @param [properties] Properties to set @@ -9770,6 +10595,9 @@ export namespace google { /** ReviewDocumentOperationMetadata updateTime */ updateTime?: (google.protobuf.ITimestamp|null); + + /** ReviewDocumentOperationMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); } /** Represents a ReviewDocumentOperationMetadata. */ @@ -9793,6 +10621,9 @@ export namespace google { /** ReviewDocumentOperationMetadata updateTime. */ public updateTime?: (google.protobuf.ITimestamp|null); + /** ReviewDocumentOperationMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + /** * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. * @param [properties] Properties to set @@ -9876,6 +10707,127 @@ export namespace google { CANCELLED = 5 } } + + /** Properties of a CommonOperationMetadata. */ + interface ICommonOperationMetadata { + + /** CommonOperationMetadata state */ + state?: (google.cloud.documentai.v1beta3.CommonOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.CommonOperationMetadata.State|null); + + /** CommonOperationMetadata stateMessage */ + stateMessage?: (string|null); + + /** CommonOperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** CommonOperationMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a CommonOperationMetadata. */ + class CommonOperationMetadata implements ICommonOperationMetadata { + + /** + * Constructs a new CommonOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.ICommonOperationMetadata); + + /** CommonOperationMetadata state. */ + public state: (google.cloud.documentai.v1beta3.CommonOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.CommonOperationMetadata.State); + + /** CommonOperationMetadata stateMessage. */ + public stateMessage: string; + + /** CommonOperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** CommonOperationMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new CommonOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns CommonOperationMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.ICommonOperationMetadata): google.cloud.documentai.v1beta3.CommonOperationMetadata; + + /** + * Encodes the specified CommonOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.CommonOperationMetadata.verify|verify} messages. + * @param message CommonOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.ICommonOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CommonOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.CommonOperationMetadata.verify|verify} messages. + * @param message CommonOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.ICommonOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CommonOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CommonOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.CommonOperationMetadata; + + /** + * Decodes a CommonOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CommonOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.CommonOperationMetadata; + + /** + * Verifies a CommonOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CommonOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CommonOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.CommonOperationMetadata; + + /** + * Creates a plain object from a CommonOperationMetadata message. Also converts values to other types if specified. + * @param message CommonOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.CommonOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CommonOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace CommonOperationMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + CANCELLING = 2, + SUCCEEDED = 3, + FAILED = 4, + CANCELLED = 5 + } + } } } } diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index c5a631999da..437ba439479 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -22362,160 +22362,1945 @@ return BoundingPoly; })(); - v1beta3.DocumentProcessorService = (function() { + v1beta3.RawDocument = (function() { /** - * Constructs a new DocumentProcessorService service. + * Properties of a RawDocument. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a DocumentProcessorService - * @extends $protobuf.rpc.Service + * @interface IRawDocument + * @property {Uint8Array|null} [content] RawDocument content + * @property {string|null} [mimeType] RawDocument mimeType + */ + + /** + * Constructs a new RawDocument. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a RawDocument. + * @implements IRawDocument * @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.documentai.v1beta3.IRawDocument=} [properties] Properties to set */ - function DocumentProcessorService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + function RawDocument(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - (DocumentProcessorService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = DocumentProcessorService; + /** + * RawDocument content. + * @member {Uint8Array} content + * @memberof google.cloud.documentai.v1beta3.RawDocument + * @instance + */ + RawDocument.prototype.content = $util.newBuffer([]); /** - * Creates new DocumentProcessorService service using the specified rpc implementation. + * RawDocument mimeType. + * @member {string} mimeType + * @memberof google.cloud.documentai.v1beta3.RawDocument + * @instance + */ + RawDocument.prototype.mimeType = ""; + + /** + * Creates a new RawDocument instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @memberof google.cloud.documentai.v1beta3.RawDocument * @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 {DocumentProcessorService} RPC service. Useful where requests and/or responses are streamed. + * @param {google.cloud.documentai.v1beta3.IRawDocument=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.RawDocument} RawDocument instance */ - DocumentProcessorService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); + RawDocument.create = function create(properties) { + return new RawDocument(properties); }; /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#processDocument}. - * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService - * @typedef ProcessDocumentCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.documentai.v1beta3.ProcessResponse} [response] ProcessResponse + * Encodes the specified RawDocument message. Does not implicitly {@link google.cloud.documentai.v1beta3.RawDocument.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.RawDocument + * @static + * @param {google.cloud.documentai.v1beta3.IRawDocument} message RawDocument message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ + RawDocument.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.content != null && Object.hasOwnProperty.call(message, "content")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.content); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); + return writer; + }; /** - * Calls ProcessDocument. - * @function processDocument - * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService - * @instance - * @param {google.cloud.documentai.v1beta3.IProcessRequest} request ProcessRequest message or plain object - * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.ProcessDocumentCallback} callback Node-style callback called with the error, if any, and ProcessResponse - * @returns {undefined} - * @variation 1 + * Encodes the specified RawDocument message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.RawDocument.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.RawDocument + * @static + * @param {google.cloud.documentai.v1beta3.IRawDocument} message RawDocument message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Object.defineProperty(DocumentProcessorService.prototype.processDocument = function processDocument(request, callback) { - return this.rpcCall(processDocument, $root.google.cloud.documentai.v1beta3.ProcessRequest, $root.google.cloud.documentai.v1beta3.ProcessResponse, request, callback); - }, "name", { value: "ProcessDocument" }); + RawDocument.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Calls ProcessDocument. - * @function processDocument - * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * Decodes a RawDocument message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.RawDocument + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.RawDocument} RawDocument + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RawDocument.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.RawDocument(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.content = reader.bytes(); + break; + case 2: + message.mimeType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RawDocument message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.RawDocument + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.RawDocument} RawDocument + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RawDocument.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RawDocument message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.RawDocument + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RawDocument.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.content != null && message.hasOwnProperty("content")) + if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) + return "content: buffer expected"; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + return null; + }; + + /** + * Creates a RawDocument message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.RawDocument + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.RawDocument} RawDocument + */ + RawDocument.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.RawDocument) + return object; + var message = new $root.google.cloud.documentai.v1beta3.RawDocument(); + if (object.content != null) + if (typeof object.content === "string") + $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); + else if (object.content.length) + message.content = object.content; + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + return message; + }; + + /** + * Creates a plain object from a RawDocument message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.RawDocument + * @static + * @param {google.cloud.documentai.v1beta3.RawDocument} message RawDocument + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RawDocument.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.content = ""; + else { + object.content = []; + if (options.bytes !== Array) + object.content = $util.newBuffer(object.content); + } + object.mimeType = ""; + } + if (message.content != null && message.hasOwnProperty("content")) + object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + return object; + }; + + /** + * Converts this RawDocument to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.RawDocument * @instance - * @param {google.cloud.documentai.v1beta3.IProcessRequest} request ProcessRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * @returns {Object.} JSON object */ + RawDocument.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RawDocument; + })(); + + v1beta3.GcsDocument = (function() { /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#batchProcessDocuments}. - * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService - * @typedef BatchProcessDocumentsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Properties of a GcsDocument. + * @memberof google.cloud.documentai.v1beta3 + * @interface IGcsDocument + * @property {string|null} [gcsUri] GcsDocument gcsUri + * @property {string|null} [mimeType] GcsDocument mimeType */ /** - * Calls BatchProcessDocuments. - * @function batchProcessDocuments - * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * Constructs a new GcsDocument. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a GcsDocument. + * @implements IGcsDocument + * @constructor + * @param {google.cloud.documentai.v1beta3.IGcsDocument=} [properties] Properties to set + */ + function GcsDocument(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GcsDocument gcsUri. + * @member {string} gcsUri + * @memberof google.cloud.documentai.v1beta3.GcsDocument * @instance - * @param {google.cloud.documentai.v1beta3.IBatchProcessRequest} request BatchProcessRequest message or plain object - * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.BatchProcessDocumentsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 */ - Object.defineProperty(DocumentProcessorService.prototype.batchProcessDocuments = function batchProcessDocuments(request, callback) { - return this.rpcCall(batchProcessDocuments, $root.google.cloud.documentai.v1beta3.BatchProcessRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "BatchProcessDocuments" }); + GcsDocument.prototype.gcsUri = ""; /** - * Calls BatchProcessDocuments. - * @function batchProcessDocuments - * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * GcsDocument mimeType. + * @member {string} mimeType + * @memberof google.cloud.documentai.v1beta3.GcsDocument * @instance - * @param {google.cloud.documentai.v1beta3.IBatchProcessRequest} request BatchProcessRequest message or plain object - * @returns {Promise} Promise - * @variation 2 */ + GcsDocument.prototype.mimeType = ""; /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#reviewDocument}. - * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService - * @typedef ReviewDocumentCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Creates a new GcsDocument instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.GcsDocument + * @static + * @param {google.cloud.documentai.v1beta3.IGcsDocument=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.GcsDocument} GcsDocument instance */ + GcsDocument.create = function create(properties) { + return new GcsDocument(properties); + }; /** - * Calls ReviewDocument. - * @function reviewDocument - * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService - * @instance - * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} request ReviewDocumentRequest message or plain object - * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.ReviewDocumentCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 + * Encodes the specified GcsDocument message. Does not implicitly {@link google.cloud.documentai.v1beta3.GcsDocument.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.GcsDocument + * @static + * @param {google.cloud.documentai.v1beta3.IGcsDocument} message GcsDocument message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Object.defineProperty(DocumentProcessorService.prototype.reviewDocument = function reviewDocument(request, callback) { - return this.rpcCall(reviewDocument, $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ReviewDocument" }); + GcsDocument.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsUri != null && Object.hasOwnProperty.call(message, "gcsUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsUri); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); + return writer; + }; + + /** + * Encodes the specified GcsDocument message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.GcsDocument.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.GcsDocument + * @static + * @param {google.cloud.documentai.v1beta3.IGcsDocument} message GcsDocument message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsDocument.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GcsDocument message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.GcsDocument + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.GcsDocument} GcsDocument + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsDocument.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.GcsDocument(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsUri = reader.string(); + break; + case 2: + message.mimeType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GcsDocument message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.GcsDocument + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.GcsDocument} GcsDocument + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsDocument.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GcsDocument message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.GcsDocument + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsDocument.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.gcsUri != null && message.hasOwnProperty("gcsUri")) + if (!$util.isString(message.gcsUri)) + return "gcsUri: string expected"; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + return null; + }; + + /** + * Creates a GcsDocument message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.GcsDocument + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.GcsDocument} GcsDocument + */ + GcsDocument.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.GcsDocument) + return object; + var message = new $root.google.cloud.documentai.v1beta3.GcsDocument(); + if (object.gcsUri != null) + message.gcsUri = String(object.gcsUri); + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + return message; + }; + + /** + * Creates a plain object from a GcsDocument message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.GcsDocument + * @static + * @param {google.cloud.documentai.v1beta3.GcsDocument} message GcsDocument + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsDocument.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.gcsUri = ""; + object.mimeType = ""; + } + if (message.gcsUri != null && message.hasOwnProperty("gcsUri")) + object.gcsUri = message.gcsUri; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + return object; + }; + + /** + * Converts this GcsDocument to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.GcsDocument + * @instance + * @returns {Object.} JSON object + */ + GcsDocument.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GcsDocument; + })(); + + v1beta3.GcsDocuments = (function() { + + /** + * Properties of a GcsDocuments. + * @memberof google.cloud.documentai.v1beta3 + * @interface IGcsDocuments + * @property {Array.|null} [documents] GcsDocuments documents + */ + + /** + * Constructs a new GcsDocuments. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a GcsDocuments. + * @implements IGcsDocuments + * @constructor + * @param {google.cloud.documentai.v1beta3.IGcsDocuments=} [properties] Properties to set + */ + function GcsDocuments(properties) { + this.documents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GcsDocuments documents. + * @member {Array.} documents + * @memberof google.cloud.documentai.v1beta3.GcsDocuments + * @instance + */ + GcsDocuments.prototype.documents = $util.emptyArray; + + /** + * Creates a new GcsDocuments instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.GcsDocuments + * @static + * @param {google.cloud.documentai.v1beta3.IGcsDocuments=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.GcsDocuments} GcsDocuments instance + */ + GcsDocuments.create = function create(properties) { + return new GcsDocuments(properties); + }; + + /** + * Encodes the specified GcsDocuments message. Does not implicitly {@link google.cloud.documentai.v1beta3.GcsDocuments.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.GcsDocuments + * @static + * @param {google.cloud.documentai.v1beta3.IGcsDocuments} message GcsDocuments message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsDocuments.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.documents != null && message.documents.length) + for (var i = 0; i < message.documents.length; ++i) + $root.google.cloud.documentai.v1beta3.GcsDocument.encode(message.documents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GcsDocuments message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.GcsDocuments.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.GcsDocuments + * @static + * @param {google.cloud.documentai.v1beta3.IGcsDocuments} message GcsDocuments message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsDocuments.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GcsDocuments message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.GcsDocuments + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.GcsDocuments} GcsDocuments + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsDocuments.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.GcsDocuments(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.documents && message.documents.length)) + message.documents = []; + message.documents.push($root.google.cloud.documentai.v1beta3.GcsDocument.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GcsDocuments message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.GcsDocuments + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.GcsDocuments} GcsDocuments + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsDocuments.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GcsDocuments message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.GcsDocuments + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsDocuments.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.documents != null && message.hasOwnProperty("documents")) { + if (!Array.isArray(message.documents)) + return "documents: array expected"; + for (var i = 0; i < message.documents.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.GcsDocument.verify(message.documents[i]); + if (error) + return "documents." + error; + } + } + return null; + }; + + /** + * Creates a GcsDocuments message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.GcsDocuments + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.GcsDocuments} GcsDocuments + */ + GcsDocuments.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.GcsDocuments) + return object; + var message = new $root.google.cloud.documentai.v1beta3.GcsDocuments(); + if (object.documents) { + if (!Array.isArray(object.documents)) + throw TypeError(".google.cloud.documentai.v1beta3.GcsDocuments.documents: array expected"); + message.documents = []; + for (var i = 0; i < object.documents.length; ++i) { + if (typeof object.documents[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.GcsDocuments.documents: object expected"); + message.documents[i] = $root.google.cloud.documentai.v1beta3.GcsDocument.fromObject(object.documents[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GcsDocuments message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.GcsDocuments + * @static + * @param {google.cloud.documentai.v1beta3.GcsDocuments} message GcsDocuments + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsDocuments.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.documents = []; + if (message.documents && message.documents.length) { + object.documents = []; + for (var j = 0; j < message.documents.length; ++j) + object.documents[j] = $root.google.cloud.documentai.v1beta3.GcsDocument.toObject(message.documents[j], options); + } + return object; + }; + + /** + * Converts this GcsDocuments to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.GcsDocuments + * @instance + * @returns {Object.} JSON object + */ + GcsDocuments.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GcsDocuments; + })(); + + v1beta3.GcsPrefix = (function() { + + /** + * Properties of a GcsPrefix. + * @memberof google.cloud.documentai.v1beta3 + * @interface IGcsPrefix + * @property {string|null} [gcsUriPrefix] GcsPrefix gcsUriPrefix + */ + + /** + * Constructs a new GcsPrefix. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a GcsPrefix. + * @implements IGcsPrefix + * @constructor + * @param {google.cloud.documentai.v1beta3.IGcsPrefix=} [properties] Properties to set + */ + function GcsPrefix(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GcsPrefix gcsUriPrefix. + * @member {string} gcsUriPrefix + * @memberof google.cloud.documentai.v1beta3.GcsPrefix + * @instance + */ + GcsPrefix.prototype.gcsUriPrefix = ""; + + /** + * Creates a new GcsPrefix instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.GcsPrefix + * @static + * @param {google.cloud.documentai.v1beta3.IGcsPrefix=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.GcsPrefix} GcsPrefix instance + */ + GcsPrefix.create = function create(properties) { + return new GcsPrefix(properties); + }; + + /** + * Encodes the specified GcsPrefix message. Does not implicitly {@link google.cloud.documentai.v1beta3.GcsPrefix.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.GcsPrefix + * @static + * @param {google.cloud.documentai.v1beta3.IGcsPrefix} message GcsPrefix message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsPrefix.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsUriPrefix != null && Object.hasOwnProperty.call(message, "gcsUriPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsUriPrefix); + return writer; + }; + + /** + * Encodes the specified GcsPrefix message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.GcsPrefix.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.GcsPrefix + * @static + * @param {google.cloud.documentai.v1beta3.IGcsPrefix} message GcsPrefix message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsPrefix.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GcsPrefix message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.GcsPrefix + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.GcsPrefix} GcsPrefix + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsPrefix.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.GcsPrefix(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsUriPrefix = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GcsPrefix message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.GcsPrefix + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.GcsPrefix} GcsPrefix + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsPrefix.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GcsPrefix message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.GcsPrefix + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsPrefix.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.gcsUriPrefix != null && message.hasOwnProperty("gcsUriPrefix")) + if (!$util.isString(message.gcsUriPrefix)) + return "gcsUriPrefix: string expected"; + return null; + }; + + /** + * Creates a GcsPrefix message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.GcsPrefix + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.GcsPrefix} GcsPrefix + */ + GcsPrefix.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.GcsPrefix) + return object; + var message = new $root.google.cloud.documentai.v1beta3.GcsPrefix(); + if (object.gcsUriPrefix != null) + message.gcsUriPrefix = String(object.gcsUriPrefix); + return message; + }; + + /** + * Creates a plain object from a GcsPrefix message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.GcsPrefix + * @static + * @param {google.cloud.documentai.v1beta3.GcsPrefix} message GcsPrefix + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsPrefix.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.gcsUriPrefix = ""; + if (message.gcsUriPrefix != null && message.hasOwnProperty("gcsUriPrefix")) + object.gcsUriPrefix = message.gcsUriPrefix; + return object; + }; + + /** + * Converts this GcsPrefix to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.GcsPrefix + * @instance + * @returns {Object.} JSON object + */ + GcsPrefix.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GcsPrefix; + })(); + + v1beta3.BatchDocumentsInputConfig = (function() { + + /** + * Properties of a BatchDocumentsInputConfig. + * @memberof google.cloud.documentai.v1beta3 + * @interface IBatchDocumentsInputConfig + * @property {google.cloud.documentai.v1beta3.IGcsPrefix|null} [gcsPrefix] BatchDocumentsInputConfig gcsPrefix + * @property {google.cloud.documentai.v1beta3.IGcsDocuments|null} [gcsDocuments] BatchDocumentsInputConfig gcsDocuments + */ + + /** + * Constructs a new BatchDocumentsInputConfig. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a BatchDocumentsInputConfig. + * @implements IBatchDocumentsInputConfig + * @constructor + * @param {google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig=} [properties] Properties to set + */ + function BatchDocumentsInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchDocumentsInputConfig gcsPrefix. + * @member {google.cloud.documentai.v1beta3.IGcsPrefix|null|undefined} gcsPrefix + * @memberof google.cloud.documentai.v1beta3.BatchDocumentsInputConfig + * @instance + */ + BatchDocumentsInputConfig.prototype.gcsPrefix = null; + + /** + * BatchDocumentsInputConfig gcsDocuments. + * @member {google.cloud.documentai.v1beta3.IGcsDocuments|null|undefined} gcsDocuments + * @memberof google.cloud.documentai.v1beta3.BatchDocumentsInputConfig + * @instance + */ + BatchDocumentsInputConfig.prototype.gcsDocuments = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BatchDocumentsInputConfig source. + * @member {"gcsPrefix"|"gcsDocuments"|undefined} source + * @memberof google.cloud.documentai.v1beta3.BatchDocumentsInputConfig + * @instance + */ + Object.defineProperty(BatchDocumentsInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["gcsPrefix", "gcsDocuments"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BatchDocumentsInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.BatchDocumentsInputConfig + * @static + * @param {google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.BatchDocumentsInputConfig} BatchDocumentsInputConfig instance + */ + BatchDocumentsInputConfig.create = function create(properties) { + return new BatchDocumentsInputConfig(properties); + }; + + /** + * Encodes the specified BatchDocumentsInputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.BatchDocumentsInputConfig + * @static + * @param {google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig} message BatchDocumentsInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDocumentsInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) + $root.google.cloud.documentai.v1beta3.GcsPrefix.encode(message.gcsPrefix, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsDocuments != null && Object.hasOwnProperty.call(message, "gcsDocuments")) + $root.google.cloud.documentai.v1beta3.GcsDocuments.encode(message.gcsDocuments, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchDocumentsInputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.BatchDocumentsInputConfig + * @static + * @param {google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig} message BatchDocumentsInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDocumentsInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchDocumentsInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.BatchDocumentsInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.BatchDocumentsInputConfig} BatchDocumentsInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDocumentsInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsPrefix = $root.google.cloud.documentai.v1beta3.GcsPrefix.decode(reader, reader.uint32()); + break; + case 2: + message.gcsDocuments = $root.google.cloud.documentai.v1beta3.GcsDocuments.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchDocumentsInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.BatchDocumentsInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.BatchDocumentsInputConfig} BatchDocumentsInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDocumentsInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchDocumentsInputConfig message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.BatchDocumentsInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchDocumentsInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + properties.source = 1; + { + var error = $root.google.cloud.documentai.v1beta3.GcsPrefix.verify(message.gcsPrefix); + if (error) + return "gcsPrefix." + error; + } + } + if (message.gcsDocuments != null && message.hasOwnProperty("gcsDocuments")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.documentai.v1beta3.GcsDocuments.verify(message.gcsDocuments); + if (error) + return "gcsDocuments." + error; + } + } + return null; + }; + + /** + * Creates a BatchDocumentsInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.BatchDocumentsInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.BatchDocumentsInputConfig} BatchDocumentsInputConfig + */ + BatchDocumentsInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig) + return object; + var message = new $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig(); + if (object.gcsPrefix != null) { + if (typeof object.gcsPrefix !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.gcsPrefix: object expected"); + message.gcsPrefix = $root.google.cloud.documentai.v1beta3.GcsPrefix.fromObject(object.gcsPrefix); + } + if (object.gcsDocuments != null) { + if (typeof object.gcsDocuments !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.gcsDocuments: object expected"); + message.gcsDocuments = $root.google.cloud.documentai.v1beta3.GcsDocuments.fromObject(object.gcsDocuments); + } + return message; + }; + + /** + * Creates a plain object from a BatchDocumentsInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.BatchDocumentsInputConfig + * @static + * @param {google.cloud.documentai.v1beta3.BatchDocumentsInputConfig} message BatchDocumentsInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchDocumentsInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + object.gcsPrefix = $root.google.cloud.documentai.v1beta3.GcsPrefix.toObject(message.gcsPrefix, options); + if (options.oneofs) + object.source = "gcsPrefix"; + } + if (message.gcsDocuments != null && message.hasOwnProperty("gcsDocuments")) { + object.gcsDocuments = $root.google.cloud.documentai.v1beta3.GcsDocuments.toObject(message.gcsDocuments, options); + if (options.oneofs) + object.source = "gcsDocuments"; + } + return object; + }; + + /** + * Converts this BatchDocumentsInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.BatchDocumentsInputConfig + * @instance + * @returns {Object.} JSON object + */ + BatchDocumentsInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BatchDocumentsInputConfig; + })(); + + v1beta3.DocumentOutputConfig = (function() { + + /** + * Properties of a DocumentOutputConfig. + * @memberof google.cloud.documentai.v1beta3 + * @interface IDocumentOutputConfig + * @property {google.cloud.documentai.v1beta3.DocumentOutputConfig.IGcsOutputConfig|null} [gcsOutputConfig] DocumentOutputConfig gcsOutputConfig + */ + + /** + * Constructs a new DocumentOutputConfig. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a DocumentOutputConfig. + * @implements IDocumentOutputConfig + * @constructor + * @param {google.cloud.documentai.v1beta3.IDocumentOutputConfig=} [properties] Properties to set + */ + function DocumentOutputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentOutputConfig gcsOutputConfig. + * @member {google.cloud.documentai.v1beta3.DocumentOutputConfig.IGcsOutputConfig|null|undefined} gcsOutputConfig + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig + * @instance + */ + DocumentOutputConfig.prototype.gcsOutputConfig = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * DocumentOutputConfig destination. + * @member {"gcsOutputConfig"|undefined} destination + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig + * @instance + */ + Object.defineProperty(DocumentOutputConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsOutputConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new DocumentOutputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig + * @static + * @param {google.cloud.documentai.v1beta3.IDocumentOutputConfig=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DocumentOutputConfig} DocumentOutputConfig instance + */ + DocumentOutputConfig.create = function create(properties) { + return new DocumentOutputConfig(properties); + }; + + /** + * Encodes the specified DocumentOutputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentOutputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig + * @static + * @param {google.cloud.documentai.v1beta3.IDocumentOutputConfig} message DocumentOutputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentOutputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsOutputConfig != null && Object.hasOwnProperty.call(message, "gcsOutputConfig")) + $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.encode(message.gcsOutputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DocumentOutputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentOutputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig + * @static + * @param {google.cloud.documentai.v1beta3.IDocumentOutputConfig} message DocumentOutputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentOutputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DocumentOutputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DocumentOutputConfig} DocumentOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentOutputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DocumentOutputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsOutputConfig = $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentOutputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DocumentOutputConfig} DocumentOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentOutputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentOutputConfig message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentOutputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.gcsOutputConfig != null && message.hasOwnProperty("gcsOutputConfig")) { + properties.destination = 1; + { + var error = $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.verify(message.gcsOutputConfig); + if (error) + return "gcsOutputConfig." + error; + } + } + return null; + }; + + /** + * Creates a DocumentOutputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DocumentOutputConfig} DocumentOutputConfig + */ + DocumentOutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DocumentOutputConfig) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DocumentOutputConfig(); + if (object.gcsOutputConfig != null) { + if (typeof object.gcsOutputConfig !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.DocumentOutputConfig.gcsOutputConfig: object expected"); + message.gcsOutputConfig = $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.fromObject(object.gcsOutputConfig); + } + return message; + }; + + /** + * Creates a plain object from a DocumentOutputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig + * @static + * @param {google.cloud.documentai.v1beta3.DocumentOutputConfig} message DocumentOutputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentOutputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsOutputConfig != null && message.hasOwnProperty("gcsOutputConfig")) { + object.gcsOutputConfig = $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.toObject(message.gcsOutputConfig, options); + if (options.oneofs) + object.destination = "gcsOutputConfig"; + } + return object; + }; + + /** + * Converts this DocumentOutputConfig to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig + * @instance + * @returns {Object.} JSON object + */ + DocumentOutputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + DocumentOutputConfig.GcsOutputConfig = (function() { + + /** + * Properties of a GcsOutputConfig. + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig + * @interface IGcsOutputConfig + * @property {string|null} [gcsUri] GcsOutputConfig gcsUri + */ + + /** + * Constructs a new GcsOutputConfig. + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig + * @classdesc Represents a GcsOutputConfig. + * @implements IGcsOutputConfig + * @constructor + * @param {google.cloud.documentai.v1beta3.DocumentOutputConfig.IGcsOutputConfig=} [properties] Properties to set + */ + function GcsOutputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GcsOutputConfig gcsUri. + * @member {string} gcsUri + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig + * @instance + */ + GcsOutputConfig.prototype.gcsUri = ""; + + /** + * Creates a new GcsOutputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig + * @static + * @param {google.cloud.documentai.v1beta3.DocumentOutputConfig.IGcsOutputConfig=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig} GcsOutputConfig instance + */ + GcsOutputConfig.create = function create(properties) { + return new GcsOutputConfig(properties); + }; + + /** + * Encodes the specified GcsOutputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig + * @static + * @param {google.cloud.documentai.v1beta3.DocumentOutputConfig.IGcsOutputConfig} message GcsOutputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsOutputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsUri != null && Object.hasOwnProperty.call(message, "gcsUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsUri); + return writer; + }; + + /** + * Encodes the specified GcsOutputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig + * @static + * @param {google.cloud.documentai.v1beta3.DocumentOutputConfig.IGcsOutputConfig} message GcsOutputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsOutputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GcsOutputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig} GcsOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsOutputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsUri = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GcsOutputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig} GcsOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsOutputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GcsOutputConfig message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsOutputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.gcsUri != null && message.hasOwnProperty("gcsUri")) + if (!$util.isString(message.gcsUri)) + return "gcsUri: string expected"; + return null; + }; + + /** + * Creates a GcsOutputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig} GcsOutputConfig + */ + GcsOutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig(); + if (object.gcsUri != null) + message.gcsUri = String(object.gcsUri); + return message; + }; + + /** + * Creates a plain object from a GcsOutputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig + * @static + * @param {google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig} message GcsOutputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsOutputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.gcsUri = ""; + if (message.gcsUri != null && message.hasOwnProperty("gcsUri")) + object.gcsUri = message.gcsUri; + return object; + }; + + /** + * Converts this GcsOutputConfig to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig + * @instance + * @returns {Object.} JSON object + */ + GcsOutputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GcsOutputConfig; + })(); + + return DocumentOutputConfig; + })(); + + v1beta3.DocumentProcessorService = (function() { + + /** + * Constructs a new DocumentProcessorService service. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a DocumentProcessorService + * @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 DocumentProcessorService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (DocumentProcessorService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = DocumentProcessorService; + + /** + * Creates new DocumentProcessorService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @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 {DocumentProcessorService} RPC service. Useful where requests and/or responses are streamed. + */ + DocumentProcessorService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#processDocument}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef ProcessDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1beta3.ProcessResponse} [response] ProcessResponse + */ + + /** + * Calls ProcessDocument. + * @function processDocument + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IProcessRequest} request ProcessRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.ProcessDocumentCallback} callback Node-style callback called with the error, if any, and ProcessResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.processDocument = function processDocument(request, callback) { + return this.rpcCall(processDocument, $root.google.cloud.documentai.v1beta3.ProcessRequest, $root.google.cloud.documentai.v1beta3.ProcessResponse, request, callback); + }, "name", { value: "ProcessDocument" }); + + /** + * Calls ProcessDocument. + * @function processDocument + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IProcessRequest} request ProcessRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#batchProcessDocuments}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef BatchProcessDocumentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchProcessDocuments. + * @function batchProcessDocuments + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IBatchProcessRequest} request BatchProcessRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.BatchProcessDocumentsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.batchProcessDocuments = function batchProcessDocuments(request, callback) { + return this.rpcCall(batchProcessDocuments, $root.google.cloud.documentai.v1beta3.BatchProcessRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchProcessDocuments" }); + + /** + * Calls BatchProcessDocuments. + * @function batchProcessDocuments + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IBatchProcessRequest} request BatchProcessRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#reviewDocument}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef ReviewDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ReviewDocument. + * @function reviewDocument + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} request ReviewDocumentRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.ReviewDocumentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.reviewDocument = function reviewDocument(request, callback) { + return this.rpcCall(reviewDocument, $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ReviewDocument" }); + + /** + * Calls ReviewDocument. + * @function reviewDocument + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} request ReviewDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return DocumentProcessorService; + })(); + + v1beta3.ProcessRequest = (function() { + + /** + * Properties of a ProcessRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IProcessRequest + * @property {google.cloud.documentai.v1beta3.IDocument|null} [inlineDocument] ProcessRequest inlineDocument + * @property {google.cloud.documentai.v1beta3.IRawDocument|null} [rawDocument] ProcessRequest rawDocument + * @property {string|null} [name] ProcessRequest name + * @property {google.cloud.documentai.v1beta3.IDocument|null} [document] ProcessRequest document + * @property {boolean|null} [skipHumanReview] ProcessRequest skipHumanReview + */ + + /** + * Constructs a new ProcessRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ProcessRequest. + * @implements IProcessRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.IProcessRequest=} [properties] Properties to set + */ + function ProcessRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProcessRequest inlineDocument. + * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} inlineDocument + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @instance + */ + ProcessRequest.prototype.inlineDocument = null; + + /** + * ProcessRequest rawDocument. + * @member {google.cloud.documentai.v1beta3.IRawDocument|null|undefined} rawDocument + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @instance + */ + ProcessRequest.prototype.rawDocument = null; + + /** + * ProcessRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @instance + */ + ProcessRequest.prototype.name = ""; + + /** + * ProcessRequest document. + * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} document + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @instance + */ + ProcessRequest.prototype.document = null; + + /** + * ProcessRequest skipHumanReview. + * @member {boolean} skipHumanReview + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @instance + */ + ProcessRequest.prototype.skipHumanReview = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ProcessRequest source. + * @member {"inlineDocument"|"rawDocument"|undefined} source + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @instance + */ + Object.defineProperty(ProcessRequest.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["inlineDocument", "rawDocument"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ProcessRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @static + * @param {google.cloud.documentai.v1beta3.IProcessRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ProcessRequest} ProcessRequest instance + */ + ProcessRequest.create = function create(properties) { + return new ProcessRequest(properties); + }; + + /** + * Encodes the specified ProcessRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @static + * @param {google.cloud.documentai.v1beta3.IProcessRequest} message ProcessRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessRequest.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.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.cloud.documentai.v1beta3.Document.encode(message.document, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.skipHumanReview != null && Object.hasOwnProperty.call(message, "skipHumanReview")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.skipHumanReview); + if (message.inlineDocument != null && Object.hasOwnProperty.call(message, "inlineDocument")) + $root.google.cloud.documentai.v1beta3.Document.encode(message.inlineDocument, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.rawDocument != null && Object.hasOwnProperty.call(message, "rawDocument")) + $root.google.cloud.documentai.v1beta3.RawDocument.encode(message.rawDocument, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProcessRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @static + * @param {google.cloud.documentai.v1beta3.IProcessRequest} message ProcessRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProcessRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ProcessRequest} ProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ProcessRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + message.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); + break; + case 5: + message.rawDocument = $root.google.cloud.documentai.v1beta3.RawDocument.decode(reader, reader.uint32()); + break; + case 1: + message.name = reader.string(); + break; + case 2: + message.document = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); + break; + case 3: + message.skipHumanReview = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProcessRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ProcessRequest} ProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProcessRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProcessRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { + properties.source = 1; + { + var error = $root.google.cloud.documentai.v1beta3.Document.verify(message.inlineDocument); + if (error) + return "inlineDocument." + error; + } + } + if (message.rawDocument != null && message.hasOwnProperty("rawDocument")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.documentai.v1beta3.RawDocument.verify(message.rawDocument); + if (error) + return "rawDocument." + error; + } + } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.document != null && message.hasOwnProperty("document")) { + var error = $root.google.cloud.documentai.v1beta3.Document.verify(message.document); + if (error) + return "document." + error; + } + if (message.skipHumanReview != null && message.hasOwnProperty("skipHumanReview")) + if (typeof message.skipHumanReview !== "boolean") + return "skipHumanReview: boolean expected"; + return null; + }; + + /** + * Creates a ProcessRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ProcessRequest} ProcessRequest + */ + ProcessRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ProcessRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ProcessRequest(); + if (object.inlineDocument != null) { + if (typeof object.inlineDocument !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ProcessRequest.inlineDocument: object expected"); + message.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.fromObject(object.inlineDocument); + } + if (object.rawDocument != null) { + if (typeof object.rawDocument !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ProcessRequest.rawDocument: object expected"); + message.rawDocument = $root.google.cloud.documentai.v1beta3.RawDocument.fromObject(object.rawDocument); + } + if (object.name != null) + message.name = String(object.name); + if (object.document != null) { + if (typeof object.document !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ProcessRequest.document: object expected"); + message.document = $root.google.cloud.documentai.v1beta3.Document.fromObject(object.document); + } + if (object.skipHumanReview != null) + message.skipHumanReview = Boolean(object.skipHumanReview); + return message; + }; + + /** + * Creates a plain object from a ProcessRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @static + * @param {google.cloud.documentai.v1beta3.ProcessRequest} message ProcessRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProcessRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.document = null; + object.skipHumanReview = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.document != null && message.hasOwnProperty("document")) + object.document = $root.google.cloud.documentai.v1beta3.Document.toObject(message.document, options); + if (message.skipHumanReview != null && message.hasOwnProperty("skipHumanReview")) + object.skipHumanReview = message.skipHumanReview; + if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { + object.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.toObject(message.inlineDocument, options); + if (options.oneofs) + object.source = "inlineDocument"; + } + if (message.rawDocument != null && message.hasOwnProperty("rawDocument")) { + object.rawDocument = $root.google.cloud.documentai.v1beta3.RawDocument.toObject(message.rawDocument, options); + if (options.oneofs) + object.source = "rawDocument"; + } + return object; + }; /** - * Calls ReviewDocument. - * @function reviewDocument - * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * Converts this ProcessRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ProcessRequest * @instance - * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} request ReviewDocumentRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * @returns {Object.} JSON object */ + ProcessRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return DocumentProcessorService; + return ProcessRequest; })(); - v1beta3.ProcessRequest = (function() { + v1beta3.HumanReviewStatus = (function() { /** - * Properties of a ProcessRequest. + * Properties of a HumanReviewStatus. * @memberof google.cloud.documentai.v1beta3 - * @interface IProcessRequest - * @property {string|null} [name] ProcessRequest name - * @property {google.cloud.documentai.v1beta3.IDocument|null} [document] ProcessRequest document - * @property {boolean|null} [skipHumanReview] ProcessRequest skipHumanReview + * @interface IHumanReviewStatus + * @property {google.cloud.documentai.v1beta3.HumanReviewStatus.State|null} [state] HumanReviewStatus state + * @property {string|null} [stateMessage] HumanReviewStatus stateMessage + * @property {string|null} [humanReviewOperation] HumanReviewStatus humanReviewOperation */ /** - * Constructs a new ProcessRequest. + * Constructs a new HumanReviewStatus. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a ProcessRequest. - * @implements IProcessRequest + * @classdesc Represents a HumanReviewStatus. + * @implements IHumanReviewStatus * @constructor - * @param {google.cloud.documentai.v1beta3.IProcessRequest=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IHumanReviewStatus=} [properties] Properties to set */ - function ProcessRequest(properties) { + function HumanReviewStatus(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -22523,101 +24308,101 @@ } /** - * ProcessRequest name. - * @member {string} name - * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * HumanReviewStatus state. + * @member {google.cloud.documentai.v1beta3.HumanReviewStatus.State} state + * @memberof google.cloud.documentai.v1beta3.HumanReviewStatus * @instance */ - ProcessRequest.prototype.name = ""; + HumanReviewStatus.prototype.state = 0; /** - * ProcessRequest document. - * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} document - * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * HumanReviewStatus stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1beta3.HumanReviewStatus * @instance */ - ProcessRequest.prototype.document = null; + HumanReviewStatus.prototype.stateMessage = ""; /** - * ProcessRequest skipHumanReview. - * @member {boolean} skipHumanReview - * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * HumanReviewStatus humanReviewOperation. + * @member {string} humanReviewOperation + * @memberof google.cloud.documentai.v1beta3.HumanReviewStatus * @instance */ - ProcessRequest.prototype.skipHumanReview = false; + HumanReviewStatus.prototype.humanReviewOperation = ""; /** - * Creates a new ProcessRequest instance using the specified properties. + * Creates a new HumanReviewStatus instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @memberof google.cloud.documentai.v1beta3.HumanReviewStatus * @static - * @param {google.cloud.documentai.v1beta3.IProcessRequest=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.ProcessRequest} ProcessRequest instance + * @param {google.cloud.documentai.v1beta3.IHumanReviewStatus=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.HumanReviewStatus} HumanReviewStatus instance */ - ProcessRequest.create = function create(properties) { - return new ProcessRequest(properties); + HumanReviewStatus.create = function create(properties) { + return new HumanReviewStatus(properties); }; /** - * Encodes the specified ProcessRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessRequest.verify|verify} messages. + * Encodes the specified HumanReviewStatus message. Does not implicitly {@link google.cloud.documentai.v1beta3.HumanReviewStatus.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @memberof google.cloud.documentai.v1beta3.HumanReviewStatus * @static - * @param {google.cloud.documentai.v1beta3.IProcessRequest} message ProcessRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IHumanReviewStatus} message HumanReviewStatus message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProcessRequest.encode = function encode(message, writer) { + HumanReviewStatus.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.document != null && Object.hasOwnProperty.call(message, "document")) - $root.google.cloud.documentai.v1beta3.Document.encode(message.document, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.skipHumanReview != null && Object.hasOwnProperty.call(message, "skipHumanReview")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.skipHumanReview); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); + if (message.humanReviewOperation != null && Object.hasOwnProperty.call(message, "humanReviewOperation")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.humanReviewOperation); return writer; }; /** - * Encodes the specified ProcessRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessRequest.verify|verify} messages. + * Encodes the specified HumanReviewStatus message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.HumanReviewStatus.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @memberof google.cloud.documentai.v1beta3.HumanReviewStatus * @static - * @param {google.cloud.documentai.v1beta3.IProcessRequest} message ProcessRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IHumanReviewStatus} message HumanReviewStatus message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProcessRequest.encodeDelimited = function encodeDelimited(message, writer) { + HumanReviewStatus.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProcessRequest message from the specified reader or buffer. + * Decodes a HumanReviewStatus message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @memberof google.cloud.documentai.v1beta3.HumanReviewStatus * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.ProcessRequest} ProcessRequest + * @returns {google.cloud.documentai.v1beta3.HumanReviewStatus} HumanReviewStatus * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProcessRequest.decode = function decode(reader, length) { + HumanReviewStatus.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ProcessRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.HumanReviewStatus(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.state = reader.int32(); break; case 2: - message.document = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); + message.stateMessage = reader.string(); break; case 3: - message.skipHumanReview = reader.bool(); + message.humanReviewOperation = reader.string(); break; default: reader.skipType(tag & 7); @@ -22628,109 +24413,152 @@ }; /** - * Decodes a ProcessRequest message from the specified reader or buffer, length delimited. + * Decodes a HumanReviewStatus message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @memberof google.cloud.documentai.v1beta3.HumanReviewStatus * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.ProcessRequest} ProcessRequest + * @returns {google.cloud.documentai.v1beta3.HumanReviewStatus} HumanReviewStatus * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProcessRequest.decodeDelimited = function decodeDelimited(reader) { + HumanReviewStatus.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ProcessRequest message. + * Verifies a HumanReviewStatus message. * @function verify - * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @memberof google.cloud.documentai.v1beta3.HumanReviewStatus * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ProcessRequest.verify = function verify(message) { + HumanReviewStatus.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.document != null && message.hasOwnProperty("document")) { - var error = $root.google.cloud.documentai.v1beta3.Document.verify(message.document); - if (error) - return "document." + error; - } - if (message.skipHumanReview != null && message.hasOwnProperty("skipHumanReview")) - if (typeof message.skipHumanReview !== "boolean") - return "skipHumanReview: boolean expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + if (!$util.isString(message.stateMessage)) + return "stateMessage: string expected"; + if (message.humanReviewOperation != null && message.hasOwnProperty("humanReviewOperation")) + if (!$util.isString(message.humanReviewOperation)) + return "humanReviewOperation: string expected"; return null; }; /** - * Creates a ProcessRequest message from a plain object. Also converts values to their respective internal types. + * Creates a HumanReviewStatus message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @memberof google.cloud.documentai.v1beta3.HumanReviewStatus * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.ProcessRequest} ProcessRequest + * @returns {google.cloud.documentai.v1beta3.HumanReviewStatus} HumanReviewStatus */ - ProcessRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.ProcessRequest) + HumanReviewStatus.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.HumanReviewStatus) return object; - var message = new $root.google.cloud.documentai.v1beta3.ProcessRequest(); - if (object.name != null) - message.name = String(object.name); - if (object.document != null) { - if (typeof object.document !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.ProcessRequest.document: object expected"); - message.document = $root.google.cloud.documentai.v1beta3.Document.fromObject(object.document); + var message = new $root.google.cloud.documentai.v1beta3.HumanReviewStatus(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "SKIPPED": + case 1: + message.state = 1; + break; + case "VALIDATION_PASSED": + case 2: + message.state = 2; + break; + case "IN_PROGRESS": + case 3: + message.state = 3; + break; + case "ERROR": + case 4: + message.state = 4; + break; } - if (object.skipHumanReview != null) - message.skipHumanReview = Boolean(object.skipHumanReview); + if (object.stateMessage != null) + message.stateMessage = String(object.stateMessage); + if (object.humanReviewOperation != null) + message.humanReviewOperation = String(object.humanReviewOperation); return message; }; /** - * Creates a plain object from a ProcessRequest message. Also converts values to other types if specified. + * Creates a plain object from a HumanReviewStatus message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @memberof google.cloud.documentai.v1beta3.HumanReviewStatus * @static - * @param {google.cloud.documentai.v1beta3.ProcessRequest} message ProcessRequest + * @param {google.cloud.documentai.v1beta3.HumanReviewStatus} message HumanReviewStatus * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ProcessRequest.toObject = function toObject(message, options) { + HumanReviewStatus.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.name = ""; - object.document = null; - object.skipHumanReview = false; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.stateMessage = ""; + object.humanReviewOperation = ""; } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.document != null && message.hasOwnProperty("document")) - object.document = $root.google.cloud.documentai.v1beta3.Document.toObject(message.document, options); - if (message.skipHumanReview != null && message.hasOwnProperty("skipHumanReview")) - object.skipHumanReview = message.skipHumanReview; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.HumanReviewStatus.State[message.state] : message.state; + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + object.stateMessage = message.stateMessage; + if (message.humanReviewOperation != null && message.hasOwnProperty("humanReviewOperation")) + object.humanReviewOperation = message.humanReviewOperation; return object; }; /** - * Converts this ProcessRequest to JSON. + * Converts this HumanReviewStatus to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @memberof google.cloud.documentai.v1beta3.HumanReviewStatus * @instance * @returns {Object.} JSON object */ - ProcessRequest.prototype.toJSON = function toJSON() { + HumanReviewStatus.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ProcessRequest; + /** + * State enum. + * @name google.cloud.documentai.v1beta3.HumanReviewStatus.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} SKIPPED=1 SKIPPED value + * @property {number} VALIDATION_PASSED=2 VALIDATION_PASSED value + * @property {number} IN_PROGRESS=3 IN_PROGRESS value + * @property {number} ERROR=4 ERROR value + */ + HumanReviewStatus.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SKIPPED"] = 1; + values[valuesById[2] = "VALIDATION_PASSED"] = 2; + values[valuesById[3] = "IN_PROGRESS"] = 3; + values[valuesById[4] = "ERROR"] = 4; + return values; + })(); + + return HumanReviewStatus; })(); v1beta3.ProcessResponse = (function() { @@ -22741,6 +24569,7 @@ * @interface IProcessResponse * @property {google.cloud.documentai.v1beta3.IDocument|null} [document] ProcessResponse document * @property {string|null} [humanReviewOperation] ProcessResponse humanReviewOperation + * @property {google.cloud.documentai.v1beta3.IHumanReviewStatus|null} [humanReviewStatus] ProcessResponse humanReviewStatus */ /** @@ -22774,6 +24603,14 @@ */ ProcessResponse.prototype.humanReviewOperation = ""; + /** + * ProcessResponse humanReviewStatus. + * @member {google.cloud.documentai.v1beta3.IHumanReviewStatus|null|undefined} humanReviewStatus + * @memberof google.cloud.documentai.v1beta3.ProcessResponse + * @instance + */ + ProcessResponse.prototype.humanReviewStatus = null; + /** * Creates a new ProcessResponse instance using the specified properties. * @function create @@ -22802,6 +24639,8 @@ $root.google.cloud.documentai.v1beta3.Document.encode(message.document, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.humanReviewOperation != null && Object.hasOwnProperty.call(message, "humanReviewOperation")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.humanReviewOperation); + if (message.humanReviewStatus != null && Object.hasOwnProperty.call(message, "humanReviewStatus")) + $root.google.cloud.documentai.v1beta3.HumanReviewStatus.encode(message.humanReviewStatus, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -22842,6 +24681,9 @@ case 2: message.humanReviewOperation = reader.string(); break; + case 3: + message.humanReviewStatus = $root.google.cloud.documentai.v1beta3.HumanReviewStatus.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -22885,6 +24727,11 @@ if (message.humanReviewOperation != null && message.hasOwnProperty("humanReviewOperation")) if (!$util.isString(message.humanReviewOperation)) return "humanReviewOperation: string expected"; + if (message.humanReviewStatus != null && message.hasOwnProperty("humanReviewStatus")) { + var error = $root.google.cloud.documentai.v1beta3.HumanReviewStatus.verify(message.humanReviewStatus); + if (error) + return "humanReviewStatus." + error; + } return null; }; @@ -22907,6 +24754,11 @@ } if (object.humanReviewOperation != null) message.humanReviewOperation = String(object.humanReviewOperation); + if (object.humanReviewStatus != null) { + if (typeof object.humanReviewStatus !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ProcessResponse.humanReviewStatus: object expected"); + message.humanReviewStatus = $root.google.cloud.documentai.v1beta3.HumanReviewStatus.fromObject(object.humanReviewStatus); + } return message; }; @@ -22926,11 +24778,14 @@ if (options.defaults) { object.document = null; object.humanReviewOperation = ""; + object.humanReviewStatus = null; } if (message.document != null && message.hasOwnProperty("document")) object.document = $root.google.cloud.documentai.v1beta3.Document.toObject(message.document, options); if (message.humanReviewOperation != null && message.hasOwnProperty("humanReviewOperation")) object.humanReviewOperation = message.humanReviewOperation; + if (message.humanReviewStatus != null && message.hasOwnProperty("humanReviewStatus")) + object.humanReviewStatus = $root.google.cloud.documentai.v1beta3.HumanReviewStatus.toObject(message.humanReviewStatus, options); return object; }; @@ -22957,6 +24812,9 @@ * @property {string|null} [name] BatchProcessRequest name * @property {Array.|null} [inputConfigs] BatchProcessRequest inputConfigs * @property {google.cloud.documentai.v1beta3.BatchProcessRequest.IBatchOutputConfig|null} [outputConfig] BatchProcessRequest outputConfig + * @property {google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig|null} [inputDocuments] BatchProcessRequest inputDocuments + * @property {google.cloud.documentai.v1beta3.IDocumentOutputConfig|null} [documentOutputConfig] BatchProcessRequest documentOutputConfig + * @property {boolean|null} [skipHumanReview] BatchProcessRequest skipHumanReview */ /** @@ -22999,6 +24857,30 @@ */ BatchProcessRequest.prototype.outputConfig = null; + /** + * BatchProcessRequest inputDocuments. + * @member {google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig|null|undefined} inputDocuments + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest + * @instance + */ + BatchProcessRequest.prototype.inputDocuments = null; + + /** + * BatchProcessRequest documentOutputConfig. + * @member {google.cloud.documentai.v1beta3.IDocumentOutputConfig|null|undefined} documentOutputConfig + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest + * @instance + */ + BatchProcessRequest.prototype.documentOutputConfig = null; + + /** + * BatchProcessRequest skipHumanReview. + * @member {boolean} skipHumanReview + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest + * @instance + */ + BatchProcessRequest.prototype.skipHumanReview = false; + /** * Creates a new BatchProcessRequest instance using the specified properties. * @function create @@ -23030,6 +24912,12 @@ $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.encode(message.inputConfigs[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.encode(message.outputConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.skipHumanReview != null && Object.hasOwnProperty.call(message, "skipHumanReview")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.skipHumanReview); + if (message.inputDocuments != null && Object.hasOwnProperty.call(message, "inputDocuments")) + $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.encode(message.inputDocuments, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.documentOutputConfig != null && Object.hasOwnProperty.call(message, "documentOutputConfig")) + $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.encode(message.documentOutputConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; @@ -23075,6 +24963,15 @@ case 3: message.outputConfig = $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.decode(reader, reader.uint32()); break; + case 5: + message.inputDocuments = $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.decode(reader, reader.uint32()); + break; + case 6: + message.documentOutputConfig = $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.decode(reader, reader.uint32()); + break; + case 4: + message.skipHumanReview = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -23127,6 +25024,19 @@ if (error) return "outputConfig." + error; } + if (message.inputDocuments != null && message.hasOwnProperty("inputDocuments")) { + var error = $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.verify(message.inputDocuments); + if (error) + return "inputDocuments." + error; + } + if (message.documentOutputConfig != null && message.hasOwnProperty("documentOutputConfig")) { + var error = $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.verify(message.documentOutputConfig); + if (error) + return "documentOutputConfig." + error; + } + if (message.skipHumanReview != null && message.hasOwnProperty("skipHumanReview")) + if (typeof message.skipHumanReview !== "boolean") + return "skipHumanReview: boolean expected"; return null; }; @@ -23159,6 +25069,18 @@ throw TypeError(".google.cloud.documentai.v1beta3.BatchProcessRequest.outputConfig: object expected"); message.outputConfig = $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.fromObject(object.outputConfig); } + if (object.inputDocuments != null) { + if (typeof object.inputDocuments !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.BatchProcessRequest.inputDocuments: object expected"); + message.inputDocuments = $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.fromObject(object.inputDocuments); + } + if (object.documentOutputConfig != null) { + if (typeof object.documentOutputConfig !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.BatchProcessRequest.documentOutputConfig: object expected"); + message.documentOutputConfig = $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.fromObject(object.documentOutputConfig); + } + if (object.skipHumanReview != null) + message.skipHumanReview = Boolean(object.skipHumanReview); return message; }; @@ -23180,6 +25102,9 @@ if (options.defaults) { object.name = ""; object.outputConfig = null; + object.skipHumanReview = false; + object.inputDocuments = null; + object.documentOutputConfig = null; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -23190,6 +25115,12 @@ } if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) object.outputConfig = $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.toObject(message.outputConfig, options); + if (message.skipHumanReview != null && message.hasOwnProperty("skipHumanReview")) + object.skipHumanReview = message.skipHumanReview; + if (message.inputDocuments != null && message.hasOwnProperty("inputDocuments")) + object.inputDocuments = $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.toObject(message.inputDocuments, options); + if (message.documentOutputConfig != null && message.hasOwnProperty("documentOutputConfig")) + object.documentOutputConfig = $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.toObject(message.documentOutputConfig, options); return object; }; @@ -24117,6 +26048,7 @@ * @property {google.rpc.IStatus|null} [status] IndividualProcessStatus status * @property {string|null} [outputGcsDestination] IndividualProcessStatus outputGcsDestination * @property {string|null} [humanReviewOperation] IndividualProcessStatus humanReviewOperation + * @property {google.cloud.documentai.v1beta3.IHumanReviewStatus|null} [humanReviewStatus] IndividualProcessStatus humanReviewStatus */ /** @@ -24164,7 +26096,15 @@ * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus * @instance */ - IndividualProcessStatus.prototype.humanReviewOperation = ""; + IndividualProcessStatus.prototype.humanReviewOperation = ""; + + /** + * IndividualProcessStatus humanReviewStatus. + * @member {google.cloud.documentai.v1beta3.IHumanReviewStatus|null|undefined} humanReviewStatus + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + * @instance + */ + IndividualProcessStatus.prototype.humanReviewStatus = null; /** * Creates a new IndividualProcessStatus instance using the specified properties. @@ -24198,6 +26138,8 @@ writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputGcsDestination); if (message.humanReviewOperation != null && Object.hasOwnProperty.call(message, "humanReviewOperation")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.humanReviewOperation); + if (message.humanReviewStatus != null && Object.hasOwnProperty.call(message, "humanReviewStatus")) + $root.google.cloud.documentai.v1beta3.HumanReviewStatus.encode(message.humanReviewStatus, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; @@ -24244,6 +26186,9 @@ case 4: message.humanReviewOperation = reader.string(); break; + case 5: + message.humanReviewStatus = $root.google.cloud.documentai.v1beta3.HumanReviewStatus.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -24293,6 +26238,11 @@ if (message.humanReviewOperation != null && message.hasOwnProperty("humanReviewOperation")) if (!$util.isString(message.humanReviewOperation)) return "humanReviewOperation: string expected"; + if (message.humanReviewStatus != null && message.hasOwnProperty("humanReviewStatus")) { + var error = $root.google.cloud.documentai.v1beta3.HumanReviewStatus.verify(message.humanReviewStatus); + if (error) + return "humanReviewStatus." + error; + } return null; }; @@ -24319,6 +26269,11 @@ message.outputGcsDestination = String(object.outputGcsDestination); if (object.humanReviewOperation != null) message.humanReviewOperation = String(object.humanReviewOperation); + if (object.humanReviewStatus != null) { + if (typeof object.humanReviewStatus !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus.humanReviewStatus: object expected"); + message.humanReviewStatus = $root.google.cloud.documentai.v1beta3.HumanReviewStatus.fromObject(object.humanReviewStatus); + } return message; }; @@ -24340,6 +26295,7 @@ object.status = null; object.outputGcsDestination = ""; object.humanReviewOperation = ""; + object.humanReviewStatus = null; } if (message.inputGcsSource != null && message.hasOwnProperty("inputGcsSource")) object.inputGcsSource = message.inputGcsSource; @@ -24349,6 +26305,8 @@ object.outputGcsDestination = message.outputGcsDestination; if (message.humanReviewOperation != null && message.hasOwnProperty("humanReviewOperation")) object.humanReviewOperation = message.humanReviewOperation; + if (message.humanReviewStatus != null && message.hasOwnProperty("humanReviewStatus")) + object.humanReviewStatus = $root.google.cloud.documentai.v1beta3.HumanReviewStatus.toObject(message.humanReviewStatus, options); return object; }; @@ -24399,6 +26357,7 @@ * Properties of a ReviewDocumentRequest. * @memberof google.cloud.documentai.v1beta3 * @interface IReviewDocumentRequest + * @property {google.cloud.documentai.v1beta3.IDocument|null} [inlineDocument] ReviewDocumentRequest inlineDocument * @property {string|null} [humanReviewConfig] ReviewDocumentRequest humanReviewConfig * @property {google.cloud.documentai.v1beta3.IDocument|null} [document] ReviewDocumentRequest document */ @@ -24418,6 +26377,14 @@ this[keys[i]] = properties[keys[i]]; } + /** + * ReviewDocumentRequest inlineDocument. + * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} inlineDocument + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.inlineDocument = null; + /** * ReviewDocumentRequest humanReviewConfig. * @member {string} humanReviewConfig @@ -24434,6 +26401,20 @@ */ ReviewDocumentRequest.prototype.document = null; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ReviewDocumentRequest source. + * @member {"inlineDocument"|undefined} source + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + Object.defineProperty(ReviewDocumentRequest.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["inlineDocument"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new ReviewDocumentRequest instance using the specified properties. * @function create @@ -24462,6 +26443,8 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.humanReviewConfig); if (message.document != null && Object.hasOwnProperty.call(message, "document")) $root.google.cloud.documentai.v1beta3.Document.encode(message.document, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.inlineDocument != null && Object.hasOwnProperty.call(message, "inlineDocument")) + $root.google.cloud.documentai.v1beta3.Document.encode(message.inlineDocument, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; @@ -24496,6 +26479,9 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 4: + message.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); + break; case 1: message.humanReviewConfig = reader.string(); break; @@ -24537,6 +26523,15 @@ ReviewDocumentRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; + if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { + properties.source = 1; + { + var error = $root.google.cloud.documentai.v1beta3.Document.verify(message.inlineDocument); + if (error) + return "inlineDocument." + error; + } + } if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) if (!$util.isString(message.humanReviewConfig)) return "humanReviewConfig: string expected"; @@ -24560,6 +26555,11 @@ if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest) return object; var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest(); + if (object.inlineDocument != null) { + if (typeof object.inlineDocument !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentRequest.inlineDocument: object expected"); + message.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.fromObject(object.inlineDocument); + } if (object.humanReviewConfig != null) message.humanReviewConfig = String(object.humanReviewConfig); if (object.document != null) { @@ -24591,6 +26591,11 @@ object.humanReviewConfig = message.humanReviewConfig; if (message.document != null && message.hasOwnProperty("document")) object.document = $root.google.cloud.documentai.v1beta3.Document.toObject(message.document, options); + if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { + object.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.toObject(message.inlineDocument, options); + if (options.oneofs) + object.source = "inlineDocument"; + } return object; }; @@ -24670,38 +26675,281 @@ }; /** - * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsDestination = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReviewDocumentResponse message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReviewDocumentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + if (!$util.isString(message.gcsDestination)) + return "gcsDestination: string expected"; + return null; + }; + + /** + * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + */ + ReviewDocumentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse(); + if (object.gcsDestination != null) + message.gcsDestination = String(object.gcsDestination); + return message; + }; + + /** + * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta3.ReviewDocumentResponse} message ReviewDocumentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReviewDocumentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.gcsDestination = ""; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + object.gcsDestination = message.gcsDestination; + return object; + }; + + /** + * Converts this ReviewDocumentResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ReviewDocumentResponse; + })(); + + v1beta3.ReviewDocumentOperationMetadata = (function() { + + /** + * Properties of a ReviewDocumentOperationMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @interface IReviewDocumentOperationMetadata + * @property {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|null} [state] ReviewDocumentOperationMetadata state + * @property {string|null} [stateMessage] ReviewDocumentOperationMetadata stateMessage + * @property {google.protobuf.ITimestamp|null} [createTime] ReviewDocumentOperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ReviewDocumentOperationMetadata updateTime + * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] ReviewDocumentOperationMetadata commonMetadata + */ + + /** + * Constructs a new ReviewDocumentOperationMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ReviewDocumentOperationMetadata. + * @implements IReviewDocumentOperationMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata=} [properties] Properties to set + */ + function ReviewDocumentOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReviewDocumentOperationMetadata state. + * @member {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State} state + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.state = 0; + + /** + * ReviewDocumentOperationMetadata stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.stateMessage = ""; + + /** + * ReviewDocumentOperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.createTime = null; + + /** + * ReviewDocumentOperationMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.updateTime = null; + + /** + * ReviewDocumentOperationMetadata commonMetadata. + * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.commonMetadata = null; + + /** + * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata instance + */ + ReviewDocumentOperationMetadata.create = function create(properties) { + return new ReviewDocumentOperationMetadata(properties); + }; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { + ReviewDocumentOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentResponse.decode = function decode(reader, length) { + ReviewDocumentOperationMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsDestination = reader.string(); + message.state = reader.int32(); + break; + case 2: + message.stateMessage = reader.string(); + break; + case 3: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -24712,110 +26960,213 @@ }; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentResponse.decodeDelimited = function decodeDelimited(reader) { + ReviewDocumentOperationMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReviewDocumentResponse message. + * Verifies a ReviewDocumentOperationMetadata message. * @function verify - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ReviewDocumentResponse.verify = function verify(message) { + ReviewDocumentOperationMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) - if (!$util.isString(message.gcsDestination)) - return "gcsDestination: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + if (!$util.isString(message.stateMessage)) + return "stateMessage: string 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.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } return null; }; /** - * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata */ - ReviewDocumentResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse) + ReviewDocumentOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata) return object; - var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse(); - if (object.gcsDestination != null) - message.gcsDestination = String(object.gcsDestination); + var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "RUNNING": + case 1: + message.state = 1; + break; + case "CANCELLING": + case 2: + message.state = 2; + break; + case "SUCCEEDED": + case 3: + message.state = 3; + break; + case "FAILED": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + } + if (object.stateMessage != null) + message.stateMessage = String(object.stateMessage); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.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.documentai.v1beta3.ReviewDocumentOperationMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); + } return message; }; /** - * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. + * Creates a plain object from a ReviewDocumentOperationMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata * @static - * @param {google.cloud.documentai.v1beta3.ReviewDocumentResponse} message ReviewDocumentResponse + * @param {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReviewDocumentResponse.toObject = function toObject(message, options) { + ReviewDocumentOperationMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.gcsDestination = ""; - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) - object.gcsDestination = message.gcsDestination; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.stateMessage = ""; + object.createTime = null; + object.updateTime = null; + object.commonMetadata = null; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State[message.state] : message.state; + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + object.stateMessage = message.stateMessage; + 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.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); return object; }; /** - * Converts this ReviewDocumentResponse to JSON. + * Converts this ReviewDocumentOperationMetadata to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata * @instance * @returns {Object.} JSON object */ - ReviewDocumentResponse.prototype.toJSON = function toJSON() { + ReviewDocumentOperationMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ReviewDocumentResponse; + /** + * State enum. + * @name google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} CANCELLING=2 CANCELLING value + * @property {number} SUCCEEDED=3 SUCCEEDED value + * @property {number} FAILED=4 FAILED value + * @property {number} CANCELLED=5 CANCELLED value + */ + ReviewDocumentOperationMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "CANCELLING"] = 2; + values[valuesById[3] = "SUCCEEDED"] = 3; + values[valuesById[4] = "FAILED"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return ReviewDocumentOperationMetadata; })(); - v1beta3.ReviewDocumentOperationMetadata = (function() { + v1beta3.CommonOperationMetadata = (function() { /** - * Properties of a ReviewDocumentOperationMetadata. + * Properties of a CommonOperationMetadata. * @memberof google.cloud.documentai.v1beta3 - * @interface IReviewDocumentOperationMetadata - * @property {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|null} [state] ReviewDocumentOperationMetadata state - * @property {string|null} [stateMessage] ReviewDocumentOperationMetadata stateMessage - * @property {google.protobuf.ITimestamp|null} [createTime] ReviewDocumentOperationMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] ReviewDocumentOperationMetadata updateTime + * @interface ICommonOperationMetadata + * @property {google.cloud.documentai.v1beta3.CommonOperationMetadata.State|null} [state] CommonOperationMetadata state + * @property {string|null} [stateMessage] CommonOperationMetadata stateMessage + * @property {google.protobuf.ITimestamp|null} [createTime] CommonOperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] CommonOperationMetadata updateTime */ /** - * Constructs a new ReviewDocumentOperationMetadata. + * Constructs a new CommonOperationMetadata. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a ReviewDocumentOperationMetadata. - * @implements IReviewDocumentOperationMetadata + * @classdesc Represents a CommonOperationMetadata. + * @implements ICommonOperationMetadata * @constructor - * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.ICommonOperationMetadata=} [properties] Properties to set */ - function ReviewDocumentOperationMetadata(properties) { + function CommonOperationMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -24823,59 +27174,59 @@ } /** - * ReviewDocumentOperationMetadata state. - * @member {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State} state - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * CommonOperationMetadata state. + * @member {google.cloud.documentai.v1beta3.CommonOperationMetadata.State} state + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata * @instance */ - ReviewDocumentOperationMetadata.prototype.state = 0; + CommonOperationMetadata.prototype.state = 0; /** - * ReviewDocumentOperationMetadata stateMessage. + * CommonOperationMetadata stateMessage. * @member {string} stateMessage - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata * @instance */ - ReviewDocumentOperationMetadata.prototype.stateMessage = ""; + CommonOperationMetadata.prototype.stateMessage = ""; /** - * ReviewDocumentOperationMetadata createTime. + * CommonOperationMetadata createTime. * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata * @instance */ - ReviewDocumentOperationMetadata.prototype.createTime = null; + CommonOperationMetadata.prototype.createTime = null; /** - * ReviewDocumentOperationMetadata updateTime. + * CommonOperationMetadata updateTime. * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata * @instance */ - ReviewDocumentOperationMetadata.prototype.updateTime = null; + CommonOperationMetadata.prototype.updateTime = null; /** - * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * Creates a new CommonOperationMetadata instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata instance + * @param {google.cloud.documentai.v1beta3.ICommonOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.CommonOperationMetadata} CommonOperationMetadata instance */ - ReviewDocumentOperationMetadata.create = function create(properties) { - return new ReviewDocumentOperationMetadata(properties); + CommonOperationMetadata.create = function create(properties) { + return new CommonOperationMetadata(properties); }; /** - * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * Encodes the specified CommonOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.CommonOperationMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1beta3.ICommonOperationMetadata} message CommonOperationMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentOperationMetadata.encode = function encode(message, writer) { + CommonOperationMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.state != null && Object.hasOwnProperty.call(message, "state")) @@ -24890,33 +27241,33 @@ }; /** - * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * Encodes the specified CommonOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.CommonOperationMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1beta3.ICommonOperationMetadata} message CommonOperationMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + CommonOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * Decodes a CommonOperationMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @returns {google.cloud.documentai.v1beta3.CommonOperationMetadata} CommonOperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentOperationMetadata.decode = function decode(reader, length) { + CommonOperationMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.CommonOperationMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -24941,30 +27292,30 @@ }; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * Decodes a CommonOperationMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @returns {google.cloud.documentai.v1beta3.CommonOperationMetadata} CommonOperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + CommonOperationMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReviewDocumentOperationMetadata message. + * Verifies a CommonOperationMetadata message. * @function verify - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ReviewDocumentOperationMetadata.verify = function verify(message) { + CommonOperationMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.state != null && message.hasOwnProperty("state")) @@ -24996,17 +27347,17 @@ }; /** - * Creates a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a CommonOperationMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @returns {google.cloud.documentai.v1beta3.CommonOperationMetadata} CommonOperationMetadata */ - ReviewDocumentOperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata) + CommonOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.CommonOperationMetadata) return object; - var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata(); + var message = new $root.google.cloud.documentai.v1beta3.CommonOperationMetadata(); switch (object.state) { case "STATE_UNSPECIFIED": case 0: @@ -25037,27 +27388,27 @@ message.stateMessage = String(object.stateMessage); if (object.createTime != null) { if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.createTime: object expected"); + throw TypeError(".google.cloud.documentai.v1beta3.CommonOperationMetadata.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.documentai.v1beta3.ReviewDocumentOperationMetadata.updateTime: object expected"); + throw TypeError(".google.cloud.documentai.v1beta3.CommonOperationMetadata.updateTime: object expected"); message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); } return message; }; /** - * Creates a plain object from a ReviewDocumentOperationMetadata message. Also converts values to other types if specified. + * Creates a plain object from a CommonOperationMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata * @static - * @param {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata + * @param {google.cloud.documentai.v1beta3.CommonOperationMetadata} message CommonOperationMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReviewDocumentOperationMetadata.toObject = function toObject(message, options) { + CommonOperationMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -25068,7 +27419,7 @@ object.updateTime = null; } if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.State[message.state] : message.state; if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) object.stateMessage = message.stateMessage; if (message.createTime != null && message.hasOwnProperty("createTime")) @@ -25079,19 +27430,19 @@ }; /** - * Converts this ReviewDocumentOperationMetadata to JSON. + * Converts this CommonOperationMetadata to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata * @instance * @returns {Object.} JSON object */ - ReviewDocumentOperationMetadata.prototype.toJSON = function toJSON() { + CommonOperationMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * State enum. - * @name google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State + * @name google.cloud.documentai.v1beta3.CommonOperationMetadata.State * @enum {number} * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value * @property {number} RUNNING=1 RUNNING value @@ -25100,7 +27451,7 @@ * @property {number} FAILED=4 FAILED value * @property {number} CANCELLED=5 CANCELLED value */ - ReviewDocumentOperationMetadata.State = (function() { + CommonOperationMetadata.State = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; values[valuesById[1] = "RUNNING"] = 1; @@ -25111,7 +27462,7 @@ return values; })(); - return ReviewDocumentOperationMetadata; + return CommonOperationMetadata; })(); return v1beta3; diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index f8bca06b121..d9a69d33882 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -1881,6 +1881,92 @@ } } }, + "RawDocument": { + "fields": { + "content": { + "type": "bytes", + "id": 1 + }, + "mimeType": { + "type": "string", + "id": 2 + } + } + }, + "GcsDocument": { + "fields": { + "gcsUri": { + "type": "string", + "id": 1 + }, + "mimeType": { + "type": "string", + "id": 2 + } + } + }, + "GcsDocuments": { + "fields": { + "documents": { + "rule": "repeated", + "type": "GcsDocument", + "id": 1 + } + } + }, + "GcsPrefix": { + "fields": { + "gcsUriPrefix": { + "type": "string", + "id": 1 + } + } + }, + "BatchDocumentsInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "gcsPrefix", + "gcsDocuments" + ] + } + }, + "fields": { + "gcsPrefix": { + "type": "GcsPrefix", + "id": 1 + }, + "gcsDocuments": { + "type": "GcsDocuments", + "id": 2 + } + } + }, + "DocumentOutputConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsOutputConfig" + ] + } + }, + "fields": { + "gcsOutputConfig": { + "type": "GcsOutputConfig", + "id": 1 + } + }, + "nested": { + "GcsOutputConfig": { + "fields": { + "gcsUri": { + "type": "string", + "id": 1 + } + } + } + } + }, "DocumentProcessorService": { "options": { "(google.api.default_host)": "us-documentai.googleapis.com", @@ -1966,7 +2052,23 @@ } }, "ProcessRequest": { + "oneofs": { + "source": { + "oneof": [ + "inlineDocument", + "rawDocument" + ] + } + }, "fields": { + "inlineDocument": { + "type": "Document", + "id": 4 + }, + "rawDocument": { + "type": "RawDocument", + "id": 5 + }, "name": { "type": "string", "id": 1, @@ -1977,7 +2079,10 @@ }, "document": { "type": "Document", - "id": 2 + "id": 2, + "options": { + "deprecated": true + } }, "skipHumanReview": { "type": "bool", @@ -1985,6 +2090,33 @@ } } }, + "HumanReviewStatus": { + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "stateMessage": { + "type": "string", + "id": 2 + }, + "humanReviewOperation": { + "type": "string", + "id": 3 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "SKIPPED": 1, + "VALIDATION_PASSED": 2, + "IN_PROGRESS": 3, + "ERROR": 4 + } + } + } + }, "ProcessResponse": { "fields": { "document": { @@ -1993,7 +2125,14 @@ }, "humanReviewOperation": { "type": "string", - "id": 2 + "id": 2, + "options": { + "deprecated": true + } + }, + "humanReviewStatus": { + "type": "HumanReviewStatus", + "id": 3 } } }, @@ -2010,15 +2149,36 @@ "inputConfigs": { "rule": "repeated", "type": "BatchInputConfig", - "id": 2 + "id": 2, + "options": { + "deprecated": true + } }, "outputConfig": { "type": "BatchOutputConfig", - "id": 3 + "id": 3, + "options": { + "deprecated": true + } + }, + "inputDocuments": { + "type": "BatchDocumentsInputConfig", + "id": 5 + }, + "documentOutputConfig": { + "type": "DocumentOutputConfig", + "id": 6 + }, + "skipHumanReview": { + "type": "bool", + "id": 4 } }, "nested": { "BatchInputConfig": { + "options": { + "deprecated": true + }, "fields": { "gcsSource": { "type": "string", @@ -2031,6 +2191,9 @@ } }, "BatchOutputConfig": { + "options": { + "deprecated": true + }, "fields": { "gcsDestination": { "type": "string", @@ -2084,7 +2247,14 @@ }, "humanReviewOperation": { "type": "string", - "id": 4 + "id": 4, + "options": { + "deprecated": true + } + }, + "humanReviewStatus": { + "type": "HumanReviewStatus", + "id": 5 } } }, @@ -2102,7 +2272,18 @@ } }, "ReviewDocumentRequest": { + "oneofs": { + "source": { + "oneof": [ + "inlineDocument" + ] + } + }, "fields": { + "inlineDocument": { + "type": "Document", + "id": 4 + }, "humanReviewConfig": { "type": "string", "id": 1, @@ -2113,7 +2294,10 @@ }, "document": { "type": "Document", - "id": 2 + "id": 2, + "options": { + "deprecated": true + } } } }, @@ -2126,6 +2310,42 @@ } }, "ReviewDocumentOperationMetadata": { + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "stateMessage": { + "type": "string", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + }, + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 5 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "RUNNING": 1, + "CANCELLING": 2, + "SUCCEEDED": 3, + "FAILED": 4, + "CANCELLED": 5 + } + } + } + }, + "CommonOperationMetadata": { "fields": { "state": { "type": "State", diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index 4916c0eca73..dc79f91ed71 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts @@ -378,6 +378,10 @@ export class DocumentProcessorServiceClient { * * @param {Object} request * The request object that will be sent. + * @param {google.cloud.documentai.v1beta3.Document} request.inlineDocument + * An inline document proto. + * @param {google.cloud.documentai.v1beta3.RawDocument} request.rawDocument + * A raw document content (bytes). * @param {string} request.name * Required. The processor resource name. * @param {google.cloud.documentai.v1beta3.Document} request.document @@ -486,6 +490,13 @@ export class DocumentProcessorServiceClient { * The input config for each single document in the batch process. * @param {google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig} request.outputConfig * The overall output config for batch process. + * @param {google.cloud.documentai.v1beta3.BatchDocumentsInputConfig} request.inputDocuments + * The input documents for batch process. + * @param {google.cloud.documentai.v1beta3.DocumentOutputConfig} request.documentOutputConfig + * The overall output config for batch process. + * @param {boolean} request.skipHumanReview + * Whether Human Review feature should be skipped for this request. Default to + * false. * @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. @@ -627,6 +638,8 @@ export class DocumentProcessorServiceClient { * * @param {Object} request * The request object that will be sent. + * @param {google.cloud.documentai.v1beta3.Document} request.inlineDocument + * An inline document proto. * @param {string} request.humanReviewConfig * Required. The resource name of the HumanReviewConfig that the document will be * reviewed with. diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json index 66fbd4e2aaa..0b10d7411a1 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json @@ -1,5 +1,6 @@ [ "../../protos/google/cloud/documentai/v1beta3/document.proto", + "../../protos/google/cloud/documentai/v1beta3/document_io.proto", "../../protos/google/cloud/documentai/v1beta3/document_processor_service.proto", "../../protos/google/cloud/documentai/v1beta3/geometry.proto" ] diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 3c4cb676b39..fd0789c0b49 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "3f79ed0df10834530d0a8da77f25eb91654ebc57" + "sha": "8e9875849fd3ab8aee22974dbc3b74ceff6b0e40" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "d189e871205fea665a9648f7c4676f027495ccaf", - "internalRef": "345596855" + "sha": "1f68cd0c02d6925e97aa5bbb153d70a70554dab0", + "internalRef": "357825340" } }, { From 68567ac3bf48d65633d9116b4fc9903a20448f49 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 17 Feb 2021 12:00:10 -0800 Subject: [PATCH 099/213] chore: release 2.4.0 (#153) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-documentai/CHANGELOG.md | 7 +++++++ packages/google-cloud-documentai/package.json | 2 +- packages/google-cloud-documentai/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index 2d6b5175b8d..770883c308a 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [2.4.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.3.0...v2.4.0) (2021-02-17) + + +### Features + +* Update documentai/v1beta3 protos ([#152](https://www.github.com/googleapis/nodejs-document-ai/issues/152)) ([9e6b660](https://www.github.com/googleapis/nodejs-document-ai/commit/9e6b66000cc12a08c87924ab26ad9a482f03dbeb)) + ## [2.3.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.2.2...v2.3.0) (2021-01-09) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index b718c7f2e77..0dd7b1d9a94 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "2.3.0", + "version": "2.4.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index ee5d81f09a5..d628d085f18 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^2.3.0", + "@google-cloud/documentai": "^2.4.0", "@google-cloud/storage": "^5.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" From 1d52be48161011b9a1c9c4b6ad88b9eb89a3a46e Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 24 Feb 2021 09:53:40 -0800 Subject: [PATCH 100/213] feat: Update documentai/v1beta3 protos: add support for boolean normalized value (#154) PiperOrigin-RevId: 359109762 Source-Author: Google APIs Source-Date: Tue Feb 23 12:45:26 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 8c058c505afc717966bc815075bdd11ff76618e5 Source-Link: https://github.com/googleapis/googleapis/commit/8c058c505afc717966bc815075bdd11ff76618e5 --- .../cloud/documentai/v1beta3/document.proto | 11 +++++-- .../documentai/v1beta3/document_io.proto | 2 +- .../cloud/documentai/v1beta3/geometry.proto | 2 +- .../protos/protos.d.ts | 8 ++++- .../google-cloud-documentai/protos/protos.js | 32 +++++++++++++++++-- .../protos/protos.json | 12 +++++-- .../google-cloud-documentai/synth.metadata | 6 ++-- 7 files changed, 60 insertions(+), 13 deletions(-) diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto index 31642871c4c..2c790cbbcab 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto @@ -418,6 +418,10 @@ message Document { // https: // github.com/googleapis/googleapis/blob/master/google/type/postal_address.proto google.type.PostalAddress address_value = 5; + + // Boolean value. Can be used for entities with binary values, or for + // checkboxes. + bool boolean_value = 6; } // Required. Normalized entity value stored as a string. This field is populated for @@ -450,9 +454,9 @@ message Document { // page where it was found. PageAnchor page_anchor = 6 [(google.api.field_behavior) = OPTIONAL]; - // Canonical id. This will be a unique value in the entity list + // Optional. Canonical id. This will be a unique value in the entity list // for this document. - string id = 7; + string id = 7 [(google.api.field_behavior) = OPTIONAL]; // Optional. Normalized entity value. Absent if the extracted value could not be // converted or the type (e.g. address) is not supported for certain @@ -559,7 +563,8 @@ message Document { FORM_FIELD = 7; } - // Required. Index into the [Document.pages][google.cloud.documentai.v1beta3.Document.pages] element + // Required. Index into the [Document.pages][google.cloud.documentai.v1beta3.Document.pages] element, for example using + // [Document.pages][page_refs.page] to locate the related page element. int64 page = 1 [(google.api.field_behavior) = REQUIRED]; // Optional. The type of the layout element that is being referenced if any. diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.proto index 4b5439617e0..d364d4aba76 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.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-documentai/protos/google/cloud/documentai/v1beta3/geometry.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/geometry.proto index 8ac46643f4b..240faf1f45f 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/geometry.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/geometry.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-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index e6bce5d70a3..fa2623e378d 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -7120,6 +7120,9 @@ export namespace google { /** NormalizedValue addressValue */ addressValue?: (google.type.IPostalAddress|null); + /** NormalizedValue booleanValue */ + booleanValue?: (boolean|null); + /** NormalizedValue text */ text?: (string|null); } @@ -7145,11 +7148,14 @@ export namespace google { /** NormalizedValue addressValue. */ public addressValue?: (google.type.IPostalAddress|null); + /** NormalizedValue booleanValue. */ + public booleanValue: boolean; + /** NormalizedValue text. */ public text: string; /** NormalizedValue structuredValue. */ - public structuredValue?: ("moneyValue"|"dateValue"|"datetimeValue"|"addressValue"); + public structuredValue?: ("moneyValue"|"dateValue"|"datetimeValue"|"addressValue"|"booleanValue"); /** * Creates a new NormalizedValue instance using the specified properties. diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 437ba439479..5980519a4bd 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -18458,6 +18458,7 @@ * @property {google.type.IDate|null} [dateValue] NormalizedValue dateValue * @property {google.type.IDateTime|null} [datetimeValue] NormalizedValue datetimeValue * @property {google.type.IPostalAddress|null} [addressValue] NormalizedValue addressValue + * @property {boolean|null} [booleanValue] NormalizedValue booleanValue * @property {string|null} [text] NormalizedValue text */ @@ -18508,6 +18509,14 @@ */ NormalizedValue.prototype.addressValue = null; + /** + * NormalizedValue booleanValue. + * @member {boolean} booleanValue + * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue + * @instance + */ + NormalizedValue.prototype.booleanValue = false; + /** * NormalizedValue text. * @member {string} text @@ -18521,12 +18530,12 @@ /** * NormalizedValue structuredValue. - * @member {"moneyValue"|"dateValue"|"datetimeValue"|"addressValue"|undefined} structuredValue + * @member {"moneyValue"|"dateValue"|"datetimeValue"|"addressValue"|"booleanValue"|undefined} structuredValue * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue * @instance */ Object.defineProperty(NormalizedValue.prototype, "structuredValue", { - get: $util.oneOfGetter($oneOfFields = ["moneyValue", "dateValue", "datetimeValue", "addressValue"]), + get: $util.oneOfGetter($oneOfFields = ["moneyValue", "dateValue", "datetimeValue", "addressValue", "booleanValue"]), set: $util.oneOfSetter($oneOfFields) }); @@ -18564,6 +18573,8 @@ $root.google.type.DateTime.encode(message.datetimeValue, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.addressValue != null && Object.hasOwnProperty.call(message, "addressValue")) $root.google.type.PostalAddress.encode(message.addressValue, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.booleanValue != null && Object.hasOwnProperty.call(message, "booleanValue")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.booleanValue); return writer; }; @@ -18610,6 +18621,9 @@ case 5: message.addressValue = $root.google.type.PostalAddress.decode(reader, reader.uint32()); break; + case 6: + message.booleanValue = reader.bool(); + break; case 1: message.text = reader.string(); break; @@ -18687,6 +18701,13 @@ return "addressValue." + error; } } + if (message.booleanValue != null && message.hasOwnProperty("booleanValue")) { + if (properties.structuredValue === 1) + return "structuredValue: multiple values"; + properties.structuredValue = 1; + if (typeof message.booleanValue !== "boolean") + return "booleanValue: boolean expected"; + } if (message.text != null && message.hasOwnProperty("text")) if (!$util.isString(message.text)) return "text: string expected"; @@ -18725,6 +18746,8 @@ throw TypeError(".google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue.addressValue: object expected"); message.addressValue = $root.google.type.PostalAddress.fromObject(object.addressValue); } + if (object.booleanValue != null) + message.booleanValue = Boolean(object.booleanValue); if (object.text != null) message.text = String(object.text); return message; @@ -18767,6 +18790,11 @@ if (options.oneofs) object.structuredValue = "addressValue"; } + if (message.booleanValue != null && message.hasOwnProperty("booleanValue")) { + object.booleanValue = message.booleanValue; + if (options.oneofs) + object.structuredValue = "booleanValue"; + } return object; }; diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index d9a69d33882..044a8b85687 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -1534,7 +1534,10 @@ }, "id": { "type": "string", - "id": 7 + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } }, "normalizedValue": { "type": "NormalizedValue", @@ -1574,7 +1577,8 @@ "moneyValue", "dateValue", "datetimeValue", - "addressValue" + "addressValue", + "booleanValue" ] } }, @@ -1595,6 +1599,10 @@ "type": "google.type.PostalAddress", "id": 5 }, + "booleanValue": { + "type": "bool", + "id": 6 + }, "text": { "type": "string", "id": 1, diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index fd0789c0b49..86127caf5dd 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "8e9875849fd3ab8aee22974dbc3b74ceff6b0e40" + "sha": "67be45e7db8a76b13c96caa70db887a58719f5d7" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "1f68cd0c02d6925e97aa5bbb153d70a70554dab0", - "internalRef": "357825340" + "sha": "8c058c505afc717966bc815075bdd11ff76618e5", + "internalRef": "359109762" } }, { From a1cd7a72934dcb07412b5f2d308f33be01debadc Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 24 Feb 2021 10:22:56 -0800 Subject: [PATCH 101/213] chore: release 2.5.0 (#155) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-documentai/CHANGELOG.md | 7 +++++++ packages/google-cloud-documentai/package.json | 2 +- packages/google-cloud-documentai/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index 770883c308a..07fdc61524f 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [2.5.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.4.0...v2.5.0) (2021-02-24) + + +### Features + +* Update documentai/v1beta3 protos: add support for boolean normalized value ([#154](https://www.github.com/googleapis/nodejs-document-ai/issues/154)) ([4ae8c57](https://www.github.com/googleapis/nodejs-document-ai/commit/4ae8c572089cf607810a5e730a4e5807a495bcbc)) + ## [2.4.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.3.0...v2.4.0) (2021-02-17) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 0dd7b1d9a94..e5b4ad2c3a3 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "2.4.0", + "version": "2.5.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index d628d085f18..abd3c733c3c 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^2.4.0", + "@google-cloud/documentai": "^2.5.0", "@google-cloud/storage": "^5.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" From 56ffcf335ec53eaee38772a3255f0b4dd69bd967 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Wed, 3 Mar 2021 17:34:22 -0800 Subject: [PATCH 102/213] build: add OwlBot configuration (#156) --- .../.github/.OwlBot.yaml | 27 ++++++++++ packages/google-cloud-documentai/owlbot.py | 49 +++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 packages/google-cloud-documentai/.github/.OwlBot.yaml create mode 100644 packages/google-cloud-documentai/owlbot.py diff --git a/packages/google-cloud-documentai/.github/.OwlBot.yaml b/packages/google-cloud-documentai/.github/.OwlBot.yaml new file mode 100644 index 00000000000..b16cdf931a3 --- /dev/null +++ b/packages/google-cloud-documentai/.github/.OwlBot.yaml @@ -0,0 +1,27 @@ +# 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-copy-regex: + - source: /google/cloud/documentai/.*/documentai-.*-nodejs/src/(.*) + dest: /src/$1 + rm-dest: /src/.* + - source: /google/cloud/documentai/.*/documentai-.*-nodejs/protos/google/cloud/document/(.*) + dest: /document/$1 + rm-dest: /document/.* + - source: /google/cloud/documentai/.*/documentai-.*-nodejs/test/(.*) + dest: /test/$1 + - source: /google/cloud/documentai/.*/documentai-.*-nodejs/system-test/(.*) + dest: /system-test/$1 diff --git a/packages/google-cloud-documentai/owlbot.py b/packages/google-cloud-documentai/owlbot.py new file mode 100644 index 00000000000..41fcb70c37f --- /dev/null +++ b/packages/google-cloud-documentai/owlbot.py @@ -0,0 +1,49 @@ +# 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. +"""This script is used to synthesize generated parts of this library.""" + +import os +import synthtool as s +import synthtool.gcp as gcp +import synthtool.languages.node as node +import logging + +# Infer version from src directory: +versions = [] +default_version = 'v1beta3' +for directory in os.listdir('./src'): + if os.path.isdir(os.path.join('./src', directory)): + versions.append(directory) +name = 'documentai' + +## Note: this API only supports regional endpoints and does not support default scopes. +s.replace(f"src/*/document_*_service_client.ts", + "servicePath !== staticMembers.servicePath && ", + "" + ) +s.replace(f"src/*/document_*_service_client.ts", + "and we're connecting to a non-default endpoint, set scopes just in case", + "set scopes" + ) +s.replace(f"src/*/document_*_service_client.ts", + r"// Set the default scopes in auth client if needed(.|\n)*?}", + "" + ) + +# Copy common templates +common_templates = gcp.CommonTemplates() +templates = common_templates.node_library(source_location='build/src', versions=versions, default_version=default_version) +s.copy(templates, excludes=[]) + +node.postprocess_gapic_library_hermetic() From 148e1a62f374e5a4bba5b937f457562338a4068d Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Wed, 3 Mar 2021 18:36:39 -0800 Subject: [PATCH 103/213] build: fix OwlBot.yaml config format (#157) --- packages/google-cloud-documentai/.github/.OwlBot.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/google-cloud-documentai/.github/.OwlBot.yaml b/packages/google-cloud-documentai/.github/.OwlBot.yaml index b16cdf931a3..b9710f9db27 100644 --- a/packages/google-cloud-documentai/.github/.OwlBot.yaml +++ b/packages/google-cloud-documentai/.github/.OwlBot.yaml @@ -23,5 +23,7 @@ deep-copy-regex: rm-dest: /document/.* - source: /google/cloud/documentai/.*/documentai-.*-nodejs/test/(.*) dest: /test/$1 + rm-dest: /test/$1 - source: /google/cloud/documentai/.*/documentai-.*-nodejs/system-test/(.*) dest: /system-test/$1 + rm-dest: /system-test/$1 From 5a7a3d8ba8cf139aad3009d222001048445a5109 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Thu, 4 Mar 2021 09:32:24 -0800 Subject: [PATCH 104/213] build: proto copy path was incorrect (#159) --- packages/google-cloud-documentai/.github/.OwlBot.yaml | 10 +++++++--- packages/google-cloud-documentai/src/index.ts | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-documentai/.github/.OwlBot.yaml b/packages/google-cloud-documentai/.github/.OwlBot.yaml index b9710f9db27..abeafc163af 100644 --- a/packages/google-cloud-documentai/.github/.OwlBot.yaml +++ b/packages/google-cloud-documentai/.github/.OwlBot.yaml @@ -15,15 +15,19 @@ docker: image: gcr.io/repo-automation-bots/owlbot-nodejs:latest deep-copy-regex: + # Source Code: - source: /google/cloud/documentai/.*/documentai-.*-nodejs/src/(.*) dest: /src/$1 rm-dest: /src/.* - - source: /google/cloud/documentai/.*/documentai-.*-nodejs/protos/google/cloud/document/(.*) - dest: /document/$1 - rm-dest: /document/.* + # Protos: + - source: /google/cloud/documentai/.*/documentai-.*-nodejs/protos/google/cloud/documentai/(.*) + dest: /protos/google/cloud/documentai/$1 + rm-dest: /protos/google/cloud/documentai/* + # Unit tests: - source: /google/cloud/documentai/.*/documentai-.*-nodejs/test/(.*) dest: /test/$1 rm-dest: /test/$1 + # TypeScript integration tests: - source: /google/cloud/documentai/.*/documentai-.*-nodejs/system-test/(.*) dest: /system-test/$1 rm-dest: /system-test/$1 diff --git a/packages/google-cloud-documentai/src/index.ts b/packages/google-cloud-documentai/src/index.ts index 3d86b2bd3a0..f6301f60c97 100644 --- a/packages/google-cloud-documentai/src/index.ts +++ b/packages/google-cloud-documentai/src/index.ts @@ -16,13 +16,13 @@ // ** https://github.com/googleapis/synthtool ** // ** All changes to this file may be overwritten. ** -import * as v1beta2 from './v1beta2'; import * as v1beta3 from './v1beta3'; +import * as v1beta2 from './v1beta2'; const DocumentProcessorServiceClient = v1beta3.DocumentProcessorServiceClient; type DocumentProcessorServiceClient = v1beta3.DocumentProcessorServiceClient; -export {v1beta2, v1beta3, DocumentProcessorServiceClient}; -export default {v1beta2, v1beta3, DocumentProcessorServiceClient}; +export {v1beta3, v1beta2, DocumentProcessorServiceClient}; +export default {v1beta3, v1beta2, DocumentProcessorServiceClient}; import * as protos from '../protos/protos'; export {protos}; From dd559044177bc113974ad3a84f274bf75a3a958f Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 8 Mar 2021 10:07:09 -0800 Subject: [PATCH 105/213] build: update copyright (#164) --- packages/google-cloud-documentai/synth.metadata | 6 +++--- packages/google-cloud-documentai/webpack.config.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 86127caf5dd..7eeb36a6e93 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "67be45e7db8a76b13c96caa70db887a58719f5d7" + "sha": "f0fd7131d79f4437df46117f66fa3d9eb6d13346" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "8c058c505afc717966bc815075bdd11ff76618e5", - "internalRef": "359109762" + "sha": "5477122b3e8037a1dc5bc920536158edbd151dc4", + "internalRef": "361273630" } }, { diff --git a/packages/google-cloud-documentai/webpack.config.js b/packages/google-cloud-documentai/webpack.config.js index 2f5cbda98e1..50f90447431 100644 --- a/packages/google-cloud-documentai/webpack.config.js +++ b/packages/google-cloud-documentai/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 463cbb305a7a1b5b07066927a797a2534edb456e Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 8 Mar 2021 10:48:31 -0800 Subject: [PATCH 106/213] build: update .OwlBot.lock with new version of post-processor (#162) --- .../system-test/test.js | 27 ------------------- 1 file changed, 27 deletions(-) delete mode 100644 packages/google-cloud-documentai/system-test/test.js diff --git a/packages/google-cloud-documentai/system-test/test.js b/packages/google-cloud-documentai/system-test/test.js deleted file mode 100644 index c0b1409bd83..00000000000 --- a/packages/google-cloud-documentai/system-test/test.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright 2019, Google, Inc. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const {assert} = require('chai'); - -describe('document-ai', () => { - it('', async () => { - const {DocumentUnderstandingServiceClient} = require('../'); - const client = new DocumentUnderstandingServiceClient(); - // TODO: write sample here that demonstrates batch processing of documents. - assert.ok(client); - }); -}); From 4f0f39dff58bd4a52ca480bd66881ba128c36921 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 12 Mar 2021 10:16:15 -0800 Subject: [PATCH 107/213] feat: remove the translation fields in document.proto (#181) --- .../cloud/documentai/v1beta3/document.proto | 27 +- .../protos/protos.d.ts | 114 ------ .../google-cloud-documentai/protos/protos.js | 324 ------------------ .../protos/protos.json | 26 -- .../google-cloud-documentai/synth.metadata | 6 +- 5 files changed, 4 insertions(+), 493 deletions(-) diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto index 2c790cbbcab..0e14be6119f 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.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. @@ -487,27 +487,6 @@ message Document { string relation = 3; } - // A translation of the text segment. - message Translation { - // Provenance of the translation. - // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. There can only be a - // single `TextAnchor.text_segments` element. If the start and - // end index of the text segment are the same, the text change is inserted - // before that index. - TextAnchor text_anchor = 1; - - // The BCP-47 language code, such as "en-US" or "sr-Latn". For more - // information, see - // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - string language_code = 2; - - // Text translated into the target language. - string translated_text = 3; - - // The history of this annotation. - repeated Provenance provenance = 4; - } - // Text reference indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. message TextAnchor { // A text segment in the [Document.text][google.cloud.documentai.v1beta3.Document.text]. The indices may be out of bounds @@ -724,10 +703,6 @@ message Document { // Relationship among [Document.entities][google.cloud.documentai.v1beta3.Document.entities]. repeated EntityRelation entity_relations = 8; - // A list of translations on [Document.text][google.cloud.documentai.v1beta3.Document.text]. For document shards, - // translations in this list may cross shard boundaries. - repeated Translation translations = 12; - // A list of text corrections made to [Document.text]. This is usually // used for annotating corrections to OCR mistakes. Text changes for a given // revision may not overlap with each other. diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index fa2623e378d..151dfb5fc1d 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -4744,9 +4744,6 @@ export namespace google { /** Document entityRelations */ entityRelations?: (google.cloud.documentai.v1beta3.Document.IEntityRelation[]|null); - /** Document translations */ - translations?: (google.cloud.documentai.v1beta3.Document.ITranslation[]|null); - /** Document textChanges */ textChanges?: (google.cloud.documentai.v1beta3.Document.ITextChange[]|null); @@ -4793,9 +4790,6 @@ export namespace google { /** Document entityRelations. */ public entityRelations: google.cloud.documentai.v1beta3.Document.IEntityRelation[]; - /** Document translations. */ - public translations: google.cloud.documentai.v1beta3.Document.ITranslation[]; - /** Document textChanges. */ public textChanges: google.cloud.documentai.v1beta3.Document.ITextChange[]; @@ -7331,114 +7325,6 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** Properties of a Translation. */ - interface ITranslation { - - /** Translation textAnchor */ - textAnchor?: (google.cloud.documentai.v1beta3.Document.ITextAnchor|null); - - /** Translation languageCode */ - languageCode?: (string|null); - - /** Translation translatedText */ - translatedText?: (string|null); - - /** Translation provenance */ - provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance[]|null); - } - - /** Represents a Translation. */ - class Translation implements ITranslation { - - /** - * Constructs a new Translation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.documentai.v1beta3.Document.ITranslation); - - /** Translation textAnchor. */ - public textAnchor?: (google.cloud.documentai.v1beta3.Document.ITextAnchor|null); - - /** Translation languageCode. */ - public languageCode: string; - - /** Translation translatedText. */ - public translatedText: string; - - /** Translation provenance. */ - public provenance: google.cloud.documentai.v1beta3.Document.IProvenance[]; - - /** - * Creates a new Translation instance using the specified properties. - * @param [properties] Properties to set - * @returns Translation instance - */ - public static create(properties?: google.cloud.documentai.v1beta3.Document.ITranslation): google.cloud.documentai.v1beta3.Document.Translation; - - /** - * Encodes the specified Translation message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Translation.verify|verify} messages. - * @param message Translation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.documentai.v1beta3.Document.ITranslation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Translation message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Translation.verify|verify} messages. - * @param message Translation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.ITranslation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Translation message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Translation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Translation; - - /** - * Decodes a Translation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Translation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Translation; - - /** - * Verifies a Translation message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Translation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Translation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Translation; - - /** - * Creates a plain object from a Translation message. Also converts values to other types if specified. - * @param message Translation - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.documentai.v1beta3.Document.Translation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Translation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - /** Properties of a TextAnchor. */ interface ITextAnchor { diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 5980519a4bd..bebbd2c0cd2 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -11905,7 +11905,6 @@ * @property {Array.|null} [pages] Document pages * @property {Array.|null} [entities] Document entities * @property {Array.|null} [entityRelations] Document entityRelations - * @property {Array.|null} [translations] Document translations * @property {Array.|null} [textChanges] Document textChanges * @property {google.cloud.documentai.v1beta3.Document.IShardInfo|null} [shardInfo] Document shardInfo * @property {google.rpc.IStatus|null} [error] Document error @@ -11925,7 +11924,6 @@ this.pages = []; this.entities = []; this.entityRelations = []; - this.translations = []; this.textChanges = []; this.revisions = []; if (properties) @@ -11998,14 +11996,6 @@ */ Document.prototype.entityRelations = $util.emptyArray; - /** - * Document translations. - * @member {Array.} translations - * @memberof google.cloud.documentai.v1beta3.Document - * @instance - */ - Document.prototype.translations = $util.emptyArray; - /** * Document textChanges. * @member {Array.} textChanges @@ -12100,9 +12090,6 @@ $root.google.cloud.documentai.v1beta3.Document.ShardInfo.encode(message.shardInfo, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); if (message.error != null && Object.hasOwnProperty.call(message, "error")) $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.translations != null && message.translations.length) - for (var i = 0; i < message.translations.length; ++i) - $root.google.cloud.documentai.v1beta3.Document.Translation.encode(message.translations[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); if (message.revisions != null && message.revisions.length) for (var i = 0; i < message.revisions.length; ++i) $root.google.cloud.documentai.v1beta3.Document.Revision.encode(message.revisions[i], writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); @@ -12175,11 +12162,6 @@ message.entityRelations = []; message.entityRelations.push($root.google.cloud.documentai.v1beta3.Document.EntityRelation.decode(reader, reader.uint32())); break; - case 12: - if (!(message.translations && message.translations.length)) - message.translations = []; - message.translations.push($root.google.cloud.documentai.v1beta3.Document.Translation.decode(reader, reader.uint32())); - break; case 14: if (!(message.textChanges && message.textChanges.length)) message.textChanges = []; @@ -12286,15 +12268,6 @@ return "entityRelations." + error; } } - if (message.translations != null && message.hasOwnProperty("translations")) { - if (!Array.isArray(message.translations)) - return "translations: array expected"; - for (var i = 0; i < message.translations.length; ++i) { - var error = $root.google.cloud.documentai.v1beta3.Document.Translation.verify(message.translations[i]); - if (error) - return "translations." + error; - } - } if (message.textChanges != null && message.hasOwnProperty("textChanges")) { if (!Array.isArray(message.textChanges)) return "textChanges: array expected"; @@ -12389,16 +12362,6 @@ message.entityRelations[i] = $root.google.cloud.documentai.v1beta3.Document.EntityRelation.fromObject(object.entityRelations[i]); } } - if (object.translations) { - if (!Array.isArray(object.translations)) - throw TypeError(".google.cloud.documentai.v1beta3.Document.translations: array expected"); - message.translations = []; - for (var i = 0; i < object.translations.length; ++i) { - if (typeof object.translations[i] !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.Document.translations: object expected"); - message.translations[i] = $root.google.cloud.documentai.v1beta3.Document.Translation.fromObject(object.translations[i]); - } - } if (object.textChanges) { if (!Array.isArray(object.textChanges)) throw TypeError(".google.cloud.documentai.v1beta3.Document.textChanges: array expected"); @@ -12450,7 +12413,6 @@ object.pages = []; object.entities = []; object.entityRelations = []; - object.translations = []; object.revisions = []; object.textChanges = []; } @@ -12498,11 +12460,6 @@ object.shardInfo = $root.google.cloud.documentai.v1beta3.Document.ShardInfo.toObject(message.shardInfo, options); if (message.error != null && message.hasOwnProperty("error")) object.error = $root.google.rpc.Status.toObject(message.error, options); - if (message.translations && message.translations.length) { - object.translations = []; - for (var j = 0; j < message.translations.length; ++j) - object.translations[j] = $root.google.cloud.documentai.v1beta3.Document.Translation.toObject(message.translations[j], options); - } if (message.revisions && message.revisions.length) { object.revisions = []; for (var j = 0; j < message.revisions.length; ++j) @@ -19047,287 +19004,6 @@ return EntityRelation; })(); - Document.Translation = (function() { - - /** - * Properties of a Translation. - * @memberof google.cloud.documentai.v1beta3.Document - * @interface ITranslation - * @property {google.cloud.documentai.v1beta3.Document.ITextAnchor|null} [textAnchor] Translation textAnchor - * @property {string|null} [languageCode] Translation languageCode - * @property {string|null} [translatedText] Translation translatedText - * @property {Array.|null} [provenance] Translation provenance - */ - - /** - * Constructs a new Translation. - * @memberof google.cloud.documentai.v1beta3.Document - * @classdesc Represents a Translation. - * @implements ITranslation - * @constructor - * @param {google.cloud.documentai.v1beta3.Document.ITranslation=} [properties] Properties to set - */ - function Translation(properties) { - this.provenance = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Translation textAnchor. - * @member {google.cloud.documentai.v1beta3.Document.ITextAnchor|null|undefined} textAnchor - * @memberof google.cloud.documentai.v1beta3.Document.Translation - * @instance - */ - Translation.prototype.textAnchor = null; - - /** - * Translation languageCode. - * @member {string} languageCode - * @memberof google.cloud.documentai.v1beta3.Document.Translation - * @instance - */ - Translation.prototype.languageCode = ""; - - /** - * Translation translatedText. - * @member {string} translatedText - * @memberof google.cloud.documentai.v1beta3.Document.Translation - * @instance - */ - Translation.prototype.translatedText = ""; - - /** - * Translation provenance. - * @member {Array.} provenance - * @memberof google.cloud.documentai.v1beta3.Document.Translation - * @instance - */ - Translation.prototype.provenance = $util.emptyArray; - - /** - * Creates a new Translation instance using the specified properties. - * @function create - * @memberof google.cloud.documentai.v1beta3.Document.Translation - * @static - * @param {google.cloud.documentai.v1beta3.Document.ITranslation=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.Document.Translation} Translation instance - */ - Translation.create = function create(properties) { - return new Translation(properties); - }; - - /** - * Encodes the specified Translation message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Translation.verify|verify} messages. - * @function encode - * @memberof google.cloud.documentai.v1beta3.Document.Translation - * @static - * @param {google.cloud.documentai.v1beta3.Document.ITranslation} message Translation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Translation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.textAnchor != null && Object.hasOwnProperty.call(message, "textAnchor")) - $root.google.cloud.documentai.v1beta3.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); - if (message.translatedText != null && Object.hasOwnProperty.call(message, "translatedText")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.translatedText); - if (message.provenance != null && message.provenance.length) - for (var i = 0; i < message.provenance.length; ++i) - $root.google.cloud.documentai.v1beta3.Document.Provenance.encode(message.provenance[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Translation message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Translation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.Document.Translation - * @static - * @param {google.cloud.documentai.v1beta3.Document.ITranslation} message Translation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Translation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Translation message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.documentai.v1beta3.Document.Translation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.Document.Translation} Translation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Translation.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Translation(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.decode(reader, reader.uint32()); - break; - case 2: - message.languageCode = reader.string(); - break; - case 3: - message.translatedText = reader.string(); - break; - case 4: - if (!(message.provenance && message.provenance.length)) - message.provenance = []; - message.provenance.push($root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Translation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.Document.Translation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.Document.Translation} Translation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Translation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Translation message. - * @function verify - * @memberof google.cloud.documentai.v1beta3.Document.Translation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Translation.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) { - var error = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.verify(message.textAnchor); - if (error) - return "textAnchor." + error; - } - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - if (!$util.isString(message.languageCode)) - return "languageCode: string expected"; - if (message.translatedText != null && message.hasOwnProperty("translatedText")) - if (!$util.isString(message.translatedText)) - return "translatedText: string expected"; - if (message.provenance != null && message.hasOwnProperty("provenance")) { - if (!Array.isArray(message.provenance)) - return "provenance: array expected"; - for (var i = 0; i < message.provenance.length; ++i) { - var error = $root.google.cloud.documentai.v1beta3.Document.Provenance.verify(message.provenance[i]); - if (error) - return "provenance." + error; - } - } - return null; - }; - - /** - * Creates a Translation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.documentai.v1beta3.Document.Translation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.Document.Translation} Translation - */ - Translation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Translation) - return object; - var message = new $root.google.cloud.documentai.v1beta3.Document.Translation(); - if (object.textAnchor != null) { - if (typeof object.textAnchor !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.Document.Translation.textAnchor: object expected"); - message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.fromObject(object.textAnchor); - } - if (object.languageCode != null) - message.languageCode = String(object.languageCode); - if (object.translatedText != null) - message.translatedText = String(object.translatedText); - if (object.provenance) { - if (!Array.isArray(object.provenance)) - throw TypeError(".google.cloud.documentai.v1beta3.Document.Translation.provenance: array expected"); - message.provenance = []; - for (var i = 0; i < object.provenance.length; ++i) { - if (typeof object.provenance[i] !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.Document.Translation.provenance: object expected"); - message.provenance[i] = $root.google.cloud.documentai.v1beta3.Document.Provenance.fromObject(object.provenance[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Translation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.documentai.v1beta3.Document.Translation - * @static - * @param {google.cloud.documentai.v1beta3.Document.Translation} message Translation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Translation.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.provenance = []; - if (options.defaults) { - object.textAnchor = null; - object.languageCode = ""; - object.translatedText = ""; - } - if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) - object.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.toObject(message.textAnchor, options); - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - object.languageCode = message.languageCode; - if (message.translatedText != null && message.hasOwnProperty("translatedText")) - object.translatedText = message.translatedText; - if (message.provenance && message.provenance.length) { - object.provenance = []; - for (var j = 0; j < message.provenance.length; ++j) - object.provenance[j] = $root.google.cloud.documentai.v1beta3.Document.Provenance.toObject(message.provenance[j], options); - } - return object; - }; - - /** - * Converts this Translation to JSON. - * @function toJSON - * @memberof google.cloud.documentai.v1beta3.Document.Translation - * @instance - * @returns {Object.} JSON object - */ - Translation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Translation; - })(); - Document.TextAnchor = (function() { /** diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 044a8b85687..e264526bb3e 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -1057,11 +1057,6 @@ "type": "EntityRelation", "id": 8 }, - "translations": { - "rule": "repeated", - "type": "Translation", - "id": 12 - }, "textChanges": { "rule": "repeated", "type": "TextChange", @@ -1630,27 +1625,6 @@ } } }, - "Translation": { - "fields": { - "textAnchor": { - "type": "TextAnchor", - "id": 1 - }, - "languageCode": { - "type": "string", - "id": 2 - }, - "translatedText": { - "type": "string", - "id": 3 - }, - "provenance": { - "rule": "repeated", - "type": "Provenance", - "id": 4 - } - } - }, "TextAnchor": { "fields": { "textSegments": { diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 7eeb36a6e93..ebb8de4abd6 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "f0fd7131d79f4437df46117f66fa3d9eb6d13346" + "sha": "a3ca979ac408c4f097a9835906c1d9faea134a13" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "5477122b3e8037a1dc5bc920536158edbd151dc4", - "internalRef": "361273630" + "sha": "0c6dd7aa98ebee634ec62568237f7ee17034ad08", + "internalRef": "361590205" } }, { From aace1e963c43775907328454bbab5a11867b2452 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 15 Mar 2021 11:47:14 -0700 Subject: [PATCH 108/213] build: update metadata (#183) --- packages/google-cloud-documentai/synth.metadata | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index ebb8de4abd6..33240434c57 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "a3ca979ac408c4f097a9835906c1d9faea134a13" + "sha": "d76272a98f527d00a5862299208f8f0ebb054405" } }, { From 49f5ae919b8e12001803ebee3cfa49f43fd2cb00 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 15 Mar 2021 19:06:07 +0000 Subject: [PATCH 109/213] chore: release 2.6.0 (#182) :robot: I have created a release \*beep\* \*boop\* --- ## [2.6.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.5.0...v2.6.0) (2021-03-15) ### Features * remove the translation fields in document.proto ([#181](https://www.github.com/googleapis/nodejs-document-ai/issues/181)) ([d76272a](https://www.github.com/googleapis/nodejs-document-ai/commit/d76272a98f527d00a5862299208f8f0ebb054405)) --- 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-documentai/CHANGELOG.md | 7 +++++++ packages/google-cloud-documentai/package.json | 2 +- packages/google-cloud-documentai/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index 07fdc61524f..c28caae6ae4 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [2.6.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.5.0...v2.6.0) (2021-03-15) + + +### Features + +* remove the translation fields in document.proto ([#181](https://www.github.com/googleapis/nodejs-document-ai/issues/181)) ([d76272a](https://www.github.com/googleapis/nodejs-document-ai/commit/d76272a98f527d00a5862299208f8f0ebb054405)) + ## [2.5.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.4.0...v2.5.0) (2021-02-24) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index e5b4ad2c3a3..dd86573e772 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "2.5.0", + "version": "2.6.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index abd3c733c3c..729707db816 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^2.5.0", + "@google-cloud/documentai": "^2.6.0", "@google-cloud/storage": "^5.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" From 3b084f47d8a4b63889e86a1eb5846ab00ba789ef Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 16 Mar 2021 13:05:47 -0700 Subject: [PATCH 110/213] build: update synthtool sha (#184) --- packages/google-cloud-documentai/synth.metadata | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index 33240434c57..d8af1bdf8e5 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "d76272a98f527d00a5862299208f8f0ebb054405" + "sha": "ab886c8793a01c12f81a577bfaa2a688d791e91a" } }, { From dc40596671099d897f3f409604a82109c85dfd0d Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 23 Mar 2021 17:50:12 +0100 Subject: [PATCH 111/213] chore(deps): update dependency sinon to v10 (#187) [![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.0.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-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index dd86573e772..0793d64fcc2 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -45,7 +45,7 @@ "mocha": "^8.0.0", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", - "sinon": "^9.0.1", + "sinon": "^10.0.0", "ts-loader": "^8.0.0", "typescript": "^3.8.3", "webpack": "^5.0.0", From 6a3dadf3b5954621597fa56ccdb9a15f23a7089b Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 6 Apr 2021 15:59:22 -0700 Subject: [PATCH 112/213] build: update sha (#190) --- packages/google-cloud-documentai/synth.metadata | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index d8af1bdf8e5..eaf76f82ef4 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "ab886c8793a01c12f81a577bfaa2a688d791e91a" + "sha": "4cce9f0cb596ed92adb85ab5432804b654bf86c8" } }, { From 0db54a12dd12705c71bdeec3073d55b67f79e7ef Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Tue, 6 Apr 2021 17:04:49 -0700 Subject: [PATCH 113/213] build: fix OwlBot configuration (#192) --- .../.github/.OwlBot.yaml | 21 ++------ .../.repo-metadata.json | 3 +- packages/google-cloud-documentai/owlbot.py | 31 ++++++++--- packages/google-cloud-documentai/src/index.ts | 6 +-- packages/google-cloud-documentai/synth.py | 54 ------------------- 5 files changed, 34 insertions(+), 81 deletions(-) delete mode 100644 packages/google-cloud-documentai/synth.py diff --git a/packages/google-cloud-documentai/.github/.OwlBot.yaml b/packages/google-cloud-documentai/.github/.OwlBot.yaml index abeafc163af..f316b1c8a07 100644 --- a/packages/google-cloud-documentai/.github/.OwlBot.yaml +++ b/packages/google-cloud-documentai/.github/.OwlBot.yaml @@ -14,20 +14,9 @@ docker: image: gcr.io/repo-automation-bots/owlbot-nodejs:latest +deep-remove-regex: + - /owl-bot-staging + deep-copy-regex: - # Source Code: - - source: /google/cloud/documentai/.*/documentai-.*-nodejs/src/(.*) - dest: /src/$1 - rm-dest: /src/.* - # Protos: - - source: /google/cloud/documentai/.*/documentai-.*-nodejs/protos/google/cloud/documentai/(.*) - dest: /protos/google/cloud/documentai/$1 - rm-dest: /protos/google/cloud/documentai/* - # Unit tests: - - source: /google/cloud/documentai/.*/documentai-.*-nodejs/test/(.*) - dest: /test/$1 - rm-dest: /test/$1 - # TypeScript integration tests: - - source: /google/cloud/documentai/.*/documentai-.*-nodejs/system-test/(.*) - dest: /system-test/$1 - rm-dest: /system-test/$1 + - source: /google/cloud/documentai/(.*)/.*-nodejs/(.*) + dest: /owl-bot-staging/$1/$2 diff --git a/packages/google-cloud-documentai/.repo-metadata.json b/packages/google-cloud-documentai/.repo-metadata.json index f3f37281f69..53fd814ceae 100644 --- a/packages/google-cloud-documentai/.repo-metadata.json +++ b/packages/google-cloud-documentai/.repo-metadata.json @@ -10,5 +10,6 @@ "distribution_name": "@google-cloud/documentai", "api_id": "documentai.googleapis.com", "requires_billing": true, - "codeowner_team": "@googleapis/ml-apis" + "codeowner_team": "@googleapis/ml-apis", + "default_version": "v1beta3" } diff --git a/packages/google-cloud-documentai/owlbot.py b/packages/google-cloud-documentai/owlbot.py index 41fcb70c37f..9ef283b402f 100644 --- a/packages/google-cloud-documentai/owlbot.py +++ b/packages/google-cloud-documentai/owlbot.py @@ -17,15 +17,32 @@ import synthtool as s import synthtool.gcp as gcp import synthtool.languages.node as node +import json import logging +from pathlib import Path -# Infer version from src directory: -versions = [] -default_version = 'v1beta3' -for directory in os.listdir('./src'): - if os.path.isdir(os.path.join('./src', directory)): - versions.append(directory) -name = 'documentai' +# Load the default version defined in .repo-metadata.json. +default_version = json.load(open(".repo-metadata.json", "rt"))["default_version"] +staging = Path("owl-bot-staging") + +if staging.is_dir(): + # Collect the subdirectories of the staging directory. + versions = [v.name for v in staging.iterdir() if v.is_dir()] + # Reorder the versions so the default version always comes last. + versions = [v for v in versions if v != default_version] + [default_version] + # Copy each version directory into the root. + for version in versions: + library = staging / version + _tracked_paths.add(library) + s_copy([library], excludes=["README.md", "package.json", "src/index.ts"]) + # The staging directory should never be merged into the main branch. + shutil.rmtree(staging) +else: + # Collect the subdirectories of the src directory. + src = Path("src") + versions = [v.name for v in src.iterdir() if v.is_dir()] + # Reorder the versions so the default version always comes last. + versions = [v for v in versions if v != default_version] + [default_version] ## Note: this API only supports regional endpoints and does not support default scopes. s.replace(f"src/*/document_*_service_client.ts", diff --git a/packages/google-cloud-documentai/src/index.ts b/packages/google-cloud-documentai/src/index.ts index f6301f60c97..3d86b2bd3a0 100644 --- a/packages/google-cloud-documentai/src/index.ts +++ b/packages/google-cloud-documentai/src/index.ts @@ -16,13 +16,13 @@ // ** https://github.com/googleapis/synthtool ** // ** All changes to this file may be overwritten. ** -import * as v1beta3 from './v1beta3'; import * as v1beta2 from './v1beta2'; +import * as v1beta3 from './v1beta3'; const DocumentProcessorServiceClient = v1beta3.DocumentProcessorServiceClient; type DocumentProcessorServiceClient = v1beta3.DocumentProcessorServiceClient; -export {v1beta3, v1beta2, DocumentProcessorServiceClient}; -export default {v1beta3, v1beta2, DocumentProcessorServiceClient}; +export {v1beta2, v1beta3, DocumentProcessorServiceClient}; +export default {v1beta2, v1beta3, DocumentProcessorServiceClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/packages/google-cloud-documentai/synth.py b/packages/google-cloud-documentai/synth.py deleted file mode 100644 index 0b27eb3cc73..00000000000 --- a/packages/google-cloud-documentai/synth.py +++ /dev/null @@ -1,54 +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 logging - -logging.basicConfig(level=logging.DEBUG) - -AUTOSYNTH_MULTIPLE_COMMITS = True - - - -# run the gapic generator -gapic = gcp.GAPICBazel() -versions = ['v1beta2', 'v1beta3'] -name = 'documentai' -for version in versions: - library = gapic.node_library(name, version) - s.copy(library, excludes=['README.md', 'package.json']) - -## Note: this API only supports regional endpoints and does not support default scopes. -s.replace(f"src/*/document_*_service_client.ts", - "servicePath !== staticMembers.servicePath && ", - "" - ) -s.replace(f"src/*/document_*_service_client.ts", - "and we're connecting to a non-default endpoint, set scopes just in case", - "set scopes" - ) -s.replace(f"src/*/document_*_service_client.ts", - r"// Set the default scopes in auth client if needed(.|\n)*?}", - "" - ) - -# Copy common templates -common_templates = gcp.CommonTemplates() -templates = common_templates.node_library(source_location='build/src', versions=versions, default_version='v1beta3') -s.copy(templates, excludes=[]) - -node.postprocess_gapic_library() From d328de078e534e21f104567ad8c1a8148de15e63 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 6 Apr 2021 17:27:20 -0700 Subject: [PATCH 114/213] feat: add EVAL_SKIPPED value to the Provenance.OperationType enum (#191) PiperOrigin-RevId: 363478455 Source-Author: Google APIs Source-Date: Wed Mar 17 12:20:53 2021 -0700 Source-Repo: googleapis/googleapis Source-Sha: 4fb2f3e141fb4a62c434e1964db0fd2f2763aa08 Source-Link: https://github.com/googleapis/googleapis/commit/4fb2f3e141fb4a62c434e1964db0fd2f2763aa08 --- .../cloud/documentai/v1beta3/document.proto | 47 +++++++++---------- .../protos/protos.d.ts | 3 +- .../google-cloud-documentai/protos/protos.js | 7 +++ .../protos/protos.json | 33 ++++++++++--- .../google-cloud-documentai/synth.metadata | 4 +- 5 files changed, 58 insertions(+), 36 deletions(-) diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto index 0e14be6119f..e9345f01ad6 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto @@ -396,27 +396,19 @@ message Document { // known. If this field is present, the 'text' field is still populated. oneof structured_value { // Money value. See also: - // - // https: - // github.com/googleapis/googleapis/blob/master/google/type/money.proto + // https://github.com/googleapis/googleapis/blob/master/google/type/money.proto google.type.Money money_value = 2; // Date value. Includes year, month, day. See also: - // - // https: - // github.com/googleapis/googleapis/blob/master/google/type/date.proto + // https://github.com/googleapis/googleapis/blob/master/google/type/date.proto google.type.Date date_value = 3; // DateTime value. Includes date, time, and timezone. See also: - // - // https: - // github.com/googleapis/googleapis/blob/master/google/type/datetime.proto + // https://github.com/googleapis/googleapis/blob/master/google/type/datetime.proto google.type.DateTime datetime_value = 4; // Postal address. See also: - // - // https: - // github.com/googleapis/googleapis/blob/master/google/type/postal_address.proto + // https://github.com/googleapis/googleapis/blob/master/google/type/postal_address.proto google.type.PostalAddress address_value = 5; // Boolean value. Can be used for entities with binary values, or for @@ -434,18 +426,18 @@ message Document { string text = 1 [(google.api.field_behavior) = REQUIRED]; } - // Provenance of the entity. + // Optional. Provenance of the entity. // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. - TextAnchor text_anchor = 1; + TextAnchor text_anchor = 1 [(google.api.field_behavior) = OPTIONAL]; // Entity type from a schema e.g. `Address`. string type = 2; - // Text value in the document e.g. `1600 Amphitheatre Pkwy`. - string mention_text = 3; + // Optional. Text value in the document e.g. `1600 Amphitheatre Pkwy`. + string mention_text = 3 [(google.api.field_behavior) = OPTIONAL]; - // Deprecated. Use `id` field instead. - string mention_id = 4; + // Optional. Deprecated. Use `id` field instead. + string mention_id = 4 [(google.api.field_behavior) = OPTIONAL]; // Optional. Confidence of detected Schema entity. Range [0, 1]. float confidence = 5 [(google.api.field_behavior) = OPTIONAL]; @@ -594,9 +586,12 @@ message Document { // Element is requested for human review. EVAL_REQUESTED = 4; - // Element is review and approved at human review, confidence will be set - // to 1.0 + // Element is reviewed and approved at human review, confidence will be + // set to 1.0. EVAL_APPROVED = 5; + + // Element is skipped in the validation process. + EVAL_SKIPPED = 6; } // The index of the revision that produced this element. @@ -669,17 +664,17 @@ message Document { // Original source document from the user. oneof source { - // Currently supports Google Cloud Storage URI of the form + // Optional. Currently supports Google Cloud Storage URI of the form // `gs://bucket_name/object_name`. Object versioning is not supported. // See [Google Cloud Storage Request // URIs](https://cloud.google.com/storage/docs/reference-uris) for more // info. - string uri = 1; + string uri = 1 [(google.api.field_behavior) = OPTIONAL]; - // Inline document content, represented as a stream of bytes. + // Optional. Inline document content, represented as a stream of bytes. // Note: As with all `bytes` fields, protobuffers use a pure binary // representation, whereas JSON representations use base64. - bytes content = 2; + bytes content = 2 [(google.api.field_behavior) = OPTIONAL]; } // An IANA published MIME type (also referred to as media type). For more @@ -687,8 +682,8 @@ message Document { // https://www.iana.org/assignments/media-types/media-types.xhtml. string mime_type = 3; - // UTF-8 encoded text in reading order from the document. - string text = 4; + // Optional. UTF-8 encoded text in reading order from the document. + string text = 4 [(google.api.field_behavior) = OPTIONAL]; // Styles for the [Document.text][google.cloud.documentai.v1beta3.Document.text]. repeated Style text_styles = 5; diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 151dfb5fc1d..ff8d35dea2f 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -7949,7 +7949,8 @@ export namespace google { REMOVE = 2, REPLACE = 3, EVAL_REQUESTED = 4, - EVAL_APPROVED = 5 + EVAL_APPROVED = 5, + EVAL_SKIPPED = 6 } } diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index bebbd2c0cd2..50d1d3d4b94 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -20224,6 +20224,7 @@ case 3: case 4: case 5: + case 6: break; } return null; @@ -20280,6 +20281,10 @@ case 5: message.type = 5; break; + case "EVAL_SKIPPED": + case 6: + message.type = 6; + break; } return message; }; @@ -20549,6 +20554,7 @@ * @property {number} REPLACE=3 REPLACE value * @property {number} EVAL_REQUESTED=4 EVAL_REQUESTED value * @property {number} EVAL_APPROVED=5 EVAL_APPROVED value + * @property {number} EVAL_SKIPPED=6 EVAL_SKIPPED value */ Provenance.OperationType = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -20558,6 +20564,7 @@ values[valuesById[3] = "REPLACE"] = 3; values[valuesById[4] = "EVAL_REQUESTED"] = 4; values[valuesById[5] = "EVAL_APPROVED"] = 5; + values[valuesById[6] = "EVAL_SKIPPED"] = 6; return values; })(); diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index e264526bb3e..7c87e1b67df 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -1023,11 +1023,17 @@ "fields": { "uri": { "type": "string", - "id": 1 + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } }, "content": { "type": "bytes", - "id": 2 + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } }, "mimeType": { "type": "string", @@ -1035,7 +1041,10 @@ }, "text": { "type": "string", - "id": 4 + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } }, "textStyles": { "rule": "repeated", @@ -1499,7 +1508,10 @@ "fields": { "textAnchor": { "type": "TextAnchor", - "id": 1 + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } }, "type": { "type": "string", @@ -1507,11 +1519,17 @@ }, "mentionText": { "type": "string", - "id": 3 + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } }, "mentionId": { "type": "string", - "id": 4 + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } }, "confidence": { "type": "float", @@ -1750,7 +1768,8 @@ "REMOVE": 2, "REPLACE": 3, "EVAL_REQUESTED": 4, - "EVAL_APPROVED": 5 + "EVAL_APPROVED": 5, + "EVAL_SKIPPED": 6 } } } diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata index eaf76f82ef4..0172dfb4437 100644 --- a/packages/google-cloud-documentai/synth.metadata +++ b/packages/google-cloud-documentai/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "0c6dd7aa98ebee634ec62568237f7ee17034ad08", - "internalRef": "361590205" + "sha": "4fb2f3e141fb4a62c434e1964db0fd2f2763aa08", + "internalRef": "363478455" } }, { From 84dc254fd466f4a4085778795b0bb3f1254d4c69 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 12 Apr 2021 13:14:29 -0700 Subject: [PATCH 115/213] chore: release 2.7.0 (#193) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-documentai/CHANGELOG.md | 7 +++++++ packages/google-cloud-documentai/package.json | 2 +- packages/google-cloud-documentai/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index c28caae6ae4..ad7bf2144e0 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [2.7.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.6.0...v2.7.0) (2021-04-12) + + +### Features + +* add EVAL_SKIPPED value to the Provenance.OperationType enum ([#191](https://www.github.com/googleapis/nodejs-document-ai/issues/191)) ([161b3e0](https://www.github.com/googleapis/nodejs-document-ai/commit/161b3e05412e27454f183c77038f3a920a8af8f5)) + ## [2.6.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.5.0...v2.6.0) (2021-03-15) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 0793d64fcc2..c54953828f9 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "2.6.0", + "version": "2.7.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 729707db816..4af410f4ff3 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^2.6.0", + "@google-cloud/documentai": "^2.7.0", "@google-cloud/storage": "^5.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" From db75cf9fbec01e6dbf004ab5bec9a735e487d108 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Tue, 13 Apr 2021 10:16:55 -0700 Subject: [PATCH 116/213] feat: add v1 API surface (#196) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add v1 API surface * 🦉 Updates from OwlBot Co-authored-by: Owl Bot --- packages/google-cloud-documentai/owlbot.py | 30 +- .../google/cloud/documentai/v1/document.proto | 715 + .../cloud/documentai/v1/document_io.proto | 86 + .../v1/document_processor_service.proto | 318 + .../google/cloud/documentai/v1/geometry.proto | 57 + .../cloud/documentai/v1beta1/document.proto | 3 + .../v1beta1/document_understanding.proto | 3 + .../cloud/documentai/v1beta1/geometry.proto | 3 + .../protos/protos.d.ts | 10132 +++++- .../google-cloud-documentai/protos/protos.js | 25546 +++++++++++++++- .../protos/protos.json | 2131 +- packages/google-cloud-documentai/src/index.ts | 6 +- .../v1/document_processor_service_client.ts | 864 + ...ument_processor_service_client_config.json | 41 + ...document_processor_service_proto_list.json | 6 + .../src/v1/gapic_metadata.json | 53 + .../google-cloud-documentai/src/v1/index.ts | 19 + .../document_understanding_service_client.ts | 486 + ...t_understanding_service_client_config.json | 31 + ...ment_understanding_service_proto_list.json | 5 + .../src/v1beta1/gapic_metadata.json | 33 + .../src/v1beta1/index.ts | 19 + .../gapic_document_processor_service_v1.ts | 855 + ..._document_understanding_service_v1beta1.ts | 383 + 24 files changed, 41462 insertions(+), 363 deletions(-) create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto create mode 100644 packages/google-cloud-documentai/src/v1/document_processor_service_client.ts create mode 100644 packages/google-cloud-documentai/src/v1/document_processor_service_client_config.json create mode 100644 packages/google-cloud-documentai/src/v1/document_processor_service_proto_list.json create mode 100644 packages/google-cloud-documentai/src/v1/gapic_metadata.json create mode 100644 packages/google-cloud-documentai/src/v1/index.ts create mode 100644 packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts create mode 100644 packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client_config.json create mode 100644 packages/google-cloud-documentai/src/v1beta1/document_understanding_service_proto_list.json create mode 100644 packages/google-cloud-documentai/src/v1beta1/gapic_metadata.json create mode 100644 packages/google-cloud-documentai/src/v1beta1/index.ts create mode 100644 packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts create mode 100644 packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts diff --git a/packages/google-cloud-documentai/owlbot.py b/packages/google-cloud-documentai/owlbot.py index 9ef283b402f..763cdf629f3 100644 --- a/packages/google-cloud-documentai/owlbot.py +++ b/packages/google-cloud-documentai/owlbot.py @@ -21,28 +21,7 @@ import logging from pathlib import Path -# Load the default version defined in .repo-metadata.json. -default_version = json.load(open(".repo-metadata.json", "rt"))["default_version"] -staging = Path("owl-bot-staging") - -if staging.is_dir(): - # Collect the subdirectories of the staging directory. - versions = [v.name for v in staging.iterdir() if v.is_dir()] - # Reorder the versions so the default version always comes last. - versions = [v for v in versions if v != default_version] + [default_version] - # Copy each version directory into the root. - for version in versions: - library = staging / version - _tracked_paths.add(library) - s_copy([library], excludes=["README.md", "package.json", "src/index.ts"]) - # The staging directory should never be merged into the main branch. - shutil.rmtree(staging) -else: - # Collect the subdirectories of the src directory. - src = Path("src") - versions = [v.name for v in src.iterdir() if v.is_dir()] - # Reorder the versions so the default version always comes last. - versions = [v for v in versions if v != default_version] + [default_version] +node.owlbot_main() ## Note: this API only supports regional endpoints and does not support default scopes. s.replace(f"src/*/document_*_service_client.ts", @@ -57,10 +36,3 @@ r"// Set the default scopes in auth client if needed(.|\n)*?}", "" ) - -# Copy common templates -common_templates = gcp.CommonTemplates() -templates = common_templates.node_library(source_location='build/src', versions=versions, default_version=default_version) -s.copy(templates, excludes=[]) - -node.postprocess_gapic_library_hermetic() diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto new file mode 100644 index 00000000000..21412e98300 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto @@ -0,0 +1,715 @@ +// 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.documentai.v1; + +import "google/api/field_behavior.proto"; +import "google/cloud/documentai/v1/geometry.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; +import "google/type/color.proto"; +import "google/type/date.proto"; +import "google/type/datetime.proto"; +import "google/type/money.proto"; +import "google/type/postal_address.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.DocumentAI.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai"; +option java_multiple_files = true; +option java_outer_classname = "DocumentProto"; +option java_package = "com.google.cloud.documentai.v1"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1"; +option ruby_package = "Google::Cloud::DocumentAI::V1"; + +// Document represents the canonical document resource in Document Understanding +// AI. +// It is an interchange format that provides insights into documents and allows +// for collaboration between users and Document Understanding AI to iterate and +// optimize for quality. +message Document { + // For a large document, sharding may be performed to produce several + // document shards. Each document shard contains this field to detail which + // shard it is. + message ShardInfo { + // The 0-based index of this shard. + int64 shard_index = 1; + + // Total number of shards. + int64 shard_count = 2; + + // The index of the first character in [Document.text][google.cloud.documentai.v1.Document.text] in the overall + // document global text. + int64 text_offset = 3; + } + + // Annotation for common text style attributes. This adheres to CSS + // conventions as much as possible. + message Style { + // Font size with unit. + message FontSize { + // Font size for the text. + float size = 1; + + // Unit for the font size. Follows CSS naming (in, px, pt, etc.). + string unit = 2; + } + + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1.Document.text]. + TextAnchor text_anchor = 1; + + // Text color. + google.type.Color color = 2; + + // Text background color. + google.type.Color background_color = 3; + + // Font weight. Possible values are normal, bold, bolder, and lighter. + // https://www.w3schools.com/cssref/pr_font_weight.asp + string font_weight = 4; + + // Text style. Possible values are normal, italic, and oblique. + // https://www.w3schools.com/cssref/pr_font_font-style.asp + string text_style = 5; + + // Text decoration. Follows CSS standard. + // + // https://www.w3schools.com/cssref/pr_text_text-decoration.asp + string text_decoration = 6; + + // Font size. + FontSize font_size = 7; + } + + // A page in a [Document][google.cloud.documentai.v1.Document]. + message Page { + // Dimension for the page. + message Dimension { + // Page width. + float width = 1; + + // Page height. + float height = 2; + + // Dimension unit. + string unit = 3; + } + + // Rendered image contents for this page. + message Image { + // Raw byte content of the image. + bytes content = 1; + + // Encoding mime type for the image. + string mime_type = 2; + + // Width of the image in pixels. + int32 width = 3; + + // Height of the image in pixels. + int32 height = 4; + } + + // Representation for transformation matrix, intended to be compatible and + // used with OpenCV format for image manipulation. + message Matrix { + // Number of rows in the matrix. + int32 rows = 1; + + // Number of columns in the matrix. + int32 cols = 2; + + // This encodes information about what data type the matrix uses. + // For example, 0 (CV_8U) is an unsigned 8-bit image. For the full list + // of OpenCV primitive data types, please refer to + // https://docs.opencv.org/4.3.0/d1/d1b/group__core__hal__interface.html + int32 type = 3; + + // The matrix data. + bytes data = 4; + } + + // Visual element describing a layout unit on a page. + message Layout { + // Detected human reading orientation. + enum Orientation { + // Unspecified orientation. + ORIENTATION_UNSPECIFIED = 0; + + // Orientation is aligned with page up. + PAGE_UP = 1; + + // Orientation is aligned with page right. + // Turn the head 90 degrees clockwise from upright to read. + PAGE_RIGHT = 2; + + // Orientation is aligned with page down. + // Turn the head 180 degrees from upright to read. + PAGE_DOWN = 3; + + // Orientation is aligned with page left. + // Turn the head 90 degrees counterclockwise from upright to read. + PAGE_LEFT = 4; + } + + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1.Document.text]. + TextAnchor text_anchor = 1; + + // Confidence of the current [Layout][google.cloud.documentai.v1.Document.Page.Layout] within context of the object this + // layout is for. e.g. confidence can be for a single token, a table, + // a visual element, etc. depending on context. Range [0, 1]. + float confidence = 2; + + // The bounding polygon for the [Layout][google.cloud.documentai.v1.Document.Page.Layout]. + BoundingPoly bounding_poly = 3; + + // Detected orientation for the [Layout][google.cloud.documentai.v1.Document.Page.Layout]. + Orientation orientation = 4; + } + + // A block has a set of lines (collected into paragraphs) that have a + // common line-spacing and orientation. + message Block { + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Block][google.cloud.documentai.v1.Document.Page.Block]. + Layout layout = 1; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 2; + + // The history of this annotation. + Provenance provenance = 3; + } + + // A collection of lines that a human would perceive as a paragraph. + message Paragraph { + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Paragraph][google.cloud.documentai.v1.Document.Page.Paragraph]. + Layout layout = 1; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 2; + + // The history of this annotation. + Provenance provenance = 3; + } + + // A collection of tokens that a human would perceive as a line. + // Does not cross column boundaries, can be horizontal, vertical, etc. + message Line { + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Line][google.cloud.documentai.v1.Document.Page.Line]. + Layout layout = 1; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 2; + + // The history of this annotation. + Provenance provenance = 3; + } + + // A detected token. + message Token { + // Detected break at the end of a [Token][google.cloud.documentai.v1.Document.Page.Token]. + message DetectedBreak { + // Enum to denote the type of break found. + enum Type { + // Unspecified break type. + TYPE_UNSPECIFIED = 0; + + // A single whitespace. + SPACE = 1; + + // A wider whitespace. + WIDE_SPACE = 2; + + // A hyphen that indicates that a token has been split across lines. + HYPHEN = 3; + } + + // Detected break type. + Type type = 1; + } + + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Token][google.cloud.documentai.v1.Document.Page.Token]. + Layout layout = 1; + + // Detected break at the end of a [Token][google.cloud.documentai.v1.Document.Page.Token]. + DetectedBreak detected_break = 2; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 3; + + // The history of this annotation. + Provenance provenance = 4; + } + + // Detected non-text visual elements e.g. checkbox, signature etc. on the + // page. + message VisualElement { + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. + Layout layout = 1; + + // Type of the [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. + string type = 2; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 3; + } + + // A table representation similar to HTML table structure. + message Table { + // A row of table cells. + message TableRow { + // Cells that make up this row. + repeated TableCell cells = 1; + } + + // A cell representation inside the table. + message TableCell { + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [TableCell][google.cloud.documentai.v1.Document.Page.Table.TableCell]. + Layout layout = 1; + + // How many rows this cell spans. + int32 row_span = 2; + + // How many columns this cell spans. + int32 col_span = 3; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 4; + } + + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Table][google.cloud.documentai.v1.Document.Page.Table]. + Layout layout = 1; + + // Header rows of the table. + repeated TableRow header_rows = 2; + + // Body rows of the table. + repeated TableRow body_rows = 3; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 4; + } + + // A form field detected on the page. + message FormField { + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the [FormField][google.cloud.documentai.v1.Document.Page.FormField] name. e.g. `Address`, `Email`, + // `Grand total`, `Phone number`, etc. + Layout field_name = 1; + + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the [FormField][google.cloud.documentai.v1.Document.Page.FormField] value. + Layout field_value = 2; + + // A list of detected languages for name together with confidence. + repeated DetectedLanguage name_detected_languages = 3; + + // A list of detected languages for value together with confidence. + repeated DetectedLanguage value_detected_languages = 4; + + // If the value is non-textual, this field represents the type. Current + // valid values are: + // - blank (this indicates the field_value is normal text) + // - "unfilled_checkbox" + // - "filled_checkbox" + string value_type = 5; + } + + // Detected language for a structural component. + message DetectedLanguage { + // The BCP-47 language code, such as "en-US" or "sr-Latn". For more + // information, see + // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + string language_code = 1; + + // Confidence of detected language. Range [0, 1]. + float confidence = 2; + } + + // 1-based index for current [Page][google.cloud.documentai.v1.Document.Page] in a parent [Document][google.cloud.documentai.v1.Document]. + // Useful when a page is taken out of a [Document][google.cloud.documentai.v1.Document] for individual + // processing. + int32 page_number = 1; + + // Rendered image for this page. This image is preprocessed to remove any + // skew, rotation, and distortions such that the annotation bounding boxes + // can be upright and axis-aligned. + Image image = 13; + + // Transformation matrices that were applied to the original document image + // to produce [Page.image][google.cloud.documentai.v1.Document.Page.image]. + repeated Matrix transforms = 14; + + // Physical dimension of the page. + Dimension dimension = 2; + + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the page. + Layout layout = 3; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 4; + + // A list of visually detected text blocks on the page. + // A block has a set of lines (collected into paragraphs) that have a common + // line-spacing and orientation. + repeated Block blocks = 5; + + // A list of visually detected text paragraphs on the page. + // A collection of lines that a human would perceive as a paragraph. + repeated Paragraph paragraphs = 6; + + // A list of visually detected text lines on the page. + // A collection of tokens that a human would perceive as a line. + repeated Line lines = 7; + + // A list of visually detected tokens on the page. + repeated Token tokens = 8; + + // A list of detected non-text visual elements e.g. checkbox, + // signature etc. on the page. + repeated VisualElement visual_elements = 9; + + // A list of visually detected tables on the page. + repeated Table tables = 10; + + // A list of visually detected form fields on the page. + repeated FormField form_fields = 11; + } + + // A phrase in the text that is a known entity type, such as a person, an + // organization, or location. + message Entity { + // Parsed and normalized entity value. + message NormalizedValue { + // Structured entity value. Must match entity type defined in schema if + // known. If this field is present, the 'text' field is still populated. + oneof structured_value { + // Money value. See also: + // https://github.com/googleapis/googleapis/blob/master/google/type/money.proto + google.type.Money money_value = 2; + + // Date value. Includes year, month, day. See also: + // https://github.com/googleapis/googleapis/blob/master/google/type/date.proto + google.type.Date date_value = 3; + + // DateTime value. Includes date, time, and timezone. See also: + // https://github.com/googleapis/googleapis/blob/master/google/type/datetime.proto + google.type.DateTime datetime_value = 4; + + // Postal address. See also: + // https://github.com/googleapis/googleapis/blob/master/google/type/postal_address.proto + google.type.PostalAddress address_value = 5; + + // Boolean value. Can be used for entities with binary values, or for + // checkboxes. + bool boolean_value = 6; + } + + // Required. Normalized entity value stored as a string. This field is populated for + // supported document type (e.g. Invoice). For some entity types, one of + // respective 'structured_value' fields may also be populated. + // + // - Money/Currency type (`money_value`) is in the ISO 4217 text format. + // - Date type (`date_value`) is in the ISO 8601 text format. + // - Datetime type (`datetime_value`) is in the ISO 8601 text format. + string text = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // Optional. Provenance of the entity. + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1.Document.text]. + TextAnchor text_anchor = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Entity type from a schema e.g. `Address`. + string type = 2; + + // Optional. Text value in the document e.g. `1600 Amphitheatre Pkwy`. + string mention_text = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Deprecated. Use `id` field instead. + string mention_id = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Confidence of detected Schema entity. Range [0, 1]. + float confidence = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Represents the provenance of this entity wrt. the location on the + // page where it was found. + PageAnchor page_anchor = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Canonical id. This will be a unique value in the entity list + // for this document. + string id = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Normalized entity value. Absent if the extracted value could not be + // converted or the type (e.g. address) is not supported for certain + // parsers. This field is also only populated for certain supported document + // types. + NormalizedValue normalized_value = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Entities can be nested to form a hierarchical data structure representing + // the content in the document. + repeated Entity properties = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The history of this annotation. + Provenance provenance = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether the entity will be redacted for de-identification purposes. + bool redacted = 12 [(google.api.field_behavior) = OPTIONAL]; + } + + // Relationship between [Entities][google.cloud.documentai.v1.Document.Entity]. + message EntityRelation { + // Subject entity id. + string subject_id = 1; + + // Object entity id. + string object_id = 2; + + // Relationship description. + string relation = 3; + } + + // Text reference indexing into the [Document.text][google.cloud.documentai.v1.Document.text]. + message TextAnchor { + // A text segment in the [Document.text][google.cloud.documentai.v1.Document.text]. The indices may be out of bounds + // which indicate that the text extends into another document shard for + // large sharded documents. See [ShardInfo.text_offset][google.cloud.documentai.v1.Document.ShardInfo.text_offset] + message TextSegment { + // [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] start UTF-8 char index in the [Document.text][google.cloud.documentai.v1.Document.text]. + int64 start_index = 1; + + // [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] half open end UTF-8 char index in the + // [Document.text][google.cloud.documentai.v1.Document.text]. + int64 end_index = 2; + } + + // The text segments from the [Document.text][google.cloud.documentai.v1.Document.text]. + repeated TextSegment text_segments = 1; + + // Contains the content of the text span so that users do + // not have to look it up in the text_segments. + string content = 2; + } + + // Referencing the visual context of the entity in the [Document.pages][google.cloud.documentai.v1.Document.pages]. + // Page anchors can be cross-page, consist of multiple bounding polygons and + // optionally reference specific layout element types. + message PageAnchor { + // Represents a weak reference to a page element within a document. + message PageRef { + // The type of layout that is being referenced. + enum LayoutType { + // Layout Unspecified. + LAYOUT_TYPE_UNSPECIFIED = 0; + + // References a [Page.blocks][google.cloud.documentai.v1.Document.Page.blocks] element. + BLOCK = 1; + + // References a [Page.paragraphs][google.cloud.documentai.v1.Document.Page.paragraphs] element. + PARAGRAPH = 2; + + // References a [Page.lines][google.cloud.documentai.v1.Document.Page.lines] element. + LINE = 3; + + // References a [Page.tokens][google.cloud.documentai.v1.Document.Page.tokens] element. + TOKEN = 4; + + // References a [Page.visual_elements][google.cloud.documentai.v1.Document.Page.visual_elements] element. + VISUAL_ELEMENT = 5; + + // Refrrences a [Page.tables][google.cloud.documentai.v1.Document.Page.tables] element. + TABLE = 6; + + // References a [Page.form_fields][google.cloud.documentai.v1.Document.Page.form_fields] element. + FORM_FIELD = 7; + } + + // Required. Index into the [Document.pages][google.cloud.documentai.v1.Document.pages] element, for example using + // [Document.pages][page_refs.page] to locate the related page element. + int64 page = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The type of the layout element that is being referenced if any. + LayoutType layout_type = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Deprecated. Use [PageRef.bounding_poly][google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly] instead. + string layout_id = 3 [ + deprecated = true, + (google.api.field_behavior) = OPTIONAL + ]; + + // Optional. Identifies the bounding polygon of a layout element on the page. + BoundingPoly bounding_poly = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // One or more references to visual page elements + repeated PageRef page_refs = 1; + } + + // Structure to identify provenance relationships between annotations in + // different revisions. + message Provenance { + // Structure for referencing parent provenances. When an element replaces + // one of more other elements parent references identify the elements that + // are replaced. + message Parent { + // The index of the [Document.revisions] identifying the parent revision. + int32 revision = 1; + + // The id of the parent provenance. + int32 id = 2; + } + + // If a processor or agent does an explicit operation on existing elements. + enum OperationType { + // Operation type unspecified. + OPERATION_TYPE_UNSPECIFIED = 0; + + // Add an element. Implicit if no `parents` are set for the provenance. + ADD = 1; + + // The element is removed. No `parents` should be set. + REMOVE = 2; + + // Explicitly replaces the element(s) identified by `parents`. + REPLACE = 3; + + // Element is requested for human review. + EVAL_REQUESTED = 4; + + // Element is reviewed and approved at human review, confidence will be + // set to 1.0. + EVAL_APPROVED = 5; + + // Element is skipped in the validation process. + EVAL_SKIPPED = 6; + } + + // The index of the revision that produced this element. + int32 revision = 1; + + // The Id of this operation. Needs to be unique within the scope of the + // revision. + int32 id = 2; + + // References to the original elements that are replaced. + repeated Parent parents = 3; + + // The type of provenance operation. + OperationType type = 4; + } + + // Contains past or forward revisions of this document. + message Revision { + // Human Review information of the document. + message HumanReview { + // Human review state. e.g. `requested`, `succeeded`, `rejected`. + string state = 1; + + // A message providing more details about the current state of processing. + // For example, the rejection reason when the state is `rejected`. + string state_message = 2; + } + + // Who/what made the change + oneof source { + // If the change was made by a person specify the name or id of that + // person. + string agent = 4; + + // If the annotation was made by processor identify the processor by its + // resource name. + string processor = 5; + } + + // Id of the revision. Unique within the context of the document. + string id = 1; + + // The revisions that this revision is based on. This can include one or + // more parent (when documents are merged.) This field represents the + // index into the `revisions` field. + repeated int32 parent = 2; + + // The time that the revision was created. + google.protobuf.Timestamp create_time = 3; + + // Human Review information of this revision. + HumanReview human_review = 6; + } + + // This message is used for text changes aka. OCR corrections. + message TextChange { + // Provenance of the correction. + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1.Document.text]. There can only be a + // single `TextAnchor.text_segments` element. If the start and + // end index of the text segment are the same, the text change is inserted + // before that index. + TextAnchor text_anchor = 1; + + // The text that replaces the text identified in the `text_anchor`. + string changed_text = 2; + + // The history of this annotation. + repeated Provenance provenance = 3; + } + + // Original source document from the user. + oneof source { + // Optional. Currently supports Google Cloud Storage URI of the form + // `gs://bucket_name/object_name`. Object versioning is not supported. + // See [Google Cloud Storage Request + // URIs](https://cloud.google.com/storage/docs/reference-uris) for more + // info. + string uri = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Inline document content, represented as a stream of bytes. + // Note: As with all `bytes` fields, protobuffers use a pure binary + // representation, whereas JSON representations use base64. + bytes content = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // An IANA published MIME type (also referred to as media type). For more + // information, see + // https://www.iana.org/assignments/media-types/media-types.xhtml. + string mime_type = 3; + + // Optional. UTF-8 encoded text in reading order from the document. + string text = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Styles for the [Document.text][google.cloud.documentai.v1.Document.text]. + repeated Style text_styles = 5; + + // Visual page layout for the [Document][google.cloud.documentai.v1.Document]. + repeated Page pages = 6; + + // A list of entities detected on [Document.text][google.cloud.documentai.v1.Document.text]. For document shards, + // entities in this list may cross shard boundaries. + repeated Entity entities = 7; + + // Relationship among [Document.entities][google.cloud.documentai.v1.Document.entities]. + repeated EntityRelation entity_relations = 8; + + // A list of text corrections made to [Document.text]. This is usually + // used for annotating corrections to OCR mistakes. Text changes for a given + // revision may not overlap with each other. + repeated TextChange text_changes = 14; + + // Information about the sharding if this document is sharded part of a larger + // document. If the document is not sharded, this message is not specified. + ShardInfo shard_info = 9; + + // Any error that occurred while processing this document. + google.rpc.Status error = 10; + + // Revision history of this document. + repeated Revision revisions = 13; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto new file mode 100644 index 00000000000..1bd020eefdb --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto @@ -0,0 +1,86 @@ +// 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.documentai.v1; + +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.DocumentAI.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai"; +option java_multiple_files = true; +option java_outer_classname = "DocumentIoProto"; +option java_package = "com.google.cloud.documentai.v1"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1"; +option ruby_package = "Google::Cloud::DocumentAI::V1"; + +// Payload message of raw document content (bytes). +message RawDocument { + // Inline document content. + bytes content = 1; + + // An IANA MIME type (RFC6838) indicating the nature and format of the + // [content]. + string mime_type = 2; +} + +// Specifies a document stored on Cloud Storage. +message GcsDocument { + // The Cloud Storage object uri. + string gcs_uri = 1; + + // An IANA MIME type (RFC6838) of the content. + string mime_type = 2; +} + +// Specifies a set of documents on Cloud Storage. +message GcsDocuments { + // The list of documents. + repeated GcsDocument documents = 1; +} + +// Specifies all documents on Cloud Storage with a common prefix. +message GcsPrefix { + // The URI prefix. + string gcs_uri_prefix = 1; +} + +// The common config to specify a set of documents used as input. +message BatchDocumentsInputConfig { + // The source. + oneof source { + // The set of documents that match the specified Cloud Storage [gcs_prefix]. + GcsPrefix gcs_prefix = 1; + + // The set of documents individually specified on Cloud Storage. + GcsDocuments gcs_documents = 2; + } +} + +// Config that controls the output of documents. All documents will be written +// as a JSON file. +message DocumentOutputConfig { + // The configuration used when outputting documents. + message GcsOutputConfig { + // The Cloud Storage uri (a directory) of the output. + string gcs_uri = 1; + } + + // The destination of the results. + oneof destination { + // Output config to write the results to Cloud Storage. + GcsOutputConfig gcs_output_config = 1; + } +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto new file mode 100644 index 00000000000..0d3e872ca62 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto @@ -0,0 +1,318 @@ +// 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.documentai.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/documentai/v1/document.proto"; +import "google/cloud/documentai/v1/document_io.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.DocumentAI.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai"; +option java_multiple_files = true; +option java_outer_classname = "DocumentAiProcessorService"; +option java_package = "com.google.cloud.documentai.v1"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1"; +option ruby_package = "Google::Cloud::DocumentAI::V1"; +option (google.api.resource_definition) = { + type: "documentai.googleapis.com/Location" + pattern: "projects/{project}/locations/{location}" +}; +option (google.api.resource_definition) = { + type: "documentai.googleapis.com/Processor" + pattern: "projects/{project}/locations/{location}/processors/{processor}" +}; +option (google.api.resource_definition) = { + type: "documentai.googleapis.com/HumanReviewConfig" + pattern: "projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig" +}; + +// Service to call Cloud DocumentAI to process documents according to the +// processor's definition. Processors are built using state-of-the-art Google +// AI such as natural language, computer vision, and translation to extract +// structured information from unstructured or semi-structured documents. +service DocumentProcessorService { + option (google.api.default_host) = "us-documentai.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Processes a single document. + rpc ProcessDocument(ProcessRequest) returns (ProcessResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/processors/*}:process" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // LRO endpoint to batch process many documents. The output is written + // to Cloud Storage as JSON in the [Document] format. + rpc BatchProcessDocuments(BatchProcessRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/processors/*}:batchProcess" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "BatchProcessResponse" + metadata_type: "BatchProcessMetadata" + }; + } + + // Send a document for Human Review. The input document should be processed by + // the specified processor. + rpc ReviewDocument(ReviewDocumentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{human_review_config=projects/*/locations/*/processors/*/humanReviewConfig}:reviewDocument" + body: "*" + }; + option (google.api.method_signature) = "human_review_config"; + option (google.longrunning.operation_info) = { + response_type: "ReviewDocumentResponse" + metadata_type: "ReviewDocumentOperationMetadata" + }; + } +} + +// Request message for the process document method. +message ProcessRequest { + // The document payload. + oneof source { + // An inline document proto. + Document inline_document = 4; + + // A raw document content (bytes). + RawDocument raw_document = 5; + } + + // Required. The processor resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/Processor" + } + ]; + + // Whether Human Review feature should be skipped for this request. Default to + // false. + bool skip_human_review = 3; +} + +// The status of human review on a processed document. +message HumanReviewStatus { + // The final state of human review on a processed document. + enum State { + // Human review state is unspecified. Most likely due to an internal error. + STATE_UNSPECIFIED = 0; + + // Human review is skipped for the document. This can happen because human + // review is not enabled on the processor or the processing request has + // been set to skip this document. + SKIPPED = 1; + + // Human review validation is triggered and passed, so no review is needed. + VALIDATION_PASSED = 2; + + // Human review validation is triggered and the document is under review. + IN_PROGRESS = 3; + + // Some error happened during triggering human review, see the + // [state_message] for details. + ERROR = 4; + } + + // The state of human review on the processing request. + State state = 1; + + // A message providing more details about the human review state. + string state_message = 2; + + // The name of the operation triggered by the processed document. This field + // is populated only when the [state] is [HUMAN_REVIEW_IN_PROGRESS]. It has + // the same response type and metadata as the long running operation returned + // by [ReviewDocument] method. + string human_review_operation = 3; +} + +// Response message for the process document method. +message ProcessResponse { + // The document payload, will populate fields based on the processor's + // behavior. + Document document = 1; + + // The status of human review on the processed document. + HumanReviewStatus human_review_status = 3; +} + +// Request message for batch process document method. +message BatchProcessRequest { + // Required. The processor resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/Processor" + } + ]; + + // The input documents for batch process. + BatchDocumentsInputConfig input_documents = 5; + + // The overall output config for batch process. + DocumentOutputConfig document_output_config = 6; + + // Whether Human Review feature should be skipped for this request. Default to + // false. + bool skip_human_review = 4; +} + +// Response message for batch process document method. +message BatchProcessResponse { + +} + +// The long running operation metadata for batch process method. +message BatchProcessMetadata { + // The status of a each individual document in the batch process. + message IndividualProcessStatus { + // The source of the document, same as the [input_gcs_source] field in the + // request when the batch process started. The batch process is started by + // take snapshot of that document, since a user can move or change that + // document during the process. + string input_gcs_source = 1; + + // The status of the processing of the document. + google.rpc.Status status = 2; + + // The output_gcs_destination (in the request as 'output_gcs_destination') + // of the processed document if it was successful, otherwise empty. + string output_gcs_destination = 3; + + // The status of human review on the processed document. + HumanReviewStatus human_review_status = 5; + } + + // Possible states of the batch processing operation. + enum State { + // The default value. This value is used if the state is omitted. + STATE_UNSPECIFIED = 0; + + // Request operation is waiting for scheduling. + WAITING = 1; + + // Request is being processed. + RUNNING = 2; + + // The batch processing completed successfully. + SUCCEEDED = 3; + + // The batch processing was being cancelled. + CANCELLING = 4; + + // The batch processing was cancelled. + CANCELLED = 5; + + // The batch processing has failed. + FAILED = 6; + } + + // The state of the current batch processing. + State state = 1; + + // A message providing more details about the current state of processing. + // For example, the error message if the operation is failed. + string state_message = 2; + + // The creation time of the operation. + google.protobuf.Timestamp create_time = 3; + + // The last update time of the operation. + google.protobuf.Timestamp update_time = 4; + + // The list of response details of each document. + repeated IndividualProcessStatus individual_process_statuses = 5; +} + +// Request message for review document method. +message ReviewDocumentRequest { + // The document payload. + oneof source { + // An inline document proto. + Document inline_document = 4; + } + + // Required. The resource name of the HumanReviewConfig that the document will be + // reviewed with. + string human_review_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/HumanReviewConfig" + } + ]; +} + +// Response message for review document method. +message ReviewDocumentResponse { + // The Cloud Storage uri for the human reviewed document. + string gcs_destination = 1; +} + +// The long running operation metadata for review document method. +message ReviewDocumentOperationMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 5; +} + +// The common metadata for long running operations. +message CommonOperationMetadata { + // State of the longrunning operation. + enum State { + // Unspecified state. + STATE_UNSPECIFIED = 0; + + // Operation is still running. + RUNNING = 1; + + // Operation is being cancelled. + CANCELLING = 2; + + // Operation succeeded. + SUCCEEDED = 3; + + // Operation failed. + FAILED = 4; + + // Operation is cancelled. + CANCELLED = 5; + } + + // The state of the operation. + State state = 1; + + // A message providing more details about the current state of processing. + string state_message = 2; + + // The creation time of the operation. + google.protobuf.Timestamp create_time = 3; + + // The last update time of the operation. + google.protobuf.Timestamp update_time = 4; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto new file mode 100644 index 00000000000..779e9664da9 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto @@ -0,0 +1,57 @@ +// 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.documentai.v1; + +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.DocumentAI.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai"; +option java_multiple_files = true; +option java_outer_classname = "GeometryProto"; +option java_package = "com.google.cloud.documentai.v1"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1"; +option ruby_package = "Google::Cloud::DocumentAI::V1"; + +// A vertex represents a 2D point in the image. +// NOTE: the vertex coordinates are in the same scale as the original image. +message Vertex { + // X coordinate. + int32 x = 1; + + // Y coordinate. + int32 y = 2; +} + +// A vertex represents a 2D point in the image. +// NOTE: the normalized vertex coordinates are relative to the original image +// and range from 0 to 1. +message NormalizedVertex { + // X coordinate. + float x = 1; + + // Y coordinate. + float y = 2; +} + +// A bounding polygon for the detected image annotation. +message BoundingPoly { + // The bounding polygon vertices. + repeated Vertex vertices = 1; + + // The bounding polygon normalized vertices. + repeated NormalizedVertex normalized_vertices = 2; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document.proto index 1303c32dd2b..2c47f6f2228 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document.proto @@ -22,10 +22,13 @@ import "google/cloud/documentai/v1beta1/geometry.proto"; import "google/rpc/status.proto"; import "google/type/color.proto"; +option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta1"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta1;documentai"; option java_multiple_files = true; option java_outer_classname = "DocumentProto"; option java_package = "com.google.cloud.documentai.v1beta1"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta1"; +option ruby_package = "Google::Cloud::DocumentAI::V1beta1"; // Document represents the canonical document resource in Document Understanding // AI. diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document_understanding.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document_understanding.proto index 4f8dfb72298..eb17286d4d5 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document_understanding.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document_understanding.proto @@ -24,10 +24,13 @@ import "google/cloud/documentai/v1beta1/geometry.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/timestamp.proto"; +option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta1"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta1;documentai"; option java_multiple_files = true; option java_outer_classname = "DocumentAiProto"; option java_package = "com.google.cloud.documentai.v1beta1"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta1"; +option ruby_package = "Google::Cloud::DocumentAI::V1beta1"; // Service to parse structured information from unstructured or semi-structured // documents using state-of-the-art Google AI such as natural language, diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/geometry.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/geometry.proto index 9dbe2b78b13..631c179c34c 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/geometry.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/geometry.proto @@ -19,10 +19,13 @@ package google.cloud.documentai.v1beta1; import "google/api/annotations.proto"; +option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta1"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta1;documentai"; option java_multiple_files = true; option java_outer_classname = "GeometryProto"; option java_package = "com.google.cloud.documentai.v1beta1"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta1"; +option ruby_package = "Google::Cloud::DocumentAI::V1beta1"; // A vertex represents a 2D point in the image. // NOTE: the vertex coordinates are in the same scale as the original image. diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index ff8d35dea2f..add8ef91d81 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -23,6 +23,9946 @@ export namespace google { /** Namespace documentai. */ namespace documentai { + /** Namespace v1. */ + namespace v1 { + + /** Properties of a Document. */ + interface IDocument { + + /** Document uri */ + uri?: (string|null); + + /** Document content */ + content?: (Uint8Array|string|null); + + /** Document mimeType */ + mimeType?: (string|null); + + /** Document text */ + text?: (string|null); + + /** Document textStyles */ + textStyles?: (google.cloud.documentai.v1.Document.IStyle[]|null); + + /** Document pages */ + pages?: (google.cloud.documentai.v1.Document.IPage[]|null); + + /** Document entities */ + entities?: (google.cloud.documentai.v1.Document.IEntity[]|null); + + /** Document entityRelations */ + entityRelations?: (google.cloud.documentai.v1.Document.IEntityRelation[]|null); + + /** Document textChanges */ + textChanges?: (google.cloud.documentai.v1.Document.ITextChange[]|null); + + /** Document shardInfo */ + shardInfo?: (google.cloud.documentai.v1.Document.IShardInfo|null); + + /** Document error */ + error?: (google.rpc.IStatus|null); + + /** Document revisions */ + revisions?: (google.cloud.documentai.v1.Document.IRevision[]|null); + } + + /** Represents a Document. */ + class Document implements IDocument { + + /** + * Constructs a new Document. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDocument); + + /** Document uri. */ + public uri: string; + + /** Document content. */ + public content: (Uint8Array|string); + + /** Document mimeType. */ + public mimeType: string; + + /** Document text. */ + public text: string; + + /** Document textStyles. */ + public textStyles: google.cloud.documentai.v1.Document.IStyle[]; + + /** Document pages. */ + public pages: google.cloud.documentai.v1.Document.IPage[]; + + /** Document entities. */ + public entities: google.cloud.documentai.v1.Document.IEntity[]; + + /** Document entityRelations. */ + public entityRelations: google.cloud.documentai.v1.Document.IEntityRelation[]; + + /** Document textChanges. */ + public textChanges: google.cloud.documentai.v1.Document.ITextChange[]; + + /** Document shardInfo. */ + public shardInfo?: (google.cloud.documentai.v1.Document.IShardInfo|null); + + /** Document error. */ + public error?: (google.rpc.IStatus|null); + + /** Document revisions. */ + public revisions: google.cloud.documentai.v1.Document.IRevision[]; + + /** Document source. */ + public source?: ("uri"|"content"); + + /** + * Creates a new Document instance using the specified properties. + * @param [properties] Properties to set + * @returns Document instance + */ + public static create(properties?: google.cloud.documentai.v1.IDocument): google.cloud.documentai.v1.Document; + + /** + * Encodes the specified Document message. Does not implicitly {@link google.cloud.documentai.v1.Document.verify|verify} messages. + * @param message Document message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Document message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.verify|verify} messages. + * @param message Document message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Document message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document; + + /** + * Decodes a Document message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document; + + /** + * Verifies a Document message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Document message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Document + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document; + + /** + * Creates a plain object from a Document message. Also converts values to other types if specified. + * @param message Document + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Document to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Document { + + /** Properties of a ShardInfo. */ + interface IShardInfo { + + /** ShardInfo shardIndex */ + shardIndex?: (number|Long|string|null); + + /** ShardInfo shardCount */ + shardCount?: (number|Long|string|null); + + /** ShardInfo textOffset */ + textOffset?: (number|Long|string|null); + } + + /** Represents a ShardInfo. */ + class ShardInfo implements IShardInfo { + + /** + * Constructs a new ShardInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.IShardInfo); + + /** ShardInfo shardIndex. */ + public shardIndex: (number|Long|string); + + /** ShardInfo shardCount. */ + public shardCount: (number|Long|string); + + /** ShardInfo textOffset. */ + public textOffset: (number|Long|string); + + /** + * Creates a new ShardInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns ShardInfo instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.IShardInfo): google.cloud.documentai.v1.Document.ShardInfo; + + /** + * Encodes the specified ShardInfo message. Does not implicitly {@link google.cloud.documentai.v1.Document.ShardInfo.verify|verify} messages. + * @param message ShardInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.IShardInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ShardInfo message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.ShardInfo.verify|verify} messages. + * @param message ShardInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.IShardInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ShardInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ShardInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.ShardInfo; + + /** + * Decodes a ShardInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ShardInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.ShardInfo; + + /** + * Verifies a ShardInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ShardInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ShardInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.ShardInfo; + + /** + * Creates a plain object from a ShardInfo message. Also converts values to other types if specified. + * @param message ShardInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.ShardInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ShardInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Style. */ + interface IStyle { + + /** Style textAnchor */ + textAnchor?: (google.cloud.documentai.v1.Document.ITextAnchor|null); + + /** Style color */ + color?: (google.type.IColor|null); + + /** Style backgroundColor */ + backgroundColor?: (google.type.IColor|null); + + /** Style fontWeight */ + fontWeight?: (string|null); + + /** Style textStyle */ + textStyle?: (string|null); + + /** Style textDecoration */ + textDecoration?: (string|null); + + /** Style fontSize */ + fontSize?: (google.cloud.documentai.v1.Document.Style.IFontSize|null); + } + + /** Represents a Style. */ + class Style implements IStyle { + + /** + * Constructs a new Style. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.IStyle); + + /** Style textAnchor. */ + public textAnchor?: (google.cloud.documentai.v1.Document.ITextAnchor|null); + + /** Style color. */ + public color?: (google.type.IColor|null); + + /** Style backgroundColor. */ + public backgroundColor?: (google.type.IColor|null); + + /** Style fontWeight. */ + public fontWeight: string; + + /** Style textStyle. */ + public textStyle: string; + + /** Style textDecoration. */ + public textDecoration: string; + + /** Style fontSize. */ + public fontSize?: (google.cloud.documentai.v1.Document.Style.IFontSize|null); + + /** + * Creates a new Style instance using the specified properties. + * @param [properties] Properties to set + * @returns Style instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.IStyle): google.cloud.documentai.v1.Document.Style; + + /** + * Encodes the specified Style message. Does not implicitly {@link google.cloud.documentai.v1.Document.Style.verify|verify} messages. + * @param message Style message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.IStyle, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Style message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Style.verify|verify} messages. + * @param message Style message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.IStyle, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Style message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Style + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Style; + + /** + * Decodes a Style message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Style + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Style; + + /** + * Verifies a Style message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Style message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Style + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Style; + + /** + * Creates a plain object from a Style message. Also converts values to other types if specified. + * @param message Style + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Style, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Style to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Style { + + /** Properties of a FontSize. */ + interface IFontSize { + + /** FontSize size */ + size?: (number|null); + + /** FontSize unit */ + unit?: (string|null); + } + + /** Represents a FontSize. */ + class FontSize implements IFontSize { + + /** + * Constructs a new FontSize. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Style.IFontSize); + + /** FontSize size. */ + public size: number; + + /** FontSize unit. */ + public unit: string; + + /** + * Creates a new FontSize instance using the specified properties. + * @param [properties] Properties to set + * @returns FontSize instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Style.IFontSize): google.cloud.documentai.v1.Document.Style.FontSize; + + /** + * Encodes the specified FontSize message. Does not implicitly {@link google.cloud.documentai.v1.Document.Style.FontSize.verify|verify} messages. + * @param message FontSize message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Style.IFontSize, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FontSize message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Style.FontSize.verify|verify} messages. + * @param message FontSize message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Style.IFontSize, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FontSize message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FontSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Style.FontSize; + + /** + * Decodes a FontSize message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FontSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Style.FontSize; + + /** + * Verifies a FontSize message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FontSize message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FontSize + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Style.FontSize; + + /** + * Creates a plain object from a FontSize message. Also converts values to other types if specified. + * @param message FontSize + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Style.FontSize, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FontSize to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a Page. */ + interface IPage { + + /** Page pageNumber */ + pageNumber?: (number|null); + + /** Page image */ + image?: (google.cloud.documentai.v1.Document.Page.IImage|null); + + /** Page transforms */ + transforms?: (google.cloud.documentai.v1.Document.Page.IMatrix[]|null); + + /** Page dimension */ + dimension?: (google.cloud.documentai.v1.Document.Page.IDimension|null); + + /** Page layout */ + layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** Page detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]|null); + + /** Page blocks */ + blocks?: (google.cloud.documentai.v1.Document.Page.IBlock[]|null); + + /** Page paragraphs */ + paragraphs?: (google.cloud.documentai.v1.Document.Page.IParagraph[]|null); + + /** Page lines */ + lines?: (google.cloud.documentai.v1.Document.Page.ILine[]|null); + + /** Page tokens */ + tokens?: (google.cloud.documentai.v1.Document.Page.IToken[]|null); + + /** Page visualElements */ + visualElements?: (google.cloud.documentai.v1.Document.Page.IVisualElement[]|null); + + /** Page tables */ + tables?: (google.cloud.documentai.v1.Document.Page.ITable[]|null); + + /** Page formFields */ + formFields?: (google.cloud.documentai.v1.Document.Page.IFormField[]|null); + } + + /** Represents a Page. */ + class Page implements IPage { + + /** + * Constructs a new Page. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.IPage); + + /** Page pageNumber. */ + public pageNumber: number; + + /** Page image. */ + public image?: (google.cloud.documentai.v1.Document.Page.IImage|null); + + /** Page transforms. */ + public transforms: google.cloud.documentai.v1.Document.Page.IMatrix[]; + + /** Page dimension. */ + public dimension?: (google.cloud.documentai.v1.Document.Page.IDimension|null); + + /** Page layout. */ + public layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** Page detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]; + + /** Page blocks. */ + public blocks: google.cloud.documentai.v1.Document.Page.IBlock[]; + + /** Page paragraphs. */ + public paragraphs: google.cloud.documentai.v1.Document.Page.IParagraph[]; + + /** Page lines. */ + public lines: google.cloud.documentai.v1.Document.Page.ILine[]; + + /** Page tokens. */ + public tokens: google.cloud.documentai.v1.Document.Page.IToken[]; + + /** Page visualElements. */ + public visualElements: google.cloud.documentai.v1.Document.Page.IVisualElement[]; + + /** Page tables. */ + public tables: google.cloud.documentai.v1.Document.Page.ITable[]; + + /** Page formFields. */ + public formFields: google.cloud.documentai.v1.Document.Page.IFormField[]; + + /** + * Creates a new Page instance using the specified properties. + * @param [properties] Properties to set + * @returns Page instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.IPage): google.cloud.documentai.v1.Document.Page; + + /** + * Encodes the specified Page message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.verify|verify} messages. + * @param message Page message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.IPage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Page message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.verify|verify} messages. + * @param message Page message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.IPage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Page message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Page + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Page; + + /** + * Decodes a Page message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Page + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Page; + + /** + * Verifies a Page message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Page message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Page + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page; + + /** + * Creates a plain object from a Page message. Also converts values to other types if specified. + * @param message Page + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Page to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Page { + + /** Properties of a Dimension. */ + interface IDimension { + + /** Dimension width */ + width?: (number|null); + + /** Dimension height */ + height?: (number|null); + + /** Dimension unit */ + unit?: (string|null); + } + + /** Represents a Dimension. */ + class Dimension implements IDimension { + + /** + * Constructs a new Dimension. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.IDimension); + + /** Dimension width. */ + public width: number; + + /** Dimension height. */ + public height: number; + + /** Dimension unit. */ + public unit: string; + + /** + * Creates a new Dimension instance using the specified properties. + * @param [properties] Properties to set + * @returns Dimension instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.IDimension): google.cloud.documentai.v1.Document.Page.Dimension; + + /** + * Encodes the specified Dimension message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Dimension.verify|verify} messages. + * @param message Dimension message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Page.IDimension, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Dimension message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Dimension.verify|verify} messages. + * @param message Dimension message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Page.IDimension, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Dimension message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Dimension + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Page.Dimension; + + /** + * Decodes a Dimension message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Dimension + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Page.Dimension; + + /** + * Verifies a Dimension message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Dimension message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Dimension + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page.Dimension; + + /** + * Creates a plain object from a Dimension message. Also converts values to other types if specified. + * @param message Dimension + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page.Dimension, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Dimension to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an Image. */ + interface IImage { + + /** Image content */ + content?: (Uint8Array|string|null); + + /** Image mimeType */ + mimeType?: (string|null); + + /** Image width */ + width?: (number|null); + + /** Image height */ + height?: (number|null); + } + + /** Represents an Image. */ + class Image implements IImage { + + /** + * Constructs a new Image. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.IImage); + + /** Image content. */ + public content: (Uint8Array|string); + + /** Image mimeType. */ + public mimeType: string; + + /** Image width. */ + public width: number; + + /** Image height. */ + public height: number; + + /** + * Creates a new Image instance using the specified properties. + * @param [properties] Properties to set + * @returns Image instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.IImage): google.cloud.documentai.v1.Document.Page.Image; + + /** + * Encodes the specified Image message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.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.documentai.v1.Document.Page.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.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.documentai.v1.Document.Page.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.documentai.v1.Document.Page.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.documentai.v1.Document.Page.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.documentai.v1.Document.Page.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.documentai.v1.Document.Page.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Image to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Matrix. */ + interface IMatrix { + + /** Matrix rows */ + rows?: (number|null); + + /** Matrix cols */ + cols?: (number|null); + + /** Matrix type */ + type?: (number|null); + + /** Matrix data */ + data?: (Uint8Array|string|null); + } + + /** Represents a Matrix. */ + class Matrix implements IMatrix { + + /** + * Constructs a new Matrix. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.IMatrix); + + /** Matrix rows. */ + public rows: number; + + /** Matrix cols. */ + public cols: number; + + /** Matrix type. */ + public type: number; + + /** Matrix data. */ + public data: (Uint8Array|string); + + /** + * Creates a new Matrix instance using the specified properties. + * @param [properties] Properties to set + * @returns Matrix instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.IMatrix): google.cloud.documentai.v1.Document.Page.Matrix; + + /** + * Encodes the specified Matrix message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Matrix.verify|verify} messages. + * @param message Matrix message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Page.IMatrix, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Matrix message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Matrix.verify|verify} messages. + * @param message Matrix message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Page.IMatrix, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Matrix message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Matrix + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Page.Matrix; + + /** + * Decodes a Matrix message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Matrix + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Page.Matrix; + + /** + * Verifies a Matrix message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Matrix message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Matrix + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page.Matrix; + + /** + * Creates a plain object from a Matrix message. Also converts values to other types if specified. + * @param message Matrix + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page.Matrix, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Matrix to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Layout. */ + interface ILayout { + + /** Layout textAnchor */ + textAnchor?: (google.cloud.documentai.v1.Document.ITextAnchor|null); + + /** Layout confidence */ + confidence?: (number|null); + + /** Layout boundingPoly */ + boundingPoly?: (google.cloud.documentai.v1.IBoundingPoly|null); + + /** Layout orientation */ + orientation?: (google.cloud.documentai.v1.Document.Page.Layout.Orientation|keyof typeof google.cloud.documentai.v1.Document.Page.Layout.Orientation|null); + } + + /** Represents a Layout. */ + class Layout implements ILayout { + + /** + * Constructs a new Layout. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.ILayout); + + /** Layout textAnchor. */ + public textAnchor?: (google.cloud.documentai.v1.Document.ITextAnchor|null); + + /** Layout confidence. */ + public confidence: number; + + /** Layout boundingPoly. */ + public boundingPoly?: (google.cloud.documentai.v1.IBoundingPoly|null); + + /** Layout orientation. */ + public orientation: (google.cloud.documentai.v1.Document.Page.Layout.Orientation|keyof typeof google.cloud.documentai.v1.Document.Page.Layout.Orientation); + + /** + * Creates a new Layout instance using the specified properties. + * @param [properties] Properties to set + * @returns Layout instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.ILayout): google.cloud.documentai.v1.Document.Page.Layout; + + /** + * Encodes the specified Layout message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Layout.verify|verify} messages. + * @param message Layout message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Page.ILayout, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Layout message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Layout.verify|verify} messages. + * @param message Layout message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Page.ILayout, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Layout message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Layout + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Page.Layout; + + /** + * Decodes a Layout message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Layout + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Page.Layout; + + /** + * Verifies a Layout message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Layout message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Layout + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page.Layout; + + /** + * Creates a plain object from a Layout message. Also converts values to other types if specified. + * @param message Layout + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page.Layout, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Layout to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Layout { + + /** Orientation enum. */ + enum Orientation { + ORIENTATION_UNSPECIFIED = 0, + PAGE_UP = 1, + PAGE_RIGHT = 2, + PAGE_DOWN = 3, + PAGE_LEFT = 4 + } + } + + /** Properties of a Block. */ + interface IBlock { + + /** Block layout */ + layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** Block detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]|null); + + /** Block provenance */ + provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); + } + + /** Represents a Block. */ + class Block implements IBlock { + + /** + * Constructs a new Block. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.IBlock); + + /** Block layout. */ + public layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** Block detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]; + + /** Block provenance. */ + public provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); + + /** + * Creates a new Block instance using the specified properties. + * @param [properties] Properties to set + * @returns Block instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.IBlock): google.cloud.documentai.v1.Document.Page.Block; + + /** + * Encodes the specified Block message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Block.verify|verify} messages. + * @param message Block message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Page.IBlock, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Block message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Block.verify|verify} messages. + * @param message Block message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Page.IBlock, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Block message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Block + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Page.Block; + + /** + * Decodes a Block message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Block + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Page.Block; + + /** + * Verifies a Block message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Block message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Block + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page.Block; + + /** + * Creates a plain object from a Block message. Also converts values to other types if specified. + * @param message Block + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page.Block, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Block to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Paragraph. */ + interface IParagraph { + + /** Paragraph layout */ + layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** Paragraph detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]|null); + + /** Paragraph provenance */ + provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); + } + + /** Represents a Paragraph. */ + class Paragraph implements IParagraph { + + /** + * Constructs a new Paragraph. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.IParagraph); + + /** Paragraph layout. */ + public layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** Paragraph detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]; + + /** Paragraph provenance. */ + public provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); + + /** + * Creates a new Paragraph instance using the specified properties. + * @param [properties] Properties to set + * @returns Paragraph instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.IParagraph): google.cloud.documentai.v1.Document.Page.Paragraph; + + /** + * Encodes the specified Paragraph message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Paragraph.verify|verify} messages. + * @param message Paragraph message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Page.IParagraph, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Paragraph message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Paragraph.verify|verify} messages. + * @param message Paragraph message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Page.IParagraph, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Paragraph message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Paragraph + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Page.Paragraph; + + /** + * Decodes a Paragraph message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Paragraph + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Page.Paragraph; + + /** + * Verifies a Paragraph message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Paragraph message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Paragraph + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page.Paragraph; + + /** + * Creates a plain object from a Paragraph message. Also converts values to other types if specified. + * @param message Paragraph + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page.Paragraph, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Paragraph to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Line. */ + interface ILine { + + /** Line layout */ + layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** Line detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]|null); + + /** Line provenance */ + provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); + } + + /** Represents a Line. */ + class Line implements ILine { + + /** + * Constructs a new Line. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.ILine); + + /** Line layout. */ + public layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** Line detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]; + + /** Line provenance. */ + public provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); + + /** + * Creates a new Line instance using the specified properties. + * @param [properties] Properties to set + * @returns Line instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.ILine): google.cloud.documentai.v1.Document.Page.Line; + + /** + * Encodes the specified Line message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Line.verify|verify} messages. + * @param message Line message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Page.ILine, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Line message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Line.verify|verify} messages. + * @param message Line message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Page.ILine, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Line message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Page.Line; + + /** + * Decodes a Line message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Page.Line; + + /** + * Verifies a Line message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Line message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Line + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page.Line; + + /** + * Creates a plain object from a Line message. Also converts values to other types if specified. + * @param message Line + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page.Line, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Line to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Token. */ + interface IToken { + + /** Token layout */ + layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** Token detectedBreak */ + detectedBreak?: (google.cloud.documentai.v1.Document.Page.Token.IDetectedBreak|null); + + /** Token detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]|null); + + /** Token provenance */ + provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); + } + + /** Represents a Token. */ + class Token implements IToken { + + /** + * Constructs a new Token. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.IToken); + + /** Token layout. */ + public layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** Token detectedBreak. */ + public detectedBreak?: (google.cloud.documentai.v1.Document.Page.Token.IDetectedBreak|null); + + /** Token detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]; + + /** Token provenance. */ + public provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); + + /** + * Creates a new Token instance using the specified properties. + * @param [properties] Properties to set + * @returns Token instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.IToken): google.cloud.documentai.v1.Document.Page.Token; + + /** + * Encodes the specified Token message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Token.verify|verify} messages. + * @param message Token message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Page.IToken, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Token message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Token.verify|verify} messages. + * @param message Token message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Page.IToken, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Token message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Token + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Page.Token; + + /** + * Decodes a Token message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Token + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Page.Token; + + /** + * Verifies a Token message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Token message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Token + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page.Token; + + /** + * Creates a plain object from a Token message. Also converts values to other types if specified. + * @param message Token + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page.Token, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Token to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Token { + + /** Properties of a DetectedBreak. */ + interface IDetectedBreak { + + /** DetectedBreak type */ + type?: (google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type|keyof typeof google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type|null); + } + + /** Represents a DetectedBreak. */ + class DetectedBreak implements IDetectedBreak { + + /** + * Constructs a new DetectedBreak. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.Token.IDetectedBreak); + + /** DetectedBreak type. */ + public type: (google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type|keyof typeof google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type); + + /** + * Creates a new DetectedBreak instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectedBreak instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.Token.IDetectedBreak): google.cloud.documentai.v1.Document.Page.Token.DetectedBreak; + + /** + * Encodes the specified DetectedBreak message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.verify|verify} messages. + * @param message DetectedBreak message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Page.Token.IDetectedBreak, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectedBreak message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.verify|verify} messages. + * @param message DetectedBreak message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Page.Token.IDetectedBreak, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectedBreak message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectedBreak + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Page.Token.DetectedBreak; + + /** + * Decodes a DetectedBreak message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectedBreak + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Page.Token.DetectedBreak; + + /** + * Verifies a DetectedBreak message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DetectedBreak message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectedBreak + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page.Token.DetectedBreak; + + /** + * Creates a plain object from a DetectedBreak message. Also converts values to other types if specified. + * @param message DetectedBreak + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page.Token.DetectedBreak, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectedBreak to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace DetectedBreak { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + SPACE = 1, + WIDE_SPACE = 2, + HYPHEN = 3 + } + } + } + + /** Properties of a VisualElement. */ + interface IVisualElement { + + /** VisualElement layout */ + layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** VisualElement type */ + type?: (string|null); + + /** VisualElement detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a VisualElement. */ + class VisualElement implements IVisualElement { + + /** + * Constructs a new VisualElement. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.IVisualElement); + + /** VisualElement layout. */ + public layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** VisualElement type. */ + public type: string; + + /** VisualElement detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new VisualElement instance using the specified properties. + * @param [properties] Properties to set + * @returns VisualElement instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.IVisualElement): google.cloud.documentai.v1.Document.Page.VisualElement; + + /** + * Encodes the specified VisualElement message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.VisualElement.verify|verify} messages. + * @param message VisualElement message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Page.IVisualElement, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VisualElement message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.VisualElement.verify|verify} messages. + * @param message VisualElement message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Page.IVisualElement, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VisualElement message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VisualElement + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Page.VisualElement; + + /** + * Decodes a VisualElement message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VisualElement + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Page.VisualElement; + + /** + * Verifies a VisualElement message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a VisualElement message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VisualElement + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page.VisualElement; + + /** + * Creates a plain object from a VisualElement message. Also converts values to other types if specified. + * @param message VisualElement + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page.VisualElement, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VisualElement to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Table. */ + interface ITable { + + /** Table layout */ + layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** Table headerRows */ + headerRows?: (google.cloud.documentai.v1.Document.Page.Table.ITableRow[]|null); + + /** Table bodyRows */ + bodyRows?: (google.cloud.documentai.v1.Document.Page.Table.ITableRow[]|null); + + /** Table detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a Table. */ + class Table implements ITable { + + /** + * Constructs a new Table. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.ITable); + + /** Table layout. */ + public layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** Table headerRows. */ + public headerRows: google.cloud.documentai.v1.Document.Page.Table.ITableRow[]; + + /** Table bodyRows. */ + public bodyRows: google.cloud.documentai.v1.Document.Page.Table.ITableRow[]; + + /** Table detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new Table instance using the specified properties. + * @param [properties] Properties to set + * @returns Table instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.ITable): google.cloud.documentai.v1.Document.Page.Table; + + /** + * Encodes the specified Table message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Table.verify|verify} messages. + * @param message Table message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Page.ITable, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Table message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Table.verify|verify} messages. + * @param message Table message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Page.ITable, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Table message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Table + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Page.Table; + + /** + * Decodes a Table message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Table + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Page.Table; + + /** + * Verifies a Table message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Table message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Table + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page.Table; + + /** + * Creates a plain object from a Table message. Also converts values to other types if specified. + * @param message Table + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page.Table, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Table to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Table { + + /** Properties of a TableRow. */ + interface ITableRow { + + /** TableRow cells */ + cells?: (google.cloud.documentai.v1.Document.Page.Table.ITableCell[]|null); + } + + /** Represents a TableRow. */ + class TableRow implements ITableRow { + + /** + * Constructs a new TableRow. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.Table.ITableRow); + + /** TableRow cells. */ + public cells: google.cloud.documentai.v1.Document.Page.Table.ITableCell[]; + + /** + * Creates a new TableRow instance using the specified properties. + * @param [properties] Properties to set + * @returns TableRow instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.Table.ITableRow): google.cloud.documentai.v1.Document.Page.Table.TableRow; + + /** + * Encodes the specified TableRow message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Table.TableRow.verify|verify} messages. + * @param message TableRow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Page.Table.ITableRow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableRow message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Table.TableRow.verify|verify} messages. + * @param message TableRow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Page.Table.ITableRow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableRow message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Page.Table.TableRow; + + /** + * Decodes a TableRow message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Page.Table.TableRow; + + /** + * Verifies a TableRow message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TableRow message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableRow + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page.Table.TableRow; + + /** + * Creates a plain object from a TableRow message. Also converts values to other types if specified. + * @param message TableRow + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page.Table.TableRow, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableRow to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TableCell. */ + interface ITableCell { + + /** TableCell layout */ + layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** TableCell rowSpan */ + rowSpan?: (number|null); + + /** TableCell colSpan */ + colSpan?: (number|null); + + /** TableCell detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a TableCell. */ + class TableCell implements ITableCell { + + /** + * Constructs a new TableCell. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.Table.ITableCell); + + /** TableCell layout. */ + public layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** TableCell rowSpan. */ + public rowSpan: number; + + /** TableCell colSpan. */ + public colSpan: number; + + /** TableCell detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new TableCell instance using the specified properties. + * @param [properties] Properties to set + * @returns TableCell instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.Table.ITableCell): google.cloud.documentai.v1.Document.Page.Table.TableCell; + + /** + * Encodes the specified TableCell message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Table.TableCell.verify|verify} messages. + * @param message TableCell message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Page.Table.ITableCell, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableCell message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Table.TableCell.verify|verify} messages. + * @param message TableCell message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Page.Table.ITableCell, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableCell message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Page.Table.TableCell; + + /** + * Decodes a TableCell message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Page.Table.TableCell; + + /** + * Verifies a TableCell message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TableCell message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableCell + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page.Table.TableCell; + + /** + * Creates a plain object from a TableCell message. Also converts values to other types if specified. + * @param message TableCell + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page.Table.TableCell, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableCell to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a FormField. */ + interface IFormField { + + /** FormField fieldName */ + fieldName?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** FormField fieldValue */ + fieldValue?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** FormField nameDetectedLanguages */ + nameDetectedLanguages?: (google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]|null); + + /** FormField valueDetectedLanguages */ + valueDetectedLanguages?: (google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]|null); + + /** FormField valueType */ + valueType?: (string|null); + } + + /** Represents a FormField. */ + class FormField implements IFormField { + + /** + * Constructs a new FormField. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.IFormField); + + /** FormField fieldName. */ + public fieldName?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** FormField fieldValue. */ + public fieldValue?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** FormField nameDetectedLanguages. */ + public nameDetectedLanguages: google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]; + + /** FormField valueDetectedLanguages. */ + public valueDetectedLanguages: google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]; + + /** FormField valueType. */ + public valueType: string; + + /** + * Creates a new FormField instance using the specified properties. + * @param [properties] Properties to set + * @returns FormField instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.IFormField): google.cloud.documentai.v1.Document.Page.FormField; + + /** + * Encodes the specified FormField message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.FormField.verify|verify} messages. + * @param message FormField message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Page.IFormField, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FormField message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.FormField.verify|verify} messages. + * @param message FormField message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Page.IFormField, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FormField message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FormField + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Page.FormField; + + /** + * Decodes a FormField message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FormField + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Page.FormField; + + /** + * Verifies a FormField message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FormField message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FormField + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page.FormField; + + /** + * Creates a plain object from a FormField message. Also converts values to other types if specified. + * @param message FormField + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page.FormField, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FormField to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DetectedLanguage. */ + interface IDetectedLanguage { + + /** DetectedLanguage languageCode */ + languageCode?: (string|null); + + /** DetectedLanguage confidence */ + confidence?: (number|null); + } + + /** Represents a DetectedLanguage. */ + class DetectedLanguage implements IDetectedLanguage { + + /** + * Constructs a new DetectedLanguage. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.IDetectedLanguage); + + /** DetectedLanguage languageCode. */ + public languageCode: string; + + /** DetectedLanguage confidence. */ + public confidence: number; + + /** + * Creates a new DetectedLanguage instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectedLanguage instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.IDetectedLanguage): google.cloud.documentai.v1.Document.Page.DetectedLanguage; + + /** + * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.DetectedLanguage.verify|verify} messages. + * @param message DetectedLanguage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Page.IDetectedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.DetectedLanguage.verify|verify} messages. + * @param message DetectedLanguage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Page.IDetectedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectedLanguage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Page.DetectedLanguage; + + /** + * Decodes a DetectedLanguage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Page.DetectedLanguage; + + /** + * Verifies a DetectedLanguage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DetectedLanguage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectedLanguage + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page.DetectedLanguage; + + /** + * Creates a plain object from a DetectedLanguage message. Also converts values to other types if specified. + * @param message DetectedLanguage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page.DetectedLanguage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectedLanguage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an Entity. */ + interface IEntity { + + /** Entity textAnchor */ + textAnchor?: (google.cloud.documentai.v1.Document.ITextAnchor|null); + + /** Entity type */ + type?: (string|null); + + /** Entity mentionText */ + mentionText?: (string|null); + + /** Entity mentionId */ + mentionId?: (string|null); + + /** Entity confidence */ + confidence?: (number|null); + + /** Entity pageAnchor */ + pageAnchor?: (google.cloud.documentai.v1.Document.IPageAnchor|null); + + /** Entity id */ + id?: (string|null); + + /** Entity normalizedValue */ + normalizedValue?: (google.cloud.documentai.v1.Document.Entity.INormalizedValue|null); + + /** Entity properties */ + properties?: (google.cloud.documentai.v1.Document.IEntity[]|null); + + /** Entity provenance */ + provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); + + /** Entity redacted */ + redacted?: (boolean|null); + } + + /** Represents an Entity. */ + class Entity implements IEntity { + + /** + * Constructs a new Entity. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.IEntity); + + /** Entity textAnchor. */ + public textAnchor?: (google.cloud.documentai.v1.Document.ITextAnchor|null); + + /** Entity type. */ + public type: string; + + /** Entity mentionText. */ + public mentionText: string; + + /** Entity mentionId. */ + public mentionId: string; + + /** Entity confidence. */ + public confidence: number; + + /** Entity pageAnchor. */ + public pageAnchor?: (google.cloud.documentai.v1.Document.IPageAnchor|null); + + /** Entity id. */ + public id: string; + + /** Entity normalizedValue. */ + public normalizedValue?: (google.cloud.documentai.v1.Document.Entity.INormalizedValue|null); + + /** Entity properties. */ + public properties: google.cloud.documentai.v1.Document.IEntity[]; + + /** Entity provenance. */ + public provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); + + /** Entity redacted. */ + public redacted: boolean; + + /** + * Creates a new Entity instance using the specified properties. + * @param [properties] Properties to set + * @returns Entity instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.IEntity): google.cloud.documentai.v1.Document.Entity; + + /** + * Encodes the specified Entity message. Does not implicitly {@link google.cloud.documentai.v1.Document.Entity.verify|verify} messages. + * @param message Entity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.IEntity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Entity message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Entity.verify|verify} messages. + * @param message Entity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.IEntity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Entity message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Entity; + + /** + * Decodes an Entity message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Entity; + + /** + * Verifies an Entity message. + * @param message Plain 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 Entity message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Entity + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Entity; + + /** + * Creates a plain object from an Entity message. Also converts values to other types if specified. + * @param message Entity + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Entity, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Entity to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Entity { + + /** Properties of a NormalizedValue. */ + interface INormalizedValue { + + /** NormalizedValue moneyValue */ + moneyValue?: (google.type.IMoney|null); + + /** NormalizedValue dateValue */ + dateValue?: (google.type.IDate|null); + + /** NormalizedValue datetimeValue */ + datetimeValue?: (google.type.IDateTime|null); + + /** NormalizedValue addressValue */ + addressValue?: (google.type.IPostalAddress|null); + + /** NormalizedValue booleanValue */ + booleanValue?: (boolean|null); + + /** NormalizedValue text */ + text?: (string|null); + } + + /** Represents a NormalizedValue. */ + class NormalizedValue implements INormalizedValue { + + /** + * Constructs a new NormalizedValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Entity.INormalizedValue); + + /** NormalizedValue moneyValue. */ + public moneyValue?: (google.type.IMoney|null); + + /** NormalizedValue dateValue. */ + public dateValue?: (google.type.IDate|null); + + /** NormalizedValue datetimeValue. */ + public datetimeValue?: (google.type.IDateTime|null); + + /** NormalizedValue addressValue. */ + public addressValue?: (google.type.IPostalAddress|null); + + /** NormalizedValue booleanValue. */ + public booleanValue: boolean; + + /** NormalizedValue text. */ + public text: string; + + /** NormalizedValue structuredValue. */ + public structuredValue?: ("moneyValue"|"dateValue"|"datetimeValue"|"addressValue"|"booleanValue"); + + /** + * Creates a new NormalizedValue instance using the specified properties. + * @param [properties] Properties to set + * @returns NormalizedValue instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Entity.INormalizedValue): google.cloud.documentai.v1.Document.Entity.NormalizedValue; + + /** + * Encodes the specified NormalizedValue message. Does not implicitly {@link google.cloud.documentai.v1.Document.Entity.NormalizedValue.verify|verify} messages. + * @param message NormalizedValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Entity.INormalizedValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NormalizedValue message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Entity.NormalizedValue.verify|verify} messages. + * @param message NormalizedValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Entity.INormalizedValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NormalizedValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NormalizedValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Entity.NormalizedValue; + + /** + * Decodes a NormalizedValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NormalizedValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Entity.NormalizedValue; + + /** + * Verifies a NormalizedValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NormalizedValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NormalizedValue + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Entity.NormalizedValue; + + /** + * Creates a plain object from a NormalizedValue message. Also converts values to other types if specified. + * @param message NormalizedValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Entity.NormalizedValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NormalizedValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an EntityRelation. */ + interface IEntityRelation { + + /** EntityRelation subjectId */ + subjectId?: (string|null); + + /** EntityRelation objectId */ + objectId?: (string|null); + + /** EntityRelation relation */ + relation?: (string|null); + } + + /** Represents an EntityRelation. */ + class EntityRelation implements IEntityRelation { + + /** + * Constructs a new EntityRelation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.IEntityRelation); + + /** EntityRelation subjectId. */ + public subjectId: string; + + /** EntityRelation objectId. */ + public objectId: string; + + /** EntityRelation relation. */ + public relation: string; + + /** + * Creates a new EntityRelation instance using the specified properties. + * @param [properties] Properties to set + * @returns EntityRelation instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.IEntityRelation): google.cloud.documentai.v1.Document.EntityRelation; + + /** + * Encodes the specified EntityRelation message. Does not implicitly {@link google.cloud.documentai.v1.Document.EntityRelation.verify|verify} messages. + * @param message EntityRelation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.IEntityRelation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EntityRelation message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.EntityRelation.verify|verify} messages. + * @param message EntityRelation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.IEntityRelation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EntityRelation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EntityRelation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.EntityRelation; + + /** + * Decodes an EntityRelation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EntityRelation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.EntityRelation; + + /** + * Verifies an EntityRelation message. + * @param message Plain 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 EntityRelation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EntityRelation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.EntityRelation; + + /** + * Creates a plain object from an EntityRelation message. Also converts values to other types if specified. + * @param message EntityRelation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.EntityRelation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EntityRelation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TextAnchor. */ + interface ITextAnchor { + + /** TextAnchor textSegments */ + textSegments?: (google.cloud.documentai.v1.Document.TextAnchor.ITextSegment[]|null); + + /** TextAnchor content */ + content?: (string|null); + } + + /** Represents a TextAnchor. */ + class TextAnchor implements ITextAnchor { + + /** + * Constructs a new TextAnchor. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.ITextAnchor); + + /** TextAnchor textSegments. */ + public textSegments: google.cloud.documentai.v1.Document.TextAnchor.ITextSegment[]; + + /** TextAnchor content. */ + public content: string; + + /** + * Creates a new TextAnchor instance using the specified properties. + * @param [properties] Properties to set + * @returns TextAnchor instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.ITextAnchor): google.cloud.documentai.v1.Document.TextAnchor; + + /** + * Encodes the specified TextAnchor message. Does not implicitly {@link google.cloud.documentai.v1.Document.TextAnchor.verify|verify} messages. + * @param message TextAnchor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.ITextAnchor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TextAnchor message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.TextAnchor.verify|verify} messages. + * @param message TextAnchor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.ITextAnchor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TextAnchor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TextAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.TextAnchor; + + /** + * Decodes a TextAnchor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TextAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.TextAnchor; + + /** + * Verifies a TextAnchor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TextAnchor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TextAnchor + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.TextAnchor; + + /** + * Creates a plain object from a TextAnchor message. Also converts values to other types if specified. + * @param message TextAnchor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.TextAnchor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TextAnchor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace TextAnchor { + + /** Properties of a TextSegment. */ + interface ITextSegment { + + /** TextSegment startIndex */ + startIndex?: (number|Long|string|null); + + /** TextSegment endIndex */ + endIndex?: (number|Long|string|null); + } + + /** Represents a TextSegment. */ + class TextSegment implements ITextSegment { + + /** + * Constructs a new TextSegment. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.TextAnchor.ITextSegment); + + /** TextSegment startIndex. */ + public startIndex: (number|Long|string); + + /** TextSegment endIndex. */ + public endIndex: (number|Long|string); + + /** + * Creates a new TextSegment instance using the specified properties. + * @param [properties] Properties to set + * @returns TextSegment instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.TextAnchor.ITextSegment): google.cloud.documentai.v1.Document.TextAnchor.TextSegment; + + /** + * Encodes the specified TextSegment message. Does not implicitly {@link google.cloud.documentai.v1.Document.TextAnchor.TextSegment.verify|verify} messages. + * @param message TextSegment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.TextAnchor.ITextSegment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TextSegment message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.TextAnchor.TextSegment.verify|verify} messages. + * @param message TextSegment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.TextAnchor.ITextSegment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TextSegment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TextSegment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.TextAnchor.TextSegment; + + /** + * Decodes a TextSegment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TextSegment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.TextAnchor.TextSegment; + + /** + * Verifies a TextSegment message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TextSegment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TextSegment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.TextAnchor.TextSegment; + + /** + * Creates a plain object from a TextSegment message. Also converts values to other types if specified. + * @param message TextSegment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.TextAnchor.TextSegment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TextSegment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a PageAnchor. */ + interface IPageAnchor { + + /** PageAnchor pageRefs */ + pageRefs?: (google.cloud.documentai.v1.Document.PageAnchor.IPageRef[]|null); + } + + /** Represents a PageAnchor. */ + class PageAnchor implements IPageAnchor { + + /** + * Constructs a new PageAnchor. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.IPageAnchor); + + /** PageAnchor pageRefs. */ + public pageRefs: google.cloud.documentai.v1.Document.PageAnchor.IPageRef[]; + + /** + * Creates a new PageAnchor instance using the specified properties. + * @param [properties] Properties to set + * @returns PageAnchor instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.IPageAnchor): google.cloud.documentai.v1.Document.PageAnchor; + + /** + * Encodes the specified PageAnchor message. Does not implicitly {@link google.cloud.documentai.v1.Document.PageAnchor.verify|verify} messages. + * @param message PageAnchor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.IPageAnchor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PageAnchor message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.PageAnchor.verify|verify} messages. + * @param message PageAnchor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.IPageAnchor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PageAnchor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PageAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.PageAnchor; + + /** + * Decodes a PageAnchor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PageAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.PageAnchor; + + /** + * Verifies a PageAnchor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PageAnchor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PageAnchor + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.PageAnchor; + + /** + * Creates a plain object from a PageAnchor message. Also converts values to other types if specified. + * @param message PageAnchor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.PageAnchor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PageAnchor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PageAnchor { + + /** Properties of a PageRef. */ + interface IPageRef { + + /** PageRef page */ + page?: (number|Long|string|null); + + /** PageRef layoutType */ + layoutType?: (google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType|keyof typeof google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType|null); + + /** PageRef layoutId */ + layoutId?: (string|null); + + /** PageRef boundingPoly */ + boundingPoly?: (google.cloud.documentai.v1.IBoundingPoly|null); + } + + /** Represents a PageRef. */ + class PageRef implements IPageRef { + + /** + * Constructs a new PageRef. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.PageAnchor.IPageRef); + + /** PageRef page. */ + public page: (number|Long|string); + + /** PageRef layoutType. */ + public layoutType: (google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType|keyof typeof google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType); + + /** PageRef layoutId. */ + public layoutId: string; + + /** PageRef boundingPoly. */ + public boundingPoly?: (google.cloud.documentai.v1.IBoundingPoly|null); + + /** + * Creates a new PageRef instance using the specified properties. + * @param [properties] Properties to set + * @returns PageRef instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.PageAnchor.IPageRef): google.cloud.documentai.v1.Document.PageAnchor.PageRef; + + /** + * Encodes the specified PageRef message. Does not implicitly {@link google.cloud.documentai.v1.Document.PageAnchor.PageRef.verify|verify} messages. + * @param message PageRef message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.PageAnchor.IPageRef, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PageRef message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.PageAnchor.PageRef.verify|verify} messages. + * @param message PageRef message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.PageAnchor.IPageRef, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PageRef message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PageRef + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.PageAnchor.PageRef; + + /** + * Decodes a PageRef message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PageRef + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.PageAnchor.PageRef; + + /** + * Verifies a PageRef message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PageRef message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PageRef + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.PageAnchor.PageRef; + + /** + * Creates a plain object from a PageRef message. Also converts values to other types if specified. + * @param message PageRef + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.PageAnchor.PageRef, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PageRef to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PageRef { + + /** LayoutType enum. */ + enum LayoutType { + LAYOUT_TYPE_UNSPECIFIED = 0, + BLOCK = 1, + PARAGRAPH = 2, + LINE = 3, + TOKEN = 4, + VISUAL_ELEMENT = 5, + TABLE = 6, + FORM_FIELD = 7 + } + } + } + + /** Properties of a Provenance. */ + interface IProvenance { + + /** Provenance revision */ + revision?: (number|null); + + /** Provenance id */ + id?: (number|null); + + /** Provenance parents */ + parents?: (google.cloud.documentai.v1.Document.Provenance.IParent[]|null); + + /** Provenance type */ + type?: (google.cloud.documentai.v1.Document.Provenance.OperationType|keyof typeof google.cloud.documentai.v1.Document.Provenance.OperationType|null); + } + + /** Represents a Provenance. */ + class Provenance implements IProvenance { + + /** + * Constructs a new Provenance. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.IProvenance); + + /** Provenance revision. */ + public revision: number; + + /** Provenance id. */ + public id: number; + + /** Provenance parents. */ + public parents: google.cloud.documentai.v1.Document.Provenance.IParent[]; + + /** Provenance type. */ + public type: (google.cloud.documentai.v1.Document.Provenance.OperationType|keyof typeof google.cloud.documentai.v1.Document.Provenance.OperationType); + + /** + * Creates a new Provenance instance using the specified properties. + * @param [properties] Properties to set + * @returns Provenance instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.IProvenance): google.cloud.documentai.v1.Document.Provenance; + + /** + * Encodes the specified Provenance message. Does not implicitly {@link google.cloud.documentai.v1.Document.Provenance.verify|verify} messages. + * @param message Provenance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.IProvenance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Provenance message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Provenance.verify|verify} messages. + * @param message Provenance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.IProvenance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Provenance message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Provenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Provenance; + + /** + * Decodes a Provenance message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Provenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Provenance; + + /** + * Verifies a Provenance message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Provenance message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Provenance + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Provenance; + + /** + * Creates a plain object from a Provenance message. Also converts values to other types if specified. + * @param message Provenance + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Provenance, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Provenance to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Provenance { + + /** Properties of a Parent. */ + interface IParent { + + /** Parent revision */ + revision?: (number|null); + + /** Parent id */ + id?: (number|null); + } + + /** Represents a Parent. */ + class Parent implements IParent { + + /** + * Constructs a new Parent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Provenance.IParent); + + /** Parent revision. */ + public revision: number; + + /** Parent id. */ + public id: number; + + /** + * Creates a new Parent instance using the specified properties. + * @param [properties] Properties to set + * @returns Parent instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Provenance.IParent): google.cloud.documentai.v1.Document.Provenance.Parent; + + /** + * Encodes the specified Parent message. Does not implicitly {@link google.cloud.documentai.v1.Document.Provenance.Parent.verify|verify} messages. + * @param message Parent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Provenance.IParent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Parent message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Provenance.Parent.verify|verify} messages. + * @param message Parent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Provenance.IParent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Parent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Parent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Provenance.Parent; + + /** + * Decodes a Parent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Parent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Provenance.Parent; + + /** + * Verifies a Parent message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Parent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Parent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Provenance.Parent; + + /** + * Creates a plain object from a Parent message. Also converts values to other types if specified. + * @param message Parent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Provenance.Parent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Parent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** OperationType enum. */ + enum OperationType { + OPERATION_TYPE_UNSPECIFIED = 0, + ADD = 1, + REMOVE = 2, + REPLACE = 3, + EVAL_REQUESTED = 4, + EVAL_APPROVED = 5, + EVAL_SKIPPED = 6 + } + } + + /** Properties of a Revision. */ + interface IRevision { + + /** Revision agent */ + agent?: (string|null); + + /** Revision processor */ + processor?: (string|null); + + /** Revision id */ + id?: (string|null); + + /** Revision parent */ + parent?: (number[]|null); + + /** Revision createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Revision humanReview */ + humanReview?: (google.cloud.documentai.v1.Document.Revision.IHumanReview|null); + } + + /** Represents a Revision. */ + class Revision implements IRevision { + + /** + * Constructs a new Revision. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.IRevision); + + /** Revision agent. */ + public agent: string; + + /** Revision processor. */ + public processor: string; + + /** Revision id. */ + public id: string; + + /** Revision parent. */ + public parent: number[]; + + /** Revision createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Revision humanReview. */ + public humanReview?: (google.cloud.documentai.v1.Document.Revision.IHumanReview|null); + + /** Revision source. */ + public source?: ("agent"|"processor"); + + /** + * Creates a new Revision instance using the specified properties. + * @param [properties] Properties to set + * @returns Revision instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.IRevision): google.cloud.documentai.v1.Document.Revision; + + /** + * Encodes the specified Revision message. Does not implicitly {@link google.cloud.documentai.v1.Document.Revision.verify|verify} messages. + * @param message Revision message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.IRevision, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Revision message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Revision.verify|verify} messages. + * @param message Revision message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.IRevision, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Revision message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Revision + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Revision; + + /** + * Decodes a Revision message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Revision + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Revision; + + /** + * Verifies a Revision message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Revision message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Revision + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Revision; + + /** + * Creates a plain object from a Revision message. Also converts values to other types if specified. + * @param message Revision + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Revision, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Revision to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Revision { + + /** Properties of a HumanReview. */ + interface IHumanReview { + + /** HumanReview state */ + state?: (string|null); + + /** HumanReview stateMessage */ + stateMessage?: (string|null); + } + + /** Represents a HumanReview. */ + class HumanReview implements IHumanReview { + + /** + * Constructs a new HumanReview. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Revision.IHumanReview); + + /** HumanReview state. */ + public state: string; + + /** HumanReview stateMessage. */ + public stateMessage: string; + + /** + * Creates a new HumanReview instance using the specified properties. + * @param [properties] Properties to set + * @returns HumanReview instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Revision.IHumanReview): google.cloud.documentai.v1.Document.Revision.HumanReview; + + /** + * Encodes the specified HumanReview message. Does not implicitly {@link google.cloud.documentai.v1.Document.Revision.HumanReview.verify|verify} messages. + * @param message HumanReview message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Revision.IHumanReview, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HumanReview message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Revision.HumanReview.verify|verify} messages. + * @param message HumanReview message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Revision.IHumanReview, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HumanReview message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HumanReview + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Revision.HumanReview; + + /** + * Decodes a HumanReview message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HumanReview + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Revision.HumanReview; + + /** + * Verifies a HumanReview message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HumanReview message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HumanReview + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Revision.HumanReview; + + /** + * Creates a plain object from a HumanReview message. Also converts values to other types if specified. + * @param message HumanReview + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Revision.HumanReview, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HumanReview to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a TextChange. */ + interface ITextChange { + + /** TextChange textAnchor */ + textAnchor?: (google.cloud.documentai.v1.Document.ITextAnchor|null); + + /** TextChange changedText */ + changedText?: (string|null); + + /** TextChange provenance */ + provenance?: (google.cloud.documentai.v1.Document.IProvenance[]|null); + } + + /** Represents a TextChange. */ + class TextChange implements ITextChange { + + /** + * Constructs a new TextChange. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.ITextChange); + + /** TextChange textAnchor. */ + public textAnchor?: (google.cloud.documentai.v1.Document.ITextAnchor|null); + + /** TextChange changedText. */ + public changedText: string; + + /** TextChange provenance. */ + public provenance: google.cloud.documentai.v1.Document.IProvenance[]; + + /** + * Creates a new TextChange instance using the specified properties. + * @param [properties] Properties to set + * @returns TextChange instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.ITextChange): google.cloud.documentai.v1.Document.TextChange; + + /** + * Encodes the specified TextChange message. Does not implicitly {@link google.cloud.documentai.v1.Document.TextChange.verify|verify} messages. + * @param message TextChange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.ITextChange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TextChange message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.TextChange.verify|verify} messages. + * @param message TextChange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.ITextChange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TextChange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TextChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.TextChange; + + /** + * Decodes a TextChange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TextChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.TextChange; + + /** + * Verifies a TextChange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TextChange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TextChange + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.TextChange; + + /** + * Creates a plain object from a TextChange message. Also converts values to other types if specified. + * @param message TextChange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.TextChange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TextChange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a Vertex. */ + interface IVertex { + + /** Vertex x */ + x?: (number|null); + + /** Vertex y */ + y?: (number|null); + } + + /** Represents a Vertex. */ + class Vertex implements IVertex { + + /** + * Constructs a new Vertex. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IVertex); + + /** Vertex x. */ + public x: number; + + /** Vertex y. */ + public y: number; + + /** + * Creates a new Vertex instance using the specified properties. + * @param [properties] Properties to set + * @returns Vertex instance + */ + public static create(properties?: google.cloud.documentai.v1.IVertex): google.cloud.documentai.v1.Vertex; + + /** + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.documentai.v1.Vertex.verify|verify} messages. + * @param message Vertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Vertex.verify|verify} messages. + * @param message Vertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Vertex message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Vertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Vertex; + + /** + * Decodes a Vertex message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Vertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Vertex; + + /** + * Verifies a Vertex message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Vertex message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Vertex + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Vertex; + + /** + * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * @param message Vertex + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Vertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Vertex to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a NormalizedVertex. */ + interface INormalizedVertex { + + /** NormalizedVertex x */ + x?: (number|null); + + /** NormalizedVertex y */ + y?: (number|null); + } + + /** Represents a NormalizedVertex. */ + class NormalizedVertex implements INormalizedVertex { + + /** + * Constructs a new NormalizedVertex. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.INormalizedVertex); + + /** NormalizedVertex x. */ + public x: number; + + /** NormalizedVertex y. */ + public y: number; + + /** + * Creates a new NormalizedVertex instance using the specified properties. + * @param [properties] Properties to set + * @returns NormalizedVertex instance + */ + public static create(properties?: google.cloud.documentai.v1.INormalizedVertex): google.cloud.documentai.v1.NormalizedVertex; + + /** + * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.documentai.v1.NormalizedVertex.verify|verify} messages. + * @param message NormalizedVertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.NormalizedVertex.verify|verify} messages. + * @param message NormalizedVertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NormalizedVertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.NormalizedVertex; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NormalizedVertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.NormalizedVertex; + + /** + * Verifies a NormalizedVertex message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NormalizedVertex + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.NormalizedVertex; + + /** + * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. + * @param message NormalizedVertex + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.NormalizedVertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NormalizedVertex to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BoundingPoly. */ + interface IBoundingPoly { + + /** BoundingPoly vertices */ + vertices?: (google.cloud.documentai.v1.IVertex[]|null); + + /** BoundingPoly normalizedVertices */ + normalizedVertices?: (google.cloud.documentai.v1.INormalizedVertex[]|null); + } + + /** Represents a BoundingPoly. */ + class BoundingPoly implements IBoundingPoly { + + /** + * Constructs a new BoundingPoly. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IBoundingPoly); + + /** BoundingPoly vertices. */ + public vertices: google.cloud.documentai.v1.IVertex[]; + + /** BoundingPoly normalizedVertices. */ + public normalizedVertices: google.cloud.documentai.v1.INormalizedVertex[]; + + /** + * Creates a new BoundingPoly instance using the specified properties. + * @param [properties] Properties to set + * @returns BoundingPoly instance + */ + public static create(properties?: google.cloud.documentai.v1.IBoundingPoly): google.cloud.documentai.v1.BoundingPoly; + + /** + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.documentai.v1.BoundingPoly.verify|verify} messages. + * @param message BoundingPoly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BoundingPoly.verify|verify} messages. + * @param message BoundingPoly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoundingPoly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.BoundingPoly; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoundingPoly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.BoundingPoly; + + /** + * Verifies a BoundingPoly message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoundingPoly + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BoundingPoly; + + /** + * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. + * @param message BoundingPoly + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.BoundingPoly, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoundingPoly to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RawDocument. */ + interface IRawDocument { + + /** RawDocument content */ + content?: (Uint8Array|string|null); + + /** RawDocument mimeType */ + mimeType?: (string|null); + } + + /** Represents a RawDocument. */ + class RawDocument implements IRawDocument { + + /** + * Constructs a new RawDocument. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IRawDocument); + + /** RawDocument content. */ + public content: (Uint8Array|string); + + /** RawDocument mimeType. */ + public mimeType: string; + + /** + * Creates a new RawDocument instance using the specified properties. + * @param [properties] Properties to set + * @returns RawDocument instance + */ + public static create(properties?: google.cloud.documentai.v1.IRawDocument): google.cloud.documentai.v1.RawDocument; + + /** + * Encodes the specified RawDocument message. Does not implicitly {@link google.cloud.documentai.v1.RawDocument.verify|verify} messages. + * @param message RawDocument message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IRawDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RawDocument message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.RawDocument.verify|verify} messages. + * @param message RawDocument message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IRawDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RawDocument message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RawDocument + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.RawDocument; + + /** + * Decodes a RawDocument message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RawDocument + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.RawDocument; + + /** + * Verifies a RawDocument message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RawDocument message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RawDocument + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.RawDocument; + + /** + * Creates a plain object from a RawDocument message. Also converts values to other types if specified. + * @param message RawDocument + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.RawDocument, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RawDocument to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GcsDocument. */ + interface IGcsDocument { + + /** GcsDocument gcsUri */ + gcsUri?: (string|null); + + /** GcsDocument mimeType */ + mimeType?: (string|null); + } + + /** Represents a GcsDocument. */ + class GcsDocument implements IGcsDocument { + + /** + * Constructs a new GcsDocument. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IGcsDocument); + + /** GcsDocument gcsUri. */ + public gcsUri: string; + + /** GcsDocument mimeType. */ + public mimeType: string; + + /** + * Creates a new GcsDocument instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsDocument instance + */ + public static create(properties?: google.cloud.documentai.v1.IGcsDocument): google.cloud.documentai.v1.GcsDocument; + + /** + * Encodes the specified GcsDocument message. Does not implicitly {@link google.cloud.documentai.v1.GcsDocument.verify|verify} messages. + * @param message GcsDocument message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IGcsDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsDocument message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.GcsDocument.verify|verify} messages. + * @param message GcsDocument message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IGcsDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsDocument message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsDocument + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.GcsDocument; + + /** + * Decodes a GcsDocument message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsDocument + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.GcsDocument; + + /** + * Verifies a GcsDocument message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GcsDocument message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsDocument + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.GcsDocument; + + /** + * Creates a plain object from a GcsDocument message. Also converts values to other types if specified. + * @param message GcsDocument + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.GcsDocument, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsDocument to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GcsDocuments. */ + interface IGcsDocuments { + + /** GcsDocuments documents */ + documents?: (google.cloud.documentai.v1.IGcsDocument[]|null); + } + + /** Represents a GcsDocuments. */ + class GcsDocuments implements IGcsDocuments { + + /** + * Constructs a new GcsDocuments. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IGcsDocuments); + + /** GcsDocuments documents. */ + public documents: google.cloud.documentai.v1.IGcsDocument[]; + + /** + * Creates a new GcsDocuments instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsDocuments instance + */ + public static create(properties?: google.cloud.documentai.v1.IGcsDocuments): google.cloud.documentai.v1.GcsDocuments; + + /** + * Encodes the specified GcsDocuments message. Does not implicitly {@link google.cloud.documentai.v1.GcsDocuments.verify|verify} messages. + * @param message GcsDocuments message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IGcsDocuments, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsDocuments message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.GcsDocuments.verify|verify} messages. + * @param message GcsDocuments message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IGcsDocuments, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsDocuments message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsDocuments + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.GcsDocuments; + + /** + * Decodes a GcsDocuments message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsDocuments + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.GcsDocuments; + + /** + * Verifies a GcsDocuments message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GcsDocuments message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsDocuments + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.GcsDocuments; + + /** + * Creates a plain object from a GcsDocuments message. Also converts values to other types if specified. + * @param message GcsDocuments + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.GcsDocuments, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsDocuments to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GcsPrefix. */ + interface IGcsPrefix { + + /** GcsPrefix gcsUriPrefix */ + gcsUriPrefix?: (string|null); + } + + /** Represents a GcsPrefix. */ + class GcsPrefix implements IGcsPrefix { + + /** + * Constructs a new GcsPrefix. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IGcsPrefix); + + /** GcsPrefix gcsUriPrefix. */ + public gcsUriPrefix: string; + + /** + * Creates a new GcsPrefix instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsPrefix instance + */ + public static create(properties?: google.cloud.documentai.v1.IGcsPrefix): google.cloud.documentai.v1.GcsPrefix; + + /** + * Encodes the specified GcsPrefix message. Does not implicitly {@link google.cloud.documentai.v1.GcsPrefix.verify|verify} messages. + * @param message GcsPrefix message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IGcsPrefix, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsPrefix message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.GcsPrefix.verify|verify} messages. + * @param message GcsPrefix message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IGcsPrefix, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsPrefix message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsPrefix + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.GcsPrefix; + + /** + * Decodes a GcsPrefix message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsPrefix + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.GcsPrefix; + + /** + * Verifies a GcsPrefix message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GcsPrefix message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsPrefix + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.GcsPrefix; + + /** + * Creates a plain object from a GcsPrefix message. Also converts values to other types if specified. + * @param message GcsPrefix + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.GcsPrefix, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsPrefix to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BatchDocumentsInputConfig. */ + interface IBatchDocumentsInputConfig { + + /** BatchDocumentsInputConfig gcsPrefix */ + gcsPrefix?: (google.cloud.documentai.v1.IGcsPrefix|null); + + /** BatchDocumentsInputConfig gcsDocuments */ + gcsDocuments?: (google.cloud.documentai.v1.IGcsDocuments|null); + } + + /** Represents a BatchDocumentsInputConfig. */ + class BatchDocumentsInputConfig implements IBatchDocumentsInputConfig { + + /** + * Constructs a new BatchDocumentsInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IBatchDocumentsInputConfig); + + /** BatchDocumentsInputConfig gcsPrefix. */ + public gcsPrefix?: (google.cloud.documentai.v1.IGcsPrefix|null); + + /** BatchDocumentsInputConfig gcsDocuments. */ + public gcsDocuments?: (google.cloud.documentai.v1.IGcsDocuments|null); + + /** BatchDocumentsInputConfig source. */ + public source?: ("gcsPrefix"|"gcsDocuments"); + + /** + * Creates a new BatchDocumentsInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchDocumentsInputConfig instance + */ + public static create(properties?: google.cloud.documentai.v1.IBatchDocumentsInputConfig): google.cloud.documentai.v1.BatchDocumentsInputConfig; + + /** + * Encodes the specified BatchDocumentsInputConfig message. Does not implicitly {@link google.cloud.documentai.v1.BatchDocumentsInputConfig.verify|verify} messages. + * @param message BatchDocumentsInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IBatchDocumentsInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchDocumentsInputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchDocumentsInputConfig.verify|verify} messages. + * @param message BatchDocumentsInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IBatchDocumentsInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchDocumentsInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchDocumentsInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.BatchDocumentsInputConfig; + + /** + * Decodes a BatchDocumentsInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchDocumentsInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.BatchDocumentsInputConfig; + + /** + * Verifies a BatchDocumentsInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchDocumentsInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchDocumentsInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchDocumentsInputConfig; + + /** + * Creates a plain object from a BatchDocumentsInputConfig message. Also converts values to other types if specified. + * @param message BatchDocumentsInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.BatchDocumentsInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchDocumentsInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DocumentOutputConfig. */ + interface IDocumentOutputConfig { + + /** DocumentOutputConfig gcsOutputConfig */ + gcsOutputConfig?: (google.cloud.documentai.v1.DocumentOutputConfig.IGcsOutputConfig|null); + } + + /** Represents a DocumentOutputConfig. */ + class DocumentOutputConfig implements IDocumentOutputConfig { + + /** + * Constructs a new DocumentOutputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDocumentOutputConfig); + + /** DocumentOutputConfig gcsOutputConfig. */ + public gcsOutputConfig?: (google.cloud.documentai.v1.DocumentOutputConfig.IGcsOutputConfig|null); + + /** DocumentOutputConfig destination. */ + public destination?: "gcsOutputConfig"; + + /** + * Creates a new DocumentOutputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentOutputConfig instance + */ + public static create(properties?: google.cloud.documentai.v1.IDocumentOutputConfig): google.cloud.documentai.v1.DocumentOutputConfig; + + /** + * Encodes the specified DocumentOutputConfig message. Does not implicitly {@link google.cloud.documentai.v1.DocumentOutputConfig.verify|verify} messages. + * @param message DocumentOutputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDocumentOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentOutputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DocumentOutputConfig.verify|verify} messages. + * @param message DocumentOutputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDocumentOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentOutputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.DocumentOutputConfig; + + /** + * Decodes a DocumentOutputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.DocumentOutputConfig; + + /** + * Verifies a DocumentOutputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentOutputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentOutputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DocumentOutputConfig; + + /** + * Creates a plain object from a DocumentOutputConfig message. Also converts values to other types if specified. + * @param message DocumentOutputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DocumentOutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentOutputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace DocumentOutputConfig { + + /** Properties of a GcsOutputConfig. */ + interface IGcsOutputConfig { + + /** GcsOutputConfig gcsUri */ + gcsUri?: (string|null); + } + + /** Represents a GcsOutputConfig. */ + class GcsOutputConfig implements IGcsOutputConfig { + + /** + * Constructs a new GcsOutputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.DocumentOutputConfig.IGcsOutputConfig); + + /** GcsOutputConfig gcsUri. */ + public gcsUri: string; + + /** + * Creates a new GcsOutputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsOutputConfig instance + */ + public static create(properties?: google.cloud.documentai.v1.DocumentOutputConfig.IGcsOutputConfig): google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig; + + /** + * Encodes the specified GcsOutputConfig message. Does not implicitly {@link google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.verify|verify} messages. + * @param message GcsOutputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.DocumentOutputConfig.IGcsOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsOutputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.verify|verify} messages. + * @param message GcsOutputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.DocumentOutputConfig.IGcsOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsOutputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig; + + /** + * Decodes a GcsOutputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig; + + /** + * Verifies a GcsOutputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GcsOutputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsOutputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig; + + /** + * Creates a plain object from a GcsOutputConfig message. Also converts values to other types if specified. + * @param message GcsOutputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsOutputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Represents a DocumentProcessorService */ + class DocumentProcessorService extends $protobuf.rpc.Service { + + /** + * Constructs a new DocumentProcessorService 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 DocumentProcessorService 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): DocumentProcessorService; + + /** + * Calls ProcessDocument. + * @param request ProcessRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ProcessResponse + */ + public processDocument(request: google.cloud.documentai.v1.IProcessRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.ProcessDocumentCallback): void; + + /** + * Calls ProcessDocument. + * @param request ProcessRequest message or plain object + * @returns Promise + */ + public processDocument(request: google.cloud.documentai.v1.IProcessRequest): Promise; + + /** + * Calls BatchProcessDocuments. + * @param request BatchProcessRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchProcessDocuments(request: google.cloud.documentai.v1.IBatchProcessRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocumentsCallback): void; + + /** + * Calls BatchProcessDocuments. + * @param request BatchProcessRequest message or plain object + * @returns Promise + */ + public batchProcessDocuments(request: google.cloud.documentai.v1.IBatchProcessRequest): Promise; + + /** + * Calls ReviewDocument. + * @param request ReviewDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public reviewDocument(request: google.cloud.documentai.v1.IReviewDocumentRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.ReviewDocumentCallback): void; + + /** + * Calls ReviewDocument. + * @param request ReviewDocumentRequest message or plain object + * @returns Promise + */ + public reviewDocument(request: google.cloud.documentai.v1.IReviewDocumentRequest): Promise; + } + + namespace DocumentProcessorService { + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#processDocument}. + * @param error Error, if any + * @param [response] ProcessResponse + */ + type ProcessDocumentCallback = (error: (Error|null), response?: google.cloud.documentai.v1.ProcessResponse) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#batchProcessDocuments}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchProcessDocumentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#reviewDocument}. + * @param error Error, if any + * @param [response] Operation + */ + type ReviewDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a ProcessRequest. */ + interface IProcessRequest { + + /** ProcessRequest inlineDocument */ + inlineDocument?: (google.cloud.documentai.v1.IDocument|null); + + /** ProcessRequest rawDocument */ + rawDocument?: (google.cloud.documentai.v1.IRawDocument|null); + + /** ProcessRequest name */ + name?: (string|null); + + /** ProcessRequest skipHumanReview */ + skipHumanReview?: (boolean|null); + } + + /** Represents a ProcessRequest. */ + class ProcessRequest implements IProcessRequest { + + /** + * Constructs a new ProcessRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IProcessRequest); + + /** ProcessRequest inlineDocument. */ + public inlineDocument?: (google.cloud.documentai.v1.IDocument|null); + + /** ProcessRequest rawDocument. */ + public rawDocument?: (google.cloud.documentai.v1.IRawDocument|null); + + /** ProcessRequest name. */ + public name: string; + + /** ProcessRequest skipHumanReview. */ + public skipHumanReview: boolean; + + /** ProcessRequest source. */ + public source?: ("inlineDocument"|"rawDocument"); + + /** + * Creates a new ProcessRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ProcessRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IProcessRequest): google.cloud.documentai.v1.ProcessRequest; + + /** + * Encodes the specified ProcessRequest message. Does not implicitly {@link google.cloud.documentai.v1.ProcessRequest.verify|verify} messages. + * @param message ProcessRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProcessRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessRequest.verify|verify} messages. + * @param message ProcessRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProcessRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ProcessRequest; + + /** + * Decodes a ProcessRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ProcessRequest; + + /** + * Verifies a ProcessRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProcessRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProcessRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ProcessRequest; + + /** + * Creates a plain object from a ProcessRequest message. Also converts values to other types if specified. + * @param message ProcessRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ProcessRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProcessRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a HumanReviewStatus. */ + interface IHumanReviewStatus { + + /** HumanReviewStatus state */ + state?: (google.cloud.documentai.v1.HumanReviewStatus.State|keyof typeof google.cloud.documentai.v1.HumanReviewStatus.State|null); + + /** HumanReviewStatus stateMessage */ + stateMessage?: (string|null); + + /** HumanReviewStatus humanReviewOperation */ + humanReviewOperation?: (string|null); + } + + /** Represents a HumanReviewStatus. */ + class HumanReviewStatus implements IHumanReviewStatus { + + /** + * Constructs a new HumanReviewStatus. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IHumanReviewStatus); + + /** HumanReviewStatus state. */ + public state: (google.cloud.documentai.v1.HumanReviewStatus.State|keyof typeof google.cloud.documentai.v1.HumanReviewStatus.State); + + /** HumanReviewStatus stateMessage. */ + public stateMessage: string; + + /** HumanReviewStatus humanReviewOperation. */ + public humanReviewOperation: string; + + /** + * Creates a new HumanReviewStatus instance using the specified properties. + * @param [properties] Properties to set + * @returns HumanReviewStatus instance + */ + public static create(properties?: google.cloud.documentai.v1.IHumanReviewStatus): google.cloud.documentai.v1.HumanReviewStatus; + + /** + * Encodes the specified HumanReviewStatus message. Does not implicitly {@link google.cloud.documentai.v1.HumanReviewStatus.verify|verify} messages. + * @param message HumanReviewStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IHumanReviewStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HumanReviewStatus message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.HumanReviewStatus.verify|verify} messages. + * @param message HumanReviewStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IHumanReviewStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HumanReviewStatus message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HumanReviewStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.HumanReviewStatus; + + /** + * Decodes a HumanReviewStatus message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HumanReviewStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.HumanReviewStatus; + + /** + * Verifies a HumanReviewStatus message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HumanReviewStatus message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HumanReviewStatus + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.HumanReviewStatus; + + /** + * Creates a plain object from a HumanReviewStatus message. Also converts values to other types if specified. + * @param message HumanReviewStatus + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.HumanReviewStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HumanReviewStatus to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace HumanReviewStatus { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + SKIPPED = 1, + VALIDATION_PASSED = 2, + IN_PROGRESS = 3, + ERROR = 4 + } + } + + /** Properties of a ProcessResponse. */ + interface IProcessResponse { + + /** ProcessResponse document */ + document?: (google.cloud.documentai.v1.IDocument|null); + + /** ProcessResponse humanReviewStatus */ + humanReviewStatus?: (google.cloud.documentai.v1.IHumanReviewStatus|null); + } + + /** Represents a ProcessResponse. */ + class ProcessResponse implements IProcessResponse { + + /** + * Constructs a new ProcessResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IProcessResponse); + + /** ProcessResponse document. */ + public document?: (google.cloud.documentai.v1.IDocument|null); + + /** ProcessResponse humanReviewStatus. */ + public humanReviewStatus?: (google.cloud.documentai.v1.IHumanReviewStatus|null); + + /** + * Creates a new ProcessResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ProcessResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IProcessResponse): google.cloud.documentai.v1.ProcessResponse; + + /** + * Encodes the specified ProcessResponse message. Does not implicitly {@link google.cloud.documentai.v1.ProcessResponse.verify|verify} messages. + * @param message ProcessResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProcessResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessResponse.verify|verify} messages. + * @param message ProcessResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProcessResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProcessResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ProcessResponse; + + /** + * Decodes a ProcessResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProcessResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ProcessResponse; + + /** + * Verifies a ProcessResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProcessResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProcessResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ProcessResponse; + + /** + * Creates a plain object from a ProcessResponse message. Also converts values to other types if specified. + * @param message ProcessResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ProcessResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProcessResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BatchProcessRequest. */ + interface IBatchProcessRequest { + + /** BatchProcessRequest name */ + name?: (string|null); + + /** BatchProcessRequest inputDocuments */ + inputDocuments?: (google.cloud.documentai.v1.IBatchDocumentsInputConfig|null); + + /** BatchProcessRequest documentOutputConfig */ + documentOutputConfig?: (google.cloud.documentai.v1.IDocumentOutputConfig|null); + + /** BatchProcessRequest skipHumanReview */ + skipHumanReview?: (boolean|null); + } + + /** Represents a BatchProcessRequest. */ + class BatchProcessRequest implements IBatchProcessRequest { + + /** + * Constructs a new BatchProcessRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IBatchProcessRequest); + + /** BatchProcessRequest name. */ + public name: string; + + /** BatchProcessRequest inputDocuments. */ + public inputDocuments?: (google.cloud.documentai.v1.IBatchDocumentsInputConfig|null); + + /** BatchProcessRequest documentOutputConfig. */ + public documentOutputConfig?: (google.cloud.documentai.v1.IDocumentOutputConfig|null); + + /** BatchProcessRequest skipHumanReview. */ + public skipHumanReview: boolean; + + /** + * Creates a new BatchProcessRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchProcessRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IBatchProcessRequest): google.cloud.documentai.v1.BatchProcessRequest; + + /** + * Encodes the specified BatchProcessRequest message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessRequest.verify|verify} messages. + * @param message BatchProcessRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IBatchProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchProcessRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessRequest.verify|verify} messages. + * @param message BatchProcessRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IBatchProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchProcessRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.BatchProcessRequest; + + /** + * Decodes a BatchProcessRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.BatchProcessRequest; + + /** + * Verifies a BatchProcessRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchProcessRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchProcessRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchProcessRequest; + + /** + * Creates a plain object from a BatchProcessRequest message. Also converts values to other types if specified. + * @param message BatchProcessRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.BatchProcessRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchProcessRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BatchProcessResponse. */ + interface IBatchProcessResponse { + } + + /** Represents a BatchProcessResponse. */ + class BatchProcessResponse implements IBatchProcessResponse { + + /** + * Constructs a new BatchProcessResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IBatchProcessResponse); + + /** + * Creates a new BatchProcessResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchProcessResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IBatchProcessResponse): google.cloud.documentai.v1.BatchProcessResponse; + + /** + * Encodes the specified BatchProcessResponse message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessResponse.verify|verify} messages. + * @param message BatchProcessResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IBatchProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchProcessResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessResponse.verify|verify} messages. + * @param message BatchProcessResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IBatchProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchProcessResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchProcessResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.BatchProcessResponse; + + /** + * Decodes a BatchProcessResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchProcessResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.BatchProcessResponse; + + /** + * Verifies a BatchProcessResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchProcessResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchProcessResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchProcessResponse; + + /** + * Creates a plain object from a BatchProcessResponse message. Also converts values to other types if specified. + * @param message BatchProcessResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.BatchProcessResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchProcessResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BatchProcessMetadata. */ + interface IBatchProcessMetadata { + + /** BatchProcessMetadata state */ + state?: (google.cloud.documentai.v1.BatchProcessMetadata.State|keyof typeof google.cloud.documentai.v1.BatchProcessMetadata.State|null); + + /** BatchProcessMetadata stateMessage */ + stateMessage?: (string|null); + + /** BatchProcessMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** BatchProcessMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** BatchProcessMetadata individualProcessStatuses */ + individualProcessStatuses?: (google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus[]|null); + } + + /** Represents a BatchProcessMetadata. */ + class BatchProcessMetadata implements IBatchProcessMetadata { + + /** + * Constructs a new BatchProcessMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IBatchProcessMetadata); + + /** BatchProcessMetadata state. */ + public state: (google.cloud.documentai.v1.BatchProcessMetadata.State|keyof typeof google.cloud.documentai.v1.BatchProcessMetadata.State); + + /** BatchProcessMetadata stateMessage. */ + public stateMessage: string; + + /** BatchProcessMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** BatchProcessMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** BatchProcessMetadata individualProcessStatuses. */ + public individualProcessStatuses: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus[]; + + /** + * Creates a new BatchProcessMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchProcessMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1.IBatchProcessMetadata): google.cloud.documentai.v1.BatchProcessMetadata; + + /** + * Encodes the specified BatchProcessMetadata message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.verify|verify} messages. + * @param message BatchProcessMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IBatchProcessMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchProcessMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.verify|verify} messages. + * @param message BatchProcessMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IBatchProcessMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchProcessMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchProcessMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.BatchProcessMetadata; + + /** + * Decodes a BatchProcessMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchProcessMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.BatchProcessMetadata; + + /** + * Verifies a BatchProcessMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchProcessMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchProcessMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchProcessMetadata; + + /** + * Creates a plain object from a BatchProcessMetadata message. Also converts values to other types if specified. + * @param message BatchProcessMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.BatchProcessMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchProcessMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace BatchProcessMetadata { + + /** Properties of an IndividualProcessStatus. */ + interface IIndividualProcessStatus { + + /** IndividualProcessStatus inputGcsSource */ + inputGcsSource?: (string|null); + + /** IndividualProcessStatus status */ + status?: (google.rpc.IStatus|null); + + /** IndividualProcessStatus outputGcsDestination */ + outputGcsDestination?: (string|null); + + /** IndividualProcessStatus humanReviewStatus */ + humanReviewStatus?: (google.cloud.documentai.v1.IHumanReviewStatus|null); + } + + /** Represents an IndividualProcessStatus. */ + class IndividualProcessStatus implements IIndividualProcessStatus { + + /** + * Constructs a new IndividualProcessStatus. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus); + + /** IndividualProcessStatus inputGcsSource. */ + public inputGcsSource: string; + + /** IndividualProcessStatus status. */ + public status?: (google.rpc.IStatus|null); + + /** IndividualProcessStatus outputGcsDestination. */ + public outputGcsDestination: string; + + /** IndividualProcessStatus humanReviewStatus. */ + public humanReviewStatus?: (google.cloud.documentai.v1.IHumanReviewStatus|null); + + /** + * Creates a new IndividualProcessStatus instance using the specified properties. + * @param [properties] Properties to set + * @returns IndividualProcessStatus instance + */ + public static create(properties?: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus): google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus; + + /** + * Encodes the specified IndividualProcessStatus message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.verify|verify} messages. + * @param message IndividualProcessStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IndividualProcessStatus message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.verify|verify} messages. + * @param message IndividualProcessStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IndividualProcessStatus message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IndividualProcessStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus; + + /** + * Decodes an IndividualProcessStatus message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IndividualProcessStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus; + + /** + * Verifies an IndividualProcessStatus message. + * @param message Plain 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 IndividualProcessStatus message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IndividualProcessStatus + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus; + + /** + * Creates a plain object from an IndividualProcessStatus message. Also converts values to other types if specified. + * @param message IndividualProcessStatus + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IndividualProcessStatus to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + WAITING = 1, + RUNNING = 2, + SUCCEEDED = 3, + CANCELLING = 4, + CANCELLED = 5, + FAILED = 6 + } + } + + /** Properties of a ReviewDocumentRequest. */ + interface IReviewDocumentRequest { + + /** ReviewDocumentRequest inlineDocument */ + inlineDocument?: (google.cloud.documentai.v1.IDocument|null); + + /** ReviewDocumentRequest humanReviewConfig */ + humanReviewConfig?: (string|null); + } + + /** Represents a ReviewDocumentRequest. */ + class ReviewDocumentRequest implements IReviewDocumentRequest { + + /** + * Constructs a new ReviewDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IReviewDocumentRequest); + + /** ReviewDocumentRequest inlineDocument. */ + public inlineDocument?: (google.cloud.documentai.v1.IDocument|null); + + /** ReviewDocumentRequest humanReviewConfig. */ + public humanReviewConfig: string; + + /** ReviewDocumentRequest source. */ + public source?: "inlineDocument"; + + /** + * Creates a new ReviewDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ReviewDocumentRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IReviewDocumentRequest): google.cloud.documentai.v1.ReviewDocumentRequest; + + /** + * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentRequest.verify|verify} messages. + * @param message ReviewDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentRequest.verify|verify} messages. + * @param message ReviewDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ReviewDocumentRequest; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ReviewDocumentRequest; + + /** + * Verifies a ReviewDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReviewDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ReviewDocumentRequest; + + /** + * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. + * @param message ReviewDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ReviewDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReviewDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ReviewDocumentResponse. */ + interface IReviewDocumentResponse { + + /** ReviewDocumentResponse gcsDestination */ + gcsDestination?: (string|null); + } + + /** Represents a ReviewDocumentResponse. */ + class ReviewDocumentResponse implements IReviewDocumentResponse { + + /** + * Constructs a new ReviewDocumentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IReviewDocumentResponse); + + /** ReviewDocumentResponse gcsDestination. */ + public gcsDestination: string; + + /** + * Creates a new ReviewDocumentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ReviewDocumentResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IReviewDocumentResponse): google.cloud.documentai.v1.ReviewDocumentResponse; + + /** + * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentResponse.verify|verify} messages. + * @param message ReviewDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentResponse.verify|verify} messages. + * @param message ReviewDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ReviewDocumentResponse; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ReviewDocumentResponse; + + /** + * Verifies a ReviewDocumentResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReviewDocumentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ReviewDocumentResponse; + + /** + * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. + * @param message ReviewDocumentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ReviewDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReviewDocumentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ReviewDocumentOperationMetadata. */ + interface IReviewDocumentOperationMetadata { + + /** ReviewDocumentOperationMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + } + + /** Represents a ReviewDocumentOperationMetadata. */ + class ReviewDocumentOperationMetadata implements IReviewDocumentOperationMetadata { + + /** + * Constructs a new ReviewDocumentOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IReviewDocumentOperationMetadata); + + /** ReviewDocumentOperationMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + + /** + * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ReviewDocumentOperationMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1.IReviewDocumentOperationMetadata): google.cloud.documentai.v1.ReviewDocumentOperationMetadata; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentOperationMetadata.verify|verify} messages. + * @param message ReviewDocumentOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentOperationMetadata.verify|verify} messages. + * @param message ReviewDocumentOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ReviewDocumentOperationMetadata; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ReviewDocumentOperationMetadata; + + /** + * Verifies a ReviewDocumentOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReviewDocumentOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ReviewDocumentOperationMetadata; + + /** + * Creates a plain object from a ReviewDocumentOperationMetadata message. Also converts values to other types if specified. + * @param message ReviewDocumentOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ReviewDocumentOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReviewDocumentOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CommonOperationMetadata. */ + interface ICommonOperationMetadata { + + /** CommonOperationMetadata state */ + state?: (google.cloud.documentai.v1.CommonOperationMetadata.State|keyof typeof google.cloud.documentai.v1.CommonOperationMetadata.State|null); + + /** CommonOperationMetadata stateMessage */ + stateMessage?: (string|null); + + /** CommonOperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** CommonOperationMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a CommonOperationMetadata. */ + class CommonOperationMetadata implements ICommonOperationMetadata { + + /** + * Constructs a new CommonOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.ICommonOperationMetadata); + + /** CommonOperationMetadata state. */ + public state: (google.cloud.documentai.v1.CommonOperationMetadata.State|keyof typeof google.cloud.documentai.v1.CommonOperationMetadata.State); + + /** CommonOperationMetadata stateMessage. */ + public stateMessage: string; + + /** CommonOperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** CommonOperationMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new CommonOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns CommonOperationMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1.ICommonOperationMetadata): google.cloud.documentai.v1.CommonOperationMetadata; + + /** + * Encodes the specified CommonOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1.CommonOperationMetadata.verify|verify} messages. + * @param message CommonOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.ICommonOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CommonOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.CommonOperationMetadata.verify|verify} messages. + * @param message CommonOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.ICommonOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CommonOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CommonOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.CommonOperationMetadata; + + /** + * Decodes a CommonOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CommonOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.CommonOperationMetadata; + + /** + * Verifies a CommonOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CommonOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CommonOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.CommonOperationMetadata; + + /** + * Creates a plain object from a CommonOperationMetadata message. Also converts values to other types if specified. + * @param message CommonOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.CommonOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CommonOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace CommonOperationMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + CANCELLING = 2, + SUCCEEDED = 3, + FAILED = 4, + CANCELLED = 5 + } + } + } + + /** Namespace v1beta1. */ + namespace v1beta1 { + + /** Properties of a Document. */ + interface IDocument { + + /** Document uri */ + uri?: (string|null); + + /** Document content */ + content?: (Uint8Array|string|null); + + /** Document mimeType */ + mimeType?: (string|null); + + /** Document text */ + text?: (string|null); + + /** Document textStyles */ + textStyles?: (google.cloud.documentai.v1beta1.Document.IStyle[]|null); + + /** Document pages */ + pages?: (google.cloud.documentai.v1beta1.Document.IPage[]|null); + + /** Document entities */ + entities?: (google.cloud.documentai.v1beta1.Document.IEntity[]|null); + + /** Document entityRelations */ + entityRelations?: (google.cloud.documentai.v1beta1.Document.IEntityRelation[]|null); + + /** Document shardInfo */ + shardInfo?: (google.cloud.documentai.v1beta1.Document.IShardInfo|null); + + /** Document error */ + error?: (google.rpc.IStatus|null); + } + + /** Represents a Document. */ + class Document implements IDocument { + + /** + * Constructs a new Document. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IDocument); + + /** Document uri. */ + public uri: string; + + /** Document content. */ + public content: (Uint8Array|string); + + /** Document mimeType. */ + public mimeType: string; + + /** Document text. */ + public text: string; + + /** Document textStyles. */ + public textStyles: google.cloud.documentai.v1beta1.Document.IStyle[]; + + /** Document pages. */ + public pages: google.cloud.documentai.v1beta1.Document.IPage[]; + + /** Document entities. */ + public entities: google.cloud.documentai.v1beta1.Document.IEntity[]; + + /** Document entityRelations. */ + public entityRelations: google.cloud.documentai.v1beta1.Document.IEntityRelation[]; + + /** Document shardInfo. */ + public shardInfo?: (google.cloud.documentai.v1beta1.Document.IShardInfo|null); + + /** Document error. */ + public error?: (google.rpc.IStatus|null); + + /** Document source. */ + public source?: ("uri"|"content"); + + /** + * Creates a new Document instance using the specified properties. + * @param [properties] Properties to set + * @returns Document instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IDocument): google.cloud.documentai.v1beta1.Document; + + /** + * Encodes the specified Document message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.verify|verify} messages. + * @param message Document message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Document message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.verify|verify} messages. + * @param message Document message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Document message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document; + + /** + * Decodes a Document message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document; + + /** + * Verifies a Document message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Document message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Document + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document; + + /** + * Creates a plain object from a Document message. Also converts values to other types if specified. + * @param message Document + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Document to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Document { + + /** Properties of a ShardInfo. */ + interface IShardInfo { + + /** ShardInfo shardIndex */ + shardIndex?: (number|Long|string|null); + + /** ShardInfo shardCount */ + shardCount?: (number|Long|string|null); + + /** ShardInfo textOffset */ + textOffset?: (number|Long|string|null); + } + + /** Represents a ShardInfo. */ + class ShardInfo implements IShardInfo { + + /** + * Constructs a new ShardInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.IShardInfo); + + /** ShardInfo shardIndex. */ + public shardIndex: (number|Long|string); + + /** ShardInfo shardCount. */ + public shardCount: (number|Long|string); + + /** ShardInfo textOffset. */ + public textOffset: (number|Long|string); + + /** + * Creates a new ShardInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns ShardInfo instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.IShardInfo): google.cloud.documentai.v1beta1.Document.ShardInfo; + + /** + * Encodes the specified ShardInfo message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.ShardInfo.verify|verify} messages. + * @param message ShardInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.IShardInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ShardInfo message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.ShardInfo.verify|verify} messages. + * @param message ShardInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.IShardInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ShardInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ShardInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.ShardInfo; + + /** + * Decodes a ShardInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ShardInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.ShardInfo; + + /** + * Verifies a ShardInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ShardInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ShardInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.ShardInfo; + + /** + * Creates a plain object from a ShardInfo message. Also converts values to other types if specified. + * @param message ShardInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.ShardInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ShardInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Style. */ + interface IStyle { + + /** Style textAnchor */ + textAnchor?: (google.cloud.documentai.v1beta1.Document.ITextAnchor|null); + + /** Style color */ + color?: (google.type.IColor|null); + + /** Style backgroundColor */ + backgroundColor?: (google.type.IColor|null); + + /** Style fontWeight */ + fontWeight?: (string|null); + + /** Style textStyle */ + textStyle?: (string|null); + + /** Style textDecoration */ + textDecoration?: (string|null); + + /** Style fontSize */ + fontSize?: (google.cloud.documentai.v1beta1.Document.Style.IFontSize|null); + } + + /** Represents a Style. */ + class Style implements IStyle { + + /** + * Constructs a new Style. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.IStyle); + + /** Style textAnchor. */ + public textAnchor?: (google.cloud.documentai.v1beta1.Document.ITextAnchor|null); + + /** Style color. */ + public color?: (google.type.IColor|null); + + /** Style backgroundColor. */ + public backgroundColor?: (google.type.IColor|null); + + /** Style fontWeight. */ + public fontWeight: string; + + /** Style textStyle. */ + public textStyle: string; + + /** Style textDecoration. */ + public textDecoration: string; + + /** Style fontSize. */ + public fontSize?: (google.cloud.documentai.v1beta1.Document.Style.IFontSize|null); + + /** + * Creates a new Style instance using the specified properties. + * @param [properties] Properties to set + * @returns Style instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.IStyle): google.cloud.documentai.v1beta1.Document.Style; + + /** + * Encodes the specified Style message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Style.verify|verify} messages. + * @param message Style message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.IStyle, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Style message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Style.verify|verify} messages. + * @param message Style message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.IStyle, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Style message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Style + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.Style; + + /** + * Decodes a Style message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Style + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.Style; + + /** + * Verifies a Style message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Style message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Style + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.Style; + + /** + * Creates a plain object from a Style message. Also converts values to other types if specified. + * @param message Style + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.Style, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Style to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Style { + + /** Properties of a FontSize. */ + interface IFontSize { + + /** FontSize size */ + size?: (number|null); + + /** FontSize unit */ + unit?: (string|null); + } + + /** Represents a FontSize. */ + class FontSize implements IFontSize { + + /** + * Constructs a new FontSize. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.Style.IFontSize); + + /** FontSize size. */ + public size: number; + + /** FontSize unit. */ + public unit: string; + + /** + * Creates a new FontSize instance using the specified properties. + * @param [properties] Properties to set + * @returns FontSize instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.Style.IFontSize): google.cloud.documentai.v1beta1.Document.Style.FontSize; + + /** + * Encodes the specified FontSize message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Style.FontSize.verify|verify} messages. + * @param message FontSize message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.Style.IFontSize, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FontSize message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Style.FontSize.verify|verify} messages. + * @param message FontSize message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.Style.IFontSize, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FontSize message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FontSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.Style.FontSize; + + /** + * Decodes a FontSize message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FontSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.Style.FontSize; + + /** + * Verifies a FontSize message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FontSize message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FontSize + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.Style.FontSize; + + /** + * Creates a plain object from a FontSize message. Also converts values to other types if specified. + * @param message FontSize + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.Style.FontSize, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FontSize to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a Page. */ + interface IPage { + + /** Page pageNumber */ + pageNumber?: (number|null); + + /** Page dimension */ + dimension?: (google.cloud.documentai.v1beta1.Document.Page.IDimension|null); + + /** Page layout */ + layout?: (google.cloud.documentai.v1beta1.Document.Page.ILayout|null); + + /** Page detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage[]|null); + + /** Page blocks */ + blocks?: (google.cloud.documentai.v1beta1.Document.Page.IBlock[]|null); + + /** Page paragraphs */ + paragraphs?: (google.cloud.documentai.v1beta1.Document.Page.IParagraph[]|null); + + /** Page lines */ + lines?: (google.cloud.documentai.v1beta1.Document.Page.ILine[]|null); + + /** Page tokens */ + tokens?: (google.cloud.documentai.v1beta1.Document.Page.IToken[]|null); + + /** Page visualElements */ + visualElements?: (google.cloud.documentai.v1beta1.Document.Page.IVisualElement[]|null); + + /** Page tables */ + tables?: (google.cloud.documentai.v1beta1.Document.Page.ITable[]|null); + + /** Page formFields */ + formFields?: (google.cloud.documentai.v1beta1.Document.Page.IFormField[]|null); + } + + /** Represents a Page. */ + class Page implements IPage { + + /** + * Constructs a new Page. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.IPage); + + /** Page pageNumber. */ + public pageNumber: number; + + /** Page dimension. */ + public dimension?: (google.cloud.documentai.v1beta1.Document.Page.IDimension|null); + + /** Page layout. */ + public layout?: (google.cloud.documentai.v1beta1.Document.Page.ILayout|null); + + /** Page detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage[]; + + /** Page blocks. */ + public blocks: google.cloud.documentai.v1beta1.Document.Page.IBlock[]; + + /** Page paragraphs. */ + public paragraphs: google.cloud.documentai.v1beta1.Document.Page.IParagraph[]; + + /** Page lines. */ + public lines: google.cloud.documentai.v1beta1.Document.Page.ILine[]; + + /** Page tokens. */ + public tokens: google.cloud.documentai.v1beta1.Document.Page.IToken[]; + + /** Page visualElements. */ + public visualElements: google.cloud.documentai.v1beta1.Document.Page.IVisualElement[]; + + /** Page tables. */ + public tables: google.cloud.documentai.v1beta1.Document.Page.ITable[]; + + /** Page formFields. */ + public formFields: google.cloud.documentai.v1beta1.Document.Page.IFormField[]; + + /** + * Creates a new Page instance using the specified properties. + * @param [properties] Properties to set + * @returns Page instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.IPage): google.cloud.documentai.v1beta1.Document.Page; + + /** + * Encodes the specified Page message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.verify|verify} messages. + * @param message Page message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.IPage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Page message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.verify|verify} messages. + * @param message Page message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.IPage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Page message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Page + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.Page; + + /** + * Decodes a Page message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Page + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.Page; + + /** + * Verifies a Page message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Page message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Page + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.Page; + + /** + * Creates a plain object from a Page message. Also converts values to other types if specified. + * @param message Page + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.Page, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Page to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Page { + + /** Properties of a Dimension. */ + interface IDimension { + + /** Dimension width */ + width?: (number|null); + + /** Dimension height */ + height?: (number|null); + + /** Dimension unit */ + unit?: (string|null); + } + + /** Represents a Dimension. */ + class Dimension implements IDimension { + + /** + * Constructs a new Dimension. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.Page.IDimension); + + /** Dimension width. */ + public width: number; + + /** Dimension height. */ + public height: number; + + /** Dimension unit. */ + public unit: string; + + /** + * Creates a new Dimension instance using the specified properties. + * @param [properties] Properties to set + * @returns Dimension instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.Page.IDimension): google.cloud.documentai.v1beta1.Document.Page.Dimension; + + /** + * Encodes the specified Dimension message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Dimension.verify|verify} messages. + * @param message Dimension message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.Page.IDimension, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Dimension message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Dimension.verify|verify} messages. + * @param message Dimension message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.Page.IDimension, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Dimension message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Dimension + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.Page.Dimension; + + /** + * Decodes a Dimension message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Dimension + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.Page.Dimension; + + /** + * Verifies a Dimension message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Dimension message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Dimension + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.Page.Dimension; + + /** + * Creates a plain object from a Dimension message. Also converts values to other types if specified. + * @param message Dimension + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.Page.Dimension, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Dimension to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Layout. */ + interface ILayout { + + /** Layout textAnchor */ + textAnchor?: (google.cloud.documentai.v1beta1.Document.ITextAnchor|null); + + /** Layout confidence */ + confidence?: (number|null); + + /** Layout boundingPoly */ + boundingPoly?: (google.cloud.documentai.v1beta1.IBoundingPoly|null); + + /** Layout orientation */ + orientation?: (google.cloud.documentai.v1beta1.Document.Page.Layout.Orientation|keyof typeof google.cloud.documentai.v1beta1.Document.Page.Layout.Orientation|null); + } + + /** Represents a Layout. */ + class Layout implements ILayout { + + /** + * Constructs a new Layout. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.Page.ILayout); + + /** Layout textAnchor. */ + public textAnchor?: (google.cloud.documentai.v1beta1.Document.ITextAnchor|null); + + /** Layout confidence. */ + public confidence: number; + + /** Layout boundingPoly. */ + public boundingPoly?: (google.cloud.documentai.v1beta1.IBoundingPoly|null); + + /** Layout orientation. */ + public orientation: (google.cloud.documentai.v1beta1.Document.Page.Layout.Orientation|keyof typeof google.cloud.documentai.v1beta1.Document.Page.Layout.Orientation); + + /** + * Creates a new Layout instance using the specified properties. + * @param [properties] Properties to set + * @returns Layout instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.Page.ILayout): google.cloud.documentai.v1beta1.Document.Page.Layout; + + /** + * Encodes the specified Layout message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Layout.verify|verify} messages. + * @param message Layout message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.Page.ILayout, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Layout message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Layout.verify|verify} messages. + * @param message Layout message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.Page.ILayout, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Layout message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Layout + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.Page.Layout; + + /** + * Decodes a Layout message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Layout + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.Page.Layout; + + /** + * Verifies a Layout message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Layout message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Layout + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.Page.Layout; + + /** + * Creates a plain object from a Layout message. Also converts values to other types if specified. + * @param message Layout + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.Page.Layout, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Layout to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Layout { + + /** Orientation enum. */ + enum Orientation { + ORIENTATION_UNSPECIFIED = 0, + PAGE_UP = 1, + PAGE_RIGHT = 2, + PAGE_DOWN = 3, + PAGE_LEFT = 4 + } + } + + /** Properties of a Block. */ + interface IBlock { + + /** Block layout */ + layout?: (google.cloud.documentai.v1beta1.Document.Page.ILayout|null); + + /** Block detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a Block. */ + class Block implements IBlock { + + /** + * Constructs a new Block. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.Page.IBlock); + + /** Block layout. */ + public layout?: (google.cloud.documentai.v1beta1.Document.Page.ILayout|null); + + /** Block detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new Block instance using the specified properties. + * @param [properties] Properties to set + * @returns Block instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.Page.IBlock): google.cloud.documentai.v1beta1.Document.Page.Block; + + /** + * Encodes the specified Block message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Block.verify|verify} messages. + * @param message Block message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.Page.IBlock, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Block message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Block.verify|verify} messages. + * @param message Block message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.Page.IBlock, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Block message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Block + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.Page.Block; + + /** + * Decodes a Block message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Block + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.Page.Block; + + /** + * Verifies a Block message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Block message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Block + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.Page.Block; + + /** + * Creates a plain object from a Block message. Also converts values to other types if specified. + * @param message Block + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.Page.Block, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Block to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Paragraph. */ + interface IParagraph { + + /** Paragraph layout */ + layout?: (google.cloud.documentai.v1beta1.Document.Page.ILayout|null); + + /** Paragraph detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a Paragraph. */ + class Paragraph implements IParagraph { + + /** + * Constructs a new Paragraph. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.Page.IParagraph); + + /** Paragraph layout. */ + public layout?: (google.cloud.documentai.v1beta1.Document.Page.ILayout|null); + + /** Paragraph detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new Paragraph instance using the specified properties. + * @param [properties] Properties to set + * @returns Paragraph instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.Page.IParagraph): google.cloud.documentai.v1beta1.Document.Page.Paragraph; + + /** + * Encodes the specified Paragraph message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Paragraph.verify|verify} messages. + * @param message Paragraph message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.Page.IParagraph, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Paragraph message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Paragraph.verify|verify} messages. + * @param message Paragraph message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.Page.IParagraph, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Paragraph message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Paragraph + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.Page.Paragraph; + + /** + * Decodes a Paragraph message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Paragraph + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.Page.Paragraph; + + /** + * Verifies a Paragraph message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Paragraph message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Paragraph + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.Page.Paragraph; + + /** + * Creates a plain object from a Paragraph message. Also converts values to other types if specified. + * @param message Paragraph + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.Page.Paragraph, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Paragraph to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Line. */ + interface ILine { + + /** Line layout */ + layout?: (google.cloud.documentai.v1beta1.Document.Page.ILayout|null); + + /** Line detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a Line. */ + class Line implements ILine { + + /** + * Constructs a new Line. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.Page.ILine); + + /** Line layout. */ + public layout?: (google.cloud.documentai.v1beta1.Document.Page.ILayout|null); + + /** Line detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new Line instance using the specified properties. + * @param [properties] Properties to set + * @returns Line instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.Page.ILine): google.cloud.documentai.v1beta1.Document.Page.Line; + + /** + * Encodes the specified Line message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Line.verify|verify} messages. + * @param message Line message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.Page.ILine, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Line message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Line.verify|verify} messages. + * @param message Line message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.Page.ILine, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Line message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.Page.Line; + + /** + * Decodes a Line message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.Page.Line; + + /** + * Verifies a Line message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Line message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Line + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.Page.Line; + + /** + * Creates a plain object from a Line message. Also converts values to other types if specified. + * @param message Line + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.Page.Line, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Line to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Token. */ + interface IToken { + + /** Token layout */ + layout?: (google.cloud.documentai.v1beta1.Document.Page.ILayout|null); + + /** Token detectedBreak */ + detectedBreak?: (google.cloud.documentai.v1beta1.Document.Page.Token.IDetectedBreak|null); + + /** Token detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a Token. */ + class Token implements IToken { + + /** + * Constructs a new Token. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.Page.IToken); + + /** Token layout. */ + public layout?: (google.cloud.documentai.v1beta1.Document.Page.ILayout|null); + + /** Token detectedBreak. */ + public detectedBreak?: (google.cloud.documentai.v1beta1.Document.Page.Token.IDetectedBreak|null); + + /** Token detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new Token instance using the specified properties. + * @param [properties] Properties to set + * @returns Token instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.Page.IToken): google.cloud.documentai.v1beta1.Document.Page.Token; + + /** + * Encodes the specified Token message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Token.verify|verify} messages. + * @param message Token message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.Page.IToken, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Token message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Token.verify|verify} messages. + * @param message Token message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.Page.IToken, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Token message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Token + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.Page.Token; + + /** + * Decodes a Token message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Token + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.Page.Token; + + /** + * Verifies a Token message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Token message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Token + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.Page.Token; + + /** + * Creates a plain object from a Token message. Also converts values to other types if specified. + * @param message Token + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.Page.Token, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Token to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Token { + + /** Properties of a DetectedBreak. */ + interface IDetectedBreak { + + /** DetectedBreak type */ + type?: (google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.Type|keyof typeof google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.Type|null); + } + + /** Represents a DetectedBreak. */ + class DetectedBreak implements IDetectedBreak { + + /** + * Constructs a new DetectedBreak. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.Page.Token.IDetectedBreak); + + /** DetectedBreak type. */ + public type: (google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.Type|keyof typeof google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.Type); + + /** + * Creates a new DetectedBreak instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectedBreak instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.Page.Token.IDetectedBreak): google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak; + + /** + * Encodes the specified DetectedBreak message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.verify|verify} messages. + * @param message DetectedBreak message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.Page.Token.IDetectedBreak, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectedBreak message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.verify|verify} messages. + * @param message DetectedBreak message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.Page.Token.IDetectedBreak, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectedBreak message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectedBreak + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak; + + /** + * Decodes a DetectedBreak message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectedBreak + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak; + + /** + * Verifies a DetectedBreak message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DetectedBreak message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectedBreak + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak; + + /** + * Creates a plain object from a DetectedBreak message. Also converts values to other types if specified. + * @param message DetectedBreak + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectedBreak to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace DetectedBreak { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + SPACE = 1, + WIDE_SPACE = 2, + HYPHEN = 3 + } + } + } + + /** Properties of a VisualElement. */ + interface IVisualElement { + + /** VisualElement layout */ + layout?: (google.cloud.documentai.v1beta1.Document.Page.ILayout|null); + + /** VisualElement type */ + type?: (string|null); + + /** VisualElement detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a VisualElement. */ + class VisualElement implements IVisualElement { + + /** + * Constructs a new VisualElement. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.Page.IVisualElement); + + /** VisualElement layout. */ + public layout?: (google.cloud.documentai.v1beta1.Document.Page.ILayout|null); + + /** VisualElement type. */ + public type: string; + + /** VisualElement detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new VisualElement instance using the specified properties. + * @param [properties] Properties to set + * @returns VisualElement instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.Page.IVisualElement): google.cloud.documentai.v1beta1.Document.Page.VisualElement; + + /** + * Encodes the specified VisualElement message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.VisualElement.verify|verify} messages. + * @param message VisualElement message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.Page.IVisualElement, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VisualElement message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.VisualElement.verify|verify} messages. + * @param message VisualElement message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.Page.IVisualElement, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VisualElement message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VisualElement + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.Page.VisualElement; + + /** + * Decodes a VisualElement message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VisualElement + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.Page.VisualElement; + + /** + * Verifies a VisualElement message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a VisualElement message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VisualElement + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.Page.VisualElement; + + /** + * Creates a plain object from a VisualElement message. Also converts values to other types if specified. + * @param message VisualElement + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.Page.VisualElement, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VisualElement to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Table. */ + interface ITable { + + /** Table layout */ + layout?: (google.cloud.documentai.v1beta1.Document.Page.ILayout|null); + + /** Table headerRows */ + headerRows?: (google.cloud.documentai.v1beta1.Document.Page.Table.ITableRow[]|null); + + /** Table bodyRows */ + bodyRows?: (google.cloud.documentai.v1beta1.Document.Page.Table.ITableRow[]|null); + + /** Table detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a Table. */ + class Table implements ITable { + + /** + * Constructs a new Table. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.Page.ITable); + + /** Table layout. */ + public layout?: (google.cloud.documentai.v1beta1.Document.Page.ILayout|null); + + /** Table headerRows. */ + public headerRows: google.cloud.documentai.v1beta1.Document.Page.Table.ITableRow[]; + + /** Table bodyRows. */ + public bodyRows: google.cloud.documentai.v1beta1.Document.Page.Table.ITableRow[]; + + /** Table detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new Table instance using the specified properties. + * @param [properties] Properties to set + * @returns Table instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.Page.ITable): google.cloud.documentai.v1beta1.Document.Page.Table; + + /** + * Encodes the specified Table message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Table.verify|verify} messages. + * @param message Table message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.Page.ITable, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Table message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Table.verify|verify} messages. + * @param message Table message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.Page.ITable, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Table message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Table + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.Page.Table; + + /** + * Decodes a Table message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Table + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.Page.Table; + + /** + * Verifies a Table message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Table message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Table + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.Page.Table; + + /** + * Creates a plain object from a Table message. Also converts values to other types if specified. + * @param message Table + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.Page.Table, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Table to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Table { + + /** Properties of a TableRow. */ + interface ITableRow { + + /** TableRow cells */ + cells?: (google.cloud.documentai.v1beta1.Document.Page.Table.ITableCell[]|null); + } + + /** Represents a TableRow. */ + class TableRow implements ITableRow { + + /** + * Constructs a new TableRow. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.Page.Table.ITableRow); + + /** TableRow cells. */ + public cells: google.cloud.documentai.v1beta1.Document.Page.Table.ITableCell[]; + + /** + * Creates a new TableRow instance using the specified properties. + * @param [properties] Properties to set + * @returns TableRow instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.Page.Table.ITableRow): google.cloud.documentai.v1beta1.Document.Page.Table.TableRow; + + /** + * Encodes the specified TableRow message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Table.TableRow.verify|verify} messages. + * @param message TableRow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.Page.Table.ITableRow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableRow message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Table.TableRow.verify|verify} messages. + * @param message TableRow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.Page.Table.ITableRow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableRow message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.Page.Table.TableRow; + + /** + * Decodes a TableRow message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.Page.Table.TableRow; + + /** + * Verifies a TableRow message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TableRow message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableRow + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.Page.Table.TableRow; + + /** + * Creates a plain object from a TableRow message. Also converts values to other types if specified. + * @param message TableRow + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.Page.Table.TableRow, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableRow to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TableCell. */ + interface ITableCell { + + /** TableCell layout */ + layout?: (google.cloud.documentai.v1beta1.Document.Page.ILayout|null); + + /** TableCell rowSpan */ + rowSpan?: (number|null); + + /** TableCell colSpan */ + colSpan?: (number|null); + + /** TableCell detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a TableCell. */ + class TableCell implements ITableCell { + + /** + * Constructs a new TableCell. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.Page.Table.ITableCell); + + /** TableCell layout. */ + public layout?: (google.cloud.documentai.v1beta1.Document.Page.ILayout|null); + + /** TableCell rowSpan. */ + public rowSpan: number; + + /** TableCell colSpan. */ + public colSpan: number; + + /** TableCell detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new TableCell instance using the specified properties. + * @param [properties] Properties to set + * @returns TableCell instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.Page.Table.ITableCell): google.cloud.documentai.v1beta1.Document.Page.Table.TableCell; + + /** + * Encodes the specified TableCell message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Table.TableCell.verify|verify} messages. + * @param message TableCell message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.Page.Table.ITableCell, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableCell message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Table.TableCell.verify|verify} messages. + * @param message TableCell message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.Page.Table.ITableCell, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableCell message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.Page.Table.TableCell; + + /** + * Decodes a TableCell message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.Page.Table.TableCell; + + /** + * Verifies a TableCell message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TableCell message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableCell + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.Page.Table.TableCell; + + /** + * Creates a plain object from a TableCell message. Also converts values to other types if specified. + * @param message TableCell + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.Page.Table.TableCell, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableCell to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a FormField. */ + interface IFormField { + + /** FormField fieldName */ + fieldName?: (google.cloud.documentai.v1beta1.Document.Page.ILayout|null); + + /** FormField fieldValue */ + fieldValue?: (google.cloud.documentai.v1beta1.Document.Page.ILayout|null); + + /** FormField nameDetectedLanguages */ + nameDetectedLanguages?: (google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage[]|null); + + /** FormField valueDetectedLanguages */ + valueDetectedLanguages?: (google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a FormField. */ + class FormField implements IFormField { + + /** + * Constructs a new FormField. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.Page.IFormField); + + /** FormField fieldName. */ + public fieldName?: (google.cloud.documentai.v1beta1.Document.Page.ILayout|null); + + /** FormField fieldValue. */ + public fieldValue?: (google.cloud.documentai.v1beta1.Document.Page.ILayout|null); + + /** FormField nameDetectedLanguages. */ + public nameDetectedLanguages: google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage[]; + + /** FormField valueDetectedLanguages. */ + public valueDetectedLanguages: google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new FormField instance using the specified properties. + * @param [properties] Properties to set + * @returns FormField instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.Page.IFormField): google.cloud.documentai.v1beta1.Document.Page.FormField; + + /** + * Encodes the specified FormField message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.FormField.verify|verify} messages. + * @param message FormField message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.Page.IFormField, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FormField message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.FormField.verify|verify} messages. + * @param message FormField message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.Page.IFormField, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FormField message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FormField + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.Page.FormField; + + /** + * Decodes a FormField message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FormField + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.Page.FormField; + + /** + * Verifies a FormField message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FormField message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FormField + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.Page.FormField; + + /** + * Creates a plain object from a FormField message. Also converts values to other types if specified. + * @param message FormField + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.Page.FormField, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FormField to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DetectedLanguage. */ + interface IDetectedLanguage { + + /** DetectedLanguage languageCode */ + languageCode?: (string|null); + + /** DetectedLanguage confidence */ + confidence?: (number|null); + } + + /** Represents a DetectedLanguage. */ + class DetectedLanguage implements IDetectedLanguage { + + /** + * Constructs a new DetectedLanguage. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage); + + /** DetectedLanguage languageCode. */ + public languageCode: string; + + /** DetectedLanguage confidence. */ + public confidence: number; + + /** + * Creates a new DetectedLanguage instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectedLanguage instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage): google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage; + + /** + * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.verify|verify} messages. + * @param message DetectedLanguage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.verify|verify} messages. + * @param message DetectedLanguage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectedLanguage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage; + + /** + * Decodes a DetectedLanguage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage; + + /** + * Verifies a DetectedLanguage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DetectedLanguage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectedLanguage + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage; + + /** + * Creates a plain object from a DetectedLanguage message. Also converts values to other types if specified. + * @param message DetectedLanguage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectedLanguage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an Entity. */ + interface IEntity { + + /** Entity textAnchor */ + textAnchor?: (google.cloud.documentai.v1beta1.Document.ITextAnchor|null); + + /** Entity type */ + type?: (string|null); + + /** Entity mentionText */ + mentionText?: (string|null); + + /** Entity mentionId */ + mentionId?: (string|null); + } + + /** Represents an Entity. */ + class Entity implements IEntity { + + /** + * Constructs a new Entity. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.IEntity); + + /** Entity textAnchor. */ + public textAnchor?: (google.cloud.documentai.v1beta1.Document.ITextAnchor|null); + + /** Entity type. */ + public type: string; + + /** Entity mentionText. */ + public mentionText: string; + + /** Entity mentionId. */ + public mentionId: string; + + /** + * Creates a new Entity instance using the specified properties. + * @param [properties] Properties to set + * @returns Entity instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.IEntity): google.cloud.documentai.v1beta1.Document.Entity; + + /** + * Encodes the specified Entity message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Entity.verify|verify} messages. + * @param message Entity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.IEntity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Entity message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Entity.verify|verify} messages. + * @param message Entity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.IEntity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Entity message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.Entity; + + /** + * Decodes an Entity message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.Entity; + + /** + * Verifies an Entity message. + * @param message Plain 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 Entity message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Entity + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.Entity; + + /** + * Creates a plain object from an Entity message. Also converts values to other types if specified. + * @param message Entity + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.Entity, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Entity to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EntityRelation. */ + interface IEntityRelation { + + /** EntityRelation subjectId */ + subjectId?: (string|null); + + /** EntityRelation objectId */ + objectId?: (string|null); + + /** EntityRelation relation */ + relation?: (string|null); + } + + /** Represents an EntityRelation. */ + class EntityRelation implements IEntityRelation { + + /** + * Constructs a new EntityRelation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.IEntityRelation); + + /** EntityRelation subjectId. */ + public subjectId: string; + + /** EntityRelation objectId. */ + public objectId: string; + + /** EntityRelation relation. */ + public relation: string; + + /** + * Creates a new EntityRelation instance using the specified properties. + * @param [properties] Properties to set + * @returns EntityRelation instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.IEntityRelation): google.cloud.documentai.v1beta1.Document.EntityRelation; + + /** + * Encodes the specified EntityRelation message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.EntityRelation.verify|verify} messages. + * @param message EntityRelation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.IEntityRelation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EntityRelation message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.EntityRelation.verify|verify} messages. + * @param message EntityRelation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.IEntityRelation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EntityRelation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EntityRelation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.EntityRelation; + + /** + * Decodes an EntityRelation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EntityRelation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.EntityRelation; + + /** + * Verifies an EntityRelation message. + * @param message Plain 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 EntityRelation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EntityRelation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.EntityRelation; + + /** + * Creates a plain object from an EntityRelation message. Also converts values to other types if specified. + * @param message EntityRelation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.EntityRelation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EntityRelation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TextAnchor. */ + interface ITextAnchor { + + /** TextAnchor textSegments */ + textSegments?: (google.cloud.documentai.v1beta1.Document.TextAnchor.ITextSegment[]|null); + } + + /** Represents a TextAnchor. */ + class TextAnchor implements ITextAnchor { + + /** + * Constructs a new TextAnchor. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.ITextAnchor); + + /** TextAnchor textSegments. */ + public textSegments: google.cloud.documentai.v1beta1.Document.TextAnchor.ITextSegment[]; + + /** + * Creates a new TextAnchor instance using the specified properties. + * @param [properties] Properties to set + * @returns TextAnchor instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.ITextAnchor): google.cloud.documentai.v1beta1.Document.TextAnchor; + + /** + * Encodes the specified TextAnchor message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.TextAnchor.verify|verify} messages. + * @param message TextAnchor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.ITextAnchor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TextAnchor message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.TextAnchor.verify|verify} messages. + * @param message TextAnchor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.ITextAnchor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TextAnchor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TextAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.TextAnchor; + + /** + * Decodes a TextAnchor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TextAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.TextAnchor; + + /** + * Verifies a TextAnchor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TextAnchor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TextAnchor + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.TextAnchor; + + /** + * Creates a plain object from a TextAnchor message. Also converts values to other types if specified. + * @param message TextAnchor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.TextAnchor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TextAnchor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace TextAnchor { + + /** Properties of a TextSegment. */ + interface ITextSegment { + + /** TextSegment startIndex */ + startIndex?: (number|Long|string|null); + + /** TextSegment endIndex */ + endIndex?: (number|Long|string|null); + } + + /** Represents a TextSegment. */ + class TextSegment implements ITextSegment { + + /** + * Constructs a new TextSegment. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.Document.TextAnchor.ITextSegment); + + /** TextSegment startIndex. */ + public startIndex: (number|Long|string); + + /** TextSegment endIndex. */ + public endIndex: (number|Long|string); + + /** + * Creates a new TextSegment instance using the specified properties. + * @param [properties] Properties to set + * @returns TextSegment instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.Document.TextAnchor.ITextSegment): google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment; + + /** + * Encodes the specified TextSegment message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment.verify|verify} messages. + * @param message TextSegment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.Document.TextAnchor.ITextSegment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TextSegment message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment.verify|verify} messages. + * @param message TextSegment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.Document.TextAnchor.ITextSegment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TextSegment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TextSegment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment; + + /** + * Decodes a TextSegment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TextSegment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment; + + /** + * Verifies a TextSegment message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TextSegment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TextSegment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment; + + /** + * Creates a plain object from a TextSegment message. Also converts values to other types if specified. + * @param message TextSegment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TextSegment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + } + + /** Properties of a Vertex. */ + interface IVertex { + + /** Vertex x */ + x?: (number|null); + + /** Vertex y */ + y?: (number|null); + } + + /** Represents a Vertex. */ + class Vertex implements IVertex { + + /** + * Constructs a new Vertex. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IVertex); + + /** Vertex x. */ + public x: number; + + /** Vertex y. */ + public y: number; + + /** + * Creates a new Vertex instance using the specified properties. + * @param [properties] Properties to set + * @returns Vertex instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IVertex): google.cloud.documentai.v1beta1.Vertex; + + /** + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.documentai.v1beta1.Vertex.verify|verify} messages. + * @param message Vertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Vertex.verify|verify} messages. + * @param message Vertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Vertex message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Vertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.Vertex; + + /** + * Decodes a Vertex message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Vertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.Vertex; + + /** + * Verifies a Vertex message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Vertex message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Vertex + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.Vertex; + + /** + * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * @param message Vertex + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.Vertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Vertex to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a NormalizedVertex. */ + interface INormalizedVertex { + + /** NormalizedVertex x */ + x?: (number|null); + + /** NormalizedVertex y */ + y?: (number|null); + } + + /** Represents a NormalizedVertex. */ + class NormalizedVertex implements INormalizedVertex { + + /** + * Constructs a new NormalizedVertex. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.INormalizedVertex); + + /** NormalizedVertex x. */ + public x: number; + + /** NormalizedVertex y. */ + public y: number; + + /** + * Creates a new NormalizedVertex instance using the specified properties. + * @param [properties] Properties to set + * @returns NormalizedVertex instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.INormalizedVertex): google.cloud.documentai.v1beta1.NormalizedVertex; + + /** + * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.documentai.v1beta1.NormalizedVertex.verify|verify} messages. + * @param message NormalizedVertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.NormalizedVertex.verify|verify} messages. + * @param message NormalizedVertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NormalizedVertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.NormalizedVertex; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NormalizedVertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.NormalizedVertex; + + /** + * Verifies a NormalizedVertex message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NormalizedVertex + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.NormalizedVertex; + + /** + * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. + * @param message NormalizedVertex + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.NormalizedVertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NormalizedVertex to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BoundingPoly. */ + interface IBoundingPoly { + + /** BoundingPoly vertices */ + vertices?: (google.cloud.documentai.v1beta1.IVertex[]|null); + + /** BoundingPoly normalizedVertices */ + normalizedVertices?: (google.cloud.documentai.v1beta1.INormalizedVertex[]|null); + } + + /** Represents a BoundingPoly. */ + class BoundingPoly implements IBoundingPoly { + + /** + * Constructs a new BoundingPoly. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IBoundingPoly); + + /** BoundingPoly vertices. */ + public vertices: google.cloud.documentai.v1beta1.IVertex[]; + + /** BoundingPoly normalizedVertices. */ + public normalizedVertices: google.cloud.documentai.v1beta1.INormalizedVertex[]; + + /** + * Creates a new BoundingPoly instance using the specified properties. + * @param [properties] Properties to set + * @returns BoundingPoly instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IBoundingPoly): google.cloud.documentai.v1beta1.BoundingPoly; + + /** + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.documentai.v1beta1.BoundingPoly.verify|verify} messages. + * @param message BoundingPoly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.BoundingPoly.verify|verify} messages. + * @param message BoundingPoly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoundingPoly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.BoundingPoly; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoundingPoly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.BoundingPoly; + + /** + * Verifies a BoundingPoly message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoundingPoly + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.BoundingPoly; + + /** + * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. + * @param message BoundingPoly + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.BoundingPoly, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoundingPoly to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a DocumentUnderstandingService */ + class DocumentUnderstandingService extends $protobuf.rpc.Service { + + /** + * Constructs a new DocumentUnderstandingService 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 DocumentUnderstandingService 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): DocumentUnderstandingService; + + /** + * Calls BatchProcessDocuments. + * @param request BatchProcessDocumentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchProcessDocuments(request: google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest, callback: google.cloud.documentai.v1beta1.DocumentUnderstandingService.BatchProcessDocumentsCallback): void; + + /** + * Calls BatchProcessDocuments. + * @param request BatchProcessDocumentsRequest message or plain object + * @returns Promise + */ + public batchProcessDocuments(request: google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest): Promise; + } + + namespace DocumentUnderstandingService { + + /** + * Callback as used by {@link google.cloud.documentai.v1beta1.DocumentUnderstandingService#batchProcessDocuments}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchProcessDocumentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a BatchProcessDocumentsRequest. */ + interface IBatchProcessDocumentsRequest { + + /** BatchProcessDocumentsRequest requests */ + requests?: (google.cloud.documentai.v1beta1.IProcessDocumentRequest[]|null); + + /** BatchProcessDocumentsRequest parent */ + parent?: (string|null); + } + + /** Represents a BatchProcessDocumentsRequest. */ + class BatchProcessDocumentsRequest implements IBatchProcessDocumentsRequest { + + /** + * Constructs a new BatchProcessDocumentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest); + + /** BatchProcessDocumentsRequest requests. */ + public requests: google.cloud.documentai.v1beta1.IProcessDocumentRequest[]; + + /** BatchProcessDocumentsRequest parent. */ + public parent: string; + + /** + * Creates a new BatchProcessDocumentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchProcessDocumentsRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest): google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest; + + /** + * Encodes the specified BatchProcessDocumentsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.verify|verify} messages. + * @param message BatchProcessDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchProcessDocumentsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.verify|verify} messages. + * @param message BatchProcessDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchProcessDocumentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchProcessDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest; + + /** + * Decodes a BatchProcessDocumentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchProcessDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest; + + /** + * Verifies a BatchProcessDocumentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchProcessDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchProcessDocumentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest; + + /** + * Creates a plain object from a BatchProcessDocumentsRequest message. Also converts values to other types if specified. + * @param message BatchProcessDocumentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchProcessDocumentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProcessDocumentRequest. */ + interface IProcessDocumentRequest { + + /** ProcessDocumentRequest inputConfig */ + inputConfig?: (google.cloud.documentai.v1beta1.IInputConfig|null); + + /** ProcessDocumentRequest outputConfig */ + outputConfig?: (google.cloud.documentai.v1beta1.IOutputConfig|null); + + /** ProcessDocumentRequest documentType */ + documentType?: (string|null); + + /** ProcessDocumentRequest tableExtractionParams */ + tableExtractionParams?: (google.cloud.documentai.v1beta1.ITableExtractionParams|null); + + /** ProcessDocumentRequest formExtractionParams */ + formExtractionParams?: (google.cloud.documentai.v1beta1.IFormExtractionParams|null); + + /** ProcessDocumentRequest entityExtractionParams */ + entityExtractionParams?: (google.cloud.documentai.v1beta1.IEntityExtractionParams|null); + + /** ProcessDocumentRequest ocrParams */ + ocrParams?: (google.cloud.documentai.v1beta1.IOcrParams|null); + } + + /** Represents a ProcessDocumentRequest. */ + class ProcessDocumentRequest implements IProcessDocumentRequest { + + /** + * Constructs a new ProcessDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IProcessDocumentRequest); + + /** ProcessDocumentRequest inputConfig. */ + public inputConfig?: (google.cloud.documentai.v1beta1.IInputConfig|null); + + /** ProcessDocumentRequest outputConfig. */ + public outputConfig?: (google.cloud.documentai.v1beta1.IOutputConfig|null); + + /** ProcessDocumentRequest documentType. */ + public documentType: string; + + /** ProcessDocumentRequest tableExtractionParams. */ + public tableExtractionParams?: (google.cloud.documentai.v1beta1.ITableExtractionParams|null); + + /** ProcessDocumentRequest formExtractionParams. */ + public formExtractionParams?: (google.cloud.documentai.v1beta1.IFormExtractionParams|null); + + /** ProcessDocumentRequest entityExtractionParams. */ + public entityExtractionParams?: (google.cloud.documentai.v1beta1.IEntityExtractionParams|null); + + /** ProcessDocumentRequest ocrParams. */ + public ocrParams?: (google.cloud.documentai.v1beta1.IOcrParams|null); + + /** + * Creates a new ProcessDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ProcessDocumentRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IProcessDocumentRequest): google.cloud.documentai.v1beta1.ProcessDocumentRequest; + + /** + * Encodes the specified ProcessDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentRequest.verify|verify} messages. + * @param message ProcessDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IProcessDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProcessDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentRequest.verify|verify} messages. + * @param message ProcessDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IProcessDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProcessDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProcessDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.ProcessDocumentRequest; + + /** + * Decodes a ProcessDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProcessDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.ProcessDocumentRequest; + + /** + * Verifies a ProcessDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProcessDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProcessDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.ProcessDocumentRequest; + + /** + * Creates a plain object from a ProcessDocumentRequest message. Also converts values to other types if specified. + * @param message ProcessDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.ProcessDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProcessDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BatchProcessDocumentsResponse. */ + interface IBatchProcessDocumentsResponse { + + /** BatchProcessDocumentsResponse responses */ + responses?: (google.cloud.documentai.v1beta1.IProcessDocumentResponse[]|null); + } + + /** Represents a BatchProcessDocumentsResponse. */ + class BatchProcessDocumentsResponse implements IBatchProcessDocumentsResponse { + + /** + * Constructs a new BatchProcessDocumentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse); + + /** BatchProcessDocumentsResponse responses. */ + public responses: google.cloud.documentai.v1beta1.IProcessDocumentResponse[]; + + /** + * Creates a new BatchProcessDocumentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchProcessDocumentsResponse instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse): google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse; + + /** + * Encodes the specified BatchProcessDocumentsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.verify|verify} messages. + * @param message BatchProcessDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchProcessDocumentsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.verify|verify} messages. + * @param message BatchProcessDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchProcessDocumentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchProcessDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse; + + /** + * Decodes a BatchProcessDocumentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchProcessDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse; + + /** + * Verifies a BatchProcessDocumentsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchProcessDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchProcessDocumentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse; + + /** + * Creates a plain object from a BatchProcessDocumentsResponse message. Also converts values to other types if specified. + * @param message BatchProcessDocumentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchProcessDocumentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProcessDocumentResponse. */ + interface IProcessDocumentResponse { + + /** ProcessDocumentResponse inputConfig */ + inputConfig?: (google.cloud.documentai.v1beta1.IInputConfig|null); + + /** ProcessDocumentResponse outputConfig */ + outputConfig?: (google.cloud.documentai.v1beta1.IOutputConfig|null); + } + + /** Represents a ProcessDocumentResponse. */ + class ProcessDocumentResponse implements IProcessDocumentResponse { + + /** + * Constructs a new ProcessDocumentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IProcessDocumentResponse); + + /** ProcessDocumentResponse inputConfig. */ + public inputConfig?: (google.cloud.documentai.v1beta1.IInputConfig|null); + + /** ProcessDocumentResponse outputConfig. */ + public outputConfig?: (google.cloud.documentai.v1beta1.IOutputConfig|null); + + /** + * Creates a new ProcessDocumentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ProcessDocumentResponse instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IProcessDocumentResponse): google.cloud.documentai.v1beta1.ProcessDocumentResponse; + + /** + * Encodes the specified ProcessDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentResponse.verify|verify} messages. + * @param message ProcessDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IProcessDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProcessDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentResponse.verify|verify} messages. + * @param message ProcessDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IProcessDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProcessDocumentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProcessDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.ProcessDocumentResponse; + + /** + * Decodes a ProcessDocumentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProcessDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.ProcessDocumentResponse; + + /** + * Verifies a ProcessDocumentResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProcessDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProcessDocumentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.ProcessDocumentResponse; + + /** + * Creates a plain object from a ProcessDocumentResponse message. Also converts values to other types if specified. + * @param message ProcessDocumentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.ProcessDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProcessDocumentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an OcrParams. */ + interface IOcrParams { + + /** OcrParams languageHints */ + languageHints?: (string[]|null); + } + + /** Represents an OcrParams. */ + class OcrParams implements IOcrParams { + + /** + * Constructs a new OcrParams. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IOcrParams); + + /** OcrParams languageHints. */ + public languageHints: string[]; + + /** + * Creates a new OcrParams instance using the specified properties. + * @param [properties] Properties to set + * @returns OcrParams instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IOcrParams): google.cloud.documentai.v1beta1.OcrParams; + + /** + * Encodes the specified OcrParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.OcrParams.verify|verify} messages. + * @param message OcrParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IOcrParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OcrParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.OcrParams.verify|verify} messages. + * @param message OcrParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IOcrParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OcrParams message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OcrParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.OcrParams; + + /** + * Decodes an OcrParams message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OcrParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.OcrParams; + + /** + * Verifies an OcrParams message. + * @param message Plain 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 OcrParams message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OcrParams + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.OcrParams; + + /** + * Creates a plain object from an OcrParams message. Also converts values to other types if specified. + * @param message OcrParams + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.OcrParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OcrParams to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TableExtractionParams. */ + interface ITableExtractionParams { + + /** TableExtractionParams enabled */ + enabled?: (boolean|null); + + /** TableExtractionParams tableBoundHints */ + tableBoundHints?: (google.cloud.documentai.v1beta1.ITableBoundHint[]|null); + + /** TableExtractionParams headerHints */ + headerHints?: (string[]|null); + + /** TableExtractionParams modelVersion */ + modelVersion?: (string|null); + } + + /** Represents a TableExtractionParams. */ + class TableExtractionParams implements ITableExtractionParams { + + /** + * Constructs a new TableExtractionParams. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.ITableExtractionParams); + + /** TableExtractionParams enabled. */ + public enabled: boolean; + + /** TableExtractionParams tableBoundHints. */ + public tableBoundHints: google.cloud.documentai.v1beta1.ITableBoundHint[]; + + /** TableExtractionParams headerHints. */ + public headerHints: string[]; + + /** TableExtractionParams modelVersion. */ + public modelVersion: string; + + /** + * Creates a new TableExtractionParams instance using the specified properties. + * @param [properties] Properties to set + * @returns TableExtractionParams instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.ITableExtractionParams): google.cloud.documentai.v1beta1.TableExtractionParams; + + /** + * Encodes the specified TableExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.TableExtractionParams.verify|verify} messages. + * @param message TableExtractionParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.ITableExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.TableExtractionParams.verify|verify} messages. + * @param message TableExtractionParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.ITableExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableExtractionParams message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.TableExtractionParams; + + /** + * Decodes a TableExtractionParams message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.TableExtractionParams; + + /** + * Verifies a TableExtractionParams message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TableExtractionParams message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableExtractionParams + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.TableExtractionParams; + + /** + * Creates a plain object from a TableExtractionParams message. Also converts values to other types if specified. + * @param message TableExtractionParams + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.TableExtractionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableExtractionParams to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TableBoundHint. */ + interface ITableBoundHint { + + /** TableBoundHint pageNumber */ + pageNumber?: (number|null); + + /** TableBoundHint boundingBox */ + boundingBox?: (google.cloud.documentai.v1beta1.IBoundingPoly|null); + } + + /** Represents a TableBoundHint. */ + class TableBoundHint implements ITableBoundHint { + + /** + * Constructs a new TableBoundHint. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.ITableBoundHint); + + /** TableBoundHint pageNumber. */ + public pageNumber: number; + + /** TableBoundHint boundingBox. */ + public boundingBox?: (google.cloud.documentai.v1beta1.IBoundingPoly|null); + + /** + * Creates a new TableBoundHint instance using the specified properties. + * @param [properties] Properties to set + * @returns TableBoundHint instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.ITableBoundHint): google.cloud.documentai.v1beta1.TableBoundHint; + + /** + * Encodes the specified TableBoundHint message. Does not implicitly {@link google.cloud.documentai.v1beta1.TableBoundHint.verify|verify} messages. + * @param message TableBoundHint message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.ITableBoundHint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableBoundHint message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.TableBoundHint.verify|verify} messages. + * @param message TableBoundHint message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.ITableBoundHint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableBoundHint message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableBoundHint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.TableBoundHint; + + /** + * Decodes a TableBoundHint message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableBoundHint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.TableBoundHint; + + /** + * Verifies a TableBoundHint message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TableBoundHint message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableBoundHint + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.TableBoundHint; + + /** + * Creates a plain object from a TableBoundHint message. Also converts values to other types if specified. + * @param message TableBoundHint + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.TableBoundHint, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableBoundHint to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FormExtractionParams. */ + interface IFormExtractionParams { + + /** FormExtractionParams enabled */ + enabled?: (boolean|null); + + /** FormExtractionParams keyValuePairHints */ + keyValuePairHints?: (google.cloud.documentai.v1beta1.IKeyValuePairHint[]|null); + + /** FormExtractionParams modelVersion */ + modelVersion?: (string|null); + } + + /** Represents a FormExtractionParams. */ + class FormExtractionParams implements IFormExtractionParams { + + /** + * Constructs a new FormExtractionParams. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IFormExtractionParams); + + /** FormExtractionParams enabled. */ + public enabled: boolean; + + /** FormExtractionParams keyValuePairHints. */ + public keyValuePairHints: google.cloud.documentai.v1beta1.IKeyValuePairHint[]; + + /** FormExtractionParams modelVersion. */ + public modelVersion: string; + + /** + * Creates a new FormExtractionParams instance using the specified properties. + * @param [properties] Properties to set + * @returns FormExtractionParams instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IFormExtractionParams): google.cloud.documentai.v1beta1.FormExtractionParams; + + /** + * Encodes the specified FormExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.FormExtractionParams.verify|verify} messages. + * @param message FormExtractionParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IFormExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FormExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.FormExtractionParams.verify|verify} messages. + * @param message FormExtractionParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IFormExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FormExtractionParams message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FormExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.FormExtractionParams; + + /** + * Decodes a FormExtractionParams message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FormExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.FormExtractionParams; + + /** + * Verifies a FormExtractionParams message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FormExtractionParams message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FormExtractionParams + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.FormExtractionParams; + + /** + * Creates a plain object from a FormExtractionParams message. Also converts values to other types if specified. + * @param message FormExtractionParams + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.FormExtractionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FormExtractionParams to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a KeyValuePairHint. */ + interface IKeyValuePairHint { + + /** KeyValuePairHint key */ + key?: (string|null); + + /** KeyValuePairHint valueTypes */ + valueTypes?: (string[]|null); + } + + /** Represents a KeyValuePairHint. */ + class KeyValuePairHint implements IKeyValuePairHint { + + /** + * Constructs a new KeyValuePairHint. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IKeyValuePairHint); + + /** KeyValuePairHint key. */ + public key: string; + + /** KeyValuePairHint valueTypes. */ + public valueTypes: string[]; + + /** + * Creates a new KeyValuePairHint instance using the specified properties. + * @param [properties] Properties to set + * @returns KeyValuePairHint instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IKeyValuePairHint): google.cloud.documentai.v1beta1.KeyValuePairHint; + + /** + * Encodes the specified KeyValuePairHint message. Does not implicitly {@link google.cloud.documentai.v1beta1.KeyValuePairHint.verify|verify} messages. + * @param message KeyValuePairHint message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IKeyValuePairHint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified KeyValuePairHint message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.KeyValuePairHint.verify|verify} messages. + * @param message KeyValuePairHint message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IKeyValuePairHint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a KeyValuePairHint message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns KeyValuePairHint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.KeyValuePairHint; + + /** + * Decodes a KeyValuePairHint message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns KeyValuePairHint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.KeyValuePairHint; + + /** + * Verifies a KeyValuePairHint message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a KeyValuePairHint message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns KeyValuePairHint + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.KeyValuePairHint; + + /** + * Creates a plain object from a KeyValuePairHint message. Also converts values to other types if specified. + * @param message KeyValuePairHint + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.KeyValuePairHint, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this KeyValuePairHint to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EntityExtractionParams. */ + interface IEntityExtractionParams { + + /** EntityExtractionParams enabled */ + enabled?: (boolean|null); + + /** EntityExtractionParams modelVersion */ + modelVersion?: (string|null); + } + + /** Represents an EntityExtractionParams. */ + class EntityExtractionParams implements IEntityExtractionParams { + + /** + * Constructs a new EntityExtractionParams. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IEntityExtractionParams); + + /** EntityExtractionParams enabled. */ + public enabled: boolean; + + /** EntityExtractionParams modelVersion. */ + public modelVersion: string; + + /** + * Creates a new EntityExtractionParams instance using the specified properties. + * @param [properties] Properties to set + * @returns EntityExtractionParams instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IEntityExtractionParams): google.cloud.documentai.v1beta1.EntityExtractionParams; + + /** + * Encodes the specified EntityExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.EntityExtractionParams.verify|verify} messages. + * @param message EntityExtractionParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IEntityExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EntityExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.EntityExtractionParams.verify|verify} messages. + * @param message EntityExtractionParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IEntityExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EntityExtractionParams message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EntityExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.EntityExtractionParams; + + /** + * Decodes an EntityExtractionParams message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EntityExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.EntityExtractionParams; + + /** + * Verifies an EntityExtractionParams message. + * @param message Plain 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 EntityExtractionParams message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EntityExtractionParams + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.EntityExtractionParams; + + /** + * Creates a plain object from an EntityExtractionParams message. Also converts values to other types if specified. + * @param message EntityExtractionParams + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.EntityExtractionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EntityExtractionParams to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an InputConfig. */ + interface IInputConfig { + + /** InputConfig gcsSource */ + gcsSource?: (google.cloud.documentai.v1beta1.IGcsSource|null); + + /** InputConfig mimeType */ + mimeType?: (string|null); + } + + /** Represents an InputConfig. */ + class InputConfig implements IInputConfig { + + /** + * Constructs a new InputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IInputConfig); + + /** InputConfig gcsSource. */ + public gcsSource?: (google.cloud.documentai.v1beta1.IGcsSource|null); + + /** InputConfig mimeType. */ + public mimeType: string; + + /** InputConfig source. */ + public source?: "gcsSource"; + + /** + * Creates a new InputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns InputConfig instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IInputConfig): google.cloud.documentai.v1beta1.InputConfig; + + /** + * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta1.InputConfig.verify|verify} messages. + * @param message InputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.InputConfig.verify|verify} messages. + * @param message InputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.InputConfig; + + /** + * Decodes an InputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.InputConfig; + + /** + * Verifies an InputConfig message. + * @param message Plain 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 InputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.InputConfig; + + /** + * Creates a plain object from an InputConfig message. Also converts values to other types if specified. + * @param message InputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.InputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an OutputConfig. */ + interface IOutputConfig { + + /** OutputConfig gcsDestination */ + gcsDestination?: (google.cloud.documentai.v1beta1.IGcsDestination|null); + + /** OutputConfig pagesPerShard */ + pagesPerShard?: (number|null); + } + + /** Represents an OutputConfig. */ + class OutputConfig implements IOutputConfig { + + /** + * Constructs a new OutputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IOutputConfig); + + /** OutputConfig gcsDestination. */ + public gcsDestination?: (google.cloud.documentai.v1beta1.IGcsDestination|null); + + /** OutputConfig pagesPerShard. */ + public pagesPerShard: number; + + /** OutputConfig destination. */ + public destination?: "gcsDestination"; + + /** + * Creates a new OutputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns OutputConfig instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IOutputConfig): google.cloud.documentai.v1beta1.OutputConfig; + + /** + * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta1.OutputConfig.verify|verify} messages. + * @param message OutputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.OutputConfig.verify|verify} messages. + * @param message OutputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OutputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.OutputConfig; + + /** + * Decodes an OutputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.OutputConfig; + + /** + * Verifies an OutputConfig message. + * @param message Plain 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 OutputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OutputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.OutputConfig; + + /** + * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. + * @param message OutputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.OutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OutputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GcsSource. */ + interface IGcsSource { + + /** GcsSource uri */ + uri?: (string|null); + } + + /** Represents a GcsSource. */ + class GcsSource implements IGcsSource { + + /** + * Constructs a new GcsSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IGcsSource); + + /** GcsSource uri. */ + public uri: string; + + /** + * Creates a new GcsSource instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsSource instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IGcsSource): google.cloud.documentai.v1beta1.GcsSource; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.documentai.v1beta1.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.documentai.v1beta1.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.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.documentai.v1beta1.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.documentai.v1beta1.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.documentai.v1beta1.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.documentai.v1beta1.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.documentai.v1beta1.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GcsDestination. */ + interface IGcsDestination { + + /** GcsDestination uri */ + uri?: (string|null); + } + + /** Represents a GcsDestination. */ + class GcsDestination implements IGcsDestination { + + /** + * Constructs a new GcsDestination. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IGcsDestination); + + /** GcsDestination uri. */ + public uri: string; + + /** + * Creates a new GcsDestination instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsDestination instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IGcsDestination): google.cloud.documentai.v1beta1.GcsDestination; + + /** + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.documentai.v1beta1.GcsDestination.verify|verify} messages. + * @param message GcsDestination message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.GcsDestination.verify|verify} messages. + * @param message GcsDestination message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsDestination message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.GcsDestination; + + /** + * Decodes a GcsDestination message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.GcsDestination; + + /** + * Verifies a GcsDestination message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GcsDestination message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsDestination + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.GcsDestination; + + /** + * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. + * @param message GcsDestination + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.GcsDestination, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsDestination to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an OperationMetadata. */ + interface IOperationMetadata { + + /** OperationMetadata state */ + state?: (google.cloud.documentai.v1beta1.OperationMetadata.State|keyof typeof google.cloud.documentai.v1beta1.OperationMetadata.State|null); + + /** OperationMetadata stateMessage */ + stateMessage?: (string|null); + + /** OperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents an OperationMetadata. */ + class OperationMetadata implements IOperationMetadata { + + /** + * Constructs a new OperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta1.IOperationMetadata); + + /** OperationMetadata state. */ + public state: (google.cloud.documentai.v1beta1.OperationMetadata.State|keyof typeof google.cloud.documentai.v1beta1.OperationMetadata.State); + + /** OperationMetadata stateMessage. */ + public stateMessage: string; + + /** OperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1beta1.IOperationMetadata): google.cloud.documentai.v1beta1.OperationMetadata; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta1.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta1.OperationMetadata; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta1.OperationMetadata; + + /** + * Verifies an OperationMetadata message. + * @param message Plain 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 OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta1.OperationMetadata; + + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @param message OperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta1.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace OperationMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + ACCEPTED = 1, + WAITING = 2, + RUNNING = 3, + SUCCEEDED = 4, + CANCELLED = 5, + FAILED = 6 + } + } + } + /** Namespace v1beta2. */ namespace v1beta2 { @@ -14449,6 +24389,102 @@ 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 an Any. */ interface IAny { @@ -15535,102 +25571,6 @@ 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 FieldMask. */ interface IFieldMask { diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 50d1d3d4b94..8adb0eb6329 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -57,6 +57,25104 @@ */ var documentai = {}; + documentai.v1 = (function() { + + /** + * Namespace v1. + * @memberof google.cloud.documentai + * @namespace + */ + var v1 = {}; + + v1.Document = (function() { + + /** + * Properties of a Document. + * @memberof google.cloud.documentai.v1 + * @interface IDocument + * @property {string|null} [uri] Document uri + * @property {Uint8Array|null} [content] Document content + * @property {string|null} [mimeType] Document mimeType + * @property {string|null} [text] Document text + * @property {Array.|null} [textStyles] Document textStyles + * @property {Array.|null} [pages] Document pages + * @property {Array.|null} [entities] Document entities + * @property {Array.|null} [entityRelations] Document entityRelations + * @property {Array.|null} [textChanges] Document textChanges + * @property {google.cloud.documentai.v1.Document.IShardInfo|null} [shardInfo] Document shardInfo + * @property {google.rpc.IStatus|null} [error] Document error + * @property {Array.|null} [revisions] Document revisions + */ + + /** + * Constructs a new Document. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a Document. + * @implements IDocument + * @constructor + * @param {google.cloud.documentai.v1.IDocument=} [properties] Properties to set + */ + function Document(properties) { + this.textStyles = []; + this.pages = []; + this.entities = []; + this.entityRelations = []; + this.textChanges = []; + this.revisions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Document uri. + * @member {string} uri + * @memberof google.cloud.documentai.v1.Document + * @instance + */ + Document.prototype.uri = ""; + + /** + * Document content. + * @member {Uint8Array} content + * @memberof google.cloud.documentai.v1.Document + * @instance + */ + Document.prototype.content = $util.newBuffer([]); + + /** + * Document mimeType. + * @member {string} mimeType + * @memberof google.cloud.documentai.v1.Document + * @instance + */ + Document.prototype.mimeType = ""; + + /** + * Document text. + * @member {string} text + * @memberof google.cloud.documentai.v1.Document + * @instance + */ + Document.prototype.text = ""; + + /** + * Document textStyles. + * @member {Array.} textStyles + * @memberof google.cloud.documentai.v1.Document + * @instance + */ + Document.prototype.textStyles = $util.emptyArray; + + /** + * Document pages. + * @member {Array.} pages + * @memberof google.cloud.documentai.v1.Document + * @instance + */ + Document.prototype.pages = $util.emptyArray; + + /** + * Document entities. + * @member {Array.} entities + * @memberof google.cloud.documentai.v1.Document + * @instance + */ + Document.prototype.entities = $util.emptyArray; + + /** + * Document entityRelations. + * @member {Array.} entityRelations + * @memberof google.cloud.documentai.v1.Document + * @instance + */ + Document.prototype.entityRelations = $util.emptyArray; + + /** + * Document textChanges. + * @member {Array.} textChanges + * @memberof google.cloud.documentai.v1.Document + * @instance + */ + Document.prototype.textChanges = $util.emptyArray; + + /** + * Document shardInfo. + * @member {google.cloud.documentai.v1.Document.IShardInfo|null|undefined} shardInfo + * @memberof google.cloud.documentai.v1.Document + * @instance + */ + Document.prototype.shardInfo = null; + + /** + * Document error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.cloud.documentai.v1.Document + * @instance + */ + Document.prototype.error = null; + + /** + * Document revisions. + * @member {Array.} revisions + * @memberof google.cloud.documentai.v1.Document + * @instance + */ + Document.prototype.revisions = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Document source. + * @member {"uri"|"content"|undefined} source + * @memberof google.cloud.documentai.v1.Document + * @instance + */ + Object.defineProperty(Document.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["uri", "content"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Document instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document + * @static + * @param {google.cloud.documentai.v1.IDocument=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document} Document instance + */ + Document.create = function create(properties) { + return new Document(properties); + }; + + /** + * Encodes the specified Document message. Does not implicitly {@link google.cloud.documentai.v1.Document.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document + * @static + * @param {google.cloud.documentai.v1.IDocument} message Document message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Document.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.content != null && Object.hasOwnProperty.call(message, "content")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.content); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.mimeType); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.text); + if (message.textStyles != null && message.textStyles.length) + for (var i = 0; i < message.textStyles.length; ++i) + $root.google.cloud.documentai.v1.Document.Style.encode(message.textStyles[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.pages != null && message.pages.length) + for (var i = 0; i < message.pages.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.encode(message.pages[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.entities != null && message.entities.length) + for (var i = 0; i < message.entities.length; ++i) + $root.google.cloud.documentai.v1.Document.Entity.encode(message.entities[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.entityRelations != null && message.entityRelations.length) + for (var i = 0; i < message.entityRelations.length; ++i) + $root.google.cloud.documentai.v1.Document.EntityRelation.encode(message.entityRelations[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.shardInfo != null && Object.hasOwnProperty.call(message, "shardInfo")) + $root.google.cloud.documentai.v1.Document.ShardInfo.encode(message.shardInfo, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.revisions != null && message.revisions.length) + for (var i = 0; i < message.revisions.length; ++i) + $root.google.cloud.documentai.v1.Document.Revision.encode(message.revisions[i], writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.textChanges != null && message.textChanges.length) + for (var i = 0; i < message.textChanges.length; ++i) + $root.google.cloud.documentai.v1.Document.TextChange.encode(message.textChanges[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Document message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document + * @static + * @param {google.cloud.documentai.v1.IDocument} message Document message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Document.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Document message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document} Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Document.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uri = reader.string(); + break; + case 2: + message.content = reader.bytes(); + break; + case 3: + message.mimeType = reader.string(); + break; + case 4: + message.text = reader.string(); + break; + case 5: + if (!(message.textStyles && message.textStyles.length)) + message.textStyles = []; + message.textStyles.push($root.google.cloud.documentai.v1.Document.Style.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.pages && message.pages.length)) + message.pages = []; + message.pages.push($root.google.cloud.documentai.v1.Document.Page.decode(reader, reader.uint32())); + break; + case 7: + if (!(message.entities && message.entities.length)) + message.entities = []; + message.entities.push($root.google.cloud.documentai.v1.Document.Entity.decode(reader, reader.uint32())); + break; + case 8: + if (!(message.entityRelations && message.entityRelations.length)) + message.entityRelations = []; + message.entityRelations.push($root.google.cloud.documentai.v1.Document.EntityRelation.decode(reader, reader.uint32())); + break; + case 14: + if (!(message.textChanges && message.textChanges.length)) + message.textChanges = []; + message.textChanges.push($root.google.cloud.documentai.v1.Document.TextChange.decode(reader, reader.uint32())); + break; + case 9: + message.shardInfo = $root.google.cloud.documentai.v1.Document.ShardInfo.decode(reader, reader.uint32()); + break; + case 10: + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + case 13: + if (!(message.revisions && message.revisions.length)) + message.revisions = []; + message.revisions.push($root.google.cloud.documentai.v1.Document.Revision.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Document message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document} Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Document.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Document message. + * @function verify + * @memberof google.cloud.documentai.v1.Document + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Document.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.uri != null && message.hasOwnProperty("uri")) { + properties.source = 1; + if (!$util.isString(message.uri)) + return "uri: string expected"; + } + if (message.content != null && message.hasOwnProperty("content")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) + return "content: buffer expected"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.textStyles != null && message.hasOwnProperty("textStyles")) { + if (!Array.isArray(message.textStyles)) + return "textStyles: array expected"; + for (var i = 0; i < message.textStyles.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Style.verify(message.textStyles[i]); + if (error) + return "textStyles." + error; + } + } + if (message.pages != null && message.hasOwnProperty("pages")) { + if (!Array.isArray(message.pages)) + return "pages: array expected"; + for (var i = 0; i < message.pages.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.verify(message.pages[i]); + if (error) + return "pages." + error; + } + } + if (message.entities != null && message.hasOwnProperty("entities")) { + if (!Array.isArray(message.entities)) + return "entities: array expected"; + for (var i = 0; i < message.entities.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Entity.verify(message.entities[i]); + if (error) + return "entities." + error; + } + } + if (message.entityRelations != null && message.hasOwnProperty("entityRelations")) { + if (!Array.isArray(message.entityRelations)) + return "entityRelations: array expected"; + for (var i = 0; i < message.entityRelations.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.EntityRelation.verify(message.entityRelations[i]); + if (error) + return "entityRelations." + error; + } + } + if (message.textChanges != null && message.hasOwnProperty("textChanges")) { + if (!Array.isArray(message.textChanges)) + return "textChanges: array expected"; + for (var i = 0; i < message.textChanges.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.TextChange.verify(message.textChanges[i]); + if (error) + return "textChanges." + error; + } + } + if (message.shardInfo != null && message.hasOwnProperty("shardInfo")) { + var error = $root.google.cloud.documentai.v1.Document.ShardInfo.verify(message.shardInfo); + if (error) + return "shardInfo." + error; + } + if (message.error != null && message.hasOwnProperty("error")) { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; + } + if (message.revisions != null && message.hasOwnProperty("revisions")) { + if (!Array.isArray(message.revisions)) + return "revisions: array expected"; + for (var i = 0; i < message.revisions.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Revision.verify(message.revisions[i]); + if (error) + return "revisions." + error; + } + } + return null; + }; + + /** + * Creates a Document message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document} Document + */ + Document.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document) + return object; + var message = new $root.google.cloud.documentai.v1.Document(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.content != null) + if (typeof object.content === "string") + $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); + else if (object.content.length) + message.content = object.content; + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + if (object.text != null) + message.text = String(object.text); + if (object.textStyles) { + if (!Array.isArray(object.textStyles)) + throw TypeError(".google.cloud.documentai.v1.Document.textStyles: array expected"); + message.textStyles = []; + for (var i = 0; i < object.textStyles.length; ++i) { + if (typeof object.textStyles[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.textStyles: object expected"); + message.textStyles[i] = $root.google.cloud.documentai.v1.Document.Style.fromObject(object.textStyles[i]); + } + } + if (object.pages) { + if (!Array.isArray(object.pages)) + throw TypeError(".google.cloud.documentai.v1.Document.pages: array expected"); + message.pages = []; + for (var i = 0; i < object.pages.length; ++i) { + if (typeof object.pages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.pages: object expected"); + message.pages[i] = $root.google.cloud.documentai.v1.Document.Page.fromObject(object.pages[i]); + } + } + if (object.entities) { + if (!Array.isArray(object.entities)) + throw TypeError(".google.cloud.documentai.v1.Document.entities: array expected"); + message.entities = []; + for (var i = 0; i < object.entities.length; ++i) { + if (typeof object.entities[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.entities: object expected"); + message.entities[i] = $root.google.cloud.documentai.v1.Document.Entity.fromObject(object.entities[i]); + } + } + if (object.entityRelations) { + if (!Array.isArray(object.entityRelations)) + throw TypeError(".google.cloud.documentai.v1.Document.entityRelations: array expected"); + message.entityRelations = []; + for (var i = 0; i < object.entityRelations.length; ++i) { + if (typeof object.entityRelations[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.entityRelations: object expected"); + message.entityRelations[i] = $root.google.cloud.documentai.v1.Document.EntityRelation.fromObject(object.entityRelations[i]); + } + } + if (object.textChanges) { + if (!Array.isArray(object.textChanges)) + throw TypeError(".google.cloud.documentai.v1.Document.textChanges: array expected"); + message.textChanges = []; + for (var i = 0; i < object.textChanges.length; ++i) { + if (typeof object.textChanges[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.textChanges: object expected"); + message.textChanges[i] = $root.google.cloud.documentai.v1.Document.TextChange.fromObject(object.textChanges[i]); + } + } + if (object.shardInfo != null) { + if (typeof object.shardInfo !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.shardInfo: object expected"); + message.shardInfo = $root.google.cloud.documentai.v1.Document.ShardInfo.fromObject(object.shardInfo); + } + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error); + } + if (object.revisions) { + if (!Array.isArray(object.revisions)) + throw TypeError(".google.cloud.documentai.v1.Document.revisions: array expected"); + message.revisions = []; + for (var i = 0; i < object.revisions.length; ++i) { + if (typeof object.revisions[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.revisions: object expected"); + message.revisions[i] = $root.google.cloud.documentai.v1.Document.Revision.fromObject(object.revisions[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Document message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document + * @static + * @param {google.cloud.documentai.v1.Document} message Document + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Document.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.textStyles = []; + object.pages = []; + object.entities = []; + object.entityRelations = []; + object.revisions = []; + object.textChanges = []; + } + if (options.defaults) { + object.mimeType = ""; + object.text = ""; + object.shardInfo = null; + object.error = null; + } + if (message.uri != null && message.hasOwnProperty("uri")) { + object.uri = message.uri; + if (options.oneofs) + object.source = "uri"; + } + if (message.content != null && message.hasOwnProperty("content")) { + object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; + if (options.oneofs) + object.source = "content"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.textStyles && message.textStyles.length) { + object.textStyles = []; + for (var j = 0; j < message.textStyles.length; ++j) + object.textStyles[j] = $root.google.cloud.documentai.v1.Document.Style.toObject(message.textStyles[j], options); + } + if (message.pages && message.pages.length) { + object.pages = []; + for (var j = 0; j < message.pages.length; ++j) + object.pages[j] = $root.google.cloud.documentai.v1.Document.Page.toObject(message.pages[j], options); + } + if (message.entities && message.entities.length) { + object.entities = []; + for (var j = 0; j < message.entities.length; ++j) + object.entities[j] = $root.google.cloud.documentai.v1.Document.Entity.toObject(message.entities[j], options); + } + if (message.entityRelations && message.entityRelations.length) { + object.entityRelations = []; + for (var j = 0; j < message.entityRelations.length; ++j) + object.entityRelations[j] = $root.google.cloud.documentai.v1.Document.EntityRelation.toObject(message.entityRelations[j], options); + } + if (message.shardInfo != null && message.hasOwnProperty("shardInfo")) + object.shardInfo = $root.google.cloud.documentai.v1.Document.ShardInfo.toObject(message.shardInfo, options); + if (message.error != null && message.hasOwnProperty("error")) + object.error = $root.google.rpc.Status.toObject(message.error, options); + if (message.revisions && message.revisions.length) { + object.revisions = []; + for (var j = 0; j < message.revisions.length; ++j) + object.revisions[j] = $root.google.cloud.documentai.v1.Document.Revision.toObject(message.revisions[j], options); + } + if (message.textChanges && message.textChanges.length) { + object.textChanges = []; + for (var j = 0; j < message.textChanges.length; ++j) + object.textChanges[j] = $root.google.cloud.documentai.v1.Document.TextChange.toObject(message.textChanges[j], options); + } + return object; + }; + + /** + * Converts this Document to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document + * @instance + * @returns {Object.} JSON object + */ + Document.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Document.ShardInfo = (function() { + + /** + * Properties of a ShardInfo. + * @memberof google.cloud.documentai.v1.Document + * @interface IShardInfo + * @property {number|Long|null} [shardIndex] ShardInfo shardIndex + * @property {number|Long|null} [shardCount] ShardInfo shardCount + * @property {number|Long|null} [textOffset] ShardInfo textOffset + */ + + /** + * Constructs a new ShardInfo. + * @memberof google.cloud.documentai.v1.Document + * @classdesc Represents a ShardInfo. + * @implements IShardInfo + * @constructor + * @param {google.cloud.documentai.v1.Document.IShardInfo=} [properties] Properties to set + */ + function ShardInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ShardInfo shardIndex. + * @member {number|Long} shardIndex + * @memberof google.cloud.documentai.v1.Document.ShardInfo + * @instance + */ + ShardInfo.prototype.shardIndex = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ShardInfo shardCount. + * @member {number|Long} shardCount + * @memberof google.cloud.documentai.v1.Document.ShardInfo + * @instance + */ + ShardInfo.prototype.shardCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ShardInfo textOffset. + * @member {number|Long} textOffset + * @memberof google.cloud.documentai.v1.Document.ShardInfo + * @instance + */ + ShardInfo.prototype.textOffset = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new ShardInfo instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.ShardInfo + * @static + * @param {google.cloud.documentai.v1.Document.IShardInfo=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.ShardInfo} ShardInfo instance + */ + ShardInfo.create = function create(properties) { + return new ShardInfo(properties); + }; + + /** + * Encodes the specified ShardInfo message. Does not implicitly {@link google.cloud.documentai.v1.Document.ShardInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.ShardInfo + * @static + * @param {google.cloud.documentai.v1.Document.IShardInfo} message ShardInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ShardInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.shardIndex != null && Object.hasOwnProperty.call(message, "shardIndex")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.shardIndex); + if (message.shardCount != null && Object.hasOwnProperty.call(message, "shardCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.shardCount); + if (message.textOffset != null && Object.hasOwnProperty.call(message, "textOffset")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.textOffset); + return writer; + }; + + /** + * Encodes the specified ShardInfo message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.ShardInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.ShardInfo + * @static + * @param {google.cloud.documentai.v1.Document.IShardInfo} message ShardInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ShardInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ShardInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.ShardInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.ShardInfo} ShardInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ShardInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.ShardInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.shardIndex = reader.int64(); + break; + case 2: + message.shardCount = reader.int64(); + break; + case 3: + message.textOffset = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ShardInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.ShardInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.ShardInfo} ShardInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ShardInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ShardInfo message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.ShardInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ShardInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.shardIndex != null && message.hasOwnProperty("shardIndex")) + if (!$util.isInteger(message.shardIndex) && !(message.shardIndex && $util.isInteger(message.shardIndex.low) && $util.isInteger(message.shardIndex.high))) + return "shardIndex: integer|Long expected"; + if (message.shardCount != null && message.hasOwnProperty("shardCount")) + if (!$util.isInteger(message.shardCount) && !(message.shardCount && $util.isInteger(message.shardCount.low) && $util.isInteger(message.shardCount.high))) + return "shardCount: integer|Long expected"; + if (message.textOffset != null && message.hasOwnProperty("textOffset")) + if (!$util.isInteger(message.textOffset) && !(message.textOffset && $util.isInteger(message.textOffset.low) && $util.isInteger(message.textOffset.high))) + return "textOffset: integer|Long expected"; + return null; + }; + + /** + * Creates a ShardInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.ShardInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.ShardInfo} ShardInfo + */ + ShardInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.ShardInfo) + return object; + var message = new $root.google.cloud.documentai.v1.Document.ShardInfo(); + if (object.shardIndex != null) + if ($util.Long) + (message.shardIndex = $util.Long.fromValue(object.shardIndex)).unsigned = false; + else if (typeof object.shardIndex === "string") + message.shardIndex = parseInt(object.shardIndex, 10); + else if (typeof object.shardIndex === "number") + message.shardIndex = object.shardIndex; + else if (typeof object.shardIndex === "object") + message.shardIndex = new $util.LongBits(object.shardIndex.low >>> 0, object.shardIndex.high >>> 0).toNumber(); + if (object.shardCount != null) + if ($util.Long) + (message.shardCount = $util.Long.fromValue(object.shardCount)).unsigned = false; + else if (typeof object.shardCount === "string") + message.shardCount = parseInt(object.shardCount, 10); + else if (typeof object.shardCount === "number") + message.shardCount = object.shardCount; + else if (typeof object.shardCount === "object") + message.shardCount = new $util.LongBits(object.shardCount.low >>> 0, object.shardCount.high >>> 0).toNumber(); + if (object.textOffset != null) + if ($util.Long) + (message.textOffset = $util.Long.fromValue(object.textOffset)).unsigned = false; + else if (typeof object.textOffset === "string") + message.textOffset = parseInt(object.textOffset, 10); + else if (typeof object.textOffset === "number") + message.textOffset = object.textOffset; + else if (typeof object.textOffset === "object") + message.textOffset = new $util.LongBits(object.textOffset.low >>> 0, object.textOffset.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a ShardInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.ShardInfo + * @static + * @param {google.cloud.documentai.v1.Document.ShardInfo} message ShardInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ShardInfo.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.shardIndex = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.shardIndex = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.shardCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.shardCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.textOffset = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.textOffset = options.longs === String ? "0" : 0; + } + if (message.shardIndex != null && message.hasOwnProperty("shardIndex")) + if (typeof message.shardIndex === "number") + object.shardIndex = options.longs === String ? String(message.shardIndex) : message.shardIndex; + else + object.shardIndex = options.longs === String ? $util.Long.prototype.toString.call(message.shardIndex) : options.longs === Number ? new $util.LongBits(message.shardIndex.low >>> 0, message.shardIndex.high >>> 0).toNumber() : message.shardIndex; + if (message.shardCount != null && message.hasOwnProperty("shardCount")) + if (typeof message.shardCount === "number") + object.shardCount = options.longs === String ? String(message.shardCount) : message.shardCount; + else + object.shardCount = options.longs === String ? $util.Long.prototype.toString.call(message.shardCount) : options.longs === Number ? new $util.LongBits(message.shardCount.low >>> 0, message.shardCount.high >>> 0).toNumber() : message.shardCount; + if (message.textOffset != null && message.hasOwnProperty("textOffset")) + if (typeof message.textOffset === "number") + object.textOffset = options.longs === String ? String(message.textOffset) : message.textOffset; + else + object.textOffset = options.longs === String ? $util.Long.prototype.toString.call(message.textOffset) : options.longs === Number ? new $util.LongBits(message.textOffset.low >>> 0, message.textOffset.high >>> 0).toNumber() : message.textOffset; + return object; + }; + + /** + * Converts this ShardInfo to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.ShardInfo + * @instance + * @returns {Object.} JSON object + */ + ShardInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ShardInfo; + })(); + + Document.Style = (function() { + + /** + * Properties of a Style. + * @memberof google.cloud.documentai.v1.Document + * @interface IStyle + * @property {google.cloud.documentai.v1.Document.ITextAnchor|null} [textAnchor] Style textAnchor + * @property {google.type.IColor|null} [color] Style color + * @property {google.type.IColor|null} [backgroundColor] Style backgroundColor + * @property {string|null} [fontWeight] Style fontWeight + * @property {string|null} [textStyle] Style textStyle + * @property {string|null} [textDecoration] Style textDecoration + * @property {google.cloud.documentai.v1.Document.Style.IFontSize|null} [fontSize] Style fontSize + */ + + /** + * Constructs a new Style. + * @memberof google.cloud.documentai.v1.Document + * @classdesc Represents a Style. + * @implements IStyle + * @constructor + * @param {google.cloud.documentai.v1.Document.IStyle=} [properties] Properties to set + */ + function Style(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Style textAnchor. + * @member {google.cloud.documentai.v1.Document.ITextAnchor|null|undefined} textAnchor + * @memberof google.cloud.documentai.v1.Document.Style + * @instance + */ + Style.prototype.textAnchor = null; + + /** + * Style color. + * @member {google.type.IColor|null|undefined} color + * @memberof google.cloud.documentai.v1.Document.Style + * @instance + */ + Style.prototype.color = null; + + /** + * Style backgroundColor. + * @member {google.type.IColor|null|undefined} backgroundColor + * @memberof google.cloud.documentai.v1.Document.Style + * @instance + */ + Style.prototype.backgroundColor = null; + + /** + * Style fontWeight. + * @member {string} fontWeight + * @memberof google.cloud.documentai.v1.Document.Style + * @instance + */ + Style.prototype.fontWeight = ""; + + /** + * Style textStyle. + * @member {string} textStyle + * @memberof google.cloud.documentai.v1.Document.Style + * @instance + */ + Style.prototype.textStyle = ""; + + /** + * Style textDecoration. + * @member {string} textDecoration + * @memberof google.cloud.documentai.v1.Document.Style + * @instance + */ + Style.prototype.textDecoration = ""; + + /** + * Style fontSize. + * @member {google.cloud.documentai.v1.Document.Style.IFontSize|null|undefined} fontSize + * @memberof google.cloud.documentai.v1.Document.Style + * @instance + */ + Style.prototype.fontSize = null; + + /** + * Creates a new Style instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Style + * @static + * @param {google.cloud.documentai.v1.Document.IStyle=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Style} Style instance + */ + Style.create = function create(properties) { + return new Style(properties); + }; + + /** + * Encodes the specified Style message. Does not implicitly {@link google.cloud.documentai.v1.Document.Style.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Style + * @static + * @param {google.cloud.documentai.v1.Document.IStyle} message Style message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Style.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textAnchor != null && Object.hasOwnProperty.call(message, "textAnchor")) + $root.google.cloud.documentai.v1.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.color != null && Object.hasOwnProperty.call(message, "color")) + $root.google.type.Color.encode(message.color, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.backgroundColor != null && Object.hasOwnProperty.call(message, "backgroundColor")) + $root.google.type.Color.encode(message.backgroundColor, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.fontWeight != null && Object.hasOwnProperty.call(message, "fontWeight")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.fontWeight); + if (message.textStyle != null && Object.hasOwnProperty.call(message, "textStyle")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.textStyle); + if (message.textDecoration != null && Object.hasOwnProperty.call(message, "textDecoration")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.textDecoration); + if (message.fontSize != null && Object.hasOwnProperty.call(message, "fontSize")) + $root.google.cloud.documentai.v1.Document.Style.FontSize.encode(message.fontSize, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Style message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Style.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Style + * @static + * @param {google.cloud.documentai.v1.Document.IStyle} message Style message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Style.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Style message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Style + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Style} Style + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Style.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Style(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.decode(reader, reader.uint32()); + break; + case 2: + message.color = $root.google.type.Color.decode(reader, reader.uint32()); + break; + case 3: + message.backgroundColor = $root.google.type.Color.decode(reader, reader.uint32()); + break; + case 4: + message.fontWeight = reader.string(); + break; + case 5: + message.textStyle = reader.string(); + break; + case 6: + message.textDecoration = reader.string(); + break; + case 7: + message.fontSize = $root.google.cloud.documentai.v1.Document.Style.FontSize.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Style message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Style + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Style} Style + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Style.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Style message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Style + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Style.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) { + var error = $root.google.cloud.documentai.v1.Document.TextAnchor.verify(message.textAnchor); + if (error) + return "textAnchor." + error; + } + if (message.color != null && message.hasOwnProperty("color")) { + var error = $root.google.type.Color.verify(message.color); + if (error) + return "color." + error; + } + if (message.backgroundColor != null && message.hasOwnProperty("backgroundColor")) { + var error = $root.google.type.Color.verify(message.backgroundColor); + if (error) + return "backgroundColor." + error; + } + if (message.fontWeight != null && message.hasOwnProperty("fontWeight")) + if (!$util.isString(message.fontWeight)) + return "fontWeight: string expected"; + if (message.textStyle != null && message.hasOwnProperty("textStyle")) + if (!$util.isString(message.textStyle)) + return "textStyle: string expected"; + if (message.textDecoration != null && message.hasOwnProperty("textDecoration")) + if (!$util.isString(message.textDecoration)) + return "textDecoration: string expected"; + if (message.fontSize != null && message.hasOwnProperty("fontSize")) { + var error = $root.google.cloud.documentai.v1.Document.Style.FontSize.verify(message.fontSize); + if (error) + return "fontSize." + error; + } + return null; + }; + + /** + * Creates a Style message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Style + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Style} Style + */ + Style.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Style) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Style(); + if (object.textAnchor != null) { + if (typeof object.textAnchor !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Style.textAnchor: object expected"); + message.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.fromObject(object.textAnchor); + } + if (object.color != null) { + if (typeof object.color !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Style.color: object expected"); + message.color = $root.google.type.Color.fromObject(object.color); + } + if (object.backgroundColor != null) { + if (typeof object.backgroundColor !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Style.backgroundColor: object expected"); + message.backgroundColor = $root.google.type.Color.fromObject(object.backgroundColor); + } + if (object.fontWeight != null) + message.fontWeight = String(object.fontWeight); + if (object.textStyle != null) + message.textStyle = String(object.textStyle); + if (object.textDecoration != null) + message.textDecoration = String(object.textDecoration); + if (object.fontSize != null) { + if (typeof object.fontSize !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Style.fontSize: object expected"); + message.fontSize = $root.google.cloud.documentai.v1.Document.Style.FontSize.fromObject(object.fontSize); + } + return message; + }; + + /** + * Creates a plain object from a Style message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Style + * @static + * @param {google.cloud.documentai.v1.Document.Style} message Style + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Style.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.textAnchor = null; + object.color = null; + object.backgroundColor = null; + object.fontWeight = ""; + object.textStyle = ""; + object.textDecoration = ""; + object.fontSize = null; + } + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + object.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.toObject(message.textAnchor, options); + if (message.color != null && message.hasOwnProperty("color")) + object.color = $root.google.type.Color.toObject(message.color, options); + if (message.backgroundColor != null && message.hasOwnProperty("backgroundColor")) + object.backgroundColor = $root.google.type.Color.toObject(message.backgroundColor, options); + if (message.fontWeight != null && message.hasOwnProperty("fontWeight")) + object.fontWeight = message.fontWeight; + if (message.textStyle != null && message.hasOwnProperty("textStyle")) + object.textStyle = message.textStyle; + if (message.textDecoration != null && message.hasOwnProperty("textDecoration")) + object.textDecoration = message.textDecoration; + if (message.fontSize != null && message.hasOwnProperty("fontSize")) + object.fontSize = $root.google.cloud.documentai.v1.Document.Style.FontSize.toObject(message.fontSize, options); + return object; + }; + + /** + * Converts this Style to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Style + * @instance + * @returns {Object.} JSON object + */ + Style.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Style.FontSize = (function() { + + /** + * Properties of a FontSize. + * @memberof google.cloud.documentai.v1.Document.Style + * @interface IFontSize + * @property {number|null} [size] FontSize size + * @property {string|null} [unit] FontSize unit + */ + + /** + * Constructs a new FontSize. + * @memberof google.cloud.documentai.v1.Document.Style + * @classdesc Represents a FontSize. + * @implements IFontSize + * @constructor + * @param {google.cloud.documentai.v1.Document.Style.IFontSize=} [properties] Properties to set + */ + function FontSize(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FontSize size. + * @member {number} size + * @memberof google.cloud.documentai.v1.Document.Style.FontSize + * @instance + */ + FontSize.prototype.size = 0; + + /** + * FontSize unit. + * @member {string} unit + * @memberof google.cloud.documentai.v1.Document.Style.FontSize + * @instance + */ + FontSize.prototype.unit = ""; + + /** + * Creates a new FontSize instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Style.FontSize + * @static + * @param {google.cloud.documentai.v1.Document.Style.IFontSize=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Style.FontSize} FontSize instance + */ + FontSize.create = function create(properties) { + return new FontSize(properties); + }; + + /** + * Encodes the specified FontSize message. Does not implicitly {@link google.cloud.documentai.v1.Document.Style.FontSize.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Style.FontSize + * @static + * @param {google.cloud.documentai.v1.Document.Style.IFontSize} message FontSize message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FontSize.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.size != null && Object.hasOwnProperty.call(message, "size")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.size); + if (message.unit != null && Object.hasOwnProperty.call(message, "unit")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.unit); + return writer; + }; + + /** + * Encodes the specified FontSize message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Style.FontSize.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Style.FontSize + * @static + * @param {google.cloud.documentai.v1.Document.Style.IFontSize} message FontSize message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FontSize.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FontSize message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Style.FontSize + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Style.FontSize} FontSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FontSize.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Style.FontSize(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.size = reader.float(); + break; + case 2: + message.unit = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FontSize message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Style.FontSize + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Style.FontSize} FontSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FontSize.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FontSize message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Style.FontSize + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FontSize.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.size != null && message.hasOwnProperty("size")) + if (typeof message.size !== "number") + return "size: number expected"; + if (message.unit != null && message.hasOwnProperty("unit")) + if (!$util.isString(message.unit)) + return "unit: string expected"; + return null; + }; + + /** + * Creates a FontSize message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Style.FontSize + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Style.FontSize} FontSize + */ + FontSize.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Style.FontSize) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Style.FontSize(); + if (object.size != null) + message.size = Number(object.size); + if (object.unit != null) + message.unit = String(object.unit); + return message; + }; + + /** + * Creates a plain object from a FontSize message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Style.FontSize + * @static + * @param {google.cloud.documentai.v1.Document.Style.FontSize} message FontSize + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FontSize.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.size = 0; + object.unit = ""; + } + if (message.size != null && message.hasOwnProperty("size")) + object.size = options.json && !isFinite(message.size) ? String(message.size) : message.size; + if (message.unit != null && message.hasOwnProperty("unit")) + object.unit = message.unit; + return object; + }; + + /** + * Converts this FontSize to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Style.FontSize + * @instance + * @returns {Object.} JSON object + */ + FontSize.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FontSize; + })(); + + return Style; + })(); + + Document.Page = (function() { + + /** + * Properties of a Page. + * @memberof google.cloud.documentai.v1.Document + * @interface IPage + * @property {number|null} [pageNumber] Page pageNumber + * @property {google.cloud.documentai.v1.Document.Page.IImage|null} [image] Page image + * @property {Array.|null} [transforms] Page transforms + * @property {google.cloud.documentai.v1.Document.Page.IDimension|null} [dimension] Page dimension + * @property {google.cloud.documentai.v1.Document.Page.ILayout|null} [layout] Page layout + * @property {Array.|null} [detectedLanguages] Page detectedLanguages + * @property {Array.|null} [blocks] Page blocks + * @property {Array.|null} [paragraphs] Page paragraphs + * @property {Array.|null} [lines] Page lines + * @property {Array.|null} [tokens] Page tokens + * @property {Array.|null} [visualElements] Page visualElements + * @property {Array.|null} [tables] Page tables + * @property {Array.|null} [formFields] Page formFields + */ + + /** + * Constructs a new Page. + * @memberof google.cloud.documentai.v1.Document + * @classdesc Represents a Page. + * @implements IPage + * @constructor + * @param {google.cloud.documentai.v1.Document.IPage=} [properties] Properties to set + */ + function Page(properties) { + this.transforms = []; + this.detectedLanguages = []; + this.blocks = []; + this.paragraphs = []; + this.lines = []; + this.tokens = []; + this.visualElements = []; + this.tables = []; + this.formFields = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Page pageNumber. + * @member {number} pageNumber + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.pageNumber = 0; + + /** + * Page image. + * @member {google.cloud.documentai.v1.Document.Page.IImage|null|undefined} image + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.image = null; + + /** + * Page transforms. + * @member {Array.} transforms + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.transforms = $util.emptyArray; + + /** + * Page dimension. + * @member {google.cloud.documentai.v1.Document.Page.IDimension|null|undefined} dimension + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.dimension = null; + + /** + * Page layout. + * @member {google.cloud.documentai.v1.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.layout = null; + + /** + * Page detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.detectedLanguages = $util.emptyArray; + + /** + * Page blocks. + * @member {Array.} blocks + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.blocks = $util.emptyArray; + + /** + * Page paragraphs. + * @member {Array.} paragraphs + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.paragraphs = $util.emptyArray; + + /** + * Page lines. + * @member {Array.} lines + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.lines = $util.emptyArray; + + /** + * Page tokens. + * @member {Array.} tokens + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.tokens = $util.emptyArray; + + /** + * Page visualElements. + * @member {Array.} visualElements + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.visualElements = $util.emptyArray; + + /** + * Page tables. + * @member {Array.} tables + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.tables = $util.emptyArray; + + /** + * Page formFields. + * @member {Array.} formFields + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.formFields = $util.emptyArray; + + /** + * Creates a new Page instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page + * @static + * @param {google.cloud.documentai.v1.Document.IPage=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page} Page instance + */ + Page.create = function create(properties) { + return new Page(properties); + }; + + /** + * Encodes the specified Page message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page + * @static + * @param {google.cloud.documentai.v1.Document.IPage} message Page message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Page.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageNumber != null && Object.hasOwnProperty.call(message, "pageNumber")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.pageNumber); + if (message.dimension != null && Object.hasOwnProperty.call(message, "dimension")) + $root.google.cloud.documentai.v1.Document.Page.Dimension.encode(message.dimension, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.blocks != null && message.blocks.length) + for (var i = 0; i < message.blocks.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.Block.encode(message.blocks[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.paragraphs != null && message.paragraphs.length) + for (var i = 0; i < message.paragraphs.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.Paragraph.encode(message.paragraphs[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.lines != null && message.lines.length) + for (var i = 0; i < message.lines.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.Line.encode(message.lines[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.tokens != null && message.tokens.length) + for (var i = 0; i < message.tokens.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.Token.encode(message.tokens[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.visualElements != null && message.visualElements.length) + for (var i = 0; i < message.visualElements.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.VisualElement.encode(message.visualElements[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.tables != null && message.tables.length) + for (var i = 0; i < message.tables.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.Table.encode(message.tables[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.formFields != null && message.formFields.length) + for (var i = 0; i < message.formFields.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.FormField.encode(message.formFields[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.image != null && Object.hasOwnProperty.call(message, "image")) + $root.google.cloud.documentai.v1.Document.Page.Image.encode(message.image, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.transforms != null && message.transforms.length) + for (var i = 0; i < message.transforms.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.Matrix.encode(message.transforms[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Page message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page + * @static + * @param {google.cloud.documentai.v1.Document.IPage} message Page message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Page.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Page message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page} Page + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Page.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Page(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pageNumber = reader.int32(); + break; + case 13: + message.image = $root.google.cloud.documentai.v1.Document.Page.Image.decode(reader, reader.uint32()); + break; + case 14: + if (!(message.transforms && message.transforms.length)) + message.transforms = []; + message.transforms.push($root.google.cloud.documentai.v1.Document.Page.Matrix.decode(reader, reader.uint32())); + break; + case 2: + message.dimension = $root.google.cloud.documentai.v1.Document.Page.Dimension.decode(reader, reader.uint32()); + break; + case 3: + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.blocks && message.blocks.length)) + message.blocks = []; + message.blocks.push($root.google.cloud.documentai.v1.Document.Page.Block.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.paragraphs && message.paragraphs.length)) + message.paragraphs = []; + message.paragraphs.push($root.google.cloud.documentai.v1.Document.Page.Paragraph.decode(reader, reader.uint32())); + break; + case 7: + if (!(message.lines && message.lines.length)) + message.lines = []; + message.lines.push($root.google.cloud.documentai.v1.Document.Page.Line.decode(reader, reader.uint32())); + break; + case 8: + if (!(message.tokens && message.tokens.length)) + message.tokens = []; + message.tokens.push($root.google.cloud.documentai.v1.Document.Page.Token.decode(reader, reader.uint32())); + break; + case 9: + if (!(message.visualElements && message.visualElements.length)) + message.visualElements = []; + message.visualElements.push($root.google.cloud.documentai.v1.Document.Page.VisualElement.decode(reader, reader.uint32())); + break; + case 10: + if (!(message.tables && message.tables.length)) + message.tables = []; + message.tables.push($root.google.cloud.documentai.v1.Document.Page.Table.decode(reader, reader.uint32())); + break; + case 11: + if (!(message.formFields && message.formFields.length)) + message.formFields = []; + message.formFields.push($root.google.cloud.documentai.v1.Document.Page.FormField.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Page message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page} Page + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Page.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Page message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Page.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + if (!$util.isInteger(message.pageNumber)) + return "pageNumber: integer expected"; + if (message.image != null && message.hasOwnProperty("image")) { + var error = $root.google.cloud.documentai.v1.Document.Page.Image.verify(message.image); + if (error) + return "image." + error; + } + if (message.transforms != null && message.hasOwnProperty("transforms")) { + if (!Array.isArray(message.transforms)) + return "transforms: array expected"; + for (var i = 0; i < message.transforms.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.Matrix.verify(message.transforms[i]); + if (error) + return "transforms." + error; + } + } + if (message.dimension != null && message.hasOwnProperty("dimension")) { + var error = $root.google.cloud.documentai.v1.Document.Page.Dimension.verify(message.dimension); + if (error) + return "dimension." + error; + } + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + if (message.blocks != null && message.hasOwnProperty("blocks")) { + if (!Array.isArray(message.blocks)) + return "blocks: array expected"; + for (var i = 0; i < message.blocks.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.Block.verify(message.blocks[i]); + if (error) + return "blocks." + error; + } + } + if (message.paragraphs != null && message.hasOwnProperty("paragraphs")) { + if (!Array.isArray(message.paragraphs)) + return "paragraphs: array expected"; + for (var i = 0; i < message.paragraphs.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.Paragraph.verify(message.paragraphs[i]); + if (error) + return "paragraphs." + error; + } + } + if (message.lines != null && message.hasOwnProperty("lines")) { + if (!Array.isArray(message.lines)) + return "lines: array expected"; + for (var i = 0; i < message.lines.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.Line.verify(message.lines[i]); + if (error) + return "lines." + error; + } + } + if (message.tokens != null && message.hasOwnProperty("tokens")) { + if (!Array.isArray(message.tokens)) + return "tokens: array expected"; + for (var i = 0; i < message.tokens.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.Token.verify(message.tokens[i]); + if (error) + return "tokens." + error; + } + } + if (message.visualElements != null && message.hasOwnProperty("visualElements")) { + if (!Array.isArray(message.visualElements)) + return "visualElements: array expected"; + for (var i = 0; i < message.visualElements.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.VisualElement.verify(message.visualElements[i]); + if (error) + return "visualElements." + error; + } + } + if (message.tables != null && message.hasOwnProperty("tables")) { + if (!Array.isArray(message.tables)) + return "tables: array expected"; + for (var i = 0; i < message.tables.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.Table.verify(message.tables[i]); + if (error) + return "tables." + error; + } + } + if (message.formFields != null && message.hasOwnProperty("formFields")) { + if (!Array.isArray(message.formFields)) + return "formFields: array expected"; + for (var i = 0; i < message.formFields.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.FormField.verify(message.formFields[i]); + if (error) + return "formFields." + error; + } + } + return null; + }; + + /** + * Creates a Page message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page} Page + */ + Page.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page(); + if (object.pageNumber != null) + message.pageNumber = object.pageNumber | 0; + if (object.image != null) { + if (typeof object.image !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.image: object expected"); + message.image = $root.google.cloud.documentai.v1.Document.Page.Image.fromObject(object.image); + } + if (object.transforms) { + if (!Array.isArray(object.transforms)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.transforms: array expected"); + message.transforms = []; + for (var i = 0; i < object.transforms.length; ++i) { + if (typeof object.transforms[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.transforms: object expected"); + message.transforms[i] = $root.google.cloud.documentai.v1.Document.Page.Matrix.fromObject(object.transforms[i]); + } + } + if (object.dimension != null) { + if (typeof object.dimension !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.dimension: object expected"); + message.dimension = $root.google.cloud.documentai.v1.Document.Page.Dimension.fromObject(object.dimension); + } + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + if (object.blocks) { + if (!Array.isArray(object.blocks)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.blocks: array expected"); + message.blocks = []; + for (var i = 0; i < object.blocks.length; ++i) { + if (typeof object.blocks[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.blocks: object expected"); + message.blocks[i] = $root.google.cloud.documentai.v1.Document.Page.Block.fromObject(object.blocks[i]); + } + } + if (object.paragraphs) { + if (!Array.isArray(object.paragraphs)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.paragraphs: array expected"); + message.paragraphs = []; + for (var i = 0; i < object.paragraphs.length; ++i) { + if (typeof object.paragraphs[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.paragraphs: object expected"); + message.paragraphs[i] = $root.google.cloud.documentai.v1.Document.Page.Paragraph.fromObject(object.paragraphs[i]); + } + } + if (object.lines) { + if (!Array.isArray(object.lines)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.lines: array expected"); + message.lines = []; + for (var i = 0; i < object.lines.length; ++i) { + if (typeof object.lines[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.lines: object expected"); + message.lines[i] = $root.google.cloud.documentai.v1.Document.Page.Line.fromObject(object.lines[i]); + } + } + if (object.tokens) { + if (!Array.isArray(object.tokens)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.tokens: array expected"); + message.tokens = []; + for (var i = 0; i < object.tokens.length; ++i) { + if (typeof object.tokens[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.tokens: object expected"); + message.tokens[i] = $root.google.cloud.documentai.v1.Document.Page.Token.fromObject(object.tokens[i]); + } + } + if (object.visualElements) { + if (!Array.isArray(object.visualElements)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.visualElements: array expected"); + message.visualElements = []; + for (var i = 0; i < object.visualElements.length; ++i) { + if (typeof object.visualElements[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.visualElements: object expected"); + message.visualElements[i] = $root.google.cloud.documentai.v1.Document.Page.VisualElement.fromObject(object.visualElements[i]); + } + } + if (object.tables) { + if (!Array.isArray(object.tables)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.tables: array expected"); + message.tables = []; + for (var i = 0; i < object.tables.length; ++i) { + if (typeof object.tables[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.tables: object expected"); + message.tables[i] = $root.google.cloud.documentai.v1.Document.Page.Table.fromObject(object.tables[i]); + } + } + if (object.formFields) { + if (!Array.isArray(object.formFields)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.formFields: array expected"); + message.formFields = []; + for (var i = 0; i < object.formFields.length; ++i) { + if (typeof object.formFields[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.formFields: object expected"); + message.formFields[i] = $root.google.cloud.documentai.v1.Document.Page.FormField.fromObject(object.formFields[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Page message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page + * @static + * @param {google.cloud.documentai.v1.Document.Page} message Page + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Page.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.detectedLanguages = []; + object.blocks = []; + object.paragraphs = []; + object.lines = []; + object.tokens = []; + object.visualElements = []; + object.tables = []; + object.formFields = []; + object.transforms = []; + } + if (options.defaults) { + object.pageNumber = 0; + object.dimension = null; + object.layout = null; + object.image = null; + } + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + object.pageNumber = message.pageNumber; + if (message.dimension != null && message.hasOwnProperty("dimension")) + object.dimension = $root.google.cloud.documentai.v1.Document.Page.Dimension.toObject(message.dimension, options); + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + if (message.blocks && message.blocks.length) { + object.blocks = []; + for (var j = 0; j < message.blocks.length; ++j) + object.blocks[j] = $root.google.cloud.documentai.v1.Document.Page.Block.toObject(message.blocks[j], options); + } + if (message.paragraphs && message.paragraphs.length) { + object.paragraphs = []; + for (var j = 0; j < message.paragraphs.length; ++j) + object.paragraphs[j] = $root.google.cloud.documentai.v1.Document.Page.Paragraph.toObject(message.paragraphs[j], options); + } + if (message.lines && message.lines.length) { + object.lines = []; + for (var j = 0; j < message.lines.length; ++j) + object.lines[j] = $root.google.cloud.documentai.v1.Document.Page.Line.toObject(message.lines[j], options); + } + if (message.tokens && message.tokens.length) { + object.tokens = []; + for (var j = 0; j < message.tokens.length; ++j) + object.tokens[j] = $root.google.cloud.documentai.v1.Document.Page.Token.toObject(message.tokens[j], options); + } + if (message.visualElements && message.visualElements.length) { + object.visualElements = []; + for (var j = 0; j < message.visualElements.length; ++j) + object.visualElements[j] = $root.google.cloud.documentai.v1.Document.Page.VisualElement.toObject(message.visualElements[j], options); + } + if (message.tables && message.tables.length) { + object.tables = []; + for (var j = 0; j < message.tables.length; ++j) + object.tables[j] = $root.google.cloud.documentai.v1.Document.Page.Table.toObject(message.tables[j], options); + } + if (message.formFields && message.formFields.length) { + object.formFields = []; + for (var j = 0; j < message.formFields.length; ++j) + object.formFields[j] = $root.google.cloud.documentai.v1.Document.Page.FormField.toObject(message.formFields[j], options); + } + if (message.image != null && message.hasOwnProperty("image")) + object.image = $root.google.cloud.documentai.v1.Document.Page.Image.toObject(message.image, options); + if (message.transforms && message.transforms.length) { + object.transforms = []; + for (var j = 0; j < message.transforms.length; ++j) + object.transforms[j] = $root.google.cloud.documentai.v1.Document.Page.Matrix.toObject(message.transforms[j], options); + } + return object; + }; + + /** + * Converts this Page to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + * @returns {Object.} JSON object + */ + Page.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Page.Dimension = (function() { + + /** + * Properties of a Dimension. + * @memberof google.cloud.documentai.v1.Document.Page + * @interface IDimension + * @property {number|null} [width] Dimension width + * @property {number|null} [height] Dimension height + * @property {string|null} [unit] Dimension unit + */ + + /** + * Constructs a new Dimension. + * @memberof google.cloud.documentai.v1.Document.Page + * @classdesc Represents a Dimension. + * @implements IDimension + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.IDimension=} [properties] Properties to set + */ + function Dimension(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Dimension width. + * @member {number} width + * @memberof google.cloud.documentai.v1.Document.Page.Dimension + * @instance + */ + Dimension.prototype.width = 0; + + /** + * Dimension height. + * @member {number} height + * @memberof google.cloud.documentai.v1.Document.Page.Dimension + * @instance + */ + Dimension.prototype.height = 0; + + /** + * Dimension unit. + * @member {string} unit + * @memberof google.cloud.documentai.v1.Document.Page.Dimension + * @instance + */ + Dimension.prototype.unit = ""; + + /** + * Creates a new Dimension instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.Dimension + * @static + * @param {google.cloud.documentai.v1.Document.Page.IDimension=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.Dimension} Dimension instance + */ + Dimension.create = function create(properties) { + return new Dimension(properties); + }; + + /** + * Encodes the specified Dimension message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Dimension.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.Dimension + * @static + * @param {google.cloud.documentai.v1.Document.Page.IDimension} message Dimension message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Dimension.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.width); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.height); + if (message.unit != null && Object.hasOwnProperty.call(message, "unit")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unit); + return writer; + }; + + /** + * Encodes the specified Dimension message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Dimension.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Dimension + * @static + * @param {google.cloud.documentai.v1.Document.Page.IDimension} message Dimension message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Dimension.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Dimension message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page.Dimension + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page.Dimension} Dimension + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Dimension.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Page.Dimension(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.width = reader.float(); + break; + case 2: + message.height = reader.float(); + break; + case 3: + message.unit = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Dimension message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Dimension + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.Dimension} Dimension + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Dimension.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Dimension message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page.Dimension + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Dimension.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (typeof message.width !== "number") + return "width: number expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height !== "number") + return "height: number expected"; + if (message.unit != null && message.hasOwnProperty("unit")) + if (!$util.isString(message.unit)) + return "unit: string expected"; + return null; + }; + + /** + * Creates a Dimension message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page.Dimension + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.Dimension} Dimension + */ + Dimension.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.Dimension) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.Dimension(); + if (object.width != null) + message.width = Number(object.width); + if (object.height != null) + message.height = Number(object.height); + if (object.unit != null) + message.unit = String(object.unit); + return message; + }; + + /** + * Creates a plain object from a Dimension message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.Dimension + * @static + * @param {google.cloud.documentai.v1.Document.Page.Dimension} message Dimension + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Dimension.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.width = 0; + object.height = 0; + object.unit = ""; + } + if (message.width != null && message.hasOwnProperty("width")) + object.width = options.json && !isFinite(message.width) ? String(message.width) : message.width; + if (message.height != null && message.hasOwnProperty("height")) + object.height = options.json && !isFinite(message.height) ? String(message.height) : message.height; + if (message.unit != null && message.hasOwnProperty("unit")) + object.unit = message.unit; + return object; + }; + + /** + * Converts this Dimension to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.Dimension + * @instance + * @returns {Object.} JSON object + */ + Dimension.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Dimension; + })(); + + Page.Image = (function() { + + /** + * Properties of an Image. + * @memberof google.cloud.documentai.v1.Document.Page + * @interface IImage + * @property {Uint8Array|null} [content] Image content + * @property {string|null} [mimeType] Image mimeType + * @property {number|null} [width] Image width + * @property {number|null} [height] Image height + */ + + /** + * Constructs a new Image. + * @memberof google.cloud.documentai.v1.Document.Page + * @classdesc Represents an Image. + * @implements IImage + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.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 content. + * @member {Uint8Array} content + * @memberof google.cloud.documentai.v1.Document.Page.Image + * @instance + */ + Image.prototype.content = $util.newBuffer([]); + + /** + * Image mimeType. + * @member {string} mimeType + * @memberof google.cloud.documentai.v1.Document.Page.Image + * @instance + */ + Image.prototype.mimeType = ""; + + /** + * Image width. + * @member {number} width + * @memberof google.cloud.documentai.v1.Document.Page.Image + * @instance + */ + Image.prototype.width = 0; + + /** + * Image height. + * @member {number} height + * @memberof google.cloud.documentai.v1.Document.Page.Image + * @instance + */ + Image.prototype.height = 0; + + /** + * Creates a new Image instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.Image + * @static + * @param {google.cloud.documentai.v1.Document.Page.IImage=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.Image} Image instance + */ + Image.create = function create(properties) { + return new Image(properties); + }; + + /** + * Encodes the specified Image message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Image.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.Image + * @static + * @param {google.cloud.documentai.v1.Document.Page.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.content != null && Object.hasOwnProperty.call(message, "content")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.content); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.width); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.height); + return writer; + }; + + /** + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Image.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Image + * @static + * @param {google.cloud.documentai.v1.Document.Page.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.documentai.v1.Document.Page.Image + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page.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.documentai.v1.Document.Page.Image(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.content = reader.bytes(); + break; + case 2: + message.mimeType = reader.string(); + break; + case 3: + message.width = reader.int32(); + break; + case 4: + message.height = 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.documentai.v1.Document.Page.Image + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.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.documentai.v1.Document.Page.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.content != null && message.hasOwnProperty("content")) + if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) + return "content: buffer expected"; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (!$util.isInteger(message.width)) + return "width: integer expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: 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.documentai.v1.Document.Page.Image + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.Image} Image + */ + Image.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.Image) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.Image(); + if (object.content != null) + if (typeof object.content === "string") + $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); + else if (object.content.length) + message.content = object.content; + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + if (object.width != null) + message.width = object.width | 0; + if (object.height != null) + message.height = object.height | 0; + return message; + }; + + /** + * Creates a plain object from an Image message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.Image + * @static + * @param {google.cloud.documentai.v1.Document.Page.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) { + if (options.bytes === String) + object.content = ""; + else { + object.content = []; + if (options.bytes !== Array) + object.content = $util.newBuffer(object.content); + } + object.mimeType = ""; + object.width = 0; + object.height = 0; + } + if (message.content != null && message.hasOwnProperty("content")) + object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.width != null && message.hasOwnProperty("width")) + object.width = message.width; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + return object; + }; + + /** + * Converts this Image to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.Image + * @instance + * @returns {Object.} JSON object + */ + Image.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Image; + })(); + + Page.Matrix = (function() { + + /** + * Properties of a Matrix. + * @memberof google.cloud.documentai.v1.Document.Page + * @interface IMatrix + * @property {number|null} [rows] Matrix rows + * @property {number|null} [cols] Matrix cols + * @property {number|null} [type] Matrix type + * @property {Uint8Array|null} [data] Matrix data + */ + + /** + * Constructs a new Matrix. + * @memberof google.cloud.documentai.v1.Document.Page + * @classdesc Represents a Matrix. + * @implements IMatrix + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.IMatrix=} [properties] Properties to set + */ + function Matrix(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Matrix rows. + * @member {number} rows + * @memberof google.cloud.documentai.v1.Document.Page.Matrix + * @instance + */ + Matrix.prototype.rows = 0; + + /** + * Matrix cols. + * @member {number} cols + * @memberof google.cloud.documentai.v1.Document.Page.Matrix + * @instance + */ + Matrix.prototype.cols = 0; + + /** + * Matrix type. + * @member {number} type + * @memberof google.cloud.documentai.v1.Document.Page.Matrix + * @instance + */ + Matrix.prototype.type = 0; + + /** + * Matrix data. + * @member {Uint8Array} data + * @memberof google.cloud.documentai.v1.Document.Page.Matrix + * @instance + */ + Matrix.prototype.data = $util.newBuffer([]); + + /** + * Creates a new Matrix instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.Matrix + * @static + * @param {google.cloud.documentai.v1.Document.Page.IMatrix=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.Matrix} Matrix instance + */ + Matrix.create = function create(properties) { + return new Matrix(properties); + }; + + /** + * Encodes the specified Matrix message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Matrix.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.Matrix + * @static + * @param {google.cloud.documentai.v1.Document.Page.IMatrix} message Matrix message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Matrix.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rows != null && Object.hasOwnProperty.call(message, "rows")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.rows); + if (message.cols != null && Object.hasOwnProperty.call(message, "cols")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.cols); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.data); + return writer; + }; + + /** + * Encodes the specified Matrix message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Matrix.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Matrix + * @static + * @param {google.cloud.documentai.v1.Document.Page.IMatrix} message Matrix message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Matrix.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Matrix message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page.Matrix + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page.Matrix} Matrix + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Matrix.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Page.Matrix(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rows = reader.int32(); + break; + case 2: + message.cols = reader.int32(); + break; + case 3: + message.type = reader.int32(); + break; + case 4: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Matrix message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Matrix + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.Matrix} Matrix + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Matrix.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Matrix message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page.Matrix + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Matrix.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rows != null && message.hasOwnProperty("rows")) + if (!$util.isInteger(message.rows)) + return "rows: integer expected"; + if (message.cols != null && message.hasOwnProperty("cols")) + if (!$util.isInteger(message.cols)) + return "cols: integer expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isInteger(message.type)) + return "type: integer expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + return null; + }; + + /** + * Creates a Matrix message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page.Matrix + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.Matrix} Matrix + */ + Matrix.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.Matrix) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.Matrix(); + if (object.rows != null) + message.rows = object.rows | 0; + if (object.cols != null) + message.cols = object.cols | 0; + if (object.type != null) + message.type = object.type | 0; + 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; + return message; + }; + + /** + * Creates a plain object from a Matrix message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.Matrix + * @static + * @param {google.cloud.documentai.v1.Document.Page.Matrix} message Matrix + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Matrix.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.rows = 0; + object.cols = 0; + object.type = 0; + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + } + if (message.rows != null && message.hasOwnProperty("rows")) + object.rows = message.rows; + if (message.cols != null && message.hasOwnProperty("cols")) + object.cols = message.cols; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + 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; + return object; + }; + + /** + * Converts this Matrix to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.Matrix + * @instance + * @returns {Object.} JSON object + */ + Matrix.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Matrix; + })(); + + Page.Layout = (function() { + + /** + * Properties of a Layout. + * @memberof google.cloud.documentai.v1.Document.Page + * @interface ILayout + * @property {google.cloud.documentai.v1.Document.ITextAnchor|null} [textAnchor] Layout textAnchor + * @property {number|null} [confidence] Layout confidence + * @property {google.cloud.documentai.v1.IBoundingPoly|null} [boundingPoly] Layout boundingPoly + * @property {google.cloud.documentai.v1.Document.Page.Layout.Orientation|null} [orientation] Layout orientation + */ + + /** + * Constructs a new Layout. + * @memberof google.cloud.documentai.v1.Document.Page + * @classdesc Represents a Layout. + * @implements ILayout + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.ILayout=} [properties] Properties to set + */ + function Layout(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Layout textAnchor. + * @member {google.cloud.documentai.v1.Document.ITextAnchor|null|undefined} textAnchor + * @memberof google.cloud.documentai.v1.Document.Page.Layout + * @instance + */ + Layout.prototype.textAnchor = null; + + /** + * Layout confidence. + * @member {number} confidence + * @memberof google.cloud.documentai.v1.Document.Page.Layout + * @instance + */ + Layout.prototype.confidence = 0; + + /** + * Layout boundingPoly. + * @member {google.cloud.documentai.v1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.documentai.v1.Document.Page.Layout + * @instance + */ + Layout.prototype.boundingPoly = null; + + /** + * Layout orientation. + * @member {google.cloud.documentai.v1.Document.Page.Layout.Orientation} orientation + * @memberof google.cloud.documentai.v1.Document.Page.Layout + * @instance + */ + Layout.prototype.orientation = 0; + + /** + * Creates a new Layout instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.Layout + * @static + * @param {google.cloud.documentai.v1.Document.Page.ILayout=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.Layout} Layout instance + */ + Layout.create = function create(properties) { + return new Layout(properties); + }; + + /** + * Encodes the specified Layout message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Layout.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.Layout + * @static + * @param {google.cloud.documentai.v1.Document.Page.ILayout} message Layout message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Layout.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textAnchor != null && Object.hasOwnProperty.call(message, "textAnchor")) + $root.google.cloud.documentai.v1.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) + $root.google.cloud.documentai.v1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.orientation != null && Object.hasOwnProperty.call(message, "orientation")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.orientation); + return writer; + }; + + /** + * Encodes the specified Layout message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Layout.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Layout + * @static + * @param {google.cloud.documentai.v1.Document.Page.ILayout} message Layout message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Layout.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Layout message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page.Layout + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page.Layout} Layout + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Layout.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Page.Layout(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.decode(reader, reader.uint32()); + break; + case 2: + message.confidence = reader.float(); + break; + case 3: + message.boundingPoly = $root.google.cloud.documentai.v1.BoundingPoly.decode(reader, reader.uint32()); + break; + case 4: + message.orientation = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Layout message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Layout + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.Layout} Layout + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Layout.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Layout message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page.Layout + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Layout.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) { + var error = $root.google.cloud.documentai.v1.Document.TextAnchor.verify(message.textAnchor); + if (error) + return "textAnchor." + error; + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { + var error = $root.google.cloud.documentai.v1.BoundingPoly.verify(message.boundingPoly); + if (error) + return "boundingPoly." + error; + } + if (message.orientation != null && message.hasOwnProperty("orientation")) + switch (message.orientation) { + default: + return "orientation: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a Layout message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page.Layout + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.Layout} Layout + */ + Layout.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.Layout) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.Layout(); + if (object.textAnchor != null) { + if (typeof object.textAnchor !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Layout.textAnchor: object expected"); + message.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.fromObject(object.textAnchor); + } + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Layout.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.documentai.v1.BoundingPoly.fromObject(object.boundingPoly); + } + switch (object.orientation) { + case "ORIENTATION_UNSPECIFIED": + case 0: + message.orientation = 0; + break; + case "PAGE_UP": + case 1: + message.orientation = 1; + break; + case "PAGE_RIGHT": + case 2: + message.orientation = 2; + break; + case "PAGE_DOWN": + case 3: + message.orientation = 3; + break; + case "PAGE_LEFT": + case 4: + message.orientation = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a Layout message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.Layout + * @static + * @param {google.cloud.documentai.v1.Document.Page.Layout} message Layout + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Layout.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.textAnchor = null; + object.confidence = 0; + object.boundingPoly = null; + object.orientation = options.enums === String ? "ORIENTATION_UNSPECIFIED" : 0; + } + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + object.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.toObject(message.textAnchor, options); + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.documentai.v1.BoundingPoly.toObject(message.boundingPoly, options); + if (message.orientation != null && message.hasOwnProperty("orientation")) + object.orientation = options.enums === String ? $root.google.cloud.documentai.v1.Document.Page.Layout.Orientation[message.orientation] : message.orientation; + return object; + }; + + /** + * Converts this Layout to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.Layout + * @instance + * @returns {Object.} JSON object + */ + Layout.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Orientation enum. + * @name google.cloud.documentai.v1.Document.Page.Layout.Orientation + * @enum {number} + * @property {number} ORIENTATION_UNSPECIFIED=0 ORIENTATION_UNSPECIFIED value + * @property {number} PAGE_UP=1 PAGE_UP value + * @property {number} PAGE_RIGHT=2 PAGE_RIGHT value + * @property {number} PAGE_DOWN=3 PAGE_DOWN value + * @property {number} PAGE_LEFT=4 PAGE_LEFT value + */ + Layout.Orientation = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ORIENTATION_UNSPECIFIED"] = 0; + values[valuesById[1] = "PAGE_UP"] = 1; + values[valuesById[2] = "PAGE_RIGHT"] = 2; + values[valuesById[3] = "PAGE_DOWN"] = 3; + values[valuesById[4] = "PAGE_LEFT"] = 4; + return values; + })(); + + return Layout; + })(); + + Page.Block = (function() { + + /** + * Properties of a Block. + * @memberof google.cloud.documentai.v1.Document.Page + * @interface IBlock + * @property {google.cloud.documentai.v1.Document.Page.ILayout|null} [layout] Block layout + * @property {Array.|null} [detectedLanguages] Block detectedLanguages + * @property {google.cloud.documentai.v1.Document.IProvenance|null} [provenance] Block provenance + */ + + /** + * Constructs a new Block. + * @memberof google.cloud.documentai.v1.Document.Page + * @classdesc Represents a Block. + * @implements IBlock + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.IBlock=} [properties] Properties to set + */ + function Block(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Block layout. + * @member {google.cloud.documentai.v1.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1.Document.Page.Block + * @instance + */ + Block.prototype.layout = null; + + /** + * Block detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1.Document.Page.Block + * @instance + */ + Block.prototype.detectedLanguages = $util.emptyArray; + + /** + * Block provenance. + * @member {google.cloud.documentai.v1.Document.IProvenance|null|undefined} provenance + * @memberof google.cloud.documentai.v1.Document.Page.Block + * @instance + */ + Block.prototype.provenance = null; + + /** + * Creates a new Block instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.Block + * @static + * @param {google.cloud.documentai.v1.Document.Page.IBlock=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.Block} Block instance + */ + Block.create = function create(properties) { + return new Block(properties); + }; + + /** + * Encodes the specified Block message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Block.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.Block + * @static + * @param {google.cloud.documentai.v1.Document.Page.IBlock} message Block message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Block.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) + $root.google.cloud.documentai.v1.Document.Provenance.encode(message.provenance, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Block message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Block.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Block + * @static + * @param {google.cloud.documentai.v1.Document.Page.IBlock} message Block message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Block.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Block message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page.Block + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page.Block} Block + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Block.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Page.Block(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + case 3: + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Block message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Block + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.Block} Block + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Block.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Block message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page.Block + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Block.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + if (message.provenance != null && message.hasOwnProperty("provenance")) { + var error = $root.google.cloud.documentai.v1.Document.Provenance.verify(message.provenance); + if (error) + return "provenance." + error; + } + return null; + }; + + /** + * Creates a Block message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page.Block + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.Block} Block + */ + Block.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.Block) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.Block(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Block.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.Block.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Block.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + if (object.provenance != null) { + if (typeof object.provenance !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Block.provenance: object expected"); + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.fromObject(object.provenance); + } + return message; + }; + + /** + * Creates a plain object from a Block message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.Block + * @static + * @param {google.cloud.documentai.v1.Document.Page.Block} message Block + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Block.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) { + object.layout = null; + object.provenance = null; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + if (message.provenance != null && message.hasOwnProperty("provenance")) + object.provenance = $root.google.cloud.documentai.v1.Document.Provenance.toObject(message.provenance, options); + return object; + }; + + /** + * Converts this Block to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.Block + * @instance + * @returns {Object.} JSON object + */ + Block.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Block; + })(); + + Page.Paragraph = (function() { + + /** + * Properties of a Paragraph. + * @memberof google.cloud.documentai.v1.Document.Page + * @interface IParagraph + * @property {google.cloud.documentai.v1.Document.Page.ILayout|null} [layout] Paragraph layout + * @property {Array.|null} [detectedLanguages] Paragraph detectedLanguages + * @property {google.cloud.documentai.v1.Document.IProvenance|null} [provenance] Paragraph provenance + */ + + /** + * Constructs a new Paragraph. + * @memberof google.cloud.documentai.v1.Document.Page + * @classdesc Represents a Paragraph. + * @implements IParagraph + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.IParagraph=} [properties] Properties to set + */ + function Paragraph(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Paragraph layout. + * @member {google.cloud.documentai.v1.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1.Document.Page.Paragraph + * @instance + */ + Paragraph.prototype.layout = null; + + /** + * Paragraph detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1.Document.Page.Paragraph + * @instance + */ + Paragraph.prototype.detectedLanguages = $util.emptyArray; + + /** + * Paragraph provenance. + * @member {google.cloud.documentai.v1.Document.IProvenance|null|undefined} provenance + * @memberof google.cloud.documentai.v1.Document.Page.Paragraph + * @instance + */ + Paragraph.prototype.provenance = null; + + /** + * Creates a new Paragraph instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.Paragraph + * @static + * @param {google.cloud.documentai.v1.Document.Page.IParagraph=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.Paragraph} Paragraph instance + */ + Paragraph.create = function create(properties) { + return new Paragraph(properties); + }; + + /** + * Encodes the specified Paragraph message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Paragraph.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.Paragraph + * @static + * @param {google.cloud.documentai.v1.Document.Page.IParagraph} message Paragraph message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Paragraph.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) + $root.google.cloud.documentai.v1.Document.Provenance.encode(message.provenance, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Paragraph message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Paragraph.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Paragraph + * @static + * @param {google.cloud.documentai.v1.Document.Page.IParagraph} message Paragraph message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Paragraph.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Paragraph message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page.Paragraph + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page.Paragraph} Paragraph + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Paragraph.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Page.Paragraph(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + case 3: + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Paragraph message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Paragraph + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.Paragraph} Paragraph + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Paragraph.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Paragraph message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page.Paragraph + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Paragraph.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + if (message.provenance != null && message.hasOwnProperty("provenance")) { + var error = $root.google.cloud.documentai.v1.Document.Provenance.verify(message.provenance); + if (error) + return "provenance." + error; + } + return null; + }; + + /** + * Creates a Paragraph message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page.Paragraph + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.Paragraph} Paragraph + */ + Paragraph.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.Paragraph) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.Paragraph(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Paragraph.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.Paragraph.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Paragraph.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + if (object.provenance != null) { + if (typeof object.provenance !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Paragraph.provenance: object expected"); + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.fromObject(object.provenance); + } + return message; + }; + + /** + * Creates a plain object from a Paragraph message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.Paragraph + * @static + * @param {google.cloud.documentai.v1.Document.Page.Paragraph} message Paragraph + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Paragraph.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) { + object.layout = null; + object.provenance = null; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + if (message.provenance != null && message.hasOwnProperty("provenance")) + object.provenance = $root.google.cloud.documentai.v1.Document.Provenance.toObject(message.provenance, options); + return object; + }; + + /** + * Converts this Paragraph to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.Paragraph + * @instance + * @returns {Object.} JSON object + */ + Paragraph.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Paragraph; + })(); + + Page.Line = (function() { + + /** + * Properties of a Line. + * @memberof google.cloud.documentai.v1.Document.Page + * @interface ILine + * @property {google.cloud.documentai.v1.Document.Page.ILayout|null} [layout] Line layout + * @property {Array.|null} [detectedLanguages] Line detectedLanguages + * @property {google.cloud.documentai.v1.Document.IProvenance|null} [provenance] Line provenance + */ + + /** + * Constructs a new Line. + * @memberof google.cloud.documentai.v1.Document.Page + * @classdesc Represents a Line. + * @implements ILine + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.ILine=} [properties] Properties to set + */ + function Line(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Line layout. + * @member {google.cloud.documentai.v1.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1.Document.Page.Line + * @instance + */ + Line.prototype.layout = null; + + /** + * Line detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1.Document.Page.Line + * @instance + */ + Line.prototype.detectedLanguages = $util.emptyArray; + + /** + * Line provenance. + * @member {google.cloud.documentai.v1.Document.IProvenance|null|undefined} provenance + * @memberof google.cloud.documentai.v1.Document.Page.Line + * @instance + */ + Line.prototype.provenance = null; + + /** + * Creates a new Line instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.Line + * @static + * @param {google.cloud.documentai.v1.Document.Page.ILine=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.Line} Line instance + */ + Line.create = function create(properties) { + return new Line(properties); + }; + + /** + * Encodes the specified Line message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Line.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.Line + * @static + * @param {google.cloud.documentai.v1.Document.Page.ILine} message Line message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Line.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) + $root.google.cloud.documentai.v1.Document.Provenance.encode(message.provenance, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Line message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Line.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Line + * @static + * @param {google.cloud.documentai.v1.Document.Page.ILine} message Line message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Line.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Line message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page.Line + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page.Line} Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Line.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Page.Line(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + case 3: + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Line message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Line + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.Line} Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Line.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Line message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page.Line + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Line.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + if (message.provenance != null && message.hasOwnProperty("provenance")) { + var error = $root.google.cloud.documentai.v1.Document.Provenance.verify(message.provenance); + if (error) + return "provenance." + error; + } + return null; + }; + + /** + * Creates a Line message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page.Line + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.Line} Line + */ + Line.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.Line) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.Line(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Line.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.Line.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Line.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + if (object.provenance != null) { + if (typeof object.provenance !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Line.provenance: object expected"); + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.fromObject(object.provenance); + } + return message; + }; + + /** + * Creates a plain object from a Line message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.Line + * @static + * @param {google.cloud.documentai.v1.Document.Page.Line} message Line + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Line.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) { + object.layout = null; + object.provenance = null; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + if (message.provenance != null && message.hasOwnProperty("provenance")) + object.provenance = $root.google.cloud.documentai.v1.Document.Provenance.toObject(message.provenance, options); + return object; + }; + + /** + * Converts this Line to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.Line + * @instance + * @returns {Object.} JSON object + */ + Line.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Line; + })(); + + Page.Token = (function() { + + /** + * Properties of a Token. + * @memberof google.cloud.documentai.v1.Document.Page + * @interface IToken + * @property {google.cloud.documentai.v1.Document.Page.ILayout|null} [layout] Token layout + * @property {google.cloud.documentai.v1.Document.Page.Token.IDetectedBreak|null} [detectedBreak] Token detectedBreak + * @property {Array.|null} [detectedLanguages] Token detectedLanguages + * @property {google.cloud.documentai.v1.Document.IProvenance|null} [provenance] Token provenance + */ + + /** + * Constructs a new Token. + * @memberof google.cloud.documentai.v1.Document.Page + * @classdesc Represents a Token. + * @implements IToken + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.IToken=} [properties] Properties to set + */ + function Token(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Token layout. + * @member {google.cloud.documentai.v1.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1.Document.Page.Token + * @instance + */ + Token.prototype.layout = null; + + /** + * Token detectedBreak. + * @member {google.cloud.documentai.v1.Document.Page.Token.IDetectedBreak|null|undefined} detectedBreak + * @memberof google.cloud.documentai.v1.Document.Page.Token + * @instance + */ + Token.prototype.detectedBreak = null; + + /** + * Token detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1.Document.Page.Token + * @instance + */ + Token.prototype.detectedLanguages = $util.emptyArray; + + /** + * Token provenance. + * @member {google.cloud.documentai.v1.Document.IProvenance|null|undefined} provenance + * @memberof google.cloud.documentai.v1.Document.Page.Token + * @instance + */ + Token.prototype.provenance = null; + + /** + * Creates a new Token instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.Token + * @static + * @param {google.cloud.documentai.v1.Document.Page.IToken=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.Token} Token instance + */ + Token.create = function create(properties) { + return new Token(properties); + }; + + /** + * Encodes the specified Token message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Token.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.Token + * @static + * @param {google.cloud.documentai.v1.Document.Page.IToken} message Token message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Token.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectedBreak != null && Object.hasOwnProperty.call(message, "detectedBreak")) + $root.google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.encode(message.detectedBreak, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) + $root.google.cloud.documentai.v1.Document.Provenance.encode(message.provenance, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Token message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Token.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Token + * @static + * @param {google.cloud.documentai.v1.Document.Page.IToken} message Token message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Token.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Token message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page.Token + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page.Token} Token + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Token.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Page.Token(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + message.detectedBreak = $root.google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.decode(reader, reader.uint32()); + break; + case 3: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + case 4: + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Token message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Token + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.Token} Token + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Token.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Token message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page.Token + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Token.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) { + var error = $root.google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.verify(message.detectedBreak); + if (error) + return "detectedBreak." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + if (message.provenance != null && message.hasOwnProperty("provenance")) { + var error = $root.google.cloud.documentai.v1.Document.Provenance.verify(message.provenance); + if (error) + return "provenance." + error; + } + return null; + }; + + /** + * Creates a Token message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page.Token + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.Token} Token + */ + Token.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.Token) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.Token(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Token.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedBreak != null) { + if (typeof object.detectedBreak !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Token.detectedBreak: object expected"); + message.detectedBreak = $root.google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.fromObject(object.detectedBreak); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.Token.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Token.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + if (object.provenance != null) { + if (typeof object.provenance !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Token.provenance: object expected"); + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.fromObject(object.provenance); + } + return message; + }; + + /** + * Creates a plain object from a Token message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.Token + * @static + * @param {google.cloud.documentai.v1.Document.Page.Token} message Token + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Token.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) { + object.layout = null; + object.detectedBreak = null; + object.provenance = null; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) + object.detectedBreak = $root.google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.toObject(message.detectedBreak, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + if (message.provenance != null && message.hasOwnProperty("provenance")) + object.provenance = $root.google.cloud.documentai.v1.Document.Provenance.toObject(message.provenance, options); + return object; + }; + + /** + * Converts this Token to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.Token + * @instance + * @returns {Object.} JSON object + */ + Token.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Token.DetectedBreak = (function() { + + /** + * Properties of a DetectedBreak. + * @memberof google.cloud.documentai.v1.Document.Page.Token + * @interface IDetectedBreak + * @property {google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type|null} [type] DetectedBreak type + */ + + /** + * Constructs a new DetectedBreak. + * @memberof google.cloud.documentai.v1.Document.Page.Token + * @classdesc Represents a DetectedBreak. + * @implements IDetectedBreak + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.Token.IDetectedBreak=} [properties] Properties to set + */ + function DetectedBreak(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DetectedBreak type. + * @member {google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type} type + * @memberof google.cloud.documentai.v1.Document.Page.Token.DetectedBreak + * @instance + */ + DetectedBreak.prototype.type = 0; + + /** + * Creates a new DetectedBreak instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.Token.DetectedBreak + * @static + * @param {google.cloud.documentai.v1.Document.Page.Token.IDetectedBreak=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.Token.DetectedBreak} DetectedBreak instance + */ + DetectedBreak.create = function create(properties) { + return new DetectedBreak(properties); + }; + + /** + * Encodes the specified DetectedBreak message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.Token.DetectedBreak + * @static + * @param {google.cloud.documentai.v1.Document.Page.Token.IDetectedBreak} message DetectedBreak message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedBreak.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); + return writer; + }; + + /** + * Encodes the specified DetectedBreak message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Token.DetectedBreak + * @static + * @param {google.cloud.documentai.v1.Document.Page.Token.IDetectedBreak} message DetectedBreak message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedBreak.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectedBreak message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page.Token.DetectedBreak + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page.Token.DetectedBreak} DetectedBreak + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedBreak.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Page.Token.DetectedBreak(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectedBreak message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Token.DetectedBreak + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.Token.DetectedBreak} DetectedBreak + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedBreak.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectedBreak message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page.Token.DetectedBreak + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectedBreak.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object 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; + } + return null; + }; + + /** + * Creates a DetectedBreak message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page.Token.DetectedBreak + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.Token.DetectedBreak} DetectedBreak + */ + DetectedBreak.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.Token.DetectedBreak) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.Token.DetectedBreak(); + switch (object.type) { + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "SPACE": + case 1: + message.type = 1; + break; + case "WIDE_SPACE": + case 2: + message.type = 2; + break; + case "HYPHEN": + case 3: + message.type = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a DetectedBreak message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.Token.DetectedBreak + * @static + * @param {google.cloud.documentai.v1.Document.Page.Token.DetectedBreak} message DetectedBreak + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectedBreak.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type[message.type] : message.type; + return object; + }; + + /** + * Converts this DetectedBreak to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.Token.DetectedBreak + * @instance + * @returns {Object.} JSON object + */ + DetectedBreak.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Type enum. + * @name google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} SPACE=1 SPACE value + * @property {number} WIDE_SPACE=2 WIDE_SPACE value + * @property {number} HYPHEN=3 HYPHEN value + */ + DetectedBreak.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SPACE"] = 1; + values[valuesById[2] = "WIDE_SPACE"] = 2; + values[valuesById[3] = "HYPHEN"] = 3; + return values; + })(); + + return DetectedBreak; + })(); + + return Token; + })(); + + Page.VisualElement = (function() { + + /** + * Properties of a VisualElement. + * @memberof google.cloud.documentai.v1.Document.Page + * @interface IVisualElement + * @property {google.cloud.documentai.v1.Document.Page.ILayout|null} [layout] VisualElement layout + * @property {string|null} [type] VisualElement type + * @property {Array.|null} [detectedLanguages] VisualElement detectedLanguages + */ + + /** + * Constructs a new VisualElement. + * @memberof google.cloud.documentai.v1.Document.Page + * @classdesc Represents a VisualElement. + * @implements IVisualElement + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.IVisualElement=} [properties] Properties to set + */ + function VisualElement(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * VisualElement layout. + * @member {google.cloud.documentai.v1.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1.Document.Page.VisualElement + * @instance + */ + VisualElement.prototype.layout = null; + + /** + * VisualElement type. + * @member {string} type + * @memberof google.cloud.documentai.v1.Document.Page.VisualElement + * @instance + */ + VisualElement.prototype.type = ""; + + /** + * VisualElement detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1.Document.Page.VisualElement + * @instance + */ + VisualElement.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new VisualElement instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.VisualElement + * @static + * @param {google.cloud.documentai.v1.Document.Page.IVisualElement=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.VisualElement} VisualElement instance + */ + VisualElement.create = function create(properties) { + return new VisualElement(properties); + }; + + /** + * Encodes the specified VisualElement message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.VisualElement.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.VisualElement + * @static + * @param {google.cloud.documentai.v1.Document.Page.IVisualElement} message VisualElement message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisualElement.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified VisualElement message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.VisualElement.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.VisualElement + * @static + * @param {google.cloud.documentai.v1.Document.Page.IVisualElement} message VisualElement message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisualElement.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VisualElement message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page.VisualElement + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page.VisualElement} VisualElement + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisualElement.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Page.VisualElement(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + message.type = reader.string(); + break; + case 3: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VisualElement message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.VisualElement + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.VisualElement} VisualElement + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisualElement.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VisualElement message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page.VisualElement + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VisualElement.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a VisualElement message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page.VisualElement + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.VisualElement} VisualElement + */ + VisualElement.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.VisualElement) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.VisualElement(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.VisualElement.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.fromObject(object.layout); + } + if (object.type != null) + message.type = String(object.type); + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.VisualElement.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.VisualElement.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a VisualElement message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.VisualElement + * @static + * @param {google.cloud.documentai.v1.Document.Page.VisualElement} message VisualElement + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VisualElement.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) { + object.layout = null; + object.type = ""; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.toObject(message.layout, options); + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this VisualElement to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.VisualElement + * @instance + * @returns {Object.} JSON object + */ + VisualElement.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return VisualElement; + })(); + + Page.Table = (function() { + + /** + * Properties of a Table. + * @memberof google.cloud.documentai.v1.Document.Page + * @interface ITable + * @property {google.cloud.documentai.v1.Document.Page.ILayout|null} [layout] Table layout + * @property {Array.|null} [headerRows] Table headerRows + * @property {Array.|null} [bodyRows] Table bodyRows + * @property {Array.|null} [detectedLanguages] Table detectedLanguages + */ + + /** + * Constructs a new Table. + * @memberof google.cloud.documentai.v1.Document.Page + * @classdesc Represents a Table. + * @implements ITable + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.ITable=} [properties] Properties to set + */ + function Table(properties) { + this.headerRows = []; + this.bodyRows = []; + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Table layout. + * @member {google.cloud.documentai.v1.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1.Document.Page.Table + * @instance + */ + Table.prototype.layout = null; + + /** + * Table headerRows. + * @member {Array.} headerRows + * @memberof google.cloud.documentai.v1.Document.Page.Table + * @instance + */ + Table.prototype.headerRows = $util.emptyArray; + + /** + * Table bodyRows. + * @member {Array.} bodyRows + * @memberof google.cloud.documentai.v1.Document.Page.Table + * @instance + */ + Table.prototype.bodyRows = $util.emptyArray; + + /** + * Table detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1.Document.Page.Table + * @instance + */ + Table.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new Table instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.Table + * @static + * @param {google.cloud.documentai.v1.Document.Page.ITable=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.Table} Table instance + */ + Table.create = function create(properties) { + return new Table(properties); + }; + + /** + * Encodes the specified Table message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Table.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.Table + * @static + * @param {google.cloud.documentai.v1.Document.Page.ITable} message Table message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Table.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.headerRows != null && message.headerRows.length) + for (var i = 0; i < message.headerRows.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.Table.TableRow.encode(message.headerRows[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bodyRows != null && message.bodyRows.length) + for (var i = 0; i < message.bodyRows.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.Table.TableRow.encode(message.bodyRows[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Table message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Table.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Table + * @static + * @param {google.cloud.documentai.v1.Document.Page.ITable} message Table message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Table.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Table message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page.Table + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page.Table} Table + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Table.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Page.Table(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.headerRows && message.headerRows.length)) + message.headerRows = []; + message.headerRows.push($root.google.cloud.documentai.v1.Document.Page.Table.TableRow.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.bodyRows && message.bodyRows.length)) + message.bodyRows = []; + message.bodyRows.push($root.google.cloud.documentai.v1.Document.Page.Table.TableRow.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Table message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Table + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.Table} Table + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Table.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Table message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page.Table + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Table.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.headerRows != null && message.hasOwnProperty("headerRows")) { + if (!Array.isArray(message.headerRows)) + return "headerRows: array expected"; + for (var i = 0; i < message.headerRows.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.Table.TableRow.verify(message.headerRows[i]); + if (error) + return "headerRows." + error; + } + } + if (message.bodyRows != null && message.hasOwnProperty("bodyRows")) { + if (!Array.isArray(message.bodyRows)) + return "bodyRows: array expected"; + for (var i = 0; i < message.bodyRows.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.Table.TableRow.verify(message.bodyRows[i]); + if (error) + return "bodyRows." + error; + } + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a Table message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page.Table + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.Table} Table + */ + Table.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.Table) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.Table(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Table.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.fromObject(object.layout); + } + if (object.headerRows) { + if (!Array.isArray(object.headerRows)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.Table.headerRows: array expected"); + message.headerRows = []; + for (var i = 0; i < object.headerRows.length; ++i) { + if (typeof object.headerRows[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Table.headerRows: object expected"); + message.headerRows[i] = $root.google.cloud.documentai.v1.Document.Page.Table.TableRow.fromObject(object.headerRows[i]); + } + } + if (object.bodyRows) { + if (!Array.isArray(object.bodyRows)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.Table.bodyRows: array expected"); + message.bodyRows = []; + for (var i = 0; i < object.bodyRows.length; ++i) { + if (typeof object.bodyRows[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Table.bodyRows: object expected"); + message.bodyRows[i] = $root.google.cloud.documentai.v1.Document.Page.Table.TableRow.fromObject(object.bodyRows[i]); + } + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.Table.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Table.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Table message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.Table + * @static + * @param {google.cloud.documentai.v1.Document.Page.Table} message Table + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Table.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.headerRows = []; + object.bodyRows = []; + object.detectedLanguages = []; + } + if (options.defaults) + object.layout = null; + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.toObject(message.layout, options); + if (message.headerRows && message.headerRows.length) { + object.headerRows = []; + for (var j = 0; j < message.headerRows.length; ++j) + object.headerRows[j] = $root.google.cloud.documentai.v1.Document.Page.Table.TableRow.toObject(message.headerRows[j], options); + } + if (message.bodyRows && message.bodyRows.length) { + object.bodyRows = []; + for (var j = 0; j < message.bodyRows.length; ++j) + object.bodyRows[j] = $root.google.cloud.documentai.v1.Document.Page.Table.TableRow.toObject(message.bodyRows[j], options); + } + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this Table to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.Table + * @instance + * @returns {Object.} JSON object + */ + Table.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Table.TableRow = (function() { + + /** + * Properties of a TableRow. + * @memberof google.cloud.documentai.v1.Document.Page.Table + * @interface ITableRow + * @property {Array.|null} [cells] TableRow cells + */ + + /** + * Constructs a new TableRow. + * @memberof google.cloud.documentai.v1.Document.Page.Table + * @classdesc Represents a TableRow. + * @implements ITableRow + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.Table.ITableRow=} [properties] Properties to set + */ + function TableRow(properties) { + this.cells = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TableRow cells. + * @member {Array.} cells + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableRow + * @instance + */ + TableRow.prototype.cells = $util.emptyArray; + + /** + * Creates a new TableRow instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableRow + * @static + * @param {google.cloud.documentai.v1.Document.Page.Table.ITableRow=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.Table.TableRow} TableRow instance + */ + TableRow.create = function create(properties) { + return new TableRow(properties); + }; + + /** + * Encodes the specified TableRow message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Table.TableRow.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableRow + * @static + * @param {google.cloud.documentai.v1.Document.Page.Table.ITableRow} message TableRow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableRow.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cells != null && message.cells.length) + for (var i = 0; i < message.cells.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.Table.TableCell.encode(message.cells[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TableRow message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Table.TableRow.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableRow + * @static + * @param {google.cloud.documentai.v1.Document.Page.Table.ITableRow} message TableRow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableRow.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableRow message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableRow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page.Table.TableRow} TableRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableRow.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Page.Table.TableRow(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.cells && message.cells.length)) + message.cells = []; + message.cells.push($root.google.cloud.documentai.v1.Document.Page.Table.TableCell.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableRow message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableRow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.Table.TableRow} TableRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableRow.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableRow message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableRow + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableRow.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cells != null && message.hasOwnProperty("cells")) { + if (!Array.isArray(message.cells)) + return "cells: array expected"; + for (var i = 0; i < message.cells.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.Table.TableCell.verify(message.cells[i]); + if (error) + return "cells." + error; + } + } + return null; + }; + + /** + * Creates a TableRow message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableRow + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.Table.TableRow} TableRow + */ + TableRow.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.Table.TableRow) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.Table.TableRow(); + if (object.cells) { + if (!Array.isArray(object.cells)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.Table.TableRow.cells: array expected"); + message.cells = []; + for (var i = 0; i < object.cells.length; ++i) { + if (typeof object.cells[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Table.TableRow.cells: object expected"); + message.cells[i] = $root.google.cloud.documentai.v1.Document.Page.Table.TableCell.fromObject(object.cells[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TableRow message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableRow + * @static + * @param {google.cloud.documentai.v1.Document.Page.Table.TableRow} message TableRow + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableRow.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.cells = []; + if (message.cells && message.cells.length) { + object.cells = []; + for (var j = 0; j < message.cells.length; ++j) + object.cells[j] = $root.google.cloud.documentai.v1.Document.Page.Table.TableCell.toObject(message.cells[j], options); + } + return object; + }; + + /** + * Converts this TableRow to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableRow + * @instance + * @returns {Object.} JSON object + */ + TableRow.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TableRow; + })(); + + Table.TableCell = (function() { + + /** + * Properties of a TableCell. + * @memberof google.cloud.documentai.v1.Document.Page.Table + * @interface ITableCell + * @property {google.cloud.documentai.v1.Document.Page.ILayout|null} [layout] TableCell layout + * @property {number|null} [rowSpan] TableCell rowSpan + * @property {number|null} [colSpan] TableCell colSpan + * @property {Array.|null} [detectedLanguages] TableCell detectedLanguages + */ + + /** + * Constructs a new TableCell. + * @memberof google.cloud.documentai.v1.Document.Page.Table + * @classdesc Represents a TableCell. + * @implements ITableCell + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.Table.ITableCell=} [properties] Properties to set + */ + function TableCell(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TableCell layout. + * @member {google.cloud.documentai.v1.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableCell + * @instance + */ + TableCell.prototype.layout = null; + + /** + * TableCell rowSpan. + * @member {number} rowSpan + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableCell + * @instance + */ + TableCell.prototype.rowSpan = 0; + + /** + * TableCell colSpan. + * @member {number} colSpan + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableCell + * @instance + */ + TableCell.prototype.colSpan = 0; + + /** + * TableCell detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableCell + * @instance + */ + TableCell.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new TableCell instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableCell + * @static + * @param {google.cloud.documentai.v1.Document.Page.Table.ITableCell=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.Table.TableCell} TableCell instance + */ + TableCell.create = function create(properties) { + return new TableCell(properties); + }; + + /** + * Encodes the specified TableCell message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Table.TableCell.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableCell + * @static + * @param {google.cloud.documentai.v1.Document.Page.Table.ITableCell} message TableCell message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableCell.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.rowSpan != null && Object.hasOwnProperty.call(message, "rowSpan")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.rowSpan); + if (message.colSpan != null && Object.hasOwnProperty.call(message, "colSpan")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.colSpan); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TableCell message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Table.TableCell.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableCell + * @static + * @param {google.cloud.documentai.v1.Document.Page.Table.ITableCell} message TableCell message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableCell.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableCell message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableCell + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page.Table.TableCell} TableCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableCell.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Page.Table.TableCell(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + message.rowSpan = reader.int32(); + break; + case 3: + message.colSpan = reader.int32(); + break; + case 4: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableCell message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableCell + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.Table.TableCell} TableCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableCell.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableCell message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableCell + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableCell.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.rowSpan != null && message.hasOwnProperty("rowSpan")) + if (!$util.isInteger(message.rowSpan)) + return "rowSpan: integer expected"; + if (message.colSpan != null && message.hasOwnProperty("colSpan")) + if (!$util.isInteger(message.colSpan)) + return "colSpan: integer expected"; + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a TableCell message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableCell + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.Table.TableCell} TableCell + */ + TableCell.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.Table.TableCell) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.Table.TableCell(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Table.TableCell.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.fromObject(object.layout); + } + if (object.rowSpan != null) + message.rowSpan = object.rowSpan | 0; + if (object.colSpan != null) + message.colSpan = object.colSpan | 0; + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.Table.TableCell.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Table.TableCell.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TableCell message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableCell + * @static + * @param {google.cloud.documentai.v1.Document.Page.Table.TableCell} message TableCell + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableCell.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) { + object.layout = null; + object.rowSpan = 0; + object.colSpan = 0; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.toObject(message.layout, options); + if (message.rowSpan != null && message.hasOwnProperty("rowSpan")) + object.rowSpan = message.rowSpan; + if (message.colSpan != null && message.hasOwnProperty("colSpan")) + object.colSpan = message.colSpan; + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this TableCell to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableCell + * @instance + * @returns {Object.} JSON object + */ + TableCell.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TableCell; + })(); + + return Table; + })(); + + Page.FormField = (function() { + + /** + * Properties of a FormField. + * @memberof google.cloud.documentai.v1.Document.Page + * @interface IFormField + * @property {google.cloud.documentai.v1.Document.Page.ILayout|null} [fieldName] FormField fieldName + * @property {google.cloud.documentai.v1.Document.Page.ILayout|null} [fieldValue] FormField fieldValue + * @property {Array.|null} [nameDetectedLanguages] FormField nameDetectedLanguages + * @property {Array.|null} [valueDetectedLanguages] FormField valueDetectedLanguages + * @property {string|null} [valueType] FormField valueType + */ + + /** + * Constructs a new FormField. + * @memberof google.cloud.documentai.v1.Document.Page + * @classdesc Represents a FormField. + * @implements IFormField + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.IFormField=} [properties] Properties to set + */ + function FormField(properties) { + this.nameDetectedLanguages = []; + this.valueDetectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FormField fieldName. + * @member {google.cloud.documentai.v1.Document.Page.ILayout|null|undefined} fieldName + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @instance + */ + FormField.prototype.fieldName = null; + + /** + * FormField fieldValue. + * @member {google.cloud.documentai.v1.Document.Page.ILayout|null|undefined} fieldValue + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @instance + */ + FormField.prototype.fieldValue = null; + + /** + * FormField nameDetectedLanguages. + * @member {Array.} nameDetectedLanguages + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @instance + */ + FormField.prototype.nameDetectedLanguages = $util.emptyArray; + + /** + * FormField valueDetectedLanguages. + * @member {Array.} valueDetectedLanguages + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @instance + */ + FormField.prototype.valueDetectedLanguages = $util.emptyArray; + + /** + * FormField valueType. + * @member {string} valueType + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @instance + */ + FormField.prototype.valueType = ""; + + /** + * Creates a new FormField instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @static + * @param {google.cloud.documentai.v1.Document.Page.IFormField=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.FormField} FormField instance + */ + FormField.create = function create(properties) { + return new FormField(properties); + }; + + /** + * Encodes the specified FormField message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.FormField.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @static + * @param {google.cloud.documentai.v1.Document.Page.IFormField} message FormField message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FormField.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fieldName != null && Object.hasOwnProperty.call(message, "fieldName")) + $root.google.cloud.documentai.v1.Document.Page.Layout.encode(message.fieldName, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fieldValue != null && Object.hasOwnProperty.call(message, "fieldValue")) + $root.google.cloud.documentai.v1.Document.Page.Layout.encode(message.fieldValue, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nameDetectedLanguages != null && message.nameDetectedLanguages.length) + for (var i = 0; i < message.nameDetectedLanguages.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.encode(message.nameDetectedLanguages[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.valueDetectedLanguages != null && message.valueDetectedLanguages.length) + for (var i = 0; i < message.valueDetectedLanguages.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.encode(message.valueDetectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.valueType != null && Object.hasOwnProperty.call(message, "valueType")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.valueType); + return writer; + }; + + /** + * Encodes the specified FormField message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.FormField.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @static + * @param {google.cloud.documentai.v1.Document.Page.IFormField} message FormField message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FormField.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FormField message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page.FormField} FormField + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FormField.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Page.FormField(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fieldName = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + message.fieldValue = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 3: + if (!(message.nameDetectedLanguages && message.nameDetectedLanguages.length)) + message.nameDetectedLanguages = []; + message.nameDetectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.valueDetectedLanguages && message.valueDetectedLanguages.length)) + message.valueDetectedLanguages = []; + message.valueDetectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + case 5: + message.valueType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FormField message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.FormField} FormField + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FormField.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FormField message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FormField.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fieldName != null && message.hasOwnProperty("fieldName")) { + var error = $root.google.cloud.documentai.v1.Document.Page.Layout.verify(message.fieldName); + if (error) + return "fieldName." + error; + } + if (message.fieldValue != null && message.hasOwnProperty("fieldValue")) { + var error = $root.google.cloud.documentai.v1.Document.Page.Layout.verify(message.fieldValue); + if (error) + return "fieldValue." + error; + } + if (message.nameDetectedLanguages != null && message.hasOwnProperty("nameDetectedLanguages")) { + if (!Array.isArray(message.nameDetectedLanguages)) + return "nameDetectedLanguages: array expected"; + for (var i = 0; i < message.nameDetectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.verify(message.nameDetectedLanguages[i]); + if (error) + return "nameDetectedLanguages." + error; + } + } + if (message.valueDetectedLanguages != null && message.hasOwnProperty("valueDetectedLanguages")) { + if (!Array.isArray(message.valueDetectedLanguages)) + return "valueDetectedLanguages: array expected"; + for (var i = 0; i < message.valueDetectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.verify(message.valueDetectedLanguages[i]); + if (error) + return "valueDetectedLanguages." + error; + } + } + if (message.valueType != null && message.hasOwnProperty("valueType")) + if (!$util.isString(message.valueType)) + return "valueType: string expected"; + return null; + }; + + /** + * Creates a FormField message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.FormField} FormField + */ + FormField.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.FormField) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.FormField(); + if (object.fieldName != null) { + if (typeof object.fieldName !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.FormField.fieldName: object expected"); + message.fieldName = $root.google.cloud.documentai.v1.Document.Page.Layout.fromObject(object.fieldName); + } + if (object.fieldValue != null) { + if (typeof object.fieldValue !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.FormField.fieldValue: object expected"); + message.fieldValue = $root.google.cloud.documentai.v1.Document.Page.Layout.fromObject(object.fieldValue); + } + if (object.nameDetectedLanguages) { + if (!Array.isArray(object.nameDetectedLanguages)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.FormField.nameDetectedLanguages: array expected"); + message.nameDetectedLanguages = []; + for (var i = 0; i < object.nameDetectedLanguages.length; ++i) { + if (typeof object.nameDetectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.FormField.nameDetectedLanguages: object expected"); + message.nameDetectedLanguages[i] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.fromObject(object.nameDetectedLanguages[i]); + } + } + if (object.valueDetectedLanguages) { + if (!Array.isArray(object.valueDetectedLanguages)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.FormField.valueDetectedLanguages: array expected"); + message.valueDetectedLanguages = []; + for (var i = 0; i < object.valueDetectedLanguages.length; ++i) { + if (typeof object.valueDetectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.FormField.valueDetectedLanguages: object expected"); + message.valueDetectedLanguages[i] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.fromObject(object.valueDetectedLanguages[i]); + } + } + if (object.valueType != null) + message.valueType = String(object.valueType); + return message; + }; + + /** + * Creates a plain object from a FormField message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @static + * @param {google.cloud.documentai.v1.Document.Page.FormField} message FormField + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FormField.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.nameDetectedLanguages = []; + object.valueDetectedLanguages = []; + } + if (options.defaults) { + object.fieldName = null; + object.fieldValue = null; + object.valueType = ""; + } + if (message.fieldName != null && message.hasOwnProperty("fieldName")) + object.fieldName = $root.google.cloud.documentai.v1.Document.Page.Layout.toObject(message.fieldName, options); + if (message.fieldValue != null && message.hasOwnProperty("fieldValue")) + object.fieldValue = $root.google.cloud.documentai.v1.Document.Page.Layout.toObject(message.fieldValue, options); + if (message.nameDetectedLanguages && message.nameDetectedLanguages.length) { + object.nameDetectedLanguages = []; + for (var j = 0; j < message.nameDetectedLanguages.length; ++j) + object.nameDetectedLanguages[j] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.toObject(message.nameDetectedLanguages[j], options); + } + if (message.valueDetectedLanguages && message.valueDetectedLanguages.length) { + object.valueDetectedLanguages = []; + for (var j = 0; j < message.valueDetectedLanguages.length; ++j) + object.valueDetectedLanguages[j] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.toObject(message.valueDetectedLanguages[j], options); + } + if (message.valueType != null && message.hasOwnProperty("valueType")) + object.valueType = message.valueType; + return object; + }; + + /** + * Converts this FormField to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @instance + * @returns {Object.} JSON object + */ + FormField.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FormField; + })(); + + Page.DetectedLanguage = (function() { + + /** + * Properties of a DetectedLanguage. + * @memberof google.cloud.documentai.v1.Document.Page + * @interface IDetectedLanguage + * @property {string|null} [languageCode] DetectedLanguage languageCode + * @property {number|null} [confidence] DetectedLanguage confidence + */ + + /** + * Constructs a new DetectedLanguage. + * @memberof google.cloud.documentai.v1.Document.Page + * @classdesc Represents a DetectedLanguage. + * @implements IDetectedLanguage + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.IDetectedLanguage=} [properties] Properties to set + */ + function DetectedLanguage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DetectedLanguage languageCode. + * @member {string} languageCode + * @memberof google.cloud.documentai.v1.Document.Page.DetectedLanguage + * @instance + */ + DetectedLanguage.prototype.languageCode = ""; + + /** + * DetectedLanguage confidence. + * @member {number} confidence + * @memberof google.cloud.documentai.v1.Document.Page.DetectedLanguage + * @instance + */ + DetectedLanguage.prototype.confidence = 0; + + /** + * Creates a new DetectedLanguage instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.DetectedLanguage + * @static + * @param {google.cloud.documentai.v1.Document.Page.IDetectedLanguage=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.DetectedLanguage} DetectedLanguage instance + */ + DetectedLanguage.create = function create(properties) { + return new DetectedLanguage(properties); + }; + + /** + * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.DetectedLanguage.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.DetectedLanguage + * @static + * @param {google.cloud.documentai.v1.Document.Page.IDetectedLanguage} message DetectedLanguage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedLanguage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.languageCode); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + return writer; + }; + + /** + * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.DetectedLanguage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.DetectedLanguage + * @static + * @param {google.cloud.documentai.v1.Document.Page.IDetectedLanguage} message DetectedLanguage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedLanguage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectedLanguage message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page.DetectedLanguage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page.DetectedLanguage} DetectedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedLanguage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.languageCode = reader.string(); + break; + case 2: + message.confidence = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectedLanguage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.DetectedLanguage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.DetectedLanguage} DetectedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedLanguage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectedLanguage message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page.DetectedLanguage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectedLanguage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + return null; + }; + + /** + * Creates a DetectedLanguage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page.DetectedLanguage + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.DetectedLanguage} DetectedLanguage + */ + DetectedLanguage.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage(); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.confidence != null) + message.confidence = Number(object.confidence); + return message; + }; + + /** + * Creates a plain object from a DetectedLanguage message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.DetectedLanguage + * @static + * @param {google.cloud.documentai.v1.Document.Page.DetectedLanguage} message DetectedLanguage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectedLanguage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.languageCode = ""; + object.confidence = 0; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + return object; + }; + + /** + * Converts this DetectedLanguage to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.DetectedLanguage + * @instance + * @returns {Object.} JSON object + */ + DetectedLanguage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DetectedLanguage; + })(); + + return Page; + })(); + + Document.Entity = (function() { + + /** + * Properties of an Entity. + * @memberof google.cloud.documentai.v1.Document + * @interface IEntity + * @property {google.cloud.documentai.v1.Document.ITextAnchor|null} [textAnchor] Entity textAnchor + * @property {string|null} [type] Entity type + * @property {string|null} [mentionText] Entity mentionText + * @property {string|null} [mentionId] Entity mentionId + * @property {number|null} [confidence] Entity confidence + * @property {google.cloud.documentai.v1.Document.IPageAnchor|null} [pageAnchor] Entity pageAnchor + * @property {string|null} [id] Entity id + * @property {google.cloud.documentai.v1.Document.Entity.INormalizedValue|null} [normalizedValue] Entity normalizedValue + * @property {Array.|null} [properties] Entity properties + * @property {google.cloud.documentai.v1.Document.IProvenance|null} [provenance] Entity provenance + * @property {boolean|null} [redacted] Entity redacted + */ + + /** + * Constructs a new Entity. + * @memberof google.cloud.documentai.v1.Document + * @classdesc Represents an Entity. + * @implements IEntity + * @constructor + * @param {google.cloud.documentai.v1.Document.IEntity=} [properties] Properties to set + */ + function Entity(properties) { + this.properties = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Entity textAnchor. + * @member {google.cloud.documentai.v1.Document.ITextAnchor|null|undefined} textAnchor + * @memberof google.cloud.documentai.v1.Document.Entity + * @instance + */ + Entity.prototype.textAnchor = null; + + /** + * Entity type. + * @member {string} type + * @memberof google.cloud.documentai.v1.Document.Entity + * @instance + */ + Entity.prototype.type = ""; + + /** + * Entity mentionText. + * @member {string} mentionText + * @memberof google.cloud.documentai.v1.Document.Entity + * @instance + */ + Entity.prototype.mentionText = ""; + + /** + * Entity mentionId. + * @member {string} mentionId + * @memberof google.cloud.documentai.v1.Document.Entity + * @instance + */ + Entity.prototype.mentionId = ""; + + /** + * Entity confidence. + * @member {number} confidence + * @memberof google.cloud.documentai.v1.Document.Entity + * @instance + */ + Entity.prototype.confidence = 0; + + /** + * Entity pageAnchor. + * @member {google.cloud.documentai.v1.Document.IPageAnchor|null|undefined} pageAnchor + * @memberof google.cloud.documentai.v1.Document.Entity + * @instance + */ + Entity.prototype.pageAnchor = null; + + /** + * Entity id. + * @member {string} id + * @memberof google.cloud.documentai.v1.Document.Entity + * @instance + */ + Entity.prototype.id = ""; + + /** + * Entity normalizedValue. + * @member {google.cloud.documentai.v1.Document.Entity.INormalizedValue|null|undefined} normalizedValue + * @memberof google.cloud.documentai.v1.Document.Entity + * @instance + */ + Entity.prototype.normalizedValue = null; + + /** + * Entity properties. + * @member {Array.} properties + * @memberof google.cloud.documentai.v1.Document.Entity + * @instance + */ + Entity.prototype.properties = $util.emptyArray; + + /** + * Entity provenance. + * @member {google.cloud.documentai.v1.Document.IProvenance|null|undefined} provenance + * @memberof google.cloud.documentai.v1.Document.Entity + * @instance + */ + Entity.prototype.provenance = null; + + /** + * Entity redacted. + * @member {boolean} redacted + * @memberof google.cloud.documentai.v1.Document.Entity + * @instance + */ + Entity.prototype.redacted = false; + + /** + * Creates a new Entity instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Entity + * @static + * @param {google.cloud.documentai.v1.Document.IEntity=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Entity} Entity instance + */ + Entity.create = function create(properties) { + return new Entity(properties); + }; + + /** + * Encodes the specified Entity message. Does not implicitly {@link google.cloud.documentai.v1.Document.Entity.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Entity + * @static + * @param {google.cloud.documentai.v1.Document.IEntity} message Entity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entity.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textAnchor != null && Object.hasOwnProperty.call(message, "textAnchor")) + $root.google.cloud.documentai.v1.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.mentionText != null && Object.hasOwnProperty.call(message, "mentionText")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.mentionText); + if (message.mentionId != null && Object.hasOwnProperty.call(message, "mentionId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.mentionId); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); + if (message.pageAnchor != null && Object.hasOwnProperty.call(message, "pageAnchor")) + $root.google.cloud.documentai.v1.Document.PageAnchor.encode(message.pageAnchor, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.id); + if (message.normalizedValue != null && Object.hasOwnProperty.call(message, "normalizedValue")) + $root.google.cloud.documentai.v1.Document.Entity.NormalizedValue.encode(message.normalizedValue, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.properties != null && message.properties.length) + for (var i = 0; i < message.properties.length; ++i) + $root.google.cloud.documentai.v1.Document.Entity.encode(message.properties[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) + $root.google.cloud.documentai.v1.Document.Provenance.encode(message.provenance, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.redacted != null && Object.hasOwnProperty.call(message, "redacted")) + writer.uint32(/* id 12, wireType 0 =*/96).bool(message.redacted); + return writer; + }; + + /** + * Encodes the specified Entity message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Entity.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Entity + * @static + * @param {google.cloud.documentai.v1.Document.IEntity} message Entity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entity.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Entity message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Entity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Entity} Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entity.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Entity(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.decode(reader, reader.uint32()); + break; + case 2: + message.type = reader.string(); + break; + case 3: + message.mentionText = reader.string(); + break; + case 4: + message.mentionId = reader.string(); + break; + case 5: + message.confidence = reader.float(); + break; + case 6: + message.pageAnchor = $root.google.cloud.documentai.v1.Document.PageAnchor.decode(reader, reader.uint32()); + break; + case 7: + message.id = reader.string(); + break; + case 9: + message.normalizedValue = $root.google.cloud.documentai.v1.Document.Entity.NormalizedValue.decode(reader, reader.uint32()); + break; + case 10: + if (!(message.properties && message.properties.length)) + message.properties = []; + message.properties.push($root.google.cloud.documentai.v1.Document.Entity.decode(reader, reader.uint32())); + break; + case 11: + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); + break; + case 12: + message.redacted = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Entity message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Entity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Entity} Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entity.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Entity message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Entity + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Entity.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) { + var error = $root.google.cloud.documentai.v1.Document.TextAnchor.verify(message.textAnchor); + if (error) + return "textAnchor." + error; + } + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.mentionText != null && message.hasOwnProperty("mentionText")) + if (!$util.isString(message.mentionText)) + return "mentionText: string expected"; + if (message.mentionId != null && message.hasOwnProperty("mentionId")) + if (!$util.isString(message.mentionId)) + return "mentionId: string expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.pageAnchor != null && message.hasOwnProperty("pageAnchor")) { + var error = $root.google.cloud.documentai.v1.Document.PageAnchor.verify(message.pageAnchor); + if (error) + return "pageAnchor." + error; + } + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.normalizedValue != null && message.hasOwnProperty("normalizedValue")) { + var error = $root.google.cloud.documentai.v1.Document.Entity.NormalizedValue.verify(message.normalizedValue); + if (error) + return "normalizedValue." + error; + } + if (message.properties != null && message.hasOwnProperty("properties")) { + if (!Array.isArray(message.properties)) + return "properties: array expected"; + for (var i = 0; i < message.properties.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Entity.verify(message.properties[i]); + if (error) + return "properties." + error; + } + } + if (message.provenance != null && message.hasOwnProperty("provenance")) { + var error = $root.google.cloud.documentai.v1.Document.Provenance.verify(message.provenance); + if (error) + return "provenance." + error; + } + if (message.redacted != null && message.hasOwnProperty("redacted")) + if (typeof message.redacted !== "boolean") + return "redacted: boolean expected"; + return null; + }; + + /** + * Creates an Entity message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Entity + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Entity} Entity + */ + Entity.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Entity) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Entity(); + if (object.textAnchor != null) { + if (typeof object.textAnchor !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Entity.textAnchor: object expected"); + message.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.fromObject(object.textAnchor); + } + if (object.type != null) + message.type = String(object.type); + if (object.mentionText != null) + message.mentionText = String(object.mentionText); + if (object.mentionId != null) + message.mentionId = String(object.mentionId); + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.pageAnchor != null) { + if (typeof object.pageAnchor !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Entity.pageAnchor: object expected"); + message.pageAnchor = $root.google.cloud.documentai.v1.Document.PageAnchor.fromObject(object.pageAnchor); + } + if (object.id != null) + message.id = String(object.id); + if (object.normalizedValue != null) { + if (typeof object.normalizedValue !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Entity.normalizedValue: object expected"); + message.normalizedValue = $root.google.cloud.documentai.v1.Document.Entity.NormalizedValue.fromObject(object.normalizedValue); + } + if (object.properties) { + if (!Array.isArray(object.properties)) + throw TypeError(".google.cloud.documentai.v1.Document.Entity.properties: array expected"); + message.properties = []; + for (var i = 0; i < object.properties.length; ++i) { + if (typeof object.properties[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Entity.properties: object expected"); + message.properties[i] = $root.google.cloud.documentai.v1.Document.Entity.fromObject(object.properties[i]); + } + } + if (object.provenance != null) { + if (typeof object.provenance !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Entity.provenance: object expected"); + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.fromObject(object.provenance); + } + if (object.redacted != null) + message.redacted = Boolean(object.redacted); + return message; + }; + + /** + * Creates a plain object from an Entity message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Entity + * @static + * @param {google.cloud.documentai.v1.Document.Entity} message Entity + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Entity.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.properties = []; + if (options.defaults) { + object.textAnchor = null; + object.type = ""; + object.mentionText = ""; + object.mentionId = ""; + object.confidence = 0; + object.pageAnchor = null; + object.id = ""; + object.normalizedValue = null; + object.provenance = null; + object.redacted = false; + } + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + object.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.toObject(message.textAnchor, options); + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.mentionText != null && message.hasOwnProperty("mentionText")) + object.mentionText = message.mentionText; + if (message.mentionId != null && message.hasOwnProperty("mentionId")) + object.mentionId = message.mentionId; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.pageAnchor != null && message.hasOwnProperty("pageAnchor")) + object.pageAnchor = $root.google.cloud.documentai.v1.Document.PageAnchor.toObject(message.pageAnchor, options); + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.normalizedValue != null && message.hasOwnProperty("normalizedValue")) + object.normalizedValue = $root.google.cloud.documentai.v1.Document.Entity.NormalizedValue.toObject(message.normalizedValue, options); + if (message.properties && message.properties.length) { + object.properties = []; + for (var j = 0; j < message.properties.length; ++j) + object.properties[j] = $root.google.cloud.documentai.v1.Document.Entity.toObject(message.properties[j], options); + } + if (message.provenance != null && message.hasOwnProperty("provenance")) + object.provenance = $root.google.cloud.documentai.v1.Document.Provenance.toObject(message.provenance, options); + if (message.redacted != null && message.hasOwnProperty("redacted")) + object.redacted = message.redacted; + return object; + }; + + /** + * Converts this Entity to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Entity + * @instance + * @returns {Object.} JSON object + */ + Entity.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Entity.NormalizedValue = (function() { + + /** + * Properties of a NormalizedValue. + * @memberof google.cloud.documentai.v1.Document.Entity + * @interface INormalizedValue + * @property {google.type.IMoney|null} [moneyValue] NormalizedValue moneyValue + * @property {google.type.IDate|null} [dateValue] NormalizedValue dateValue + * @property {google.type.IDateTime|null} [datetimeValue] NormalizedValue datetimeValue + * @property {google.type.IPostalAddress|null} [addressValue] NormalizedValue addressValue + * @property {boolean|null} [booleanValue] NormalizedValue booleanValue + * @property {string|null} [text] NormalizedValue text + */ + + /** + * Constructs a new NormalizedValue. + * @memberof google.cloud.documentai.v1.Document.Entity + * @classdesc Represents a NormalizedValue. + * @implements INormalizedValue + * @constructor + * @param {google.cloud.documentai.v1.Document.Entity.INormalizedValue=} [properties] Properties to set + */ + function NormalizedValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NormalizedValue moneyValue. + * @member {google.type.IMoney|null|undefined} moneyValue + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @instance + */ + NormalizedValue.prototype.moneyValue = null; + + /** + * NormalizedValue dateValue. + * @member {google.type.IDate|null|undefined} dateValue + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @instance + */ + NormalizedValue.prototype.dateValue = null; + + /** + * NormalizedValue datetimeValue. + * @member {google.type.IDateTime|null|undefined} datetimeValue + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @instance + */ + NormalizedValue.prototype.datetimeValue = null; + + /** + * NormalizedValue addressValue. + * @member {google.type.IPostalAddress|null|undefined} addressValue + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @instance + */ + NormalizedValue.prototype.addressValue = null; + + /** + * NormalizedValue booleanValue. + * @member {boolean} booleanValue + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @instance + */ + NormalizedValue.prototype.booleanValue = false; + + /** + * NormalizedValue text. + * @member {string} text + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @instance + */ + NormalizedValue.prototype.text = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * NormalizedValue structuredValue. + * @member {"moneyValue"|"dateValue"|"datetimeValue"|"addressValue"|"booleanValue"|undefined} structuredValue + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @instance + */ + Object.defineProperty(NormalizedValue.prototype, "structuredValue", { + get: $util.oneOfGetter($oneOfFields = ["moneyValue", "dateValue", "datetimeValue", "addressValue", "booleanValue"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new NormalizedValue instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @static + * @param {google.cloud.documentai.v1.Document.Entity.INormalizedValue=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Entity.NormalizedValue} NormalizedValue instance + */ + NormalizedValue.create = function create(properties) { + return new NormalizedValue(properties); + }; + + /** + * Encodes the specified NormalizedValue message. Does not implicitly {@link google.cloud.documentai.v1.Document.Entity.NormalizedValue.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @static + * @param {google.cloud.documentai.v1.Document.Entity.INormalizedValue} message NormalizedValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NormalizedValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.moneyValue != null && Object.hasOwnProperty.call(message, "moneyValue")) + $root.google.type.Money.encode(message.moneyValue, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.dateValue != null && Object.hasOwnProperty.call(message, "dateValue")) + $root.google.type.Date.encode(message.dateValue, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.datetimeValue != null && Object.hasOwnProperty.call(message, "datetimeValue")) + $root.google.type.DateTime.encode(message.datetimeValue, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.addressValue != null && Object.hasOwnProperty.call(message, "addressValue")) + $root.google.type.PostalAddress.encode(message.addressValue, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.booleanValue != null && Object.hasOwnProperty.call(message, "booleanValue")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.booleanValue); + return writer; + }; + + /** + * Encodes the specified NormalizedValue message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Entity.NormalizedValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @static + * @param {google.cloud.documentai.v1.Document.Entity.INormalizedValue} message NormalizedValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NormalizedValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NormalizedValue message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Entity.NormalizedValue} NormalizedValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NormalizedValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Entity.NormalizedValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.moneyValue = $root.google.type.Money.decode(reader, reader.uint32()); + break; + case 3: + message.dateValue = $root.google.type.Date.decode(reader, reader.uint32()); + break; + case 4: + message.datetimeValue = $root.google.type.DateTime.decode(reader, reader.uint32()); + break; + case 5: + message.addressValue = $root.google.type.PostalAddress.decode(reader, reader.uint32()); + break; + case 6: + message.booleanValue = reader.bool(); + break; + case 1: + message.text = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NormalizedValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Entity.NormalizedValue} NormalizedValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NormalizedValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NormalizedValue message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NormalizedValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.moneyValue != null && message.hasOwnProperty("moneyValue")) { + properties.structuredValue = 1; + { + var error = $root.google.type.Money.verify(message.moneyValue); + if (error) + return "moneyValue." + error; + } + } + if (message.dateValue != null && message.hasOwnProperty("dateValue")) { + if (properties.structuredValue === 1) + return "structuredValue: multiple values"; + properties.structuredValue = 1; + { + var error = $root.google.type.Date.verify(message.dateValue); + if (error) + return "dateValue." + error; + } + } + if (message.datetimeValue != null && message.hasOwnProperty("datetimeValue")) { + if (properties.structuredValue === 1) + return "structuredValue: multiple values"; + properties.structuredValue = 1; + { + var error = $root.google.type.DateTime.verify(message.datetimeValue); + if (error) + return "datetimeValue." + error; + } + } + if (message.addressValue != null && message.hasOwnProperty("addressValue")) { + if (properties.structuredValue === 1) + return "structuredValue: multiple values"; + properties.structuredValue = 1; + { + var error = $root.google.type.PostalAddress.verify(message.addressValue); + if (error) + return "addressValue." + error; + } + } + if (message.booleanValue != null && message.hasOwnProperty("booleanValue")) { + if (properties.structuredValue === 1) + return "structuredValue: multiple values"; + properties.structuredValue = 1; + if (typeof message.booleanValue !== "boolean") + return "booleanValue: boolean expected"; + } + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + return null; + }; + + /** + * Creates a NormalizedValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Entity.NormalizedValue} NormalizedValue + */ + NormalizedValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Entity.NormalizedValue) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Entity.NormalizedValue(); + if (object.moneyValue != null) { + if (typeof object.moneyValue !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Entity.NormalizedValue.moneyValue: object expected"); + message.moneyValue = $root.google.type.Money.fromObject(object.moneyValue); + } + if (object.dateValue != null) { + if (typeof object.dateValue !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Entity.NormalizedValue.dateValue: object expected"); + message.dateValue = $root.google.type.Date.fromObject(object.dateValue); + } + if (object.datetimeValue != null) { + if (typeof object.datetimeValue !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Entity.NormalizedValue.datetimeValue: object expected"); + message.datetimeValue = $root.google.type.DateTime.fromObject(object.datetimeValue); + } + if (object.addressValue != null) { + if (typeof object.addressValue !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Entity.NormalizedValue.addressValue: object expected"); + message.addressValue = $root.google.type.PostalAddress.fromObject(object.addressValue); + } + if (object.booleanValue != null) + message.booleanValue = Boolean(object.booleanValue); + if (object.text != null) + message.text = String(object.text); + return message; + }; + + /** + * Creates a plain object from a NormalizedValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @static + * @param {google.cloud.documentai.v1.Document.Entity.NormalizedValue} message NormalizedValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NormalizedValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.text = ""; + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.moneyValue != null && message.hasOwnProperty("moneyValue")) { + object.moneyValue = $root.google.type.Money.toObject(message.moneyValue, options); + if (options.oneofs) + object.structuredValue = "moneyValue"; + } + if (message.dateValue != null && message.hasOwnProperty("dateValue")) { + object.dateValue = $root.google.type.Date.toObject(message.dateValue, options); + if (options.oneofs) + object.structuredValue = "dateValue"; + } + if (message.datetimeValue != null && message.hasOwnProperty("datetimeValue")) { + object.datetimeValue = $root.google.type.DateTime.toObject(message.datetimeValue, options); + if (options.oneofs) + object.structuredValue = "datetimeValue"; + } + if (message.addressValue != null && message.hasOwnProperty("addressValue")) { + object.addressValue = $root.google.type.PostalAddress.toObject(message.addressValue, options); + if (options.oneofs) + object.structuredValue = "addressValue"; + } + if (message.booleanValue != null && message.hasOwnProperty("booleanValue")) { + object.booleanValue = message.booleanValue; + if (options.oneofs) + object.structuredValue = "booleanValue"; + } + return object; + }; + + /** + * Converts this NormalizedValue to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @instance + * @returns {Object.} JSON object + */ + NormalizedValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NormalizedValue; + })(); + + return Entity; + })(); + + Document.EntityRelation = (function() { + + /** + * Properties of an EntityRelation. + * @memberof google.cloud.documentai.v1.Document + * @interface IEntityRelation + * @property {string|null} [subjectId] EntityRelation subjectId + * @property {string|null} [objectId] EntityRelation objectId + * @property {string|null} [relation] EntityRelation relation + */ + + /** + * Constructs a new EntityRelation. + * @memberof google.cloud.documentai.v1.Document + * @classdesc Represents an EntityRelation. + * @implements IEntityRelation + * @constructor + * @param {google.cloud.documentai.v1.Document.IEntityRelation=} [properties] Properties to set + */ + function EntityRelation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EntityRelation subjectId. + * @member {string} subjectId + * @memberof google.cloud.documentai.v1.Document.EntityRelation + * @instance + */ + EntityRelation.prototype.subjectId = ""; + + /** + * EntityRelation objectId. + * @member {string} objectId + * @memberof google.cloud.documentai.v1.Document.EntityRelation + * @instance + */ + EntityRelation.prototype.objectId = ""; + + /** + * EntityRelation relation. + * @member {string} relation + * @memberof google.cloud.documentai.v1.Document.EntityRelation + * @instance + */ + EntityRelation.prototype.relation = ""; + + /** + * Creates a new EntityRelation instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.EntityRelation + * @static + * @param {google.cloud.documentai.v1.Document.IEntityRelation=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.EntityRelation} EntityRelation instance + */ + EntityRelation.create = function create(properties) { + return new EntityRelation(properties); + }; + + /** + * Encodes the specified EntityRelation message. Does not implicitly {@link google.cloud.documentai.v1.Document.EntityRelation.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.EntityRelation + * @static + * @param {google.cloud.documentai.v1.Document.IEntityRelation} message EntityRelation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityRelation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.subjectId != null && Object.hasOwnProperty.call(message, "subjectId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.subjectId); + if (message.objectId != null && Object.hasOwnProperty.call(message, "objectId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.objectId); + if (message.relation != null && Object.hasOwnProperty.call(message, "relation")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.relation); + return writer; + }; + + /** + * Encodes the specified EntityRelation message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.EntityRelation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.EntityRelation + * @static + * @param {google.cloud.documentai.v1.Document.IEntityRelation} message EntityRelation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityRelation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EntityRelation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.EntityRelation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.EntityRelation} EntityRelation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityRelation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.EntityRelation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subjectId = reader.string(); + break; + case 2: + message.objectId = reader.string(); + break; + case 3: + message.relation = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EntityRelation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.EntityRelation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.EntityRelation} EntityRelation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityRelation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EntityRelation message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.EntityRelation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EntityRelation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.subjectId != null && message.hasOwnProperty("subjectId")) + if (!$util.isString(message.subjectId)) + return "subjectId: string expected"; + if (message.objectId != null && message.hasOwnProperty("objectId")) + if (!$util.isString(message.objectId)) + return "objectId: string expected"; + if (message.relation != null && message.hasOwnProperty("relation")) + if (!$util.isString(message.relation)) + return "relation: string expected"; + return null; + }; + + /** + * Creates an EntityRelation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.EntityRelation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.EntityRelation} EntityRelation + */ + EntityRelation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.EntityRelation) + return object; + var message = new $root.google.cloud.documentai.v1.Document.EntityRelation(); + if (object.subjectId != null) + message.subjectId = String(object.subjectId); + if (object.objectId != null) + message.objectId = String(object.objectId); + if (object.relation != null) + message.relation = String(object.relation); + return message; + }; + + /** + * Creates a plain object from an EntityRelation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.EntityRelation + * @static + * @param {google.cloud.documentai.v1.Document.EntityRelation} message EntityRelation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EntityRelation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.subjectId = ""; + object.objectId = ""; + object.relation = ""; + } + if (message.subjectId != null && message.hasOwnProperty("subjectId")) + object.subjectId = message.subjectId; + if (message.objectId != null && message.hasOwnProperty("objectId")) + object.objectId = message.objectId; + if (message.relation != null && message.hasOwnProperty("relation")) + object.relation = message.relation; + return object; + }; + + /** + * Converts this EntityRelation to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.EntityRelation + * @instance + * @returns {Object.} JSON object + */ + EntityRelation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EntityRelation; + })(); + + Document.TextAnchor = (function() { + + /** + * Properties of a TextAnchor. + * @memberof google.cloud.documentai.v1.Document + * @interface ITextAnchor + * @property {Array.|null} [textSegments] TextAnchor textSegments + * @property {string|null} [content] TextAnchor content + */ + + /** + * Constructs a new TextAnchor. + * @memberof google.cloud.documentai.v1.Document + * @classdesc Represents a TextAnchor. + * @implements ITextAnchor + * @constructor + * @param {google.cloud.documentai.v1.Document.ITextAnchor=} [properties] Properties to set + */ + function TextAnchor(properties) { + this.textSegments = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TextAnchor textSegments. + * @member {Array.} textSegments + * @memberof google.cloud.documentai.v1.Document.TextAnchor + * @instance + */ + TextAnchor.prototype.textSegments = $util.emptyArray; + + /** + * TextAnchor content. + * @member {string} content + * @memberof google.cloud.documentai.v1.Document.TextAnchor + * @instance + */ + TextAnchor.prototype.content = ""; + + /** + * Creates a new TextAnchor instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.TextAnchor + * @static + * @param {google.cloud.documentai.v1.Document.ITextAnchor=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.TextAnchor} TextAnchor instance + */ + TextAnchor.create = function create(properties) { + return new TextAnchor(properties); + }; + + /** + * Encodes the specified TextAnchor message. Does not implicitly {@link google.cloud.documentai.v1.Document.TextAnchor.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.TextAnchor + * @static + * @param {google.cloud.documentai.v1.Document.ITextAnchor} message TextAnchor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextAnchor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textSegments != null && message.textSegments.length) + for (var i = 0; i < message.textSegments.length; ++i) + $root.google.cloud.documentai.v1.Document.TextAnchor.TextSegment.encode(message.textSegments[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.content != null && Object.hasOwnProperty.call(message, "content")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.content); + return writer; + }; + + /** + * Encodes the specified TextAnchor message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.TextAnchor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.TextAnchor + * @static + * @param {google.cloud.documentai.v1.Document.ITextAnchor} message TextAnchor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextAnchor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextAnchor message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.TextAnchor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.TextAnchor} TextAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextAnchor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.TextAnchor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.textSegments && message.textSegments.length)) + message.textSegments = []; + message.textSegments.push($root.google.cloud.documentai.v1.Document.TextAnchor.TextSegment.decode(reader, reader.uint32())); + break; + case 2: + message.content = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TextAnchor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.TextAnchor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.TextAnchor} TextAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextAnchor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextAnchor message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.TextAnchor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextAnchor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textSegments != null && message.hasOwnProperty("textSegments")) { + if (!Array.isArray(message.textSegments)) + return "textSegments: array expected"; + for (var i = 0; i < message.textSegments.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.TextAnchor.TextSegment.verify(message.textSegments[i]); + if (error) + return "textSegments." + error; + } + } + if (message.content != null && message.hasOwnProperty("content")) + if (!$util.isString(message.content)) + return "content: string expected"; + return null; + }; + + /** + * Creates a TextAnchor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.TextAnchor + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.TextAnchor} TextAnchor + */ + TextAnchor.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.TextAnchor) + return object; + var message = new $root.google.cloud.documentai.v1.Document.TextAnchor(); + if (object.textSegments) { + if (!Array.isArray(object.textSegments)) + throw TypeError(".google.cloud.documentai.v1.Document.TextAnchor.textSegments: array expected"); + message.textSegments = []; + for (var i = 0; i < object.textSegments.length; ++i) { + if (typeof object.textSegments[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.TextAnchor.textSegments: object expected"); + message.textSegments[i] = $root.google.cloud.documentai.v1.Document.TextAnchor.TextSegment.fromObject(object.textSegments[i]); + } + } + if (object.content != null) + message.content = String(object.content); + return message; + }; + + /** + * Creates a plain object from a TextAnchor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.TextAnchor + * @static + * @param {google.cloud.documentai.v1.Document.TextAnchor} message TextAnchor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TextAnchor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.textSegments = []; + if (options.defaults) + object.content = ""; + if (message.textSegments && message.textSegments.length) { + object.textSegments = []; + for (var j = 0; j < message.textSegments.length; ++j) + object.textSegments[j] = $root.google.cloud.documentai.v1.Document.TextAnchor.TextSegment.toObject(message.textSegments[j], options); + } + if (message.content != null && message.hasOwnProperty("content")) + object.content = message.content; + return object; + }; + + /** + * Converts this TextAnchor to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.TextAnchor + * @instance + * @returns {Object.} JSON object + */ + TextAnchor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + TextAnchor.TextSegment = (function() { + + /** + * Properties of a TextSegment. + * @memberof google.cloud.documentai.v1.Document.TextAnchor + * @interface ITextSegment + * @property {number|Long|null} [startIndex] TextSegment startIndex + * @property {number|Long|null} [endIndex] TextSegment endIndex + */ + + /** + * Constructs a new TextSegment. + * @memberof google.cloud.documentai.v1.Document.TextAnchor + * @classdesc Represents a TextSegment. + * @implements ITextSegment + * @constructor + * @param {google.cloud.documentai.v1.Document.TextAnchor.ITextSegment=} [properties] Properties to set + */ + function TextSegment(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TextSegment startIndex. + * @member {number|Long} startIndex + * @memberof google.cloud.documentai.v1.Document.TextAnchor.TextSegment + * @instance + */ + TextSegment.prototype.startIndex = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * TextSegment endIndex. + * @member {number|Long} endIndex + * @memberof google.cloud.documentai.v1.Document.TextAnchor.TextSegment + * @instance + */ + TextSegment.prototype.endIndex = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new TextSegment instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.TextAnchor.TextSegment + * @static + * @param {google.cloud.documentai.v1.Document.TextAnchor.ITextSegment=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.TextAnchor.TextSegment} TextSegment instance + */ + TextSegment.create = function create(properties) { + return new TextSegment(properties); + }; + + /** + * Encodes the specified TextSegment message. Does not implicitly {@link google.cloud.documentai.v1.Document.TextAnchor.TextSegment.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.TextAnchor.TextSegment + * @static + * @param {google.cloud.documentai.v1.Document.TextAnchor.ITextSegment} message TextSegment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextSegment.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startIndex != null && Object.hasOwnProperty.call(message, "startIndex")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.startIndex); + if (message.endIndex != null && Object.hasOwnProperty.call(message, "endIndex")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.endIndex); + return writer; + }; + + /** + * Encodes the specified TextSegment message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.TextAnchor.TextSegment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.TextAnchor.TextSegment + * @static + * @param {google.cloud.documentai.v1.Document.TextAnchor.ITextSegment} message TextSegment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextSegment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextSegment message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.TextAnchor.TextSegment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.TextAnchor.TextSegment} TextSegment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextSegment.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.TextAnchor.TextSegment(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.startIndex = reader.int64(); + break; + case 2: + message.endIndex = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TextSegment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.TextAnchor.TextSegment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.TextAnchor.TextSegment} TextSegment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextSegment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextSegment message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.TextAnchor.TextSegment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextSegment.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startIndex != null && message.hasOwnProperty("startIndex")) + if (!$util.isInteger(message.startIndex) && !(message.startIndex && $util.isInteger(message.startIndex.low) && $util.isInteger(message.startIndex.high))) + return "startIndex: integer|Long expected"; + if (message.endIndex != null && message.hasOwnProperty("endIndex")) + if (!$util.isInteger(message.endIndex) && !(message.endIndex && $util.isInteger(message.endIndex.low) && $util.isInteger(message.endIndex.high))) + return "endIndex: integer|Long expected"; + return null; + }; + + /** + * Creates a TextSegment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.TextAnchor.TextSegment + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.TextAnchor.TextSegment} TextSegment + */ + TextSegment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.TextAnchor.TextSegment) + return object; + var message = new $root.google.cloud.documentai.v1.Document.TextAnchor.TextSegment(); + if (object.startIndex != null) + if ($util.Long) + (message.startIndex = $util.Long.fromValue(object.startIndex)).unsigned = false; + else if (typeof object.startIndex === "string") + message.startIndex = parseInt(object.startIndex, 10); + else if (typeof object.startIndex === "number") + message.startIndex = object.startIndex; + else if (typeof object.startIndex === "object") + message.startIndex = new $util.LongBits(object.startIndex.low >>> 0, object.startIndex.high >>> 0).toNumber(); + if (object.endIndex != null) + if ($util.Long) + (message.endIndex = $util.Long.fromValue(object.endIndex)).unsigned = false; + else if (typeof object.endIndex === "string") + message.endIndex = parseInt(object.endIndex, 10); + else if (typeof object.endIndex === "number") + message.endIndex = object.endIndex; + else if (typeof object.endIndex === "object") + message.endIndex = new $util.LongBits(object.endIndex.low >>> 0, object.endIndex.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a TextSegment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.TextAnchor.TextSegment + * @static + * @param {google.cloud.documentai.v1.Document.TextAnchor.TextSegment} message TextSegment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TextSegment.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.startIndex = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.startIndex = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.endIndex = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.endIndex = options.longs === String ? "0" : 0; + } + if (message.startIndex != null && message.hasOwnProperty("startIndex")) + if (typeof message.startIndex === "number") + object.startIndex = options.longs === String ? String(message.startIndex) : message.startIndex; + else + object.startIndex = options.longs === String ? $util.Long.prototype.toString.call(message.startIndex) : options.longs === Number ? new $util.LongBits(message.startIndex.low >>> 0, message.startIndex.high >>> 0).toNumber() : message.startIndex; + if (message.endIndex != null && message.hasOwnProperty("endIndex")) + if (typeof message.endIndex === "number") + object.endIndex = options.longs === String ? String(message.endIndex) : message.endIndex; + else + object.endIndex = options.longs === String ? $util.Long.prototype.toString.call(message.endIndex) : options.longs === Number ? new $util.LongBits(message.endIndex.low >>> 0, message.endIndex.high >>> 0).toNumber() : message.endIndex; + return object; + }; + + /** + * Converts this TextSegment to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.TextAnchor.TextSegment + * @instance + * @returns {Object.} JSON object + */ + TextSegment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TextSegment; + })(); + + return TextAnchor; + })(); + + Document.PageAnchor = (function() { + + /** + * Properties of a PageAnchor. + * @memberof google.cloud.documentai.v1.Document + * @interface IPageAnchor + * @property {Array.|null} [pageRefs] PageAnchor pageRefs + */ + + /** + * Constructs a new PageAnchor. + * @memberof google.cloud.documentai.v1.Document + * @classdesc Represents a PageAnchor. + * @implements IPageAnchor + * @constructor + * @param {google.cloud.documentai.v1.Document.IPageAnchor=} [properties] Properties to set + */ + function PageAnchor(properties) { + this.pageRefs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PageAnchor pageRefs. + * @member {Array.} pageRefs + * @memberof google.cloud.documentai.v1.Document.PageAnchor + * @instance + */ + PageAnchor.prototype.pageRefs = $util.emptyArray; + + /** + * Creates a new PageAnchor instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.PageAnchor + * @static + * @param {google.cloud.documentai.v1.Document.IPageAnchor=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.PageAnchor} PageAnchor instance + */ + PageAnchor.create = function create(properties) { + return new PageAnchor(properties); + }; + + /** + * Encodes the specified PageAnchor message. Does not implicitly {@link google.cloud.documentai.v1.Document.PageAnchor.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.PageAnchor + * @static + * @param {google.cloud.documentai.v1.Document.IPageAnchor} message PageAnchor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PageAnchor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageRefs != null && message.pageRefs.length) + for (var i = 0; i < message.pageRefs.length; ++i) + $root.google.cloud.documentai.v1.Document.PageAnchor.PageRef.encode(message.pageRefs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PageAnchor message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.PageAnchor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.PageAnchor + * @static + * @param {google.cloud.documentai.v1.Document.IPageAnchor} message PageAnchor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PageAnchor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PageAnchor message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.PageAnchor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.PageAnchor} PageAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PageAnchor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.PageAnchor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.pageRefs && message.pageRefs.length)) + message.pageRefs = []; + message.pageRefs.push($root.google.cloud.documentai.v1.Document.PageAnchor.PageRef.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PageAnchor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.PageAnchor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.PageAnchor} PageAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PageAnchor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PageAnchor message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.PageAnchor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PageAnchor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pageRefs != null && message.hasOwnProperty("pageRefs")) { + if (!Array.isArray(message.pageRefs)) + return "pageRefs: array expected"; + for (var i = 0; i < message.pageRefs.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.PageAnchor.PageRef.verify(message.pageRefs[i]); + if (error) + return "pageRefs." + error; + } + } + return null; + }; + + /** + * Creates a PageAnchor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.PageAnchor + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.PageAnchor} PageAnchor + */ + PageAnchor.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.PageAnchor) + return object; + var message = new $root.google.cloud.documentai.v1.Document.PageAnchor(); + if (object.pageRefs) { + if (!Array.isArray(object.pageRefs)) + throw TypeError(".google.cloud.documentai.v1.Document.PageAnchor.pageRefs: array expected"); + message.pageRefs = []; + for (var i = 0; i < object.pageRefs.length; ++i) { + if (typeof object.pageRefs[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.PageAnchor.pageRefs: object expected"); + message.pageRefs[i] = $root.google.cloud.documentai.v1.Document.PageAnchor.PageRef.fromObject(object.pageRefs[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a PageAnchor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.PageAnchor + * @static + * @param {google.cloud.documentai.v1.Document.PageAnchor} message PageAnchor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PageAnchor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.pageRefs = []; + if (message.pageRefs && message.pageRefs.length) { + object.pageRefs = []; + for (var j = 0; j < message.pageRefs.length; ++j) + object.pageRefs[j] = $root.google.cloud.documentai.v1.Document.PageAnchor.PageRef.toObject(message.pageRefs[j], options); + } + return object; + }; + + /** + * Converts this PageAnchor to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.PageAnchor + * @instance + * @returns {Object.} JSON object + */ + PageAnchor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + PageAnchor.PageRef = (function() { + + /** + * Properties of a PageRef. + * @memberof google.cloud.documentai.v1.Document.PageAnchor + * @interface IPageRef + * @property {number|Long|null} [page] PageRef page + * @property {google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType|null} [layoutType] PageRef layoutType + * @property {string|null} [layoutId] PageRef layoutId + * @property {google.cloud.documentai.v1.IBoundingPoly|null} [boundingPoly] PageRef boundingPoly + */ + + /** + * Constructs a new PageRef. + * @memberof google.cloud.documentai.v1.Document.PageAnchor + * @classdesc Represents a PageRef. + * @implements IPageRef + * @constructor + * @param {google.cloud.documentai.v1.Document.PageAnchor.IPageRef=} [properties] Properties to set + */ + function PageRef(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PageRef page. + * @member {number|Long} page + * @memberof google.cloud.documentai.v1.Document.PageAnchor.PageRef + * @instance + */ + PageRef.prototype.page = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * PageRef layoutType. + * @member {google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType} layoutType + * @memberof google.cloud.documentai.v1.Document.PageAnchor.PageRef + * @instance + */ + PageRef.prototype.layoutType = 0; + + /** + * PageRef layoutId. + * @member {string} layoutId + * @memberof google.cloud.documentai.v1.Document.PageAnchor.PageRef + * @instance + */ + PageRef.prototype.layoutId = ""; + + /** + * PageRef boundingPoly. + * @member {google.cloud.documentai.v1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.documentai.v1.Document.PageAnchor.PageRef + * @instance + */ + PageRef.prototype.boundingPoly = null; + + /** + * Creates a new PageRef instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.PageAnchor.PageRef + * @static + * @param {google.cloud.documentai.v1.Document.PageAnchor.IPageRef=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.PageAnchor.PageRef} PageRef instance + */ + PageRef.create = function create(properties) { + return new PageRef(properties); + }; + + /** + * Encodes the specified PageRef message. Does not implicitly {@link google.cloud.documentai.v1.Document.PageAnchor.PageRef.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.PageAnchor.PageRef + * @static + * @param {google.cloud.documentai.v1.Document.PageAnchor.IPageRef} message PageRef message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PageRef.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.page != null && Object.hasOwnProperty.call(message, "page")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.page); + if (message.layoutType != null && Object.hasOwnProperty.call(message, "layoutType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.layoutType); + if (message.layoutId != null && Object.hasOwnProperty.call(message, "layoutId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.layoutId); + if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) + $root.google.cloud.documentai.v1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PageRef message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.PageAnchor.PageRef.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.PageAnchor.PageRef + * @static + * @param {google.cloud.documentai.v1.Document.PageAnchor.IPageRef} message PageRef message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PageRef.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PageRef message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.PageAnchor.PageRef + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.PageAnchor.PageRef} PageRef + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PageRef.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.PageAnchor.PageRef(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.page = reader.int64(); + break; + case 2: + message.layoutType = reader.int32(); + break; + case 3: + message.layoutId = reader.string(); + break; + case 4: + message.boundingPoly = $root.google.cloud.documentai.v1.BoundingPoly.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PageRef message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.PageAnchor.PageRef + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.PageAnchor.PageRef} PageRef + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PageRef.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PageRef message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.PageAnchor.PageRef + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PageRef.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.page != null && message.hasOwnProperty("page")) + if (!$util.isInteger(message.page) && !(message.page && $util.isInteger(message.page.low) && $util.isInteger(message.page.high))) + return "page: integer|Long expected"; + if (message.layoutType != null && message.hasOwnProperty("layoutType")) + switch (message.layoutType) { + default: + return "layoutType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.layoutId != null && message.hasOwnProperty("layoutId")) + if (!$util.isString(message.layoutId)) + return "layoutId: string expected"; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { + var error = $root.google.cloud.documentai.v1.BoundingPoly.verify(message.boundingPoly); + if (error) + return "boundingPoly." + error; + } + return null; + }; + + /** + * Creates a PageRef message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.PageAnchor.PageRef + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.PageAnchor.PageRef} PageRef + */ + PageRef.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.PageAnchor.PageRef) + return object; + var message = new $root.google.cloud.documentai.v1.Document.PageAnchor.PageRef(); + if (object.page != null) + if ($util.Long) + (message.page = $util.Long.fromValue(object.page)).unsigned = false; + else if (typeof object.page === "string") + message.page = parseInt(object.page, 10); + else if (typeof object.page === "number") + message.page = object.page; + else if (typeof object.page === "object") + message.page = new $util.LongBits(object.page.low >>> 0, object.page.high >>> 0).toNumber(); + switch (object.layoutType) { + case "LAYOUT_TYPE_UNSPECIFIED": + case 0: + message.layoutType = 0; + break; + case "BLOCK": + case 1: + message.layoutType = 1; + break; + case "PARAGRAPH": + case 2: + message.layoutType = 2; + break; + case "LINE": + case 3: + message.layoutType = 3; + break; + case "TOKEN": + case 4: + message.layoutType = 4; + break; + case "VISUAL_ELEMENT": + case 5: + message.layoutType = 5; + break; + case "TABLE": + case 6: + message.layoutType = 6; + break; + case "FORM_FIELD": + case 7: + message.layoutType = 7; + break; + } + if (object.layoutId != null) + message.layoutId = String(object.layoutId); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.PageAnchor.PageRef.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.documentai.v1.BoundingPoly.fromObject(object.boundingPoly); + } + return message; + }; + + /** + * Creates a plain object from a PageRef message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.PageAnchor.PageRef + * @static + * @param {google.cloud.documentai.v1.Document.PageAnchor.PageRef} message PageRef + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PageRef.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.page = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.page = options.longs === String ? "0" : 0; + object.layoutType = options.enums === String ? "LAYOUT_TYPE_UNSPECIFIED" : 0; + object.layoutId = ""; + object.boundingPoly = null; + } + if (message.page != null && message.hasOwnProperty("page")) + if (typeof message.page === "number") + object.page = options.longs === String ? String(message.page) : message.page; + else + object.page = options.longs === String ? $util.Long.prototype.toString.call(message.page) : options.longs === Number ? new $util.LongBits(message.page.low >>> 0, message.page.high >>> 0).toNumber() : message.page; + if (message.layoutType != null && message.hasOwnProperty("layoutType")) + object.layoutType = options.enums === String ? $root.google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType[message.layoutType] : message.layoutType; + if (message.layoutId != null && message.hasOwnProperty("layoutId")) + object.layoutId = message.layoutId; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.documentai.v1.BoundingPoly.toObject(message.boundingPoly, options); + return object; + }; + + /** + * Converts this PageRef to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.PageAnchor.PageRef + * @instance + * @returns {Object.} JSON object + */ + PageRef.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * LayoutType enum. + * @name google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType + * @enum {number} + * @property {number} LAYOUT_TYPE_UNSPECIFIED=0 LAYOUT_TYPE_UNSPECIFIED value + * @property {number} BLOCK=1 BLOCK value + * @property {number} PARAGRAPH=2 PARAGRAPH value + * @property {number} LINE=3 LINE value + * @property {number} TOKEN=4 TOKEN value + * @property {number} VISUAL_ELEMENT=5 VISUAL_ELEMENT value + * @property {number} TABLE=6 TABLE value + * @property {number} FORM_FIELD=7 FORM_FIELD value + */ + PageRef.LayoutType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LAYOUT_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "BLOCK"] = 1; + values[valuesById[2] = "PARAGRAPH"] = 2; + values[valuesById[3] = "LINE"] = 3; + values[valuesById[4] = "TOKEN"] = 4; + values[valuesById[5] = "VISUAL_ELEMENT"] = 5; + values[valuesById[6] = "TABLE"] = 6; + values[valuesById[7] = "FORM_FIELD"] = 7; + return values; + })(); + + return PageRef; + })(); + + return PageAnchor; + })(); + + Document.Provenance = (function() { + + /** + * Properties of a Provenance. + * @memberof google.cloud.documentai.v1.Document + * @interface IProvenance + * @property {number|null} [revision] Provenance revision + * @property {number|null} [id] Provenance id + * @property {Array.|null} [parents] Provenance parents + * @property {google.cloud.documentai.v1.Document.Provenance.OperationType|null} [type] Provenance type + */ + + /** + * Constructs a new Provenance. + * @memberof google.cloud.documentai.v1.Document + * @classdesc Represents a Provenance. + * @implements IProvenance + * @constructor + * @param {google.cloud.documentai.v1.Document.IProvenance=} [properties] Properties to set + */ + function Provenance(properties) { + this.parents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Provenance revision. + * @member {number} revision + * @memberof google.cloud.documentai.v1.Document.Provenance + * @instance + */ + Provenance.prototype.revision = 0; + + /** + * Provenance id. + * @member {number} id + * @memberof google.cloud.documentai.v1.Document.Provenance + * @instance + */ + Provenance.prototype.id = 0; + + /** + * Provenance parents. + * @member {Array.} parents + * @memberof google.cloud.documentai.v1.Document.Provenance + * @instance + */ + Provenance.prototype.parents = $util.emptyArray; + + /** + * Provenance type. + * @member {google.cloud.documentai.v1.Document.Provenance.OperationType} type + * @memberof google.cloud.documentai.v1.Document.Provenance + * @instance + */ + Provenance.prototype.type = 0; + + /** + * Creates a new Provenance instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Provenance + * @static + * @param {google.cloud.documentai.v1.Document.IProvenance=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Provenance} Provenance instance + */ + Provenance.create = function create(properties) { + return new Provenance(properties); + }; + + /** + * Encodes the specified Provenance message. Does not implicitly {@link google.cloud.documentai.v1.Document.Provenance.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Provenance + * @static + * @param {google.cloud.documentai.v1.Document.IProvenance} message Provenance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Provenance.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.revision != null && Object.hasOwnProperty.call(message, "revision")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.revision); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.id); + if (message.parents != null && message.parents.length) + for (var i = 0; i < message.parents.length; ++i) + $root.google.cloud.documentai.v1.Document.Provenance.Parent.encode(message.parents[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.type); + return writer; + }; + + /** + * Encodes the specified Provenance message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Provenance.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Provenance + * @static + * @param {google.cloud.documentai.v1.Document.IProvenance} message Provenance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Provenance.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Provenance message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Provenance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Provenance} Provenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Provenance.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Provenance(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.revision = reader.int32(); + break; + case 2: + message.id = reader.int32(); + break; + case 3: + if (!(message.parents && message.parents.length)) + message.parents = []; + message.parents.push($root.google.cloud.documentai.v1.Document.Provenance.Parent.decode(reader, reader.uint32())); + break; + case 4: + message.type = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Provenance message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Provenance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Provenance} Provenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Provenance.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Provenance message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Provenance + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Provenance.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.revision != null && message.hasOwnProperty("revision")) + if (!$util.isInteger(message.revision)) + return "revision: integer expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id)) + return "id: integer expected"; + if (message.parents != null && message.hasOwnProperty("parents")) { + if (!Array.isArray(message.parents)) + return "parents: array expected"; + for (var i = 0; i < message.parents.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Provenance.Parent.verify(message.parents[i]); + if (error) + return "parents." + error; + } + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + return null; + }; + + /** + * Creates a Provenance message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Provenance + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Provenance} Provenance + */ + Provenance.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Provenance) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Provenance(); + if (object.revision != null) + message.revision = object.revision | 0; + if (object.id != null) + message.id = object.id | 0; + if (object.parents) { + if (!Array.isArray(object.parents)) + throw TypeError(".google.cloud.documentai.v1.Document.Provenance.parents: array expected"); + message.parents = []; + for (var i = 0; i < object.parents.length; ++i) { + if (typeof object.parents[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Provenance.parents: object expected"); + message.parents[i] = $root.google.cloud.documentai.v1.Document.Provenance.Parent.fromObject(object.parents[i]); + } + } + switch (object.type) { + case "OPERATION_TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "ADD": + case 1: + message.type = 1; + break; + case "REMOVE": + case 2: + message.type = 2; + break; + case "REPLACE": + case 3: + message.type = 3; + break; + case "EVAL_REQUESTED": + case 4: + message.type = 4; + break; + case "EVAL_APPROVED": + case 5: + message.type = 5; + break; + case "EVAL_SKIPPED": + case 6: + message.type = 6; + break; + } + return message; + }; + + /** + * Creates a plain object from a Provenance message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Provenance + * @static + * @param {google.cloud.documentai.v1.Document.Provenance} message Provenance + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Provenance.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.parents = []; + if (options.defaults) { + object.revision = 0; + object.id = 0; + object.type = options.enums === String ? "OPERATION_TYPE_UNSPECIFIED" : 0; + } + if (message.revision != null && message.hasOwnProperty("revision")) + object.revision = message.revision; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.parents && message.parents.length) { + object.parents = []; + for (var j = 0; j < message.parents.length; ++j) + object.parents[j] = $root.google.cloud.documentai.v1.Document.Provenance.Parent.toObject(message.parents[j], options); + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.documentai.v1.Document.Provenance.OperationType[message.type] : message.type; + return object; + }; + + /** + * Converts this Provenance to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Provenance + * @instance + * @returns {Object.} JSON object + */ + Provenance.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Provenance.Parent = (function() { + + /** + * Properties of a Parent. + * @memberof google.cloud.documentai.v1.Document.Provenance + * @interface IParent + * @property {number|null} [revision] Parent revision + * @property {number|null} [id] Parent id + */ + + /** + * Constructs a new Parent. + * @memberof google.cloud.documentai.v1.Document.Provenance + * @classdesc Represents a Parent. + * @implements IParent + * @constructor + * @param {google.cloud.documentai.v1.Document.Provenance.IParent=} [properties] Properties to set + */ + function Parent(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Parent revision. + * @member {number} revision + * @memberof google.cloud.documentai.v1.Document.Provenance.Parent + * @instance + */ + Parent.prototype.revision = 0; + + /** + * Parent id. + * @member {number} id + * @memberof google.cloud.documentai.v1.Document.Provenance.Parent + * @instance + */ + Parent.prototype.id = 0; + + /** + * Creates a new Parent instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Provenance.Parent + * @static + * @param {google.cloud.documentai.v1.Document.Provenance.IParent=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Provenance.Parent} Parent instance + */ + Parent.create = function create(properties) { + return new Parent(properties); + }; + + /** + * Encodes the specified Parent message. Does not implicitly {@link google.cloud.documentai.v1.Document.Provenance.Parent.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Provenance.Parent + * @static + * @param {google.cloud.documentai.v1.Document.Provenance.IParent} message Parent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Parent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.revision != null && Object.hasOwnProperty.call(message, "revision")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.revision); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.id); + return writer; + }; + + /** + * Encodes the specified Parent message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Provenance.Parent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Provenance.Parent + * @static + * @param {google.cloud.documentai.v1.Document.Provenance.IParent} message Parent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Parent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Parent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Provenance.Parent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Provenance.Parent} Parent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Parent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Provenance.Parent(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.revision = reader.int32(); + break; + case 2: + message.id = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Parent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Provenance.Parent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Provenance.Parent} Parent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Parent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Parent message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Provenance.Parent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Parent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.revision != null && message.hasOwnProperty("revision")) + if (!$util.isInteger(message.revision)) + return "revision: integer expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id)) + return "id: integer expected"; + return null; + }; + + /** + * Creates a Parent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Provenance.Parent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Provenance.Parent} Parent + */ + Parent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Provenance.Parent) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Provenance.Parent(); + if (object.revision != null) + message.revision = object.revision | 0; + if (object.id != null) + message.id = object.id | 0; + return message; + }; + + /** + * Creates a plain object from a Parent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Provenance.Parent + * @static + * @param {google.cloud.documentai.v1.Document.Provenance.Parent} message Parent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Parent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.revision = 0; + object.id = 0; + } + if (message.revision != null && message.hasOwnProperty("revision")) + object.revision = message.revision; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + return object; + }; + + /** + * Converts this Parent to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Provenance.Parent + * @instance + * @returns {Object.} JSON object + */ + Parent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Parent; + })(); + + /** + * OperationType enum. + * @name google.cloud.documentai.v1.Document.Provenance.OperationType + * @enum {number} + * @property {number} OPERATION_TYPE_UNSPECIFIED=0 OPERATION_TYPE_UNSPECIFIED value + * @property {number} ADD=1 ADD value + * @property {number} REMOVE=2 REMOVE value + * @property {number} REPLACE=3 REPLACE value + * @property {number} EVAL_REQUESTED=4 EVAL_REQUESTED value + * @property {number} EVAL_APPROVED=5 EVAL_APPROVED value + * @property {number} EVAL_SKIPPED=6 EVAL_SKIPPED value + */ + Provenance.OperationType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "OPERATION_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ADD"] = 1; + values[valuesById[2] = "REMOVE"] = 2; + values[valuesById[3] = "REPLACE"] = 3; + values[valuesById[4] = "EVAL_REQUESTED"] = 4; + values[valuesById[5] = "EVAL_APPROVED"] = 5; + values[valuesById[6] = "EVAL_SKIPPED"] = 6; + return values; + })(); + + return Provenance; + })(); + + Document.Revision = (function() { + + /** + * Properties of a Revision. + * @memberof google.cloud.documentai.v1.Document + * @interface IRevision + * @property {string|null} [agent] Revision agent + * @property {string|null} [processor] Revision processor + * @property {string|null} [id] Revision id + * @property {Array.|null} [parent] Revision parent + * @property {google.protobuf.ITimestamp|null} [createTime] Revision createTime + * @property {google.cloud.documentai.v1.Document.Revision.IHumanReview|null} [humanReview] Revision humanReview + */ + + /** + * Constructs a new Revision. + * @memberof google.cloud.documentai.v1.Document + * @classdesc Represents a Revision. + * @implements IRevision + * @constructor + * @param {google.cloud.documentai.v1.Document.IRevision=} [properties] Properties to set + */ + function Revision(properties) { + this.parent = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Revision agent. + * @member {string} agent + * @memberof google.cloud.documentai.v1.Document.Revision + * @instance + */ + Revision.prototype.agent = ""; + + /** + * Revision processor. + * @member {string} processor + * @memberof google.cloud.documentai.v1.Document.Revision + * @instance + */ + Revision.prototype.processor = ""; + + /** + * Revision id. + * @member {string} id + * @memberof google.cloud.documentai.v1.Document.Revision + * @instance + */ + Revision.prototype.id = ""; + + /** + * Revision parent. + * @member {Array.} parent + * @memberof google.cloud.documentai.v1.Document.Revision + * @instance + */ + Revision.prototype.parent = $util.emptyArray; + + /** + * Revision createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1.Document.Revision + * @instance + */ + Revision.prototype.createTime = null; + + /** + * Revision humanReview. + * @member {google.cloud.documentai.v1.Document.Revision.IHumanReview|null|undefined} humanReview + * @memberof google.cloud.documentai.v1.Document.Revision + * @instance + */ + Revision.prototype.humanReview = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Revision source. + * @member {"agent"|"processor"|undefined} source + * @memberof google.cloud.documentai.v1.Document.Revision + * @instance + */ + Object.defineProperty(Revision.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["agent", "processor"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Revision instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Revision + * @static + * @param {google.cloud.documentai.v1.Document.IRevision=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Revision} Revision instance + */ + Revision.create = function create(properties) { + return new Revision(properties); + }; + + /** + * Encodes the specified Revision message. Does not implicitly {@link google.cloud.documentai.v1.Document.Revision.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Revision + * @static + * @param {google.cloud.documentai.v1.Document.IRevision} message Revision message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Revision.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.parent != null && message.parent.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.parent.length; ++i) + writer.int32(message.parent[i]); + writer.ldelim(); + } + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.agent != null && Object.hasOwnProperty.call(message, "agent")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.agent); + if (message.processor != null && Object.hasOwnProperty.call(message, "processor")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.processor); + if (message.humanReview != null && Object.hasOwnProperty.call(message, "humanReview")) + $root.google.cloud.documentai.v1.Document.Revision.HumanReview.encode(message.humanReview, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Revision message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Revision.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Revision + * @static + * @param {google.cloud.documentai.v1.Document.IRevision} message Revision message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Revision.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Revision message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Revision + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Revision} Revision + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Revision.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Revision(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + message.agent = reader.string(); + break; + case 5: + message.processor = reader.string(); + break; + case 1: + message.id = reader.string(); + break; + case 2: + if (!(message.parent && message.parent.length)) + message.parent = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.parent.push(reader.int32()); + } else + message.parent.push(reader.int32()); + break; + case 3: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.humanReview = $root.google.cloud.documentai.v1.Document.Revision.HumanReview.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Revision message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Revision + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Revision} Revision + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Revision.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Revision message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Revision + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Revision.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.agent != null && message.hasOwnProperty("agent")) { + properties.source = 1; + if (!$util.isString(message.agent)) + return "agent: string expected"; + } + if (message.processor != null && message.hasOwnProperty("processor")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + if (!$util.isString(message.processor)) + return "processor: string expected"; + } + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.parent != null && message.hasOwnProperty("parent")) { + if (!Array.isArray(message.parent)) + return "parent: array expected"; + for (var i = 0; i < message.parent.length; ++i) + if (!$util.isInteger(message.parent[i])) + return "parent: integer[] expected"; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.humanReview != null && message.hasOwnProperty("humanReview")) { + var error = $root.google.cloud.documentai.v1.Document.Revision.HumanReview.verify(message.humanReview); + if (error) + return "humanReview." + error; + } + return null; + }; + + /** + * Creates a Revision message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Revision + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Revision} Revision + */ + Revision.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Revision) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Revision(); + if (object.agent != null) + message.agent = String(object.agent); + if (object.processor != null) + message.processor = String(object.processor); + if (object.id != null) + message.id = String(object.id); + if (object.parent) { + if (!Array.isArray(object.parent)) + throw TypeError(".google.cloud.documentai.v1.Document.Revision.parent: array expected"); + message.parent = []; + for (var i = 0; i < object.parent.length; ++i) + message.parent[i] = object.parent[i] | 0; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Revision.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.humanReview != null) { + if (typeof object.humanReview !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Revision.humanReview: object expected"); + message.humanReview = $root.google.cloud.documentai.v1.Document.Revision.HumanReview.fromObject(object.humanReview); + } + return message; + }; + + /** + * Creates a plain object from a Revision message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Revision + * @static + * @param {google.cloud.documentai.v1.Document.Revision} message Revision + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Revision.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.parent = []; + if (options.defaults) { + object.id = ""; + object.createTime = null; + object.humanReview = null; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.parent && message.parent.length) { + object.parent = []; + for (var j = 0; j < message.parent.length; ++j) + object.parent[j] = message.parent[j]; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.agent != null && message.hasOwnProperty("agent")) { + object.agent = message.agent; + if (options.oneofs) + object.source = "agent"; + } + if (message.processor != null && message.hasOwnProperty("processor")) { + object.processor = message.processor; + if (options.oneofs) + object.source = "processor"; + } + if (message.humanReview != null && message.hasOwnProperty("humanReview")) + object.humanReview = $root.google.cloud.documentai.v1.Document.Revision.HumanReview.toObject(message.humanReview, options); + return object; + }; + + /** + * Converts this Revision to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Revision + * @instance + * @returns {Object.} JSON object + */ + Revision.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Revision.HumanReview = (function() { + + /** + * Properties of a HumanReview. + * @memberof google.cloud.documentai.v1.Document.Revision + * @interface IHumanReview + * @property {string|null} [state] HumanReview state + * @property {string|null} [stateMessage] HumanReview stateMessage + */ + + /** + * Constructs a new HumanReview. + * @memberof google.cloud.documentai.v1.Document.Revision + * @classdesc Represents a HumanReview. + * @implements IHumanReview + * @constructor + * @param {google.cloud.documentai.v1.Document.Revision.IHumanReview=} [properties] Properties to set + */ + function HumanReview(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HumanReview state. + * @member {string} state + * @memberof google.cloud.documentai.v1.Document.Revision.HumanReview + * @instance + */ + HumanReview.prototype.state = ""; + + /** + * HumanReview stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1.Document.Revision.HumanReview + * @instance + */ + HumanReview.prototype.stateMessage = ""; + + /** + * Creates a new HumanReview instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Revision.HumanReview + * @static + * @param {google.cloud.documentai.v1.Document.Revision.IHumanReview=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Revision.HumanReview} HumanReview instance + */ + HumanReview.create = function create(properties) { + return new HumanReview(properties); + }; + + /** + * Encodes the specified HumanReview message. Does not implicitly {@link google.cloud.documentai.v1.Document.Revision.HumanReview.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Revision.HumanReview + * @static + * @param {google.cloud.documentai.v1.Document.Revision.IHumanReview} message HumanReview message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HumanReview.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.state); + if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); + return writer; + }; + + /** + * Encodes the specified HumanReview message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Revision.HumanReview.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Revision.HumanReview + * @static + * @param {google.cloud.documentai.v1.Document.Revision.IHumanReview} message HumanReview message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HumanReview.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HumanReview message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Revision.HumanReview + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Revision.HumanReview} HumanReview + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HumanReview.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Revision.HumanReview(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.string(); + break; + case 2: + message.stateMessage = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HumanReview message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Revision.HumanReview + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Revision.HumanReview} HumanReview + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HumanReview.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HumanReview message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Revision.HumanReview + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HumanReview.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.state != null && message.hasOwnProperty("state")) + if (!$util.isString(message.state)) + return "state: string expected"; + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + if (!$util.isString(message.stateMessage)) + return "stateMessage: string expected"; + return null; + }; + + /** + * Creates a HumanReview message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Revision.HumanReview + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Revision.HumanReview} HumanReview + */ + HumanReview.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Revision.HumanReview) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Revision.HumanReview(); + if (object.state != null) + message.state = String(object.state); + if (object.stateMessage != null) + message.stateMessage = String(object.stateMessage); + return message; + }; + + /** + * Creates a plain object from a HumanReview message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Revision.HumanReview + * @static + * @param {google.cloud.documentai.v1.Document.Revision.HumanReview} message HumanReview + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HumanReview.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = ""; + object.stateMessage = ""; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = message.state; + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + object.stateMessage = message.stateMessage; + return object; + }; + + /** + * Converts this HumanReview to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Revision.HumanReview + * @instance + * @returns {Object.} JSON object + */ + HumanReview.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HumanReview; + })(); + + return Revision; + })(); + + Document.TextChange = (function() { + + /** + * Properties of a TextChange. + * @memberof google.cloud.documentai.v1.Document + * @interface ITextChange + * @property {google.cloud.documentai.v1.Document.ITextAnchor|null} [textAnchor] TextChange textAnchor + * @property {string|null} [changedText] TextChange changedText + * @property {Array.|null} [provenance] TextChange provenance + */ + + /** + * Constructs a new TextChange. + * @memberof google.cloud.documentai.v1.Document + * @classdesc Represents a TextChange. + * @implements ITextChange + * @constructor + * @param {google.cloud.documentai.v1.Document.ITextChange=} [properties] Properties to set + */ + function TextChange(properties) { + this.provenance = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TextChange textAnchor. + * @member {google.cloud.documentai.v1.Document.ITextAnchor|null|undefined} textAnchor + * @memberof google.cloud.documentai.v1.Document.TextChange + * @instance + */ + TextChange.prototype.textAnchor = null; + + /** + * TextChange changedText. + * @member {string} changedText + * @memberof google.cloud.documentai.v1.Document.TextChange + * @instance + */ + TextChange.prototype.changedText = ""; + + /** + * TextChange provenance. + * @member {Array.} provenance + * @memberof google.cloud.documentai.v1.Document.TextChange + * @instance + */ + TextChange.prototype.provenance = $util.emptyArray; + + /** + * Creates a new TextChange instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.TextChange + * @static + * @param {google.cloud.documentai.v1.Document.ITextChange=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.TextChange} TextChange instance + */ + TextChange.create = function create(properties) { + return new TextChange(properties); + }; + + /** + * Encodes the specified TextChange message. Does not implicitly {@link google.cloud.documentai.v1.Document.TextChange.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.TextChange + * @static + * @param {google.cloud.documentai.v1.Document.ITextChange} message TextChange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextChange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textAnchor != null && Object.hasOwnProperty.call(message, "textAnchor")) + $root.google.cloud.documentai.v1.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.changedText != null && Object.hasOwnProperty.call(message, "changedText")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.changedText); + if (message.provenance != null && message.provenance.length) + for (var i = 0; i < message.provenance.length; ++i) + $root.google.cloud.documentai.v1.Document.Provenance.encode(message.provenance[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TextChange message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.TextChange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.TextChange + * @static + * @param {google.cloud.documentai.v1.Document.ITextChange} message TextChange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextChange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextChange message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.TextChange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.TextChange} TextChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextChange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.TextChange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.decode(reader, reader.uint32()); + break; + case 2: + message.changedText = reader.string(); + break; + case 3: + if (!(message.provenance && message.provenance.length)) + message.provenance = []; + message.provenance.push($root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TextChange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.TextChange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.TextChange} TextChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextChange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextChange message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.TextChange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextChange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) { + var error = $root.google.cloud.documentai.v1.Document.TextAnchor.verify(message.textAnchor); + if (error) + return "textAnchor." + error; + } + if (message.changedText != null && message.hasOwnProperty("changedText")) + if (!$util.isString(message.changedText)) + return "changedText: string expected"; + if (message.provenance != null && message.hasOwnProperty("provenance")) { + if (!Array.isArray(message.provenance)) + return "provenance: array expected"; + for (var i = 0; i < message.provenance.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Provenance.verify(message.provenance[i]); + if (error) + return "provenance." + error; + } + } + return null; + }; + + /** + * Creates a TextChange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.TextChange + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.TextChange} TextChange + */ + TextChange.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.TextChange) + return object; + var message = new $root.google.cloud.documentai.v1.Document.TextChange(); + if (object.textAnchor != null) { + if (typeof object.textAnchor !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.TextChange.textAnchor: object expected"); + message.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.fromObject(object.textAnchor); + } + if (object.changedText != null) + message.changedText = String(object.changedText); + if (object.provenance) { + if (!Array.isArray(object.provenance)) + throw TypeError(".google.cloud.documentai.v1.Document.TextChange.provenance: array expected"); + message.provenance = []; + for (var i = 0; i < object.provenance.length; ++i) { + if (typeof object.provenance[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.TextChange.provenance: object expected"); + message.provenance[i] = $root.google.cloud.documentai.v1.Document.Provenance.fromObject(object.provenance[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TextChange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.TextChange + * @static + * @param {google.cloud.documentai.v1.Document.TextChange} message TextChange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TextChange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.provenance = []; + if (options.defaults) { + object.textAnchor = null; + object.changedText = ""; + } + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + object.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.toObject(message.textAnchor, options); + if (message.changedText != null && message.hasOwnProperty("changedText")) + object.changedText = message.changedText; + if (message.provenance && message.provenance.length) { + object.provenance = []; + for (var j = 0; j < message.provenance.length; ++j) + object.provenance[j] = $root.google.cloud.documentai.v1.Document.Provenance.toObject(message.provenance[j], options); + } + return object; + }; + + /** + * Converts this TextChange to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.TextChange + * @instance + * @returns {Object.} JSON object + */ + TextChange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TextChange; + })(); + + return Document; + })(); + + v1.Vertex = (function() { + + /** + * Properties of a Vertex. + * @memberof google.cloud.documentai.v1 + * @interface IVertex + * @property {number|null} [x] Vertex x + * @property {number|null} [y] Vertex y + */ + + /** + * Constructs a new Vertex. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a Vertex. + * @implements IVertex + * @constructor + * @param {google.cloud.documentai.v1.IVertex=} [properties] Properties to set + */ + function Vertex(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Vertex x. + * @member {number} x + * @memberof google.cloud.documentai.v1.Vertex + * @instance + */ + Vertex.prototype.x = 0; + + /** + * Vertex y. + * @member {number} y + * @memberof google.cloud.documentai.v1.Vertex + * @instance + */ + Vertex.prototype.y = 0; + + /** + * Creates a new Vertex instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Vertex + * @static + * @param {google.cloud.documentai.v1.IVertex=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Vertex} Vertex instance + */ + Vertex.create = function create(properties) { + return new Vertex(properties); + }; + + /** + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.documentai.v1.Vertex.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Vertex + * @static + * @param {google.cloud.documentai.v1.IVertex} message Vertex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Vertex.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.x != null && Object.hasOwnProperty.call(message, "x")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); + if (message.y != null && Object.hasOwnProperty.call(message, "y")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); + return writer; + }; + + /** + * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Vertex.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Vertex + * @static + * @param {google.cloud.documentai.v1.IVertex} message Vertex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Vertex.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Vertex message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Vertex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Vertex} Vertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Vertex.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Vertex(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.x = reader.int32(); + break; + case 2: + message.y = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Vertex message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Vertex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Vertex} Vertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Vertex.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Vertex message. + * @function verify + * @memberof google.cloud.documentai.v1.Vertex + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Vertex.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.x != null && message.hasOwnProperty("x")) + if (!$util.isInteger(message.x)) + return "x: integer expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (!$util.isInteger(message.y)) + return "y: integer expected"; + return null; + }; + + /** + * Creates a Vertex message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Vertex + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Vertex} Vertex + */ + Vertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Vertex) + return object; + var message = new $root.google.cloud.documentai.v1.Vertex(); + if (object.x != null) + message.x = object.x | 0; + if (object.y != null) + message.y = object.y | 0; + return message; + }; + + /** + * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Vertex + * @static + * @param {google.cloud.documentai.v1.Vertex} message Vertex + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Vertex.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.x = 0; + object.y = 0; + } + if (message.x != null && message.hasOwnProperty("x")) + object.x = message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = message.y; + return object; + }; + + /** + * Converts this Vertex to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Vertex + * @instance + * @returns {Object.} JSON object + */ + Vertex.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Vertex; + })(); + + v1.NormalizedVertex = (function() { + + /** + * Properties of a NormalizedVertex. + * @memberof google.cloud.documentai.v1 + * @interface INormalizedVertex + * @property {number|null} [x] NormalizedVertex x + * @property {number|null} [y] NormalizedVertex y + */ + + /** + * Constructs a new NormalizedVertex. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a NormalizedVertex. + * @implements INormalizedVertex + * @constructor + * @param {google.cloud.documentai.v1.INormalizedVertex=} [properties] Properties to set + */ + function NormalizedVertex(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NormalizedVertex x. + * @member {number} x + * @memberof google.cloud.documentai.v1.NormalizedVertex + * @instance + */ + NormalizedVertex.prototype.x = 0; + + /** + * NormalizedVertex y. + * @member {number} y + * @memberof google.cloud.documentai.v1.NormalizedVertex + * @instance + */ + NormalizedVertex.prototype.y = 0; + + /** + * Creates a new NormalizedVertex instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.NormalizedVertex + * @static + * @param {google.cloud.documentai.v1.INormalizedVertex=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.NormalizedVertex} NormalizedVertex instance + */ + NormalizedVertex.create = function create(properties) { + return new NormalizedVertex(properties); + }; + + /** + * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.documentai.v1.NormalizedVertex.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.NormalizedVertex + * @static + * @param {google.cloud.documentai.v1.INormalizedVertex} message NormalizedVertex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NormalizedVertex.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.x != null && Object.hasOwnProperty.call(message, "x")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); + if (message.y != null && Object.hasOwnProperty.call(message, "y")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); + return writer; + }; + + /** + * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.NormalizedVertex.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.NormalizedVertex + * @static + * @param {google.cloud.documentai.v1.INormalizedVertex} message NormalizedVertex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NormalizedVertex.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.NormalizedVertex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.NormalizedVertex} NormalizedVertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NormalizedVertex.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.NormalizedVertex(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.x = reader.float(); + break; + case 2: + message.y = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.NormalizedVertex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.NormalizedVertex} NormalizedVertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NormalizedVertex.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NormalizedVertex message. + * @function verify + * @memberof google.cloud.documentai.v1.NormalizedVertex + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NormalizedVertex.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.x != null && message.hasOwnProperty("x")) + if (typeof message.x !== "number") + return "x: number expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (typeof message.y !== "number") + return "y: number expected"; + return null; + }; + + /** + * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.NormalizedVertex + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.NormalizedVertex} NormalizedVertex + */ + NormalizedVertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.NormalizedVertex) + return object; + var message = new $root.google.cloud.documentai.v1.NormalizedVertex(); + if (object.x != null) + message.x = Number(object.x); + if (object.y != null) + message.y = Number(object.y); + return message; + }; + + /** + * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.NormalizedVertex + * @static + * @param {google.cloud.documentai.v1.NormalizedVertex} message NormalizedVertex + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NormalizedVertex.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.x = 0; + object.y = 0; + } + if (message.x != null && message.hasOwnProperty("x")) + object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; + return object; + }; + + /** + * Converts this NormalizedVertex to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.NormalizedVertex + * @instance + * @returns {Object.} JSON object + */ + NormalizedVertex.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NormalizedVertex; + })(); + + v1.BoundingPoly = (function() { + + /** + * Properties of a BoundingPoly. + * @memberof google.cloud.documentai.v1 + * @interface IBoundingPoly + * @property {Array.|null} [vertices] BoundingPoly vertices + * @property {Array.|null} [normalizedVertices] BoundingPoly normalizedVertices + */ + + /** + * Constructs a new BoundingPoly. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a BoundingPoly. + * @implements IBoundingPoly + * @constructor + * @param {google.cloud.documentai.v1.IBoundingPoly=} [properties] Properties to set + */ + function BoundingPoly(properties) { + this.vertices = []; + this.normalizedVertices = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BoundingPoly vertices. + * @member {Array.} vertices + * @memberof google.cloud.documentai.v1.BoundingPoly + * @instance + */ + BoundingPoly.prototype.vertices = $util.emptyArray; + + /** + * BoundingPoly normalizedVertices. + * @member {Array.} normalizedVertices + * @memberof google.cloud.documentai.v1.BoundingPoly + * @instance + */ + BoundingPoly.prototype.normalizedVertices = $util.emptyArray; + + /** + * Creates a new BoundingPoly instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.BoundingPoly + * @static + * @param {google.cloud.documentai.v1.IBoundingPoly=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.BoundingPoly} BoundingPoly instance + */ + BoundingPoly.create = function create(properties) { + return new BoundingPoly(properties); + }; + + /** + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.documentai.v1.BoundingPoly.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.BoundingPoly + * @static + * @param {google.cloud.documentai.v1.IBoundingPoly} message BoundingPoly message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoundingPoly.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.vertices != null && message.vertices.length) + for (var i = 0; i < message.vertices.length; ++i) + $root.google.cloud.documentai.v1.Vertex.encode(message.vertices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.normalizedVertices != null && message.normalizedVertices.length) + for (var i = 0; i < message.normalizedVertices.length; ++i) + $root.google.cloud.documentai.v1.NormalizedVertex.encode(message.normalizedVertices[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BoundingPoly.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.BoundingPoly + * @static + * @param {google.cloud.documentai.v1.IBoundingPoly} message BoundingPoly message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.BoundingPoly + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.BoundingPoly} BoundingPoly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoundingPoly.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.BoundingPoly(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.vertices && message.vertices.length)) + message.vertices = []; + message.vertices.push($root.google.cloud.documentai.v1.Vertex.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.normalizedVertices && message.normalizedVertices.length)) + message.normalizedVertices = []; + message.normalizedVertices.push($root.google.cloud.documentai.v1.NormalizedVertex.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.BoundingPoly + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.BoundingPoly} BoundingPoly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoundingPoly.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BoundingPoly message. + * @function verify + * @memberof google.cloud.documentai.v1.BoundingPoly + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoundingPoly.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.vertices != null && message.hasOwnProperty("vertices")) { + if (!Array.isArray(message.vertices)) + return "vertices: array expected"; + for (var i = 0; i < message.vertices.length; ++i) { + var error = $root.google.cloud.documentai.v1.Vertex.verify(message.vertices[i]); + if (error) + return "vertices." + error; + } + } + if (message.normalizedVertices != null && message.hasOwnProperty("normalizedVertices")) { + if (!Array.isArray(message.normalizedVertices)) + return "normalizedVertices: array expected"; + for (var i = 0; i < message.normalizedVertices.length; ++i) { + var error = $root.google.cloud.documentai.v1.NormalizedVertex.verify(message.normalizedVertices[i]); + if (error) + return "normalizedVertices." + error; + } + } + return null; + }; + + /** + * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.BoundingPoly + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.BoundingPoly} BoundingPoly + */ + BoundingPoly.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.BoundingPoly) + return object; + var message = new $root.google.cloud.documentai.v1.BoundingPoly(); + if (object.vertices) { + if (!Array.isArray(object.vertices)) + throw TypeError(".google.cloud.documentai.v1.BoundingPoly.vertices: array expected"); + message.vertices = []; + for (var i = 0; i < object.vertices.length; ++i) { + if (typeof object.vertices[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.BoundingPoly.vertices: object expected"); + message.vertices[i] = $root.google.cloud.documentai.v1.Vertex.fromObject(object.vertices[i]); + } + } + if (object.normalizedVertices) { + if (!Array.isArray(object.normalizedVertices)) + throw TypeError(".google.cloud.documentai.v1.BoundingPoly.normalizedVertices: array expected"); + message.normalizedVertices = []; + for (var i = 0; i < object.normalizedVertices.length; ++i) { + if (typeof object.normalizedVertices[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.BoundingPoly.normalizedVertices: object expected"); + message.normalizedVertices[i] = $root.google.cloud.documentai.v1.NormalizedVertex.fromObject(object.normalizedVertices[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.BoundingPoly + * @static + * @param {google.cloud.documentai.v1.BoundingPoly} message BoundingPoly + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoundingPoly.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.vertices = []; + object.normalizedVertices = []; + } + if (message.vertices && message.vertices.length) { + object.vertices = []; + for (var j = 0; j < message.vertices.length; ++j) + object.vertices[j] = $root.google.cloud.documentai.v1.Vertex.toObject(message.vertices[j], options); + } + if (message.normalizedVertices && message.normalizedVertices.length) { + object.normalizedVertices = []; + for (var j = 0; j < message.normalizedVertices.length; ++j) + object.normalizedVertices[j] = $root.google.cloud.documentai.v1.NormalizedVertex.toObject(message.normalizedVertices[j], options); + } + return object; + }; + + /** + * Converts this BoundingPoly to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.BoundingPoly + * @instance + * @returns {Object.} JSON object + */ + BoundingPoly.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BoundingPoly; + })(); + + v1.RawDocument = (function() { + + /** + * Properties of a RawDocument. + * @memberof google.cloud.documentai.v1 + * @interface IRawDocument + * @property {Uint8Array|null} [content] RawDocument content + * @property {string|null} [mimeType] RawDocument mimeType + */ + + /** + * Constructs a new RawDocument. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a RawDocument. + * @implements IRawDocument + * @constructor + * @param {google.cloud.documentai.v1.IRawDocument=} [properties] Properties to set + */ + function RawDocument(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RawDocument content. + * @member {Uint8Array} content + * @memberof google.cloud.documentai.v1.RawDocument + * @instance + */ + RawDocument.prototype.content = $util.newBuffer([]); + + /** + * RawDocument mimeType. + * @member {string} mimeType + * @memberof google.cloud.documentai.v1.RawDocument + * @instance + */ + RawDocument.prototype.mimeType = ""; + + /** + * Creates a new RawDocument instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.RawDocument + * @static + * @param {google.cloud.documentai.v1.IRawDocument=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.RawDocument} RawDocument instance + */ + RawDocument.create = function create(properties) { + return new RawDocument(properties); + }; + + /** + * Encodes the specified RawDocument message. Does not implicitly {@link google.cloud.documentai.v1.RawDocument.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.RawDocument + * @static + * @param {google.cloud.documentai.v1.IRawDocument} message RawDocument message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RawDocument.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.content != null && Object.hasOwnProperty.call(message, "content")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.content); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); + return writer; + }; + + /** + * Encodes the specified RawDocument message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.RawDocument.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.RawDocument + * @static + * @param {google.cloud.documentai.v1.IRawDocument} message RawDocument message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RawDocument.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RawDocument message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.RawDocument + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.RawDocument} RawDocument + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RawDocument.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.RawDocument(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.content = reader.bytes(); + break; + case 2: + message.mimeType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RawDocument message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.RawDocument + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.RawDocument} RawDocument + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RawDocument.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RawDocument message. + * @function verify + * @memberof google.cloud.documentai.v1.RawDocument + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RawDocument.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.content != null && message.hasOwnProperty("content")) + if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) + return "content: buffer expected"; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + return null; + }; + + /** + * Creates a RawDocument message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.RawDocument + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.RawDocument} RawDocument + */ + RawDocument.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.RawDocument) + return object; + var message = new $root.google.cloud.documentai.v1.RawDocument(); + if (object.content != null) + if (typeof object.content === "string") + $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); + else if (object.content.length) + message.content = object.content; + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + return message; + }; + + /** + * Creates a plain object from a RawDocument message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.RawDocument + * @static + * @param {google.cloud.documentai.v1.RawDocument} message RawDocument + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RawDocument.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.content = ""; + else { + object.content = []; + if (options.bytes !== Array) + object.content = $util.newBuffer(object.content); + } + object.mimeType = ""; + } + if (message.content != null && message.hasOwnProperty("content")) + object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + return object; + }; + + /** + * Converts this RawDocument to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.RawDocument + * @instance + * @returns {Object.} JSON object + */ + RawDocument.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RawDocument; + })(); + + v1.GcsDocument = (function() { + + /** + * Properties of a GcsDocument. + * @memberof google.cloud.documentai.v1 + * @interface IGcsDocument + * @property {string|null} [gcsUri] GcsDocument gcsUri + * @property {string|null} [mimeType] GcsDocument mimeType + */ + + /** + * Constructs a new GcsDocument. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a GcsDocument. + * @implements IGcsDocument + * @constructor + * @param {google.cloud.documentai.v1.IGcsDocument=} [properties] Properties to set + */ + function GcsDocument(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GcsDocument gcsUri. + * @member {string} gcsUri + * @memberof google.cloud.documentai.v1.GcsDocument + * @instance + */ + GcsDocument.prototype.gcsUri = ""; + + /** + * GcsDocument mimeType. + * @member {string} mimeType + * @memberof google.cloud.documentai.v1.GcsDocument + * @instance + */ + GcsDocument.prototype.mimeType = ""; + + /** + * Creates a new GcsDocument instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.GcsDocument + * @static + * @param {google.cloud.documentai.v1.IGcsDocument=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.GcsDocument} GcsDocument instance + */ + GcsDocument.create = function create(properties) { + return new GcsDocument(properties); + }; + + /** + * Encodes the specified GcsDocument message. Does not implicitly {@link google.cloud.documentai.v1.GcsDocument.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.GcsDocument + * @static + * @param {google.cloud.documentai.v1.IGcsDocument} message GcsDocument message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsDocument.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsUri != null && Object.hasOwnProperty.call(message, "gcsUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsUri); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); + return writer; + }; + + /** + * Encodes the specified GcsDocument message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.GcsDocument.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.GcsDocument + * @static + * @param {google.cloud.documentai.v1.IGcsDocument} message GcsDocument message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsDocument.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GcsDocument message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.GcsDocument + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.GcsDocument} GcsDocument + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsDocument.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.GcsDocument(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsUri = reader.string(); + break; + case 2: + message.mimeType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GcsDocument message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.GcsDocument + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.GcsDocument} GcsDocument + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsDocument.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GcsDocument message. + * @function verify + * @memberof google.cloud.documentai.v1.GcsDocument + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsDocument.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.gcsUri != null && message.hasOwnProperty("gcsUri")) + if (!$util.isString(message.gcsUri)) + return "gcsUri: string expected"; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + return null; + }; + + /** + * Creates a GcsDocument message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.GcsDocument + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.GcsDocument} GcsDocument + */ + GcsDocument.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.GcsDocument) + return object; + var message = new $root.google.cloud.documentai.v1.GcsDocument(); + if (object.gcsUri != null) + message.gcsUri = String(object.gcsUri); + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + return message; + }; + + /** + * Creates a plain object from a GcsDocument message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.GcsDocument + * @static + * @param {google.cloud.documentai.v1.GcsDocument} message GcsDocument + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsDocument.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.gcsUri = ""; + object.mimeType = ""; + } + if (message.gcsUri != null && message.hasOwnProperty("gcsUri")) + object.gcsUri = message.gcsUri; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + return object; + }; + + /** + * Converts this GcsDocument to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.GcsDocument + * @instance + * @returns {Object.} JSON object + */ + GcsDocument.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GcsDocument; + })(); + + v1.GcsDocuments = (function() { + + /** + * Properties of a GcsDocuments. + * @memberof google.cloud.documentai.v1 + * @interface IGcsDocuments + * @property {Array.|null} [documents] GcsDocuments documents + */ + + /** + * Constructs a new GcsDocuments. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a GcsDocuments. + * @implements IGcsDocuments + * @constructor + * @param {google.cloud.documentai.v1.IGcsDocuments=} [properties] Properties to set + */ + function GcsDocuments(properties) { + this.documents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GcsDocuments documents. + * @member {Array.} documents + * @memberof google.cloud.documentai.v1.GcsDocuments + * @instance + */ + GcsDocuments.prototype.documents = $util.emptyArray; + + /** + * Creates a new GcsDocuments instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.GcsDocuments + * @static + * @param {google.cloud.documentai.v1.IGcsDocuments=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.GcsDocuments} GcsDocuments instance + */ + GcsDocuments.create = function create(properties) { + return new GcsDocuments(properties); + }; + + /** + * Encodes the specified GcsDocuments message. Does not implicitly {@link google.cloud.documentai.v1.GcsDocuments.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.GcsDocuments + * @static + * @param {google.cloud.documentai.v1.IGcsDocuments} message GcsDocuments message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsDocuments.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.documents != null && message.documents.length) + for (var i = 0; i < message.documents.length; ++i) + $root.google.cloud.documentai.v1.GcsDocument.encode(message.documents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GcsDocuments message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.GcsDocuments.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.GcsDocuments + * @static + * @param {google.cloud.documentai.v1.IGcsDocuments} message GcsDocuments message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsDocuments.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GcsDocuments message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.GcsDocuments + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.GcsDocuments} GcsDocuments + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsDocuments.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.GcsDocuments(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.documents && message.documents.length)) + message.documents = []; + message.documents.push($root.google.cloud.documentai.v1.GcsDocument.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GcsDocuments message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.GcsDocuments + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.GcsDocuments} GcsDocuments + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsDocuments.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GcsDocuments message. + * @function verify + * @memberof google.cloud.documentai.v1.GcsDocuments + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsDocuments.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.documents != null && message.hasOwnProperty("documents")) { + if (!Array.isArray(message.documents)) + return "documents: array expected"; + for (var i = 0; i < message.documents.length; ++i) { + var error = $root.google.cloud.documentai.v1.GcsDocument.verify(message.documents[i]); + if (error) + return "documents." + error; + } + } + return null; + }; + + /** + * Creates a GcsDocuments message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.GcsDocuments + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.GcsDocuments} GcsDocuments + */ + GcsDocuments.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.GcsDocuments) + return object; + var message = new $root.google.cloud.documentai.v1.GcsDocuments(); + if (object.documents) { + if (!Array.isArray(object.documents)) + throw TypeError(".google.cloud.documentai.v1.GcsDocuments.documents: array expected"); + message.documents = []; + for (var i = 0; i < object.documents.length; ++i) { + if (typeof object.documents[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.GcsDocuments.documents: object expected"); + message.documents[i] = $root.google.cloud.documentai.v1.GcsDocument.fromObject(object.documents[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GcsDocuments message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.GcsDocuments + * @static + * @param {google.cloud.documentai.v1.GcsDocuments} message GcsDocuments + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsDocuments.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.documents = []; + if (message.documents && message.documents.length) { + object.documents = []; + for (var j = 0; j < message.documents.length; ++j) + object.documents[j] = $root.google.cloud.documentai.v1.GcsDocument.toObject(message.documents[j], options); + } + return object; + }; + + /** + * Converts this GcsDocuments to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.GcsDocuments + * @instance + * @returns {Object.} JSON object + */ + GcsDocuments.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GcsDocuments; + })(); + + v1.GcsPrefix = (function() { + + /** + * Properties of a GcsPrefix. + * @memberof google.cloud.documentai.v1 + * @interface IGcsPrefix + * @property {string|null} [gcsUriPrefix] GcsPrefix gcsUriPrefix + */ + + /** + * Constructs a new GcsPrefix. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a GcsPrefix. + * @implements IGcsPrefix + * @constructor + * @param {google.cloud.documentai.v1.IGcsPrefix=} [properties] Properties to set + */ + function GcsPrefix(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GcsPrefix gcsUriPrefix. + * @member {string} gcsUriPrefix + * @memberof google.cloud.documentai.v1.GcsPrefix + * @instance + */ + GcsPrefix.prototype.gcsUriPrefix = ""; + + /** + * Creates a new GcsPrefix instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.GcsPrefix + * @static + * @param {google.cloud.documentai.v1.IGcsPrefix=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.GcsPrefix} GcsPrefix instance + */ + GcsPrefix.create = function create(properties) { + return new GcsPrefix(properties); + }; + + /** + * Encodes the specified GcsPrefix message. Does not implicitly {@link google.cloud.documentai.v1.GcsPrefix.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.GcsPrefix + * @static + * @param {google.cloud.documentai.v1.IGcsPrefix} message GcsPrefix message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsPrefix.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsUriPrefix != null && Object.hasOwnProperty.call(message, "gcsUriPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsUriPrefix); + return writer; + }; + + /** + * Encodes the specified GcsPrefix message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.GcsPrefix.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.GcsPrefix + * @static + * @param {google.cloud.documentai.v1.IGcsPrefix} message GcsPrefix message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsPrefix.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GcsPrefix message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.GcsPrefix + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.GcsPrefix} GcsPrefix + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsPrefix.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.GcsPrefix(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsUriPrefix = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GcsPrefix message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.GcsPrefix + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.GcsPrefix} GcsPrefix + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsPrefix.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GcsPrefix message. + * @function verify + * @memberof google.cloud.documentai.v1.GcsPrefix + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsPrefix.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.gcsUriPrefix != null && message.hasOwnProperty("gcsUriPrefix")) + if (!$util.isString(message.gcsUriPrefix)) + return "gcsUriPrefix: string expected"; + return null; + }; + + /** + * Creates a GcsPrefix message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.GcsPrefix + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.GcsPrefix} GcsPrefix + */ + GcsPrefix.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.GcsPrefix) + return object; + var message = new $root.google.cloud.documentai.v1.GcsPrefix(); + if (object.gcsUriPrefix != null) + message.gcsUriPrefix = String(object.gcsUriPrefix); + return message; + }; + + /** + * Creates a plain object from a GcsPrefix message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.GcsPrefix + * @static + * @param {google.cloud.documentai.v1.GcsPrefix} message GcsPrefix + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsPrefix.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.gcsUriPrefix = ""; + if (message.gcsUriPrefix != null && message.hasOwnProperty("gcsUriPrefix")) + object.gcsUriPrefix = message.gcsUriPrefix; + return object; + }; + + /** + * Converts this GcsPrefix to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.GcsPrefix + * @instance + * @returns {Object.} JSON object + */ + GcsPrefix.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GcsPrefix; + })(); + + v1.BatchDocumentsInputConfig = (function() { + + /** + * Properties of a BatchDocumentsInputConfig. + * @memberof google.cloud.documentai.v1 + * @interface IBatchDocumentsInputConfig + * @property {google.cloud.documentai.v1.IGcsPrefix|null} [gcsPrefix] BatchDocumentsInputConfig gcsPrefix + * @property {google.cloud.documentai.v1.IGcsDocuments|null} [gcsDocuments] BatchDocumentsInputConfig gcsDocuments + */ + + /** + * Constructs a new BatchDocumentsInputConfig. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a BatchDocumentsInputConfig. + * @implements IBatchDocumentsInputConfig + * @constructor + * @param {google.cloud.documentai.v1.IBatchDocumentsInputConfig=} [properties] Properties to set + */ + function BatchDocumentsInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchDocumentsInputConfig gcsPrefix. + * @member {google.cloud.documentai.v1.IGcsPrefix|null|undefined} gcsPrefix + * @memberof google.cloud.documentai.v1.BatchDocumentsInputConfig + * @instance + */ + BatchDocumentsInputConfig.prototype.gcsPrefix = null; + + /** + * BatchDocumentsInputConfig gcsDocuments. + * @member {google.cloud.documentai.v1.IGcsDocuments|null|undefined} gcsDocuments + * @memberof google.cloud.documentai.v1.BatchDocumentsInputConfig + * @instance + */ + BatchDocumentsInputConfig.prototype.gcsDocuments = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BatchDocumentsInputConfig source. + * @member {"gcsPrefix"|"gcsDocuments"|undefined} source + * @memberof google.cloud.documentai.v1.BatchDocumentsInputConfig + * @instance + */ + Object.defineProperty(BatchDocumentsInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["gcsPrefix", "gcsDocuments"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BatchDocumentsInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.BatchDocumentsInputConfig + * @static + * @param {google.cloud.documentai.v1.IBatchDocumentsInputConfig=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.BatchDocumentsInputConfig} BatchDocumentsInputConfig instance + */ + BatchDocumentsInputConfig.create = function create(properties) { + return new BatchDocumentsInputConfig(properties); + }; + + /** + * Encodes the specified BatchDocumentsInputConfig message. Does not implicitly {@link google.cloud.documentai.v1.BatchDocumentsInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.BatchDocumentsInputConfig + * @static + * @param {google.cloud.documentai.v1.IBatchDocumentsInputConfig} message BatchDocumentsInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDocumentsInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) + $root.google.cloud.documentai.v1.GcsPrefix.encode(message.gcsPrefix, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsDocuments != null && Object.hasOwnProperty.call(message, "gcsDocuments")) + $root.google.cloud.documentai.v1.GcsDocuments.encode(message.gcsDocuments, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchDocumentsInputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchDocumentsInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.BatchDocumentsInputConfig + * @static + * @param {google.cloud.documentai.v1.IBatchDocumentsInputConfig} message BatchDocumentsInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDocumentsInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchDocumentsInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.BatchDocumentsInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.BatchDocumentsInputConfig} BatchDocumentsInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDocumentsInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.BatchDocumentsInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsPrefix = $root.google.cloud.documentai.v1.GcsPrefix.decode(reader, reader.uint32()); + break; + case 2: + message.gcsDocuments = $root.google.cloud.documentai.v1.GcsDocuments.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchDocumentsInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.BatchDocumentsInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.BatchDocumentsInputConfig} BatchDocumentsInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDocumentsInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchDocumentsInputConfig message. + * @function verify + * @memberof google.cloud.documentai.v1.BatchDocumentsInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchDocumentsInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + properties.source = 1; + { + var error = $root.google.cloud.documentai.v1.GcsPrefix.verify(message.gcsPrefix); + if (error) + return "gcsPrefix." + error; + } + } + if (message.gcsDocuments != null && message.hasOwnProperty("gcsDocuments")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.documentai.v1.GcsDocuments.verify(message.gcsDocuments); + if (error) + return "gcsDocuments." + error; + } + } + return null; + }; + + /** + * Creates a BatchDocumentsInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.BatchDocumentsInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.BatchDocumentsInputConfig} BatchDocumentsInputConfig + */ + BatchDocumentsInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.BatchDocumentsInputConfig) + return object; + var message = new $root.google.cloud.documentai.v1.BatchDocumentsInputConfig(); + if (object.gcsPrefix != null) { + if (typeof object.gcsPrefix !== "object") + throw TypeError(".google.cloud.documentai.v1.BatchDocumentsInputConfig.gcsPrefix: object expected"); + message.gcsPrefix = $root.google.cloud.documentai.v1.GcsPrefix.fromObject(object.gcsPrefix); + } + if (object.gcsDocuments != null) { + if (typeof object.gcsDocuments !== "object") + throw TypeError(".google.cloud.documentai.v1.BatchDocumentsInputConfig.gcsDocuments: object expected"); + message.gcsDocuments = $root.google.cloud.documentai.v1.GcsDocuments.fromObject(object.gcsDocuments); + } + return message; + }; + + /** + * Creates a plain object from a BatchDocumentsInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.BatchDocumentsInputConfig + * @static + * @param {google.cloud.documentai.v1.BatchDocumentsInputConfig} message BatchDocumentsInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchDocumentsInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + object.gcsPrefix = $root.google.cloud.documentai.v1.GcsPrefix.toObject(message.gcsPrefix, options); + if (options.oneofs) + object.source = "gcsPrefix"; + } + if (message.gcsDocuments != null && message.hasOwnProperty("gcsDocuments")) { + object.gcsDocuments = $root.google.cloud.documentai.v1.GcsDocuments.toObject(message.gcsDocuments, options); + if (options.oneofs) + object.source = "gcsDocuments"; + } + return object; + }; + + /** + * Converts this BatchDocumentsInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.BatchDocumentsInputConfig + * @instance + * @returns {Object.} JSON object + */ + BatchDocumentsInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BatchDocumentsInputConfig; + })(); + + v1.DocumentOutputConfig = (function() { + + /** + * Properties of a DocumentOutputConfig. + * @memberof google.cloud.documentai.v1 + * @interface IDocumentOutputConfig + * @property {google.cloud.documentai.v1.DocumentOutputConfig.IGcsOutputConfig|null} [gcsOutputConfig] DocumentOutputConfig gcsOutputConfig + */ + + /** + * Constructs a new DocumentOutputConfig. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DocumentOutputConfig. + * @implements IDocumentOutputConfig + * @constructor + * @param {google.cloud.documentai.v1.IDocumentOutputConfig=} [properties] Properties to set + */ + function DocumentOutputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentOutputConfig gcsOutputConfig. + * @member {google.cloud.documentai.v1.DocumentOutputConfig.IGcsOutputConfig|null|undefined} gcsOutputConfig + * @memberof google.cloud.documentai.v1.DocumentOutputConfig + * @instance + */ + DocumentOutputConfig.prototype.gcsOutputConfig = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * DocumentOutputConfig destination. + * @member {"gcsOutputConfig"|undefined} destination + * @memberof google.cloud.documentai.v1.DocumentOutputConfig + * @instance + */ + Object.defineProperty(DocumentOutputConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsOutputConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new DocumentOutputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DocumentOutputConfig + * @static + * @param {google.cloud.documentai.v1.IDocumentOutputConfig=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DocumentOutputConfig} DocumentOutputConfig instance + */ + DocumentOutputConfig.create = function create(properties) { + return new DocumentOutputConfig(properties); + }; + + /** + * Encodes the specified DocumentOutputConfig message. Does not implicitly {@link google.cloud.documentai.v1.DocumentOutputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DocumentOutputConfig + * @static + * @param {google.cloud.documentai.v1.IDocumentOutputConfig} message DocumentOutputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentOutputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsOutputConfig != null && Object.hasOwnProperty.call(message, "gcsOutputConfig")) + $root.google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.encode(message.gcsOutputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DocumentOutputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DocumentOutputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DocumentOutputConfig + * @static + * @param {google.cloud.documentai.v1.IDocumentOutputConfig} message DocumentOutputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentOutputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DocumentOutputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DocumentOutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DocumentOutputConfig} DocumentOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentOutputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.DocumentOutputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsOutputConfig = $root.google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentOutputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DocumentOutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DocumentOutputConfig} DocumentOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentOutputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentOutputConfig message. + * @function verify + * @memberof google.cloud.documentai.v1.DocumentOutputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentOutputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.gcsOutputConfig != null && message.hasOwnProperty("gcsOutputConfig")) { + properties.destination = 1; + { + var error = $root.google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.verify(message.gcsOutputConfig); + if (error) + return "gcsOutputConfig." + error; + } + } + return null; + }; + + /** + * Creates a DocumentOutputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DocumentOutputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DocumentOutputConfig} DocumentOutputConfig + */ + DocumentOutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DocumentOutputConfig) + return object; + var message = new $root.google.cloud.documentai.v1.DocumentOutputConfig(); + if (object.gcsOutputConfig != null) { + if (typeof object.gcsOutputConfig !== "object") + throw TypeError(".google.cloud.documentai.v1.DocumentOutputConfig.gcsOutputConfig: object expected"); + message.gcsOutputConfig = $root.google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.fromObject(object.gcsOutputConfig); + } + return message; + }; + + /** + * Creates a plain object from a DocumentOutputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DocumentOutputConfig + * @static + * @param {google.cloud.documentai.v1.DocumentOutputConfig} message DocumentOutputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentOutputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsOutputConfig != null && message.hasOwnProperty("gcsOutputConfig")) { + object.gcsOutputConfig = $root.google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.toObject(message.gcsOutputConfig, options); + if (options.oneofs) + object.destination = "gcsOutputConfig"; + } + return object; + }; + + /** + * Converts this DocumentOutputConfig to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DocumentOutputConfig + * @instance + * @returns {Object.} JSON object + */ + DocumentOutputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + DocumentOutputConfig.GcsOutputConfig = (function() { + + /** + * Properties of a GcsOutputConfig. + * @memberof google.cloud.documentai.v1.DocumentOutputConfig + * @interface IGcsOutputConfig + * @property {string|null} [gcsUri] GcsOutputConfig gcsUri + */ + + /** + * Constructs a new GcsOutputConfig. + * @memberof google.cloud.documentai.v1.DocumentOutputConfig + * @classdesc Represents a GcsOutputConfig. + * @implements IGcsOutputConfig + * @constructor + * @param {google.cloud.documentai.v1.DocumentOutputConfig.IGcsOutputConfig=} [properties] Properties to set + */ + function GcsOutputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GcsOutputConfig gcsUri. + * @member {string} gcsUri + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig + * @instance + */ + GcsOutputConfig.prototype.gcsUri = ""; + + /** + * Creates a new GcsOutputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig + * @static + * @param {google.cloud.documentai.v1.DocumentOutputConfig.IGcsOutputConfig=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig} GcsOutputConfig instance + */ + GcsOutputConfig.create = function create(properties) { + return new GcsOutputConfig(properties); + }; + + /** + * Encodes the specified GcsOutputConfig message. Does not implicitly {@link google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig + * @static + * @param {google.cloud.documentai.v1.DocumentOutputConfig.IGcsOutputConfig} message GcsOutputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsOutputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsUri != null && Object.hasOwnProperty.call(message, "gcsUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsUri); + return writer; + }; + + /** + * Encodes the specified GcsOutputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig + * @static + * @param {google.cloud.documentai.v1.DocumentOutputConfig.IGcsOutputConfig} message GcsOutputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsOutputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GcsOutputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig} GcsOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsOutputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsUri = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GcsOutputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig} GcsOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsOutputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GcsOutputConfig message. + * @function verify + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsOutputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.gcsUri != null && message.hasOwnProperty("gcsUri")) + if (!$util.isString(message.gcsUri)) + return "gcsUri: string expected"; + return null; + }; + + /** + * Creates a GcsOutputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig} GcsOutputConfig + */ + GcsOutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig) + return object; + var message = new $root.google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig(); + if (object.gcsUri != null) + message.gcsUri = String(object.gcsUri); + return message; + }; + + /** + * Creates a plain object from a GcsOutputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig + * @static + * @param {google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig} message GcsOutputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsOutputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.gcsUri = ""; + if (message.gcsUri != null && message.hasOwnProperty("gcsUri")) + object.gcsUri = message.gcsUri; + return object; + }; + + /** + * Converts this GcsOutputConfig to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig + * @instance + * @returns {Object.} JSON object + */ + GcsOutputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GcsOutputConfig; + })(); + + return DocumentOutputConfig; + })(); + + v1.DocumentProcessorService = (function() { + + /** + * Constructs a new DocumentProcessorService service. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DocumentProcessorService + * @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 DocumentProcessorService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (DocumentProcessorService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = DocumentProcessorService; + + /** + * Creates new DocumentProcessorService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @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 {DocumentProcessorService} RPC service. Useful where requests and/or responses are streamed. + */ + DocumentProcessorService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#processDocument}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef ProcessDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1.ProcessResponse} [response] ProcessResponse + */ + + /** + * Calls ProcessDocument. + * @function processDocument + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IProcessRequest} request ProcessRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.ProcessDocumentCallback} callback Node-style callback called with the error, if any, and ProcessResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.processDocument = function processDocument(request, callback) { + return this.rpcCall(processDocument, $root.google.cloud.documentai.v1.ProcessRequest, $root.google.cloud.documentai.v1.ProcessResponse, request, callback); + }, "name", { value: "ProcessDocument" }); + + /** + * Calls ProcessDocument. + * @function processDocument + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IProcessRequest} request ProcessRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#batchProcessDocuments}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef BatchProcessDocumentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchProcessDocuments. + * @function batchProcessDocuments + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IBatchProcessRequest} request BatchProcessRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocumentsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.batchProcessDocuments = function batchProcessDocuments(request, callback) { + return this.rpcCall(batchProcessDocuments, $root.google.cloud.documentai.v1.BatchProcessRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchProcessDocuments" }); + + /** + * Calls BatchProcessDocuments. + * @function batchProcessDocuments + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IBatchProcessRequest} request BatchProcessRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#reviewDocument}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef ReviewDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ReviewDocument. + * @function reviewDocument + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IReviewDocumentRequest} request ReviewDocumentRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.ReviewDocumentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.reviewDocument = function reviewDocument(request, callback) { + return this.rpcCall(reviewDocument, $root.google.cloud.documentai.v1.ReviewDocumentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ReviewDocument" }); + + /** + * Calls ReviewDocument. + * @function reviewDocument + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IReviewDocumentRequest} request ReviewDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return DocumentProcessorService; + })(); + + v1.ProcessRequest = (function() { + + /** + * Properties of a ProcessRequest. + * @memberof google.cloud.documentai.v1 + * @interface IProcessRequest + * @property {google.cloud.documentai.v1.IDocument|null} [inlineDocument] ProcessRequest inlineDocument + * @property {google.cloud.documentai.v1.IRawDocument|null} [rawDocument] ProcessRequest rawDocument + * @property {string|null} [name] ProcessRequest name + * @property {boolean|null} [skipHumanReview] ProcessRequest skipHumanReview + */ + + /** + * Constructs a new ProcessRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ProcessRequest. + * @implements IProcessRequest + * @constructor + * @param {google.cloud.documentai.v1.IProcessRequest=} [properties] Properties to set + */ + function ProcessRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProcessRequest inlineDocument. + * @member {google.cloud.documentai.v1.IDocument|null|undefined} inlineDocument + * @memberof google.cloud.documentai.v1.ProcessRequest + * @instance + */ + ProcessRequest.prototype.inlineDocument = null; + + /** + * ProcessRequest rawDocument. + * @member {google.cloud.documentai.v1.IRawDocument|null|undefined} rawDocument + * @memberof google.cloud.documentai.v1.ProcessRequest + * @instance + */ + ProcessRequest.prototype.rawDocument = null; + + /** + * ProcessRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1.ProcessRequest + * @instance + */ + ProcessRequest.prototype.name = ""; + + /** + * ProcessRequest skipHumanReview. + * @member {boolean} skipHumanReview + * @memberof google.cloud.documentai.v1.ProcessRequest + * @instance + */ + ProcessRequest.prototype.skipHumanReview = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ProcessRequest source. + * @member {"inlineDocument"|"rawDocument"|undefined} source + * @memberof google.cloud.documentai.v1.ProcessRequest + * @instance + */ + Object.defineProperty(ProcessRequest.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["inlineDocument", "rawDocument"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ProcessRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ProcessRequest + * @static + * @param {google.cloud.documentai.v1.IProcessRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ProcessRequest} ProcessRequest instance + */ + ProcessRequest.create = function create(properties) { + return new ProcessRequest(properties); + }; + + /** + * Encodes the specified ProcessRequest message. Does not implicitly {@link google.cloud.documentai.v1.ProcessRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ProcessRequest + * @static + * @param {google.cloud.documentai.v1.IProcessRequest} message ProcessRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessRequest.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.skipHumanReview != null && Object.hasOwnProperty.call(message, "skipHumanReview")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.skipHumanReview); + if (message.inlineDocument != null && Object.hasOwnProperty.call(message, "inlineDocument")) + $root.google.cloud.documentai.v1.Document.encode(message.inlineDocument, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.rawDocument != null && Object.hasOwnProperty.call(message, "rawDocument")) + $root.google.cloud.documentai.v1.RawDocument.encode(message.rawDocument, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProcessRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ProcessRequest + * @static + * @param {google.cloud.documentai.v1.IProcessRequest} message ProcessRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProcessRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ProcessRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ProcessRequest} ProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ProcessRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + message.inlineDocument = $root.google.cloud.documentai.v1.Document.decode(reader, reader.uint32()); + break; + case 5: + message.rawDocument = $root.google.cloud.documentai.v1.RawDocument.decode(reader, reader.uint32()); + break; + case 1: + message.name = reader.string(); + break; + case 3: + message.skipHumanReview = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProcessRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ProcessRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ProcessRequest} ProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProcessRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.ProcessRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProcessRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { + properties.source = 1; + { + var error = $root.google.cloud.documentai.v1.Document.verify(message.inlineDocument); + if (error) + return "inlineDocument." + error; + } + } + if (message.rawDocument != null && message.hasOwnProperty("rawDocument")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.documentai.v1.RawDocument.verify(message.rawDocument); + if (error) + return "rawDocument." + error; + } + } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.skipHumanReview != null && message.hasOwnProperty("skipHumanReview")) + if (typeof message.skipHumanReview !== "boolean") + return "skipHumanReview: boolean expected"; + return null; + }; + + /** + * Creates a ProcessRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ProcessRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ProcessRequest} ProcessRequest + */ + ProcessRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ProcessRequest) + return object; + var message = new $root.google.cloud.documentai.v1.ProcessRequest(); + if (object.inlineDocument != null) { + if (typeof object.inlineDocument !== "object") + throw TypeError(".google.cloud.documentai.v1.ProcessRequest.inlineDocument: object expected"); + message.inlineDocument = $root.google.cloud.documentai.v1.Document.fromObject(object.inlineDocument); + } + if (object.rawDocument != null) { + if (typeof object.rawDocument !== "object") + throw TypeError(".google.cloud.documentai.v1.ProcessRequest.rawDocument: object expected"); + message.rawDocument = $root.google.cloud.documentai.v1.RawDocument.fromObject(object.rawDocument); + } + if (object.name != null) + message.name = String(object.name); + if (object.skipHumanReview != null) + message.skipHumanReview = Boolean(object.skipHumanReview); + return message; + }; + + /** + * Creates a plain object from a ProcessRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ProcessRequest + * @static + * @param {google.cloud.documentai.v1.ProcessRequest} message ProcessRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProcessRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.skipHumanReview = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.skipHumanReview != null && message.hasOwnProperty("skipHumanReview")) + object.skipHumanReview = message.skipHumanReview; + if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { + object.inlineDocument = $root.google.cloud.documentai.v1.Document.toObject(message.inlineDocument, options); + if (options.oneofs) + object.source = "inlineDocument"; + } + if (message.rawDocument != null && message.hasOwnProperty("rawDocument")) { + object.rawDocument = $root.google.cloud.documentai.v1.RawDocument.toObject(message.rawDocument, options); + if (options.oneofs) + object.source = "rawDocument"; + } + return object; + }; + + /** + * Converts this ProcessRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ProcessRequest + * @instance + * @returns {Object.} JSON object + */ + ProcessRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProcessRequest; + })(); + + v1.HumanReviewStatus = (function() { + + /** + * Properties of a HumanReviewStatus. + * @memberof google.cloud.documentai.v1 + * @interface IHumanReviewStatus + * @property {google.cloud.documentai.v1.HumanReviewStatus.State|null} [state] HumanReviewStatus state + * @property {string|null} [stateMessage] HumanReviewStatus stateMessage + * @property {string|null} [humanReviewOperation] HumanReviewStatus humanReviewOperation + */ + + /** + * Constructs a new HumanReviewStatus. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a HumanReviewStatus. + * @implements IHumanReviewStatus + * @constructor + * @param {google.cloud.documentai.v1.IHumanReviewStatus=} [properties] Properties to set + */ + function HumanReviewStatus(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HumanReviewStatus state. + * @member {google.cloud.documentai.v1.HumanReviewStatus.State} state + * @memberof google.cloud.documentai.v1.HumanReviewStatus + * @instance + */ + HumanReviewStatus.prototype.state = 0; + + /** + * HumanReviewStatus stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1.HumanReviewStatus + * @instance + */ + HumanReviewStatus.prototype.stateMessage = ""; + + /** + * HumanReviewStatus humanReviewOperation. + * @member {string} humanReviewOperation + * @memberof google.cloud.documentai.v1.HumanReviewStatus + * @instance + */ + HumanReviewStatus.prototype.humanReviewOperation = ""; + + /** + * Creates a new HumanReviewStatus instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.HumanReviewStatus + * @static + * @param {google.cloud.documentai.v1.IHumanReviewStatus=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.HumanReviewStatus} HumanReviewStatus instance + */ + HumanReviewStatus.create = function create(properties) { + return new HumanReviewStatus(properties); + }; + + /** + * Encodes the specified HumanReviewStatus message. Does not implicitly {@link google.cloud.documentai.v1.HumanReviewStatus.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.HumanReviewStatus + * @static + * @param {google.cloud.documentai.v1.IHumanReviewStatus} message HumanReviewStatus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HumanReviewStatus.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); + if (message.humanReviewOperation != null && Object.hasOwnProperty.call(message, "humanReviewOperation")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.humanReviewOperation); + return writer; + }; + + /** + * Encodes the specified HumanReviewStatus message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.HumanReviewStatus.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.HumanReviewStatus + * @static + * @param {google.cloud.documentai.v1.IHumanReviewStatus} message HumanReviewStatus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HumanReviewStatus.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HumanReviewStatus message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.HumanReviewStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.HumanReviewStatus} HumanReviewStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HumanReviewStatus.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.HumanReviewStatus(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.int32(); + break; + case 2: + message.stateMessage = reader.string(); + break; + case 3: + message.humanReviewOperation = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HumanReviewStatus message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.HumanReviewStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.HumanReviewStatus} HumanReviewStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HumanReviewStatus.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HumanReviewStatus message. + * @function verify + * @memberof google.cloud.documentai.v1.HumanReviewStatus + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HumanReviewStatus.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + if (!$util.isString(message.stateMessage)) + return "stateMessage: string expected"; + if (message.humanReviewOperation != null && message.hasOwnProperty("humanReviewOperation")) + if (!$util.isString(message.humanReviewOperation)) + return "humanReviewOperation: string expected"; + return null; + }; + + /** + * Creates a HumanReviewStatus message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.HumanReviewStatus + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.HumanReviewStatus} HumanReviewStatus + */ + HumanReviewStatus.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.HumanReviewStatus) + return object; + var message = new $root.google.cloud.documentai.v1.HumanReviewStatus(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "SKIPPED": + case 1: + message.state = 1; + break; + case "VALIDATION_PASSED": + case 2: + message.state = 2; + break; + case "IN_PROGRESS": + case 3: + message.state = 3; + break; + case "ERROR": + case 4: + message.state = 4; + break; + } + if (object.stateMessage != null) + message.stateMessage = String(object.stateMessage); + if (object.humanReviewOperation != null) + message.humanReviewOperation = String(object.humanReviewOperation); + return message; + }; + + /** + * Creates a plain object from a HumanReviewStatus message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.HumanReviewStatus + * @static + * @param {google.cloud.documentai.v1.HumanReviewStatus} message HumanReviewStatus + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HumanReviewStatus.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.stateMessage = ""; + object.humanReviewOperation = ""; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1.HumanReviewStatus.State[message.state] : message.state; + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + object.stateMessage = message.stateMessage; + if (message.humanReviewOperation != null && message.hasOwnProperty("humanReviewOperation")) + object.humanReviewOperation = message.humanReviewOperation; + return object; + }; + + /** + * Converts this HumanReviewStatus to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.HumanReviewStatus + * @instance + * @returns {Object.} JSON object + */ + HumanReviewStatus.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.documentai.v1.HumanReviewStatus.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} SKIPPED=1 SKIPPED value + * @property {number} VALIDATION_PASSED=2 VALIDATION_PASSED value + * @property {number} IN_PROGRESS=3 IN_PROGRESS value + * @property {number} ERROR=4 ERROR value + */ + HumanReviewStatus.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SKIPPED"] = 1; + values[valuesById[2] = "VALIDATION_PASSED"] = 2; + values[valuesById[3] = "IN_PROGRESS"] = 3; + values[valuesById[4] = "ERROR"] = 4; + return values; + })(); + + return HumanReviewStatus; + })(); + + v1.ProcessResponse = (function() { + + /** + * Properties of a ProcessResponse. + * @memberof google.cloud.documentai.v1 + * @interface IProcessResponse + * @property {google.cloud.documentai.v1.IDocument|null} [document] ProcessResponse document + * @property {google.cloud.documentai.v1.IHumanReviewStatus|null} [humanReviewStatus] ProcessResponse humanReviewStatus + */ + + /** + * Constructs a new ProcessResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ProcessResponse. + * @implements IProcessResponse + * @constructor + * @param {google.cloud.documentai.v1.IProcessResponse=} [properties] Properties to set + */ + function ProcessResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProcessResponse document. + * @member {google.cloud.documentai.v1.IDocument|null|undefined} document + * @memberof google.cloud.documentai.v1.ProcessResponse + * @instance + */ + ProcessResponse.prototype.document = null; + + /** + * ProcessResponse humanReviewStatus. + * @member {google.cloud.documentai.v1.IHumanReviewStatus|null|undefined} humanReviewStatus + * @memberof google.cloud.documentai.v1.ProcessResponse + * @instance + */ + ProcessResponse.prototype.humanReviewStatus = null; + + /** + * Creates a new ProcessResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ProcessResponse + * @static + * @param {google.cloud.documentai.v1.IProcessResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ProcessResponse} ProcessResponse instance + */ + ProcessResponse.create = function create(properties) { + return new ProcessResponse(properties); + }; + + /** + * Encodes the specified ProcessResponse message. Does not implicitly {@link google.cloud.documentai.v1.ProcessResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ProcessResponse + * @static + * @param {google.cloud.documentai.v1.IProcessResponse} message ProcessResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.cloud.documentai.v1.Document.encode(message.document, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.humanReviewStatus != null && Object.hasOwnProperty.call(message, "humanReviewStatus")) + $root.google.cloud.documentai.v1.HumanReviewStatus.encode(message.humanReviewStatus, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProcessResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ProcessResponse + * @static + * @param {google.cloud.documentai.v1.IProcessResponse} message ProcessResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProcessResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ProcessResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ProcessResponse} ProcessResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ProcessResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.document = $root.google.cloud.documentai.v1.Document.decode(reader, reader.uint32()); + break; + case 3: + message.humanReviewStatus = $root.google.cloud.documentai.v1.HumanReviewStatus.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProcessResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ProcessResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ProcessResponse} ProcessResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProcessResponse message. + * @function verify + * @memberof google.cloud.documentai.v1.ProcessResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProcessResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.document != null && message.hasOwnProperty("document")) { + var error = $root.google.cloud.documentai.v1.Document.verify(message.document); + if (error) + return "document." + error; + } + if (message.humanReviewStatus != null && message.hasOwnProperty("humanReviewStatus")) { + var error = $root.google.cloud.documentai.v1.HumanReviewStatus.verify(message.humanReviewStatus); + if (error) + return "humanReviewStatus." + error; + } + return null; + }; + + /** + * Creates a ProcessResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ProcessResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ProcessResponse} ProcessResponse + */ + ProcessResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ProcessResponse) + return object; + var message = new $root.google.cloud.documentai.v1.ProcessResponse(); + if (object.document != null) { + if (typeof object.document !== "object") + throw TypeError(".google.cloud.documentai.v1.ProcessResponse.document: object expected"); + message.document = $root.google.cloud.documentai.v1.Document.fromObject(object.document); + } + if (object.humanReviewStatus != null) { + if (typeof object.humanReviewStatus !== "object") + throw TypeError(".google.cloud.documentai.v1.ProcessResponse.humanReviewStatus: object expected"); + message.humanReviewStatus = $root.google.cloud.documentai.v1.HumanReviewStatus.fromObject(object.humanReviewStatus); + } + return message; + }; + + /** + * Creates a plain object from a ProcessResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ProcessResponse + * @static + * @param {google.cloud.documentai.v1.ProcessResponse} message ProcessResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProcessResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.document = null; + object.humanReviewStatus = null; + } + if (message.document != null && message.hasOwnProperty("document")) + object.document = $root.google.cloud.documentai.v1.Document.toObject(message.document, options); + if (message.humanReviewStatus != null && message.hasOwnProperty("humanReviewStatus")) + object.humanReviewStatus = $root.google.cloud.documentai.v1.HumanReviewStatus.toObject(message.humanReviewStatus, options); + return object; + }; + + /** + * Converts this ProcessResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ProcessResponse + * @instance + * @returns {Object.} JSON object + */ + ProcessResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProcessResponse; + })(); + + v1.BatchProcessRequest = (function() { + + /** + * Properties of a BatchProcessRequest. + * @memberof google.cloud.documentai.v1 + * @interface IBatchProcessRequest + * @property {string|null} [name] BatchProcessRequest name + * @property {google.cloud.documentai.v1.IBatchDocumentsInputConfig|null} [inputDocuments] BatchProcessRequest inputDocuments + * @property {google.cloud.documentai.v1.IDocumentOutputConfig|null} [documentOutputConfig] BatchProcessRequest documentOutputConfig + * @property {boolean|null} [skipHumanReview] BatchProcessRequest skipHumanReview + */ + + /** + * Constructs a new BatchProcessRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a BatchProcessRequest. + * @implements IBatchProcessRequest + * @constructor + * @param {google.cloud.documentai.v1.IBatchProcessRequest=} [properties] Properties to set + */ + function BatchProcessRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchProcessRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1.BatchProcessRequest + * @instance + */ + BatchProcessRequest.prototype.name = ""; + + /** + * BatchProcessRequest inputDocuments. + * @member {google.cloud.documentai.v1.IBatchDocumentsInputConfig|null|undefined} inputDocuments + * @memberof google.cloud.documentai.v1.BatchProcessRequest + * @instance + */ + BatchProcessRequest.prototype.inputDocuments = null; + + /** + * BatchProcessRequest documentOutputConfig. + * @member {google.cloud.documentai.v1.IDocumentOutputConfig|null|undefined} documentOutputConfig + * @memberof google.cloud.documentai.v1.BatchProcessRequest + * @instance + */ + BatchProcessRequest.prototype.documentOutputConfig = null; + + /** + * BatchProcessRequest skipHumanReview. + * @member {boolean} skipHumanReview + * @memberof google.cloud.documentai.v1.BatchProcessRequest + * @instance + */ + BatchProcessRequest.prototype.skipHumanReview = false; + + /** + * Creates a new BatchProcessRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.BatchProcessRequest + * @static + * @param {google.cloud.documentai.v1.IBatchProcessRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.BatchProcessRequest} BatchProcessRequest instance + */ + BatchProcessRequest.create = function create(properties) { + return new BatchProcessRequest(properties); + }; + + /** + * Encodes the specified BatchProcessRequest message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.BatchProcessRequest + * @static + * @param {google.cloud.documentai.v1.IBatchProcessRequest} message BatchProcessRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProcessRequest.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.skipHumanReview != null && Object.hasOwnProperty.call(message, "skipHumanReview")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.skipHumanReview); + if (message.inputDocuments != null && Object.hasOwnProperty.call(message, "inputDocuments")) + $root.google.cloud.documentai.v1.BatchDocumentsInputConfig.encode(message.inputDocuments, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.documentOutputConfig != null && Object.hasOwnProperty.call(message, "documentOutputConfig")) + $root.google.cloud.documentai.v1.DocumentOutputConfig.encode(message.documentOutputConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchProcessRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.BatchProcessRequest + * @static + * @param {google.cloud.documentai.v1.IBatchProcessRequest} message BatchProcessRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProcessRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchProcessRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.BatchProcessRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.BatchProcessRequest} BatchProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProcessRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.BatchProcessRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 5: + message.inputDocuments = $root.google.cloud.documentai.v1.BatchDocumentsInputConfig.decode(reader, reader.uint32()); + break; + case 6: + message.documentOutputConfig = $root.google.cloud.documentai.v1.DocumentOutputConfig.decode(reader, reader.uint32()); + break; + case 4: + message.skipHumanReview = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchProcessRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.BatchProcessRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.BatchProcessRequest} BatchProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProcessRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchProcessRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.BatchProcessRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchProcessRequest.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.inputDocuments != null && message.hasOwnProperty("inputDocuments")) { + var error = $root.google.cloud.documentai.v1.BatchDocumentsInputConfig.verify(message.inputDocuments); + if (error) + return "inputDocuments." + error; + } + if (message.documentOutputConfig != null && message.hasOwnProperty("documentOutputConfig")) { + var error = $root.google.cloud.documentai.v1.DocumentOutputConfig.verify(message.documentOutputConfig); + if (error) + return "documentOutputConfig." + error; + } + if (message.skipHumanReview != null && message.hasOwnProperty("skipHumanReview")) + if (typeof message.skipHumanReview !== "boolean") + return "skipHumanReview: boolean expected"; + return null; + }; + + /** + * Creates a BatchProcessRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.BatchProcessRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.BatchProcessRequest} BatchProcessRequest + */ + BatchProcessRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.BatchProcessRequest) + return object; + var message = new $root.google.cloud.documentai.v1.BatchProcessRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.inputDocuments != null) { + if (typeof object.inputDocuments !== "object") + throw TypeError(".google.cloud.documentai.v1.BatchProcessRequest.inputDocuments: object expected"); + message.inputDocuments = $root.google.cloud.documentai.v1.BatchDocumentsInputConfig.fromObject(object.inputDocuments); + } + if (object.documentOutputConfig != null) { + if (typeof object.documentOutputConfig !== "object") + throw TypeError(".google.cloud.documentai.v1.BatchProcessRequest.documentOutputConfig: object expected"); + message.documentOutputConfig = $root.google.cloud.documentai.v1.DocumentOutputConfig.fromObject(object.documentOutputConfig); + } + if (object.skipHumanReview != null) + message.skipHumanReview = Boolean(object.skipHumanReview); + return message; + }; + + /** + * Creates a plain object from a BatchProcessRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.BatchProcessRequest + * @static + * @param {google.cloud.documentai.v1.BatchProcessRequest} message BatchProcessRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchProcessRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.skipHumanReview = false; + object.inputDocuments = null; + object.documentOutputConfig = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.skipHumanReview != null && message.hasOwnProperty("skipHumanReview")) + object.skipHumanReview = message.skipHumanReview; + if (message.inputDocuments != null && message.hasOwnProperty("inputDocuments")) + object.inputDocuments = $root.google.cloud.documentai.v1.BatchDocumentsInputConfig.toObject(message.inputDocuments, options); + if (message.documentOutputConfig != null && message.hasOwnProperty("documentOutputConfig")) + object.documentOutputConfig = $root.google.cloud.documentai.v1.DocumentOutputConfig.toObject(message.documentOutputConfig, options); + return object; + }; + + /** + * Converts this BatchProcessRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.BatchProcessRequest + * @instance + * @returns {Object.} JSON object + */ + BatchProcessRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BatchProcessRequest; + })(); + + v1.BatchProcessResponse = (function() { + + /** + * Properties of a BatchProcessResponse. + * @memberof google.cloud.documentai.v1 + * @interface IBatchProcessResponse + */ + + /** + * Constructs a new BatchProcessResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a BatchProcessResponse. + * @implements IBatchProcessResponse + * @constructor + * @param {google.cloud.documentai.v1.IBatchProcessResponse=} [properties] Properties to set + */ + function BatchProcessResponse(properties) { + if (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 BatchProcessResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.BatchProcessResponse + * @static + * @param {google.cloud.documentai.v1.IBatchProcessResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.BatchProcessResponse} BatchProcessResponse instance + */ + BatchProcessResponse.create = function create(properties) { + return new BatchProcessResponse(properties); + }; + + /** + * Encodes the specified BatchProcessResponse message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.BatchProcessResponse + * @static + * @param {google.cloud.documentai.v1.IBatchProcessResponse} message BatchProcessResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProcessResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified BatchProcessResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.BatchProcessResponse + * @static + * @param {google.cloud.documentai.v1.IBatchProcessResponse} message BatchProcessResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProcessResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchProcessResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.BatchProcessResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.BatchProcessResponse} BatchProcessResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProcessResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.BatchProcessResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchProcessResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.BatchProcessResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.BatchProcessResponse} BatchProcessResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProcessResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchProcessResponse message. + * @function verify + * @memberof google.cloud.documentai.v1.BatchProcessResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchProcessResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a BatchProcessResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.BatchProcessResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.BatchProcessResponse} BatchProcessResponse + */ + BatchProcessResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.BatchProcessResponse) + return object; + return new $root.google.cloud.documentai.v1.BatchProcessResponse(); + }; + + /** + * Creates a plain object from a BatchProcessResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.BatchProcessResponse + * @static + * @param {google.cloud.documentai.v1.BatchProcessResponse} message BatchProcessResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchProcessResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this BatchProcessResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.BatchProcessResponse + * @instance + * @returns {Object.} JSON object + */ + BatchProcessResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BatchProcessResponse; + })(); + + v1.BatchProcessMetadata = (function() { + + /** + * Properties of a BatchProcessMetadata. + * @memberof google.cloud.documentai.v1 + * @interface IBatchProcessMetadata + * @property {google.cloud.documentai.v1.BatchProcessMetadata.State|null} [state] BatchProcessMetadata state + * @property {string|null} [stateMessage] BatchProcessMetadata stateMessage + * @property {google.protobuf.ITimestamp|null} [createTime] BatchProcessMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] BatchProcessMetadata updateTime + * @property {Array.|null} [individualProcessStatuses] BatchProcessMetadata individualProcessStatuses + */ + + /** + * Constructs a new BatchProcessMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a BatchProcessMetadata. + * @implements IBatchProcessMetadata + * @constructor + * @param {google.cloud.documentai.v1.IBatchProcessMetadata=} [properties] Properties to set + */ + function BatchProcessMetadata(properties) { + this.individualProcessStatuses = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchProcessMetadata state. + * @member {google.cloud.documentai.v1.BatchProcessMetadata.State} state + * @memberof google.cloud.documentai.v1.BatchProcessMetadata + * @instance + */ + BatchProcessMetadata.prototype.state = 0; + + /** + * BatchProcessMetadata stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1.BatchProcessMetadata + * @instance + */ + BatchProcessMetadata.prototype.stateMessage = ""; + + /** + * BatchProcessMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1.BatchProcessMetadata + * @instance + */ + BatchProcessMetadata.prototype.createTime = null; + + /** + * BatchProcessMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.documentai.v1.BatchProcessMetadata + * @instance + */ + BatchProcessMetadata.prototype.updateTime = null; + + /** + * BatchProcessMetadata individualProcessStatuses. + * @member {Array.} individualProcessStatuses + * @memberof google.cloud.documentai.v1.BatchProcessMetadata + * @instance + */ + BatchProcessMetadata.prototype.individualProcessStatuses = $util.emptyArray; + + /** + * Creates a new BatchProcessMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.BatchProcessMetadata + * @static + * @param {google.cloud.documentai.v1.IBatchProcessMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.BatchProcessMetadata} BatchProcessMetadata instance + */ + BatchProcessMetadata.create = function create(properties) { + return new BatchProcessMetadata(properties); + }; + + /** + * Encodes the specified BatchProcessMetadata message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.BatchProcessMetadata + * @static + * @param {google.cloud.documentai.v1.IBatchProcessMetadata} message BatchProcessMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProcessMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.individualProcessStatuses != null && message.individualProcessStatuses.length) + for (var i = 0; i < message.individualProcessStatuses.length; ++i) + $root.google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.encode(message.individualProcessStatuses[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchProcessMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.BatchProcessMetadata + * @static + * @param {google.cloud.documentai.v1.IBatchProcessMetadata} message BatchProcessMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProcessMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchProcessMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.BatchProcessMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.BatchProcessMetadata} BatchProcessMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProcessMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.BatchProcessMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.int32(); + break; + case 2: + message.stateMessage = reader.string(); + break; + case 3: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + if (!(message.individualProcessStatuses && message.individualProcessStatuses.length)) + message.individualProcessStatuses = []; + message.individualProcessStatuses.push($root.google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchProcessMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.BatchProcessMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.BatchProcessMetadata} BatchProcessMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProcessMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchProcessMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1.BatchProcessMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchProcessMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + if (!$util.isString(message.stateMessage)) + return "stateMessage: string 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.individualProcessStatuses != null && message.hasOwnProperty("individualProcessStatuses")) { + if (!Array.isArray(message.individualProcessStatuses)) + return "individualProcessStatuses: array expected"; + for (var i = 0; i < message.individualProcessStatuses.length; ++i) { + var error = $root.google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.verify(message.individualProcessStatuses[i]); + if (error) + return "individualProcessStatuses." + error; + } + } + return null; + }; + + /** + * Creates a BatchProcessMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.BatchProcessMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.BatchProcessMetadata} BatchProcessMetadata + */ + BatchProcessMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.BatchProcessMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.BatchProcessMetadata(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "WAITING": + case 1: + message.state = 1; + break; + case "RUNNING": + case 2: + message.state = 2; + break; + case "SUCCEEDED": + case 3: + message.state = 3; + break; + case "CANCELLING": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + case "FAILED": + case 6: + message.state = 6; + break; + } + if (object.stateMessage != null) + message.stateMessage = String(object.stateMessage); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1.BatchProcessMetadata.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.documentai.v1.BatchProcessMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.individualProcessStatuses) { + if (!Array.isArray(object.individualProcessStatuses)) + throw TypeError(".google.cloud.documentai.v1.BatchProcessMetadata.individualProcessStatuses: array expected"); + message.individualProcessStatuses = []; + for (var i = 0; i < object.individualProcessStatuses.length; ++i) { + if (typeof object.individualProcessStatuses[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.BatchProcessMetadata.individualProcessStatuses: object expected"); + message.individualProcessStatuses[i] = $root.google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.fromObject(object.individualProcessStatuses[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BatchProcessMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.BatchProcessMetadata + * @static + * @param {google.cloud.documentai.v1.BatchProcessMetadata} message BatchProcessMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchProcessMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.individualProcessStatuses = []; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.stateMessage = ""; + object.createTime = null; + object.updateTime = null; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1.BatchProcessMetadata.State[message.state] : message.state; + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + object.stateMessage = message.stateMessage; + 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.individualProcessStatuses && message.individualProcessStatuses.length) { + object.individualProcessStatuses = []; + for (var j = 0; j < message.individualProcessStatuses.length; ++j) + object.individualProcessStatuses[j] = $root.google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.toObject(message.individualProcessStatuses[j], options); + } + return object; + }; + + /** + * Converts this BatchProcessMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.BatchProcessMetadata + * @instance + * @returns {Object.} JSON object + */ + BatchProcessMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + BatchProcessMetadata.IndividualProcessStatus = (function() { + + /** + * Properties of an IndividualProcessStatus. + * @memberof google.cloud.documentai.v1.BatchProcessMetadata + * @interface IIndividualProcessStatus + * @property {string|null} [inputGcsSource] IndividualProcessStatus inputGcsSource + * @property {google.rpc.IStatus|null} [status] IndividualProcessStatus status + * @property {string|null} [outputGcsDestination] IndividualProcessStatus outputGcsDestination + * @property {google.cloud.documentai.v1.IHumanReviewStatus|null} [humanReviewStatus] IndividualProcessStatus humanReviewStatus + */ + + /** + * Constructs a new IndividualProcessStatus. + * @memberof google.cloud.documentai.v1.BatchProcessMetadata + * @classdesc Represents an IndividualProcessStatus. + * @implements IIndividualProcessStatus + * @constructor + * @param {google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus=} [properties] Properties to set + */ + function IndividualProcessStatus(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IndividualProcessStatus inputGcsSource. + * @member {string} inputGcsSource + * @memberof google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus + * @instance + */ + IndividualProcessStatus.prototype.inputGcsSource = ""; + + /** + * IndividualProcessStatus status. + * @member {google.rpc.IStatus|null|undefined} status + * @memberof google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus + * @instance + */ + IndividualProcessStatus.prototype.status = null; + + /** + * IndividualProcessStatus outputGcsDestination. + * @member {string} outputGcsDestination + * @memberof google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus + * @instance + */ + IndividualProcessStatus.prototype.outputGcsDestination = ""; + + /** + * IndividualProcessStatus humanReviewStatus. + * @member {google.cloud.documentai.v1.IHumanReviewStatus|null|undefined} humanReviewStatus + * @memberof google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus + * @instance + */ + IndividualProcessStatus.prototype.humanReviewStatus = null; + + /** + * Creates a new IndividualProcessStatus instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus + * @static + * @param {google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus} IndividualProcessStatus instance + */ + IndividualProcessStatus.create = function create(properties) { + return new IndividualProcessStatus(properties); + }; + + /** + * Encodes the specified IndividualProcessStatus message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus + * @static + * @param {google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus} message IndividualProcessStatus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IndividualProcessStatus.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.inputGcsSource != null && Object.hasOwnProperty.call(message, "inputGcsSource")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputGcsSource); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + $root.google.rpc.Status.encode(message.status, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.outputGcsDestination != null && Object.hasOwnProperty.call(message, "outputGcsDestination")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputGcsDestination); + if (message.humanReviewStatus != null && Object.hasOwnProperty.call(message, "humanReviewStatus")) + $root.google.cloud.documentai.v1.HumanReviewStatus.encode(message.humanReviewStatus, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified IndividualProcessStatus message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus + * @static + * @param {google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus} message IndividualProcessStatus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IndividualProcessStatus.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IndividualProcessStatus message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus} IndividualProcessStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IndividualProcessStatus.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.inputGcsSource = reader.string(); + break; + case 2: + message.status = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + case 3: + message.outputGcsDestination = reader.string(); + break; + case 5: + message.humanReviewStatus = $root.google.cloud.documentai.v1.HumanReviewStatus.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IndividualProcessStatus message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus} IndividualProcessStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IndividualProcessStatus.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IndividualProcessStatus message. + * @function verify + * @memberof google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IndividualProcessStatus.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.inputGcsSource != null && message.hasOwnProperty("inputGcsSource")) + if (!$util.isString(message.inputGcsSource)) + return "inputGcsSource: string expected"; + if (message.status != null && message.hasOwnProperty("status")) { + var error = $root.google.rpc.Status.verify(message.status); + if (error) + return "status." + error; + } + if (message.outputGcsDestination != null && message.hasOwnProperty("outputGcsDestination")) + if (!$util.isString(message.outputGcsDestination)) + return "outputGcsDestination: string expected"; + if (message.humanReviewStatus != null && message.hasOwnProperty("humanReviewStatus")) { + var error = $root.google.cloud.documentai.v1.HumanReviewStatus.verify(message.humanReviewStatus); + if (error) + return "humanReviewStatus." + error; + } + return null; + }; + + /** + * Creates an IndividualProcessStatus message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus} IndividualProcessStatus + */ + IndividualProcessStatus.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus) + return object; + var message = new $root.google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus(); + if (object.inputGcsSource != null) + message.inputGcsSource = String(object.inputGcsSource); + if (object.status != null) { + if (typeof object.status !== "object") + throw TypeError(".google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.status: object expected"); + message.status = $root.google.rpc.Status.fromObject(object.status); + } + if (object.outputGcsDestination != null) + message.outputGcsDestination = String(object.outputGcsDestination); + if (object.humanReviewStatus != null) { + if (typeof object.humanReviewStatus !== "object") + throw TypeError(".google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.humanReviewStatus: object expected"); + message.humanReviewStatus = $root.google.cloud.documentai.v1.HumanReviewStatus.fromObject(object.humanReviewStatus); + } + return message; + }; + + /** + * Creates a plain object from an IndividualProcessStatus message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus + * @static + * @param {google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus} message IndividualProcessStatus + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IndividualProcessStatus.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.inputGcsSource = ""; + object.status = null; + object.outputGcsDestination = ""; + object.humanReviewStatus = null; + } + if (message.inputGcsSource != null && message.hasOwnProperty("inputGcsSource")) + object.inputGcsSource = message.inputGcsSource; + if (message.status != null && message.hasOwnProperty("status")) + object.status = $root.google.rpc.Status.toObject(message.status, options); + if (message.outputGcsDestination != null && message.hasOwnProperty("outputGcsDestination")) + object.outputGcsDestination = message.outputGcsDestination; + if (message.humanReviewStatus != null && message.hasOwnProperty("humanReviewStatus")) + object.humanReviewStatus = $root.google.cloud.documentai.v1.HumanReviewStatus.toObject(message.humanReviewStatus, options); + return object; + }; + + /** + * Converts this IndividualProcessStatus to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus + * @instance + * @returns {Object.} JSON object + */ + IndividualProcessStatus.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return IndividualProcessStatus; + })(); + + /** + * State enum. + * @name google.cloud.documentai.v1.BatchProcessMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} WAITING=1 WAITING value + * @property {number} RUNNING=2 RUNNING value + * @property {number} SUCCEEDED=3 SUCCEEDED value + * @property {number} CANCELLING=4 CANCELLING value + * @property {number} CANCELLED=5 CANCELLED value + * @property {number} FAILED=6 FAILED value + */ + BatchProcessMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "WAITING"] = 1; + values[valuesById[2] = "RUNNING"] = 2; + values[valuesById[3] = "SUCCEEDED"] = 3; + values[valuesById[4] = "CANCELLING"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + values[valuesById[6] = "FAILED"] = 6; + return values; + })(); + + return BatchProcessMetadata; + })(); + + v1.ReviewDocumentRequest = (function() { + + /** + * Properties of a ReviewDocumentRequest. + * @memberof google.cloud.documentai.v1 + * @interface IReviewDocumentRequest + * @property {google.cloud.documentai.v1.IDocument|null} [inlineDocument] ReviewDocumentRequest inlineDocument + * @property {string|null} [humanReviewConfig] ReviewDocumentRequest humanReviewConfig + */ + + /** + * Constructs a new ReviewDocumentRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ReviewDocumentRequest. + * @implements IReviewDocumentRequest + * @constructor + * @param {google.cloud.documentai.v1.IReviewDocumentRequest=} [properties] Properties to set + */ + function ReviewDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReviewDocumentRequest inlineDocument. + * @member {google.cloud.documentai.v1.IDocument|null|undefined} inlineDocument + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.inlineDocument = null; + + /** + * ReviewDocumentRequest humanReviewConfig. + * @member {string} humanReviewConfig + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.humanReviewConfig = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ReviewDocumentRequest source. + * @member {"inlineDocument"|undefined} source + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @instance + */ + Object.defineProperty(ReviewDocumentRequest.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["inlineDocument"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ReviewDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ReviewDocumentRequest} ReviewDocumentRequest instance + */ + ReviewDocumentRequest.create = function create(properties) { + return new ReviewDocumentRequest(properties); + }; + + /** + * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.humanReviewConfig != null && Object.hasOwnProperty.call(message, "humanReviewConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.humanReviewConfig); + if (message.inlineDocument != null && Object.hasOwnProperty.call(message, "inlineDocument")) + $root.google.cloud.documentai.v1.Document.encode(message.inlineDocument, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ReviewDocumentRequest} ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ReviewDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + message.inlineDocument = $root.google.cloud.documentai.v1.Document.decode(reader, reader.uint32()); + break; + case 1: + message.humanReviewConfig = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ReviewDocumentRequest} ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReviewDocumentRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReviewDocumentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { + properties.source = 1; + { + var error = $root.google.cloud.documentai.v1.Document.verify(message.inlineDocument); + if (error) + return "inlineDocument." + error; + } + } + if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) + if (!$util.isString(message.humanReviewConfig)) + return "humanReviewConfig: string expected"; + return null; + }; + + /** + * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ReviewDocumentRequest} ReviewDocumentRequest + */ + ReviewDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ReviewDocumentRequest) + return object; + var message = new $root.google.cloud.documentai.v1.ReviewDocumentRequest(); + if (object.inlineDocument != null) { + if (typeof object.inlineDocument !== "object") + throw TypeError(".google.cloud.documentai.v1.ReviewDocumentRequest.inlineDocument: object expected"); + message.inlineDocument = $root.google.cloud.documentai.v1.Document.fromObject(object.inlineDocument); + } + if (object.humanReviewConfig != null) + message.humanReviewConfig = String(object.humanReviewConfig); + return message; + }; + + /** + * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1.ReviewDocumentRequest} message ReviewDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReviewDocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.humanReviewConfig = ""; + if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) + object.humanReviewConfig = message.humanReviewConfig; + if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { + object.inlineDocument = $root.google.cloud.documentai.v1.Document.toObject(message.inlineDocument, options); + if (options.oneofs) + object.source = "inlineDocument"; + } + return object; + }; + + /** + * Converts this ReviewDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ReviewDocumentRequest; + })(); + + v1.ReviewDocumentResponse = (function() { + + /** + * Properties of a ReviewDocumentResponse. + * @memberof google.cloud.documentai.v1 + * @interface IReviewDocumentResponse + * @property {string|null} [gcsDestination] ReviewDocumentResponse gcsDestination + */ + + /** + * Constructs a new ReviewDocumentResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ReviewDocumentResponse. + * @implements IReviewDocumentResponse + * @constructor + * @param {google.cloud.documentai.v1.IReviewDocumentResponse=} [properties] Properties to set + */ + function ReviewDocumentResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReviewDocumentResponse gcsDestination. + * @member {string} gcsDestination + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @instance + */ + ReviewDocumentResponse.prototype.gcsDestination = ""; + + /** + * Creates a new ReviewDocumentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ReviewDocumentResponse} ReviewDocumentResponse instance + */ + ReviewDocumentResponse.create = function create(properties) { + return new ReviewDocumentResponse(properties); + }; + + /** + * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsDestination); + return writer; + }; + + /** + * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ReviewDocumentResponse} ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ReviewDocumentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsDestination = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ReviewDocumentResponse} ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReviewDocumentResponse message. + * @function verify + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReviewDocumentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + if (!$util.isString(message.gcsDestination)) + return "gcsDestination: string expected"; + return null; + }; + + /** + * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ReviewDocumentResponse} ReviewDocumentResponse + */ + ReviewDocumentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ReviewDocumentResponse) + return object; + var message = new $root.google.cloud.documentai.v1.ReviewDocumentResponse(); + if (object.gcsDestination != null) + message.gcsDestination = String(object.gcsDestination); + return message; + }; + + /** + * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1.ReviewDocumentResponse} message ReviewDocumentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReviewDocumentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.gcsDestination = ""; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + object.gcsDestination = message.gcsDestination; + return object; + }; + + /** + * Converts this ReviewDocumentResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ReviewDocumentResponse; + })(); + + v1.ReviewDocumentOperationMetadata = (function() { + + /** + * Properties of a ReviewDocumentOperationMetadata. + * @memberof google.cloud.documentai.v1 + * @interface IReviewDocumentOperationMetadata + * @property {google.cloud.documentai.v1.ICommonOperationMetadata|null} [commonMetadata] ReviewDocumentOperationMetadata commonMetadata + */ + + /** + * Constructs a new ReviewDocumentOperationMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ReviewDocumentOperationMetadata. + * @implements IReviewDocumentOperationMetadata + * @constructor + * @param {google.cloud.documentai.v1.IReviewDocumentOperationMetadata=} [properties] Properties to set + */ + function ReviewDocumentOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReviewDocumentOperationMetadata commonMetadata. + * @member {google.cloud.documentai.v1.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.commonMetadata = null; + + /** + * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata instance + */ + ReviewDocumentOperationMetadata.create = function create(properties) { + return new ReviewDocumentOperationMetadata(properties); + }; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ReviewDocumentOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReviewDocumentOperationMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReviewDocumentOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + */ + ReviewDocumentOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ReviewDocumentOperationMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.ReviewDocumentOperationMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1.ReviewDocumentOperationMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from a ReviewDocumentOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReviewDocumentOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.commonMetadata = null; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this ReviewDocumentOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ReviewDocumentOperationMetadata; + })(); + + v1.CommonOperationMetadata = (function() { + + /** + * Properties of a CommonOperationMetadata. + * @memberof google.cloud.documentai.v1 + * @interface ICommonOperationMetadata + * @property {google.cloud.documentai.v1.CommonOperationMetadata.State|null} [state] CommonOperationMetadata state + * @property {string|null} [stateMessage] CommonOperationMetadata stateMessage + * @property {google.protobuf.ITimestamp|null} [createTime] CommonOperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] CommonOperationMetadata updateTime + */ + + /** + * Constructs a new CommonOperationMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a CommonOperationMetadata. + * @implements ICommonOperationMetadata + * @constructor + * @param {google.cloud.documentai.v1.ICommonOperationMetadata=} [properties] Properties to set + */ + function CommonOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CommonOperationMetadata state. + * @member {google.cloud.documentai.v1.CommonOperationMetadata.State} state + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.state = 0; + + /** + * CommonOperationMetadata stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.stateMessage = ""; + + /** + * CommonOperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.createTime = null; + + /** + * CommonOperationMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.updateTime = null; + + /** + * Creates a new CommonOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {google.cloud.documentai.v1.ICommonOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.CommonOperationMetadata} CommonOperationMetadata instance + */ + CommonOperationMetadata.create = function create(properties) { + return new CommonOperationMetadata(properties); + }; + + /** + * Encodes the specified CommonOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1.CommonOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {google.cloud.documentai.v1.ICommonOperationMetadata} message CommonOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommonOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CommonOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.CommonOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {google.cloud.documentai.v1.ICommonOperationMetadata} message CommonOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommonOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CommonOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.CommonOperationMetadata} CommonOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommonOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.CommonOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.int32(); + break; + case 2: + message.stateMessage = reader.string(); + break; + case 3: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CommonOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.CommonOperationMetadata} CommonOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommonOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CommonOperationMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CommonOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + if (!$util.isString(message.stateMessage)) + return "stateMessage: string 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 a CommonOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.CommonOperationMetadata} CommonOperationMetadata + */ + CommonOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.CommonOperationMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.CommonOperationMetadata(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "RUNNING": + case 1: + message.state = 1; + break; + case "CANCELLING": + case 2: + message.state = 2; + break; + case "SUCCEEDED": + case 3: + message.state = 3; + break; + case "FAILED": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + } + if (object.stateMessage != null) + message.stateMessage = String(object.stateMessage); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1.CommonOperationMetadata.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.documentai.v1.CommonOperationMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + return message; + }; + + /** + * Creates a plain object from a CommonOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {google.cloud.documentai.v1.CommonOperationMetadata} message CommonOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CommonOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.stateMessage = ""; + object.createTime = null; + object.updateTime = null; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1.CommonOperationMetadata.State[message.state] : message.state; + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + object.stateMessage = message.stateMessage; + 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 CommonOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + CommonOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.documentai.v1.CommonOperationMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} CANCELLING=2 CANCELLING value + * @property {number} SUCCEEDED=3 SUCCEEDED value + * @property {number} FAILED=4 FAILED value + * @property {number} CANCELLED=5 CANCELLED value + */ + CommonOperationMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "CANCELLING"] = 2; + values[valuesById[3] = "SUCCEEDED"] = 3; + values[valuesById[4] = "FAILED"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return CommonOperationMetadata; + })(); + + return v1; + })(); + + documentai.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof google.cloud.documentai + * @namespace + */ + var v1beta1 = {}; + + v1beta1.Document = (function() { + + /** + * Properties of a Document. + * @memberof google.cloud.documentai.v1beta1 + * @interface IDocument + * @property {string|null} [uri] Document uri + * @property {Uint8Array|null} [content] Document content + * @property {string|null} [mimeType] Document mimeType + * @property {string|null} [text] Document text + * @property {Array.|null} [textStyles] Document textStyles + * @property {Array.|null} [pages] Document pages + * @property {Array.|null} [entities] Document entities + * @property {Array.|null} [entityRelations] Document entityRelations + * @property {google.cloud.documentai.v1beta1.Document.IShardInfo|null} [shardInfo] Document shardInfo + * @property {google.rpc.IStatus|null} [error] Document error + */ + + /** + * Constructs a new Document. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a Document. + * @implements IDocument + * @constructor + * @param {google.cloud.documentai.v1beta1.IDocument=} [properties] Properties to set + */ + function Document(properties) { + this.textStyles = []; + this.pages = []; + this.entities = []; + this.entityRelations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Document uri. + * @member {string} uri + * @memberof google.cloud.documentai.v1beta1.Document + * @instance + */ + Document.prototype.uri = ""; + + /** + * Document content. + * @member {Uint8Array} content + * @memberof google.cloud.documentai.v1beta1.Document + * @instance + */ + Document.prototype.content = $util.newBuffer([]); + + /** + * Document mimeType. + * @member {string} mimeType + * @memberof google.cloud.documentai.v1beta1.Document + * @instance + */ + Document.prototype.mimeType = ""; + + /** + * Document text. + * @member {string} text + * @memberof google.cloud.documentai.v1beta1.Document + * @instance + */ + Document.prototype.text = ""; + + /** + * Document textStyles. + * @member {Array.} textStyles + * @memberof google.cloud.documentai.v1beta1.Document + * @instance + */ + Document.prototype.textStyles = $util.emptyArray; + + /** + * Document pages. + * @member {Array.} pages + * @memberof google.cloud.documentai.v1beta1.Document + * @instance + */ + Document.prototype.pages = $util.emptyArray; + + /** + * Document entities. + * @member {Array.} entities + * @memberof google.cloud.documentai.v1beta1.Document + * @instance + */ + Document.prototype.entities = $util.emptyArray; + + /** + * Document entityRelations. + * @member {Array.} entityRelations + * @memberof google.cloud.documentai.v1beta1.Document + * @instance + */ + Document.prototype.entityRelations = $util.emptyArray; + + /** + * Document shardInfo. + * @member {google.cloud.documentai.v1beta1.Document.IShardInfo|null|undefined} shardInfo + * @memberof google.cloud.documentai.v1beta1.Document + * @instance + */ + Document.prototype.shardInfo = null; + + /** + * Document error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.cloud.documentai.v1beta1.Document + * @instance + */ + Document.prototype.error = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Document source. + * @member {"uri"|"content"|undefined} source + * @memberof google.cloud.documentai.v1beta1.Document + * @instance + */ + Object.defineProperty(Document.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["uri", "content"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Document instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document + * @static + * @param {google.cloud.documentai.v1beta1.IDocument=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document} Document instance + */ + Document.create = function create(properties) { + return new Document(properties); + }; + + /** + * Encodes the specified Document message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document + * @static + * @param {google.cloud.documentai.v1beta1.IDocument} message Document message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Document.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.content != null && Object.hasOwnProperty.call(message, "content")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.content); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.mimeType); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.text); + if (message.textStyles != null && message.textStyles.length) + for (var i = 0; i < message.textStyles.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Style.encode(message.textStyles[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.pages != null && message.pages.length) + for (var i = 0; i < message.pages.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.encode(message.pages[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.entities != null && message.entities.length) + for (var i = 0; i < message.entities.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Entity.encode(message.entities[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.entityRelations != null && message.entityRelations.length) + for (var i = 0; i < message.entityRelations.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.EntityRelation.encode(message.entityRelations[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.shardInfo != null && Object.hasOwnProperty.call(message, "shardInfo")) + $root.google.cloud.documentai.v1beta1.Document.ShardInfo.encode(message.shardInfo, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Document message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document + * @static + * @param {google.cloud.documentai.v1beta1.IDocument} message Document message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Document.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Document message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document} Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Document.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uri = reader.string(); + break; + case 2: + message.content = reader.bytes(); + break; + case 3: + message.mimeType = reader.string(); + break; + case 4: + message.text = reader.string(); + break; + case 5: + if (!(message.textStyles && message.textStyles.length)) + message.textStyles = []; + message.textStyles.push($root.google.cloud.documentai.v1beta1.Document.Style.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.pages && message.pages.length)) + message.pages = []; + message.pages.push($root.google.cloud.documentai.v1beta1.Document.Page.decode(reader, reader.uint32())); + break; + case 7: + if (!(message.entities && message.entities.length)) + message.entities = []; + message.entities.push($root.google.cloud.documentai.v1beta1.Document.Entity.decode(reader, reader.uint32())); + break; + case 8: + if (!(message.entityRelations && message.entityRelations.length)) + message.entityRelations = []; + message.entityRelations.push($root.google.cloud.documentai.v1beta1.Document.EntityRelation.decode(reader, reader.uint32())); + break; + case 9: + message.shardInfo = $root.google.cloud.documentai.v1beta1.Document.ShardInfo.decode(reader, reader.uint32()); + break; + case 10: + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Document message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document} Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Document.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Document message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Document.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.uri != null && message.hasOwnProperty("uri")) { + properties.source = 1; + if (!$util.isString(message.uri)) + return "uri: string expected"; + } + if (message.content != null && message.hasOwnProperty("content")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) + return "content: buffer expected"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.textStyles != null && message.hasOwnProperty("textStyles")) { + if (!Array.isArray(message.textStyles)) + return "textStyles: array expected"; + for (var i = 0; i < message.textStyles.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Style.verify(message.textStyles[i]); + if (error) + return "textStyles." + error; + } + } + if (message.pages != null && message.hasOwnProperty("pages")) { + if (!Array.isArray(message.pages)) + return "pages: array expected"; + for (var i = 0; i < message.pages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.verify(message.pages[i]); + if (error) + return "pages." + error; + } + } + if (message.entities != null && message.hasOwnProperty("entities")) { + if (!Array.isArray(message.entities)) + return "entities: array expected"; + for (var i = 0; i < message.entities.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Entity.verify(message.entities[i]); + if (error) + return "entities." + error; + } + } + if (message.entityRelations != null && message.hasOwnProperty("entityRelations")) { + if (!Array.isArray(message.entityRelations)) + return "entityRelations: array expected"; + for (var i = 0; i < message.entityRelations.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.EntityRelation.verify(message.entityRelations[i]); + if (error) + return "entityRelations." + error; + } + } + if (message.shardInfo != null && message.hasOwnProperty("shardInfo")) { + var error = $root.google.cloud.documentai.v1beta1.Document.ShardInfo.verify(message.shardInfo); + if (error) + return "shardInfo." + error; + } + if (message.error != null && message.hasOwnProperty("error")) { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; + } + return null; + }; + + /** + * Creates a Document message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document} Document + */ + Document.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.content != null) + if (typeof object.content === "string") + $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); + else if (object.content.length) + message.content = object.content; + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + if (object.text != null) + message.text = String(object.text); + if (object.textStyles) { + if (!Array.isArray(object.textStyles)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.textStyles: array expected"); + message.textStyles = []; + for (var i = 0; i < object.textStyles.length; ++i) { + if (typeof object.textStyles[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.textStyles: object expected"); + message.textStyles[i] = $root.google.cloud.documentai.v1beta1.Document.Style.fromObject(object.textStyles[i]); + } + } + if (object.pages) { + if (!Array.isArray(object.pages)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.pages: array expected"); + message.pages = []; + for (var i = 0; i < object.pages.length; ++i) { + if (typeof object.pages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.pages: object expected"); + message.pages[i] = $root.google.cloud.documentai.v1beta1.Document.Page.fromObject(object.pages[i]); + } + } + if (object.entities) { + if (!Array.isArray(object.entities)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.entities: array expected"); + message.entities = []; + for (var i = 0; i < object.entities.length; ++i) { + if (typeof object.entities[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.entities: object expected"); + message.entities[i] = $root.google.cloud.documentai.v1beta1.Document.Entity.fromObject(object.entities[i]); + } + } + if (object.entityRelations) { + if (!Array.isArray(object.entityRelations)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.entityRelations: array expected"); + message.entityRelations = []; + for (var i = 0; i < object.entityRelations.length; ++i) { + if (typeof object.entityRelations[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.entityRelations: object expected"); + message.entityRelations[i] = $root.google.cloud.documentai.v1beta1.Document.EntityRelation.fromObject(object.entityRelations[i]); + } + } + if (object.shardInfo != null) { + if (typeof object.shardInfo !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.shardInfo: object expected"); + message.shardInfo = $root.google.cloud.documentai.v1beta1.Document.ShardInfo.fromObject(object.shardInfo); + } + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error); + } + return message; + }; + + /** + * Creates a plain object from a Document message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document + * @static + * @param {google.cloud.documentai.v1beta1.Document} message Document + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Document.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.textStyles = []; + object.pages = []; + object.entities = []; + object.entityRelations = []; + } + if (options.defaults) { + object.mimeType = ""; + object.text = ""; + object.shardInfo = null; + object.error = null; + } + if (message.uri != null && message.hasOwnProperty("uri")) { + object.uri = message.uri; + if (options.oneofs) + object.source = "uri"; + } + if (message.content != null && message.hasOwnProperty("content")) { + object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; + if (options.oneofs) + object.source = "content"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.textStyles && message.textStyles.length) { + object.textStyles = []; + for (var j = 0; j < message.textStyles.length; ++j) + object.textStyles[j] = $root.google.cloud.documentai.v1beta1.Document.Style.toObject(message.textStyles[j], options); + } + if (message.pages && message.pages.length) { + object.pages = []; + for (var j = 0; j < message.pages.length; ++j) + object.pages[j] = $root.google.cloud.documentai.v1beta1.Document.Page.toObject(message.pages[j], options); + } + if (message.entities && message.entities.length) { + object.entities = []; + for (var j = 0; j < message.entities.length; ++j) + object.entities[j] = $root.google.cloud.documentai.v1beta1.Document.Entity.toObject(message.entities[j], options); + } + if (message.entityRelations && message.entityRelations.length) { + object.entityRelations = []; + for (var j = 0; j < message.entityRelations.length; ++j) + object.entityRelations[j] = $root.google.cloud.documentai.v1beta1.Document.EntityRelation.toObject(message.entityRelations[j], options); + } + if (message.shardInfo != null && message.hasOwnProperty("shardInfo")) + object.shardInfo = $root.google.cloud.documentai.v1beta1.Document.ShardInfo.toObject(message.shardInfo, options); + if (message.error != null && message.hasOwnProperty("error")) + object.error = $root.google.rpc.Status.toObject(message.error, options); + return object; + }; + + /** + * Converts this Document to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document + * @instance + * @returns {Object.} JSON object + */ + Document.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Document.ShardInfo = (function() { + + /** + * Properties of a ShardInfo. + * @memberof google.cloud.documentai.v1beta1.Document + * @interface IShardInfo + * @property {number|Long|null} [shardIndex] ShardInfo shardIndex + * @property {number|Long|null} [shardCount] ShardInfo shardCount + * @property {number|Long|null} [textOffset] ShardInfo textOffset + */ + + /** + * Constructs a new ShardInfo. + * @memberof google.cloud.documentai.v1beta1.Document + * @classdesc Represents a ShardInfo. + * @implements IShardInfo + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.IShardInfo=} [properties] Properties to set + */ + function ShardInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ShardInfo shardIndex. + * @member {number|Long} shardIndex + * @memberof google.cloud.documentai.v1beta1.Document.ShardInfo + * @instance + */ + ShardInfo.prototype.shardIndex = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ShardInfo shardCount. + * @member {number|Long} shardCount + * @memberof google.cloud.documentai.v1beta1.Document.ShardInfo + * @instance + */ + ShardInfo.prototype.shardCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ShardInfo textOffset. + * @member {number|Long} textOffset + * @memberof google.cloud.documentai.v1beta1.Document.ShardInfo + * @instance + */ + ShardInfo.prototype.textOffset = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new ShardInfo instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.ShardInfo + * @static + * @param {google.cloud.documentai.v1beta1.Document.IShardInfo=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.ShardInfo} ShardInfo instance + */ + ShardInfo.create = function create(properties) { + return new ShardInfo(properties); + }; + + /** + * Encodes the specified ShardInfo message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.ShardInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.ShardInfo + * @static + * @param {google.cloud.documentai.v1beta1.Document.IShardInfo} message ShardInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ShardInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.shardIndex != null && Object.hasOwnProperty.call(message, "shardIndex")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.shardIndex); + if (message.shardCount != null && Object.hasOwnProperty.call(message, "shardCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.shardCount); + if (message.textOffset != null && Object.hasOwnProperty.call(message, "textOffset")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.textOffset); + return writer; + }; + + /** + * Encodes the specified ShardInfo message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.ShardInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.ShardInfo + * @static + * @param {google.cloud.documentai.v1beta1.Document.IShardInfo} message ShardInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ShardInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ShardInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.ShardInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.ShardInfo} ShardInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ShardInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.ShardInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.shardIndex = reader.int64(); + break; + case 2: + message.shardCount = reader.int64(); + break; + case 3: + message.textOffset = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ShardInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.ShardInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.ShardInfo} ShardInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ShardInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ShardInfo message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.ShardInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ShardInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.shardIndex != null && message.hasOwnProperty("shardIndex")) + if (!$util.isInteger(message.shardIndex) && !(message.shardIndex && $util.isInteger(message.shardIndex.low) && $util.isInteger(message.shardIndex.high))) + return "shardIndex: integer|Long expected"; + if (message.shardCount != null && message.hasOwnProperty("shardCount")) + if (!$util.isInteger(message.shardCount) && !(message.shardCount && $util.isInteger(message.shardCount.low) && $util.isInteger(message.shardCount.high))) + return "shardCount: integer|Long expected"; + if (message.textOffset != null && message.hasOwnProperty("textOffset")) + if (!$util.isInteger(message.textOffset) && !(message.textOffset && $util.isInteger(message.textOffset.low) && $util.isInteger(message.textOffset.high))) + return "textOffset: integer|Long expected"; + return null; + }; + + /** + * Creates a ShardInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.ShardInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.ShardInfo} ShardInfo + */ + ShardInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.ShardInfo) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.ShardInfo(); + if (object.shardIndex != null) + if ($util.Long) + (message.shardIndex = $util.Long.fromValue(object.shardIndex)).unsigned = false; + else if (typeof object.shardIndex === "string") + message.shardIndex = parseInt(object.shardIndex, 10); + else if (typeof object.shardIndex === "number") + message.shardIndex = object.shardIndex; + else if (typeof object.shardIndex === "object") + message.shardIndex = new $util.LongBits(object.shardIndex.low >>> 0, object.shardIndex.high >>> 0).toNumber(); + if (object.shardCount != null) + if ($util.Long) + (message.shardCount = $util.Long.fromValue(object.shardCount)).unsigned = false; + else if (typeof object.shardCount === "string") + message.shardCount = parseInt(object.shardCount, 10); + else if (typeof object.shardCount === "number") + message.shardCount = object.shardCount; + else if (typeof object.shardCount === "object") + message.shardCount = new $util.LongBits(object.shardCount.low >>> 0, object.shardCount.high >>> 0).toNumber(); + if (object.textOffset != null) + if ($util.Long) + (message.textOffset = $util.Long.fromValue(object.textOffset)).unsigned = false; + else if (typeof object.textOffset === "string") + message.textOffset = parseInt(object.textOffset, 10); + else if (typeof object.textOffset === "number") + message.textOffset = object.textOffset; + else if (typeof object.textOffset === "object") + message.textOffset = new $util.LongBits(object.textOffset.low >>> 0, object.textOffset.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a ShardInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.ShardInfo + * @static + * @param {google.cloud.documentai.v1beta1.Document.ShardInfo} message ShardInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ShardInfo.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.shardIndex = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.shardIndex = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.shardCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.shardCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.textOffset = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.textOffset = options.longs === String ? "0" : 0; + } + if (message.shardIndex != null && message.hasOwnProperty("shardIndex")) + if (typeof message.shardIndex === "number") + object.shardIndex = options.longs === String ? String(message.shardIndex) : message.shardIndex; + else + object.shardIndex = options.longs === String ? $util.Long.prototype.toString.call(message.shardIndex) : options.longs === Number ? new $util.LongBits(message.shardIndex.low >>> 0, message.shardIndex.high >>> 0).toNumber() : message.shardIndex; + if (message.shardCount != null && message.hasOwnProperty("shardCount")) + if (typeof message.shardCount === "number") + object.shardCount = options.longs === String ? String(message.shardCount) : message.shardCount; + else + object.shardCount = options.longs === String ? $util.Long.prototype.toString.call(message.shardCount) : options.longs === Number ? new $util.LongBits(message.shardCount.low >>> 0, message.shardCount.high >>> 0).toNumber() : message.shardCount; + if (message.textOffset != null && message.hasOwnProperty("textOffset")) + if (typeof message.textOffset === "number") + object.textOffset = options.longs === String ? String(message.textOffset) : message.textOffset; + else + object.textOffset = options.longs === String ? $util.Long.prototype.toString.call(message.textOffset) : options.longs === Number ? new $util.LongBits(message.textOffset.low >>> 0, message.textOffset.high >>> 0).toNumber() : message.textOffset; + return object; + }; + + /** + * Converts this ShardInfo to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.ShardInfo + * @instance + * @returns {Object.} JSON object + */ + ShardInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ShardInfo; + })(); + + Document.Style = (function() { + + /** + * Properties of a Style. + * @memberof google.cloud.documentai.v1beta1.Document + * @interface IStyle + * @property {google.cloud.documentai.v1beta1.Document.ITextAnchor|null} [textAnchor] Style textAnchor + * @property {google.type.IColor|null} [color] Style color + * @property {google.type.IColor|null} [backgroundColor] Style backgroundColor + * @property {string|null} [fontWeight] Style fontWeight + * @property {string|null} [textStyle] Style textStyle + * @property {string|null} [textDecoration] Style textDecoration + * @property {google.cloud.documentai.v1beta1.Document.Style.IFontSize|null} [fontSize] Style fontSize + */ + + /** + * Constructs a new Style. + * @memberof google.cloud.documentai.v1beta1.Document + * @classdesc Represents a Style. + * @implements IStyle + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.IStyle=} [properties] Properties to set + */ + function Style(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Style textAnchor. + * @member {google.cloud.documentai.v1beta1.Document.ITextAnchor|null|undefined} textAnchor + * @memberof google.cloud.documentai.v1beta1.Document.Style + * @instance + */ + Style.prototype.textAnchor = null; + + /** + * Style color. + * @member {google.type.IColor|null|undefined} color + * @memberof google.cloud.documentai.v1beta1.Document.Style + * @instance + */ + Style.prototype.color = null; + + /** + * Style backgroundColor. + * @member {google.type.IColor|null|undefined} backgroundColor + * @memberof google.cloud.documentai.v1beta1.Document.Style + * @instance + */ + Style.prototype.backgroundColor = null; + + /** + * Style fontWeight. + * @member {string} fontWeight + * @memberof google.cloud.documentai.v1beta1.Document.Style + * @instance + */ + Style.prototype.fontWeight = ""; + + /** + * Style textStyle. + * @member {string} textStyle + * @memberof google.cloud.documentai.v1beta1.Document.Style + * @instance + */ + Style.prototype.textStyle = ""; + + /** + * Style textDecoration. + * @member {string} textDecoration + * @memberof google.cloud.documentai.v1beta1.Document.Style + * @instance + */ + Style.prototype.textDecoration = ""; + + /** + * Style fontSize. + * @member {google.cloud.documentai.v1beta1.Document.Style.IFontSize|null|undefined} fontSize + * @memberof google.cloud.documentai.v1beta1.Document.Style + * @instance + */ + Style.prototype.fontSize = null; + + /** + * Creates a new Style instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.Style + * @static + * @param {google.cloud.documentai.v1beta1.Document.IStyle=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.Style} Style instance + */ + Style.create = function create(properties) { + return new Style(properties); + }; + + /** + * Encodes the specified Style message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Style.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.Style + * @static + * @param {google.cloud.documentai.v1beta1.Document.IStyle} message Style message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Style.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textAnchor != null && Object.hasOwnProperty.call(message, "textAnchor")) + $root.google.cloud.documentai.v1beta1.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.color != null && Object.hasOwnProperty.call(message, "color")) + $root.google.type.Color.encode(message.color, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.backgroundColor != null && Object.hasOwnProperty.call(message, "backgroundColor")) + $root.google.type.Color.encode(message.backgroundColor, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.fontWeight != null && Object.hasOwnProperty.call(message, "fontWeight")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.fontWeight); + if (message.textStyle != null && Object.hasOwnProperty.call(message, "textStyle")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.textStyle); + if (message.textDecoration != null && Object.hasOwnProperty.call(message, "textDecoration")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.textDecoration); + if (message.fontSize != null && Object.hasOwnProperty.call(message, "fontSize")) + $root.google.cloud.documentai.v1beta1.Document.Style.FontSize.encode(message.fontSize, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Style message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Style.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Style + * @static + * @param {google.cloud.documentai.v1beta1.Document.IStyle} message Style message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Style.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Style message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.Style + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.Style} Style + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Style.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.Style(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.textAnchor = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.decode(reader, reader.uint32()); + break; + case 2: + message.color = $root.google.type.Color.decode(reader, reader.uint32()); + break; + case 3: + message.backgroundColor = $root.google.type.Color.decode(reader, reader.uint32()); + break; + case 4: + message.fontWeight = reader.string(); + break; + case 5: + message.textStyle = reader.string(); + break; + case 6: + message.textDecoration = reader.string(); + break; + case 7: + message.fontSize = $root.google.cloud.documentai.v1beta1.Document.Style.FontSize.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Style message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Style + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.Style} Style + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Style.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Style message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.Style + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Style.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) { + var error = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.verify(message.textAnchor); + if (error) + return "textAnchor." + error; + } + if (message.color != null && message.hasOwnProperty("color")) { + var error = $root.google.type.Color.verify(message.color); + if (error) + return "color." + error; + } + if (message.backgroundColor != null && message.hasOwnProperty("backgroundColor")) { + var error = $root.google.type.Color.verify(message.backgroundColor); + if (error) + return "backgroundColor." + error; + } + if (message.fontWeight != null && message.hasOwnProperty("fontWeight")) + if (!$util.isString(message.fontWeight)) + return "fontWeight: string expected"; + if (message.textStyle != null && message.hasOwnProperty("textStyle")) + if (!$util.isString(message.textStyle)) + return "textStyle: string expected"; + if (message.textDecoration != null && message.hasOwnProperty("textDecoration")) + if (!$util.isString(message.textDecoration)) + return "textDecoration: string expected"; + if (message.fontSize != null && message.hasOwnProperty("fontSize")) { + var error = $root.google.cloud.documentai.v1beta1.Document.Style.FontSize.verify(message.fontSize); + if (error) + return "fontSize." + error; + } + return null; + }; + + /** + * Creates a Style message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.Style + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.Style} Style + */ + Style.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.Style) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.Style(); + if (object.textAnchor != null) { + if (typeof object.textAnchor !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Style.textAnchor: object expected"); + message.textAnchor = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.fromObject(object.textAnchor); + } + if (object.color != null) { + if (typeof object.color !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Style.color: object expected"); + message.color = $root.google.type.Color.fromObject(object.color); + } + if (object.backgroundColor != null) { + if (typeof object.backgroundColor !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Style.backgroundColor: object expected"); + message.backgroundColor = $root.google.type.Color.fromObject(object.backgroundColor); + } + if (object.fontWeight != null) + message.fontWeight = String(object.fontWeight); + if (object.textStyle != null) + message.textStyle = String(object.textStyle); + if (object.textDecoration != null) + message.textDecoration = String(object.textDecoration); + if (object.fontSize != null) { + if (typeof object.fontSize !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Style.fontSize: object expected"); + message.fontSize = $root.google.cloud.documentai.v1beta1.Document.Style.FontSize.fromObject(object.fontSize); + } + return message; + }; + + /** + * Creates a plain object from a Style message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.Style + * @static + * @param {google.cloud.documentai.v1beta1.Document.Style} message Style + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Style.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.textAnchor = null; + object.color = null; + object.backgroundColor = null; + object.fontWeight = ""; + object.textStyle = ""; + object.textDecoration = ""; + object.fontSize = null; + } + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + object.textAnchor = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.toObject(message.textAnchor, options); + if (message.color != null && message.hasOwnProperty("color")) + object.color = $root.google.type.Color.toObject(message.color, options); + if (message.backgroundColor != null && message.hasOwnProperty("backgroundColor")) + object.backgroundColor = $root.google.type.Color.toObject(message.backgroundColor, options); + if (message.fontWeight != null && message.hasOwnProperty("fontWeight")) + object.fontWeight = message.fontWeight; + if (message.textStyle != null && message.hasOwnProperty("textStyle")) + object.textStyle = message.textStyle; + if (message.textDecoration != null && message.hasOwnProperty("textDecoration")) + object.textDecoration = message.textDecoration; + if (message.fontSize != null && message.hasOwnProperty("fontSize")) + object.fontSize = $root.google.cloud.documentai.v1beta1.Document.Style.FontSize.toObject(message.fontSize, options); + return object; + }; + + /** + * Converts this Style to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.Style + * @instance + * @returns {Object.} JSON object + */ + Style.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Style.FontSize = (function() { + + /** + * Properties of a FontSize. + * @memberof google.cloud.documentai.v1beta1.Document.Style + * @interface IFontSize + * @property {number|null} [size] FontSize size + * @property {string|null} [unit] FontSize unit + */ + + /** + * Constructs a new FontSize. + * @memberof google.cloud.documentai.v1beta1.Document.Style + * @classdesc Represents a FontSize. + * @implements IFontSize + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.Style.IFontSize=} [properties] Properties to set + */ + function FontSize(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FontSize size. + * @member {number} size + * @memberof google.cloud.documentai.v1beta1.Document.Style.FontSize + * @instance + */ + FontSize.prototype.size = 0; + + /** + * FontSize unit. + * @member {string} unit + * @memberof google.cloud.documentai.v1beta1.Document.Style.FontSize + * @instance + */ + FontSize.prototype.unit = ""; + + /** + * Creates a new FontSize instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.Style.FontSize + * @static + * @param {google.cloud.documentai.v1beta1.Document.Style.IFontSize=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.Style.FontSize} FontSize instance + */ + FontSize.create = function create(properties) { + return new FontSize(properties); + }; + + /** + * Encodes the specified FontSize message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Style.FontSize.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.Style.FontSize + * @static + * @param {google.cloud.documentai.v1beta1.Document.Style.IFontSize} message FontSize message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FontSize.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.size != null && Object.hasOwnProperty.call(message, "size")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.size); + if (message.unit != null && Object.hasOwnProperty.call(message, "unit")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.unit); + return writer; + }; + + /** + * Encodes the specified FontSize message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Style.FontSize.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Style.FontSize + * @static + * @param {google.cloud.documentai.v1beta1.Document.Style.IFontSize} message FontSize message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FontSize.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FontSize message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.Style.FontSize + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.Style.FontSize} FontSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FontSize.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.Style.FontSize(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.size = reader.float(); + break; + case 2: + message.unit = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FontSize message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Style.FontSize + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.Style.FontSize} FontSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FontSize.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FontSize message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.Style.FontSize + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FontSize.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.size != null && message.hasOwnProperty("size")) + if (typeof message.size !== "number") + return "size: number expected"; + if (message.unit != null && message.hasOwnProperty("unit")) + if (!$util.isString(message.unit)) + return "unit: string expected"; + return null; + }; + + /** + * Creates a FontSize message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.Style.FontSize + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.Style.FontSize} FontSize + */ + FontSize.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.Style.FontSize) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.Style.FontSize(); + if (object.size != null) + message.size = Number(object.size); + if (object.unit != null) + message.unit = String(object.unit); + return message; + }; + + /** + * Creates a plain object from a FontSize message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.Style.FontSize + * @static + * @param {google.cloud.documentai.v1beta1.Document.Style.FontSize} message FontSize + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FontSize.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.size = 0; + object.unit = ""; + } + if (message.size != null && message.hasOwnProperty("size")) + object.size = options.json && !isFinite(message.size) ? String(message.size) : message.size; + if (message.unit != null && message.hasOwnProperty("unit")) + object.unit = message.unit; + return object; + }; + + /** + * Converts this FontSize to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.Style.FontSize + * @instance + * @returns {Object.} JSON object + */ + FontSize.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FontSize; + })(); + + return Style; + })(); + + Document.Page = (function() { + + /** + * Properties of a Page. + * @memberof google.cloud.documentai.v1beta1.Document + * @interface IPage + * @property {number|null} [pageNumber] Page pageNumber + * @property {google.cloud.documentai.v1beta1.Document.Page.IDimension|null} [dimension] Page dimension + * @property {google.cloud.documentai.v1beta1.Document.Page.ILayout|null} [layout] Page layout + * @property {Array.|null} [detectedLanguages] Page detectedLanguages + * @property {Array.|null} [blocks] Page blocks + * @property {Array.|null} [paragraphs] Page paragraphs + * @property {Array.|null} [lines] Page lines + * @property {Array.|null} [tokens] Page tokens + * @property {Array.|null} [visualElements] Page visualElements + * @property {Array.|null} [tables] Page tables + * @property {Array.|null} [formFields] Page formFields + */ + + /** + * Constructs a new Page. + * @memberof google.cloud.documentai.v1beta1.Document + * @classdesc Represents a Page. + * @implements IPage + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.IPage=} [properties] Properties to set + */ + function Page(properties) { + this.detectedLanguages = []; + this.blocks = []; + this.paragraphs = []; + this.lines = []; + this.tokens = []; + this.visualElements = []; + this.tables = []; + this.formFields = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Page pageNumber. + * @member {number} pageNumber + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @instance + */ + Page.prototype.pageNumber = 0; + + /** + * Page dimension. + * @member {google.cloud.documentai.v1beta1.Document.Page.IDimension|null|undefined} dimension + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @instance + */ + Page.prototype.dimension = null; + + /** + * Page layout. + * @member {google.cloud.documentai.v1beta1.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @instance + */ + Page.prototype.layout = null; + + /** + * Page detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @instance + */ + Page.prototype.detectedLanguages = $util.emptyArray; + + /** + * Page blocks. + * @member {Array.} blocks + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @instance + */ + Page.prototype.blocks = $util.emptyArray; + + /** + * Page paragraphs. + * @member {Array.} paragraphs + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @instance + */ + Page.prototype.paragraphs = $util.emptyArray; + + /** + * Page lines. + * @member {Array.} lines + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @instance + */ + Page.prototype.lines = $util.emptyArray; + + /** + * Page tokens. + * @member {Array.} tokens + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @instance + */ + Page.prototype.tokens = $util.emptyArray; + + /** + * Page visualElements. + * @member {Array.} visualElements + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @instance + */ + Page.prototype.visualElements = $util.emptyArray; + + /** + * Page tables. + * @member {Array.} tables + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @instance + */ + Page.prototype.tables = $util.emptyArray; + + /** + * Page formFields. + * @member {Array.} formFields + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @instance + */ + Page.prototype.formFields = $util.emptyArray; + + /** + * Creates a new Page instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @static + * @param {google.cloud.documentai.v1beta1.Document.IPage=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.Page} Page instance + */ + Page.create = function create(properties) { + return new Page(properties); + }; + + /** + * Encodes the specified Page message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @static + * @param {google.cloud.documentai.v1beta1.Document.IPage} message Page message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Page.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageNumber != null && Object.hasOwnProperty.call(message, "pageNumber")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.pageNumber); + if (message.dimension != null && Object.hasOwnProperty.call(message, "dimension")) + $root.google.cloud.documentai.v1beta1.Document.Page.Dimension.encode(message.dimension, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1beta1.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.blocks != null && message.blocks.length) + for (var i = 0; i < message.blocks.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.Block.encode(message.blocks[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.paragraphs != null && message.paragraphs.length) + for (var i = 0; i < message.paragraphs.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.Paragraph.encode(message.paragraphs[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.lines != null && message.lines.length) + for (var i = 0; i < message.lines.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.Line.encode(message.lines[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.tokens != null && message.tokens.length) + for (var i = 0; i < message.tokens.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.Token.encode(message.tokens[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.visualElements != null && message.visualElements.length) + for (var i = 0; i < message.visualElements.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.VisualElement.encode(message.visualElements[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.tables != null && message.tables.length) + for (var i = 0; i < message.tables.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.Table.encode(message.tables[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.formFields != null && message.formFields.length) + for (var i = 0; i < message.formFields.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.FormField.encode(message.formFields[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Page message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @static + * @param {google.cloud.documentai.v1beta1.Document.IPage} message Page message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Page.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Page message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.Page} Page + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Page.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.Page(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pageNumber = reader.int32(); + break; + case 2: + message.dimension = $root.google.cloud.documentai.v1beta1.Document.Page.Dimension.decode(reader, reader.uint32()); + break; + case 3: + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.blocks && message.blocks.length)) + message.blocks = []; + message.blocks.push($root.google.cloud.documentai.v1beta1.Document.Page.Block.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.paragraphs && message.paragraphs.length)) + message.paragraphs = []; + message.paragraphs.push($root.google.cloud.documentai.v1beta1.Document.Page.Paragraph.decode(reader, reader.uint32())); + break; + case 7: + if (!(message.lines && message.lines.length)) + message.lines = []; + message.lines.push($root.google.cloud.documentai.v1beta1.Document.Page.Line.decode(reader, reader.uint32())); + break; + case 8: + if (!(message.tokens && message.tokens.length)) + message.tokens = []; + message.tokens.push($root.google.cloud.documentai.v1beta1.Document.Page.Token.decode(reader, reader.uint32())); + break; + case 9: + if (!(message.visualElements && message.visualElements.length)) + message.visualElements = []; + message.visualElements.push($root.google.cloud.documentai.v1beta1.Document.Page.VisualElement.decode(reader, reader.uint32())); + break; + case 10: + if (!(message.tables && message.tables.length)) + message.tables = []; + message.tables.push($root.google.cloud.documentai.v1beta1.Document.Page.Table.decode(reader, reader.uint32())); + break; + case 11: + if (!(message.formFields && message.formFields.length)) + message.formFields = []; + message.formFields.push($root.google.cloud.documentai.v1beta1.Document.Page.FormField.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Page message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.Page} Page + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Page.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Page message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Page.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + if (!$util.isInteger(message.pageNumber)) + return "pageNumber: integer expected"; + if (message.dimension != null && message.hasOwnProperty("dimension")) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.Dimension.verify(message.dimension); + if (error) + return "dimension." + error; + } + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + if (message.blocks != null && message.hasOwnProperty("blocks")) { + if (!Array.isArray(message.blocks)) + return "blocks: array expected"; + for (var i = 0; i < message.blocks.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.Block.verify(message.blocks[i]); + if (error) + return "blocks." + error; + } + } + if (message.paragraphs != null && message.hasOwnProperty("paragraphs")) { + if (!Array.isArray(message.paragraphs)) + return "paragraphs: array expected"; + for (var i = 0; i < message.paragraphs.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.Paragraph.verify(message.paragraphs[i]); + if (error) + return "paragraphs." + error; + } + } + if (message.lines != null && message.hasOwnProperty("lines")) { + if (!Array.isArray(message.lines)) + return "lines: array expected"; + for (var i = 0; i < message.lines.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.Line.verify(message.lines[i]); + if (error) + return "lines." + error; + } + } + if (message.tokens != null && message.hasOwnProperty("tokens")) { + if (!Array.isArray(message.tokens)) + return "tokens: array expected"; + for (var i = 0; i < message.tokens.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.Token.verify(message.tokens[i]); + if (error) + return "tokens." + error; + } + } + if (message.visualElements != null && message.hasOwnProperty("visualElements")) { + if (!Array.isArray(message.visualElements)) + return "visualElements: array expected"; + for (var i = 0; i < message.visualElements.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.VisualElement.verify(message.visualElements[i]); + if (error) + return "visualElements." + error; + } + } + if (message.tables != null && message.hasOwnProperty("tables")) { + if (!Array.isArray(message.tables)) + return "tables: array expected"; + for (var i = 0; i < message.tables.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.Table.verify(message.tables[i]); + if (error) + return "tables." + error; + } + } + if (message.formFields != null && message.hasOwnProperty("formFields")) { + if (!Array.isArray(message.formFields)) + return "formFields: array expected"; + for (var i = 0; i < message.formFields.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.FormField.verify(message.formFields[i]); + if (error) + return "formFields." + error; + } + } + return null; + }; + + /** + * Creates a Page message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.Page} Page + */ + Page.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.Page) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.Page(); + if (object.pageNumber != null) + message.pageNumber = object.pageNumber | 0; + if (object.dimension != null) { + if (typeof object.dimension !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.dimension: object expected"); + message.dimension = $root.google.cloud.documentai.v1beta1.Document.Page.Dimension.fromObject(object.dimension); + } + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + if (object.blocks) { + if (!Array.isArray(object.blocks)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.blocks: array expected"); + message.blocks = []; + for (var i = 0; i < object.blocks.length; ++i) { + if (typeof object.blocks[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.blocks: object expected"); + message.blocks[i] = $root.google.cloud.documentai.v1beta1.Document.Page.Block.fromObject(object.blocks[i]); + } + } + if (object.paragraphs) { + if (!Array.isArray(object.paragraphs)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.paragraphs: array expected"); + message.paragraphs = []; + for (var i = 0; i < object.paragraphs.length; ++i) { + if (typeof object.paragraphs[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.paragraphs: object expected"); + message.paragraphs[i] = $root.google.cloud.documentai.v1beta1.Document.Page.Paragraph.fromObject(object.paragraphs[i]); + } + } + if (object.lines) { + if (!Array.isArray(object.lines)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.lines: array expected"); + message.lines = []; + for (var i = 0; i < object.lines.length; ++i) { + if (typeof object.lines[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.lines: object expected"); + message.lines[i] = $root.google.cloud.documentai.v1beta1.Document.Page.Line.fromObject(object.lines[i]); + } + } + if (object.tokens) { + if (!Array.isArray(object.tokens)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.tokens: array expected"); + message.tokens = []; + for (var i = 0; i < object.tokens.length; ++i) { + if (typeof object.tokens[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.tokens: object expected"); + message.tokens[i] = $root.google.cloud.documentai.v1beta1.Document.Page.Token.fromObject(object.tokens[i]); + } + } + if (object.visualElements) { + if (!Array.isArray(object.visualElements)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.visualElements: array expected"); + message.visualElements = []; + for (var i = 0; i < object.visualElements.length; ++i) { + if (typeof object.visualElements[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.visualElements: object expected"); + message.visualElements[i] = $root.google.cloud.documentai.v1beta1.Document.Page.VisualElement.fromObject(object.visualElements[i]); + } + } + if (object.tables) { + if (!Array.isArray(object.tables)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.tables: array expected"); + message.tables = []; + for (var i = 0; i < object.tables.length; ++i) { + if (typeof object.tables[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.tables: object expected"); + message.tables[i] = $root.google.cloud.documentai.v1beta1.Document.Page.Table.fromObject(object.tables[i]); + } + } + if (object.formFields) { + if (!Array.isArray(object.formFields)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.formFields: array expected"); + message.formFields = []; + for (var i = 0; i < object.formFields.length; ++i) { + if (typeof object.formFields[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.formFields: object expected"); + message.formFields[i] = $root.google.cloud.documentai.v1beta1.Document.Page.FormField.fromObject(object.formFields[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Page message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page} message Page + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Page.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.detectedLanguages = []; + object.blocks = []; + object.paragraphs = []; + object.lines = []; + object.tokens = []; + object.visualElements = []; + object.tables = []; + object.formFields = []; + } + if (options.defaults) { + object.pageNumber = 0; + object.dimension = null; + object.layout = null; + } + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + object.pageNumber = message.pageNumber; + if (message.dimension != null && message.hasOwnProperty("dimension")) + object.dimension = $root.google.cloud.documentai.v1beta1.Document.Page.Dimension.toObject(message.dimension, options); + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + if (message.blocks && message.blocks.length) { + object.blocks = []; + for (var j = 0; j < message.blocks.length; ++j) + object.blocks[j] = $root.google.cloud.documentai.v1beta1.Document.Page.Block.toObject(message.blocks[j], options); + } + if (message.paragraphs && message.paragraphs.length) { + object.paragraphs = []; + for (var j = 0; j < message.paragraphs.length; ++j) + object.paragraphs[j] = $root.google.cloud.documentai.v1beta1.Document.Page.Paragraph.toObject(message.paragraphs[j], options); + } + if (message.lines && message.lines.length) { + object.lines = []; + for (var j = 0; j < message.lines.length; ++j) + object.lines[j] = $root.google.cloud.documentai.v1beta1.Document.Page.Line.toObject(message.lines[j], options); + } + if (message.tokens && message.tokens.length) { + object.tokens = []; + for (var j = 0; j < message.tokens.length; ++j) + object.tokens[j] = $root.google.cloud.documentai.v1beta1.Document.Page.Token.toObject(message.tokens[j], options); + } + if (message.visualElements && message.visualElements.length) { + object.visualElements = []; + for (var j = 0; j < message.visualElements.length; ++j) + object.visualElements[j] = $root.google.cloud.documentai.v1beta1.Document.Page.VisualElement.toObject(message.visualElements[j], options); + } + if (message.tables && message.tables.length) { + object.tables = []; + for (var j = 0; j < message.tables.length; ++j) + object.tables[j] = $root.google.cloud.documentai.v1beta1.Document.Page.Table.toObject(message.tables[j], options); + } + if (message.formFields && message.formFields.length) { + object.formFields = []; + for (var j = 0; j < message.formFields.length; ++j) + object.formFields[j] = $root.google.cloud.documentai.v1beta1.Document.Page.FormField.toObject(message.formFields[j], options); + } + return object; + }; + + /** + * Converts this Page to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @instance + * @returns {Object.} JSON object + */ + Page.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Page.Dimension = (function() { + + /** + * Properties of a Dimension. + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @interface IDimension + * @property {number|null} [width] Dimension width + * @property {number|null} [height] Dimension height + * @property {string|null} [unit] Dimension unit + */ + + /** + * Constructs a new Dimension. + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @classdesc Represents a Dimension. + * @implements IDimension + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.Page.IDimension=} [properties] Properties to set + */ + function Dimension(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Dimension width. + * @member {number} width + * @memberof google.cloud.documentai.v1beta1.Document.Page.Dimension + * @instance + */ + Dimension.prototype.width = 0; + + /** + * Dimension height. + * @member {number} height + * @memberof google.cloud.documentai.v1beta1.Document.Page.Dimension + * @instance + */ + Dimension.prototype.height = 0; + + /** + * Dimension unit. + * @member {string} unit + * @memberof google.cloud.documentai.v1beta1.Document.Page.Dimension + * @instance + */ + Dimension.prototype.unit = ""; + + /** + * Creates a new Dimension instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.Page.Dimension + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IDimension=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.Page.Dimension} Dimension instance + */ + Dimension.create = function create(properties) { + return new Dimension(properties); + }; + + /** + * Encodes the specified Dimension message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Dimension.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.Page.Dimension + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IDimension} message Dimension message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Dimension.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.width); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.height); + if (message.unit != null && Object.hasOwnProperty.call(message, "unit")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unit); + return writer; + }; + + /** + * Encodes the specified Dimension message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Dimension.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.Dimension + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IDimension} message Dimension message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Dimension.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Dimension message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.Page.Dimension + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.Page.Dimension} Dimension + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Dimension.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.Page.Dimension(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.width = reader.float(); + break; + case 2: + message.height = reader.float(); + break; + case 3: + message.unit = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Dimension message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.Dimension + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.Page.Dimension} Dimension + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Dimension.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Dimension message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.Page.Dimension + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Dimension.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (typeof message.width !== "number") + return "width: number expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height !== "number") + return "height: number expected"; + if (message.unit != null && message.hasOwnProperty("unit")) + if (!$util.isString(message.unit)) + return "unit: string expected"; + return null; + }; + + /** + * Creates a Dimension message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.Dimension + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.Page.Dimension} Dimension + */ + Dimension.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.Page.Dimension) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.Page.Dimension(); + if (object.width != null) + message.width = Number(object.width); + if (object.height != null) + message.height = Number(object.height); + if (object.unit != null) + message.unit = String(object.unit); + return message; + }; + + /** + * Creates a plain object from a Dimension message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.Dimension + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.Dimension} message Dimension + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Dimension.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.width = 0; + object.height = 0; + object.unit = ""; + } + if (message.width != null && message.hasOwnProperty("width")) + object.width = options.json && !isFinite(message.width) ? String(message.width) : message.width; + if (message.height != null && message.hasOwnProperty("height")) + object.height = options.json && !isFinite(message.height) ? String(message.height) : message.height; + if (message.unit != null && message.hasOwnProperty("unit")) + object.unit = message.unit; + return object; + }; + + /** + * Converts this Dimension to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.Page.Dimension + * @instance + * @returns {Object.} JSON object + */ + Dimension.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Dimension; + })(); + + Page.Layout = (function() { + + /** + * Properties of a Layout. + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @interface ILayout + * @property {google.cloud.documentai.v1beta1.Document.ITextAnchor|null} [textAnchor] Layout textAnchor + * @property {number|null} [confidence] Layout confidence + * @property {google.cloud.documentai.v1beta1.IBoundingPoly|null} [boundingPoly] Layout boundingPoly + * @property {google.cloud.documentai.v1beta1.Document.Page.Layout.Orientation|null} [orientation] Layout orientation + */ + + /** + * Constructs a new Layout. + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @classdesc Represents a Layout. + * @implements ILayout + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.Page.ILayout=} [properties] Properties to set + */ + function Layout(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Layout textAnchor. + * @member {google.cloud.documentai.v1beta1.Document.ITextAnchor|null|undefined} textAnchor + * @memberof google.cloud.documentai.v1beta1.Document.Page.Layout + * @instance + */ + Layout.prototype.textAnchor = null; + + /** + * Layout confidence. + * @member {number} confidence + * @memberof google.cloud.documentai.v1beta1.Document.Page.Layout + * @instance + */ + Layout.prototype.confidence = 0; + + /** + * Layout boundingPoly. + * @member {google.cloud.documentai.v1beta1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.documentai.v1beta1.Document.Page.Layout + * @instance + */ + Layout.prototype.boundingPoly = null; + + /** + * Layout orientation. + * @member {google.cloud.documentai.v1beta1.Document.Page.Layout.Orientation} orientation + * @memberof google.cloud.documentai.v1beta1.Document.Page.Layout + * @instance + */ + Layout.prototype.orientation = 0; + + /** + * Creates a new Layout instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.Page.Layout + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.ILayout=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.Page.Layout} Layout instance + */ + Layout.create = function create(properties) { + return new Layout(properties); + }; + + /** + * Encodes the specified Layout message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Layout.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.Page.Layout + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.ILayout} message Layout message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Layout.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textAnchor != null && Object.hasOwnProperty.call(message, "textAnchor")) + $root.google.cloud.documentai.v1beta1.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) + $root.google.cloud.documentai.v1beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.orientation != null && Object.hasOwnProperty.call(message, "orientation")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.orientation); + return writer; + }; + + /** + * Encodes the specified Layout message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Layout.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.Layout + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.ILayout} message Layout message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Layout.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Layout message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.Page.Layout + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.Page.Layout} Layout + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Layout.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.Page.Layout(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.textAnchor = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.decode(reader, reader.uint32()); + break; + case 2: + message.confidence = reader.float(); + break; + case 3: + message.boundingPoly = $root.google.cloud.documentai.v1beta1.BoundingPoly.decode(reader, reader.uint32()); + break; + case 4: + message.orientation = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Layout message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.Layout + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.Page.Layout} Layout + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Layout.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Layout message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.Page.Layout + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Layout.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) { + var error = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.verify(message.textAnchor); + if (error) + return "textAnchor." + error; + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { + var error = $root.google.cloud.documentai.v1beta1.BoundingPoly.verify(message.boundingPoly); + if (error) + return "boundingPoly." + error; + } + if (message.orientation != null && message.hasOwnProperty("orientation")) + switch (message.orientation) { + default: + return "orientation: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a Layout message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.Layout + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.Page.Layout} Layout + */ + Layout.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.Page.Layout) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.Page.Layout(); + if (object.textAnchor != null) { + if (typeof object.textAnchor !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Layout.textAnchor: object expected"); + message.textAnchor = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.fromObject(object.textAnchor); + } + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Layout.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.documentai.v1beta1.BoundingPoly.fromObject(object.boundingPoly); + } + switch (object.orientation) { + case "ORIENTATION_UNSPECIFIED": + case 0: + message.orientation = 0; + break; + case "PAGE_UP": + case 1: + message.orientation = 1; + break; + case "PAGE_RIGHT": + case 2: + message.orientation = 2; + break; + case "PAGE_DOWN": + case 3: + message.orientation = 3; + break; + case "PAGE_LEFT": + case 4: + message.orientation = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a Layout message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.Layout + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.Layout} message Layout + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Layout.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.textAnchor = null; + object.confidence = 0; + object.boundingPoly = null; + object.orientation = options.enums === String ? "ORIENTATION_UNSPECIFIED" : 0; + } + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + object.textAnchor = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.toObject(message.textAnchor, options); + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.documentai.v1beta1.BoundingPoly.toObject(message.boundingPoly, options); + if (message.orientation != null && message.hasOwnProperty("orientation")) + object.orientation = options.enums === String ? $root.google.cloud.documentai.v1beta1.Document.Page.Layout.Orientation[message.orientation] : message.orientation; + return object; + }; + + /** + * Converts this Layout to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.Page.Layout + * @instance + * @returns {Object.} JSON object + */ + Layout.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Orientation enum. + * @name google.cloud.documentai.v1beta1.Document.Page.Layout.Orientation + * @enum {number} + * @property {number} ORIENTATION_UNSPECIFIED=0 ORIENTATION_UNSPECIFIED value + * @property {number} PAGE_UP=1 PAGE_UP value + * @property {number} PAGE_RIGHT=2 PAGE_RIGHT value + * @property {number} PAGE_DOWN=3 PAGE_DOWN value + * @property {number} PAGE_LEFT=4 PAGE_LEFT value + */ + Layout.Orientation = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ORIENTATION_UNSPECIFIED"] = 0; + values[valuesById[1] = "PAGE_UP"] = 1; + values[valuesById[2] = "PAGE_RIGHT"] = 2; + values[valuesById[3] = "PAGE_DOWN"] = 3; + values[valuesById[4] = "PAGE_LEFT"] = 4; + return values; + })(); + + return Layout; + })(); + + Page.Block = (function() { + + /** + * Properties of a Block. + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @interface IBlock + * @property {google.cloud.documentai.v1beta1.Document.Page.ILayout|null} [layout] Block layout + * @property {Array.|null} [detectedLanguages] Block detectedLanguages + */ + + /** + * Constructs a new Block. + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @classdesc Represents a Block. + * @implements IBlock + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.Page.IBlock=} [properties] Properties to set + */ + function Block(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Block layout. + * @member {google.cloud.documentai.v1beta1.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta1.Document.Page.Block + * @instance + */ + Block.prototype.layout = null; + + /** + * Block detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta1.Document.Page.Block + * @instance + */ + Block.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new Block instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.Page.Block + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IBlock=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.Page.Block} Block instance + */ + Block.create = function create(properties) { + return new Block(properties); + }; + + /** + * Encodes the specified Block message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Block.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.Page.Block + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IBlock} message Block message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Block.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1beta1.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Block message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Block.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.Block + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IBlock} message Block message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Block.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Block message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.Page.Block + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.Page.Block} Block + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Block.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.Page.Block(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Block message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.Block + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.Page.Block} Block + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Block.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Block message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.Page.Block + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Block.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a Block message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.Block + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.Page.Block} Block + */ + Block.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.Page.Block) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.Page.Block(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Block.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Block.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Block.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Block message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.Block + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.Block} message Block + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Block.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) + object.layout = null; + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this Block to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.Page.Block + * @instance + * @returns {Object.} JSON object + */ + Block.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Block; + })(); + + Page.Paragraph = (function() { + + /** + * Properties of a Paragraph. + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @interface IParagraph + * @property {google.cloud.documentai.v1beta1.Document.Page.ILayout|null} [layout] Paragraph layout + * @property {Array.|null} [detectedLanguages] Paragraph detectedLanguages + */ + + /** + * Constructs a new Paragraph. + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @classdesc Represents a Paragraph. + * @implements IParagraph + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.Page.IParagraph=} [properties] Properties to set + */ + function Paragraph(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Paragraph layout. + * @member {google.cloud.documentai.v1beta1.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta1.Document.Page.Paragraph + * @instance + */ + Paragraph.prototype.layout = null; + + /** + * Paragraph detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta1.Document.Page.Paragraph + * @instance + */ + Paragraph.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new Paragraph instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.Page.Paragraph + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IParagraph=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.Page.Paragraph} Paragraph instance + */ + Paragraph.create = function create(properties) { + return new Paragraph(properties); + }; + + /** + * Encodes the specified Paragraph message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Paragraph.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.Page.Paragraph + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IParagraph} message Paragraph message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Paragraph.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1beta1.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Paragraph message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Paragraph.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.Paragraph + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IParagraph} message Paragraph message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Paragraph.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Paragraph message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.Page.Paragraph + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.Page.Paragraph} Paragraph + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Paragraph.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.Page.Paragraph(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Paragraph message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.Paragraph + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.Page.Paragraph} Paragraph + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Paragraph.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Paragraph message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.Page.Paragraph + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Paragraph.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a Paragraph message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.Paragraph + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.Page.Paragraph} Paragraph + */ + Paragraph.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.Page.Paragraph) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.Page.Paragraph(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Paragraph.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Paragraph.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Paragraph.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Paragraph message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.Paragraph + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.Paragraph} message Paragraph + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Paragraph.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) + object.layout = null; + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this Paragraph to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.Page.Paragraph + * @instance + * @returns {Object.} JSON object + */ + Paragraph.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Paragraph; + })(); + + Page.Line = (function() { + + /** + * Properties of a Line. + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @interface ILine + * @property {google.cloud.documentai.v1beta1.Document.Page.ILayout|null} [layout] Line layout + * @property {Array.|null} [detectedLanguages] Line detectedLanguages + */ + + /** + * Constructs a new Line. + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @classdesc Represents a Line. + * @implements ILine + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.Page.ILine=} [properties] Properties to set + */ + function Line(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Line layout. + * @member {google.cloud.documentai.v1beta1.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta1.Document.Page.Line + * @instance + */ + Line.prototype.layout = null; + + /** + * Line detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta1.Document.Page.Line + * @instance + */ + Line.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new Line instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.Page.Line + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.ILine=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.Page.Line} Line instance + */ + Line.create = function create(properties) { + return new Line(properties); + }; + + /** + * Encodes the specified Line message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Line.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.Page.Line + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.ILine} message Line message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Line.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1beta1.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Line message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Line.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.Line + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.ILine} message Line message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Line.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Line message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.Page.Line + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.Page.Line} Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Line.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.Page.Line(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Line message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.Line + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.Page.Line} Line + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Line.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Line message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.Page.Line + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Line.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a Line message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.Line + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.Page.Line} Line + */ + Line.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.Page.Line) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.Page.Line(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Line.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Line.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Line.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Line message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.Line + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.Line} message Line + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Line.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) + object.layout = null; + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this Line to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.Page.Line + * @instance + * @returns {Object.} JSON object + */ + Line.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Line; + })(); + + Page.Token = (function() { + + /** + * Properties of a Token. + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @interface IToken + * @property {google.cloud.documentai.v1beta1.Document.Page.ILayout|null} [layout] Token layout + * @property {google.cloud.documentai.v1beta1.Document.Page.Token.IDetectedBreak|null} [detectedBreak] Token detectedBreak + * @property {Array.|null} [detectedLanguages] Token detectedLanguages + */ + + /** + * Constructs a new Token. + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @classdesc Represents a Token. + * @implements IToken + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.Page.IToken=} [properties] Properties to set + */ + function Token(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Token layout. + * @member {google.cloud.documentai.v1beta1.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token + * @instance + */ + Token.prototype.layout = null; + + /** + * Token detectedBreak. + * @member {google.cloud.documentai.v1beta1.Document.Page.Token.IDetectedBreak|null|undefined} detectedBreak + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token + * @instance + */ + Token.prototype.detectedBreak = null; + + /** + * Token detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token + * @instance + */ + Token.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new Token instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IToken=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.Page.Token} Token instance + */ + Token.create = function create(properties) { + return new Token(properties); + }; + + /** + * Encodes the specified Token message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Token.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IToken} message Token message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Token.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1beta1.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectedBreak != null && Object.hasOwnProperty.call(message, "detectedBreak")) + $root.google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.encode(message.detectedBreak, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Token message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Token.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IToken} message Token message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Token.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Token message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.Page.Token} Token + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Token.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.Page.Token(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + message.detectedBreak = $root.google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.decode(reader, reader.uint32()); + break; + case 3: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Token message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.Page.Token} Token + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Token.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Token message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Token.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.verify(message.detectedBreak); + if (error) + return "detectedBreak." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a Token message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.Page.Token} Token + */ + Token.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.Page.Token) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.Page.Token(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Token.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedBreak != null) { + if (typeof object.detectedBreak !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Token.detectedBreak: object expected"); + message.detectedBreak = $root.google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.fromObject(object.detectedBreak); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Token.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Token.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Token message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.Token} message Token + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Token.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) { + object.layout = null; + object.detectedBreak = null; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) + object.detectedBreak = $root.google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.toObject(message.detectedBreak, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this Token to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token + * @instance + * @returns {Object.} JSON object + */ + Token.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Token.DetectedBreak = (function() { + + /** + * Properties of a DetectedBreak. + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token + * @interface IDetectedBreak + * @property {google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.Type|null} [type] DetectedBreak type + */ + + /** + * Constructs a new DetectedBreak. + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token + * @classdesc Represents a DetectedBreak. + * @implements IDetectedBreak + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.Page.Token.IDetectedBreak=} [properties] Properties to set + */ + function DetectedBreak(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DetectedBreak type. + * @member {google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.Type} type + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak + * @instance + */ + DetectedBreak.prototype.type = 0; + + /** + * Creates a new DetectedBreak instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.Token.IDetectedBreak=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak} DetectedBreak instance + */ + DetectedBreak.create = function create(properties) { + return new DetectedBreak(properties); + }; + + /** + * Encodes the specified DetectedBreak message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.Token.IDetectedBreak} message DetectedBreak message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedBreak.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); + return writer; + }; + + /** + * Encodes the specified DetectedBreak message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.Token.IDetectedBreak} message DetectedBreak message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedBreak.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectedBreak message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak} DetectedBreak + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedBreak.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectedBreak message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak} DetectedBreak + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedBreak.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectedBreak message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectedBreak.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object 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; + } + return null; + }; + + /** + * Creates a DetectedBreak message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak} DetectedBreak + */ + DetectedBreak.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak(); + switch (object.type) { + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "SPACE": + case 1: + message.type = 1; + break; + case "WIDE_SPACE": + case 2: + message.type = 2; + break; + case "HYPHEN": + case 3: + message.type = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a DetectedBreak message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak} message DetectedBreak + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectedBreak.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.Type[message.type] : message.type; + return object; + }; + + /** + * Converts this DetectedBreak to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak + * @instance + * @returns {Object.} JSON object + */ + DetectedBreak.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Type enum. + * @name google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} SPACE=1 SPACE value + * @property {number} WIDE_SPACE=2 WIDE_SPACE value + * @property {number} HYPHEN=3 HYPHEN value + */ + DetectedBreak.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SPACE"] = 1; + values[valuesById[2] = "WIDE_SPACE"] = 2; + values[valuesById[3] = "HYPHEN"] = 3; + return values; + })(); + + return DetectedBreak; + })(); + + return Token; + })(); + + Page.VisualElement = (function() { + + /** + * Properties of a VisualElement. + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @interface IVisualElement + * @property {google.cloud.documentai.v1beta1.Document.Page.ILayout|null} [layout] VisualElement layout + * @property {string|null} [type] VisualElement type + * @property {Array.|null} [detectedLanguages] VisualElement detectedLanguages + */ + + /** + * Constructs a new VisualElement. + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @classdesc Represents a VisualElement. + * @implements IVisualElement + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.Page.IVisualElement=} [properties] Properties to set + */ + function VisualElement(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * VisualElement layout. + * @member {google.cloud.documentai.v1beta1.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta1.Document.Page.VisualElement + * @instance + */ + VisualElement.prototype.layout = null; + + /** + * VisualElement type. + * @member {string} type + * @memberof google.cloud.documentai.v1beta1.Document.Page.VisualElement + * @instance + */ + VisualElement.prototype.type = ""; + + /** + * VisualElement detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta1.Document.Page.VisualElement + * @instance + */ + VisualElement.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new VisualElement instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.Page.VisualElement + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IVisualElement=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.Page.VisualElement} VisualElement instance + */ + VisualElement.create = function create(properties) { + return new VisualElement(properties); + }; + + /** + * Encodes the specified VisualElement message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.VisualElement.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.Page.VisualElement + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IVisualElement} message VisualElement message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisualElement.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1beta1.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified VisualElement message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.VisualElement.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.VisualElement + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IVisualElement} message VisualElement message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisualElement.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VisualElement message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.Page.VisualElement + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.Page.VisualElement} VisualElement + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisualElement.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.Page.VisualElement(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + message.type = reader.string(); + break; + case 3: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VisualElement message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.VisualElement + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.Page.VisualElement} VisualElement + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisualElement.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VisualElement message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.Page.VisualElement + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VisualElement.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a VisualElement message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.VisualElement + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.Page.VisualElement} VisualElement + */ + VisualElement.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.Page.VisualElement) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.Page.VisualElement(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.VisualElement.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.fromObject(object.layout); + } + if (object.type != null) + message.type = String(object.type); + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.VisualElement.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.VisualElement.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a VisualElement message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.VisualElement + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.VisualElement} message VisualElement + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VisualElement.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) { + object.layout = null; + object.type = ""; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.toObject(message.layout, options); + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this VisualElement to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.Page.VisualElement + * @instance + * @returns {Object.} JSON object + */ + VisualElement.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return VisualElement; + })(); + + Page.Table = (function() { + + /** + * Properties of a Table. + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @interface ITable + * @property {google.cloud.documentai.v1beta1.Document.Page.ILayout|null} [layout] Table layout + * @property {Array.|null} [headerRows] Table headerRows + * @property {Array.|null} [bodyRows] Table bodyRows + * @property {Array.|null} [detectedLanguages] Table detectedLanguages + */ + + /** + * Constructs a new Table. + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @classdesc Represents a Table. + * @implements ITable + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.Page.ITable=} [properties] Properties to set + */ + function Table(properties) { + this.headerRows = []; + this.bodyRows = []; + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Table layout. + * @member {google.cloud.documentai.v1beta1.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table + * @instance + */ + Table.prototype.layout = null; + + /** + * Table headerRows. + * @member {Array.} headerRows + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table + * @instance + */ + Table.prototype.headerRows = $util.emptyArray; + + /** + * Table bodyRows. + * @member {Array.} bodyRows + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table + * @instance + */ + Table.prototype.bodyRows = $util.emptyArray; + + /** + * Table detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table + * @instance + */ + Table.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new Table instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.ITable=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.Page.Table} Table instance + */ + Table.create = function create(properties) { + return new Table(properties); + }; + + /** + * Encodes the specified Table message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Table.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.ITable} message Table message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Table.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1beta1.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.headerRows != null && message.headerRows.length) + for (var i = 0; i < message.headerRows.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.Table.TableRow.encode(message.headerRows[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bodyRows != null && message.bodyRows.length) + for (var i = 0; i < message.bodyRows.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.Table.TableRow.encode(message.bodyRows[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Table message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Table.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.ITable} message Table message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Table.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Table message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.Page.Table} Table + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Table.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.Page.Table(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.headerRows && message.headerRows.length)) + message.headerRows = []; + message.headerRows.push($root.google.cloud.documentai.v1beta1.Document.Page.Table.TableRow.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.bodyRows && message.bodyRows.length)) + message.bodyRows = []; + message.bodyRows.push($root.google.cloud.documentai.v1beta1.Document.Page.Table.TableRow.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Table message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.Page.Table} Table + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Table.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Table message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Table.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.headerRows != null && message.hasOwnProperty("headerRows")) { + if (!Array.isArray(message.headerRows)) + return "headerRows: array expected"; + for (var i = 0; i < message.headerRows.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.Table.TableRow.verify(message.headerRows[i]); + if (error) + return "headerRows." + error; + } + } + if (message.bodyRows != null && message.hasOwnProperty("bodyRows")) { + if (!Array.isArray(message.bodyRows)) + return "bodyRows: array expected"; + for (var i = 0; i < message.bodyRows.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.Table.TableRow.verify(message.bodyRows[i]); + if (error) + return "bodyRows." + error; + } + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a Table message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.Page.Table} Table + */ + Table.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.Page.Table) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.Page.Table(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Table.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.fromObject(object.layout); + } + if (object.headerRows) { + if (!Array.isArray(object.headerRows)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Table.headerRows: array expected"); + message.headerRows = []; + for (var i = 0; i < object.headerRows.length; ++i) { + if (typeof object.headerRows[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Table.headerRows: object expected"); + message.headerRows[i] = $root.google.cloud.documentai.v1beta1.Document.Page.Table.TableRow.fromObject(object.headerRows[i]); + } + } + if (object.bodyRows) { + if (!Array.isArray(object.bodyRows)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Table.bodyRows: array expected"); + message.bodyRows = []; + for (var i = 0; i < object.bodyRows.length; ++i) { + if (typeof object.bodyRows[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Table.bodyRows: object expected"); + message.bodyRows[i] = $root.google.cloud.documentai.v1beta1.Document.Page.Table.TableRow.fromObject(object.bodyRows[i]); + } + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Table.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Table.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Table message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.Table} message Table + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Table.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.headerRows = []; + object.bodyRows = []; + object.detectedLanguages = []; + } + if (options.defaults) + object.layout = null; + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.toObject(message.layout, options); + if (message.headerRows && message.headerRows.length) { + object.headerRows = []; + for (var j = 0; j < message.headerRows.length; ++j) + object.headerRows[j] = $root.google.cloud.documentai.v1beta1.Document.Page.Table.TableRow.toObject(message.headerRows[j], options); + } + if (message.bodyRows && message.bodyRows.length) { + object.bodyRows = []; + for (var j = 0; j < message.bodyRows.length; ++j) + object.bodyRows[j] = $root.google.cloud.documentai.v1beta1.Document.Page.Table.TableRow.toObject(message.bodyRows[j], options); + } + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this Table to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table + * @instance + * @returns {Object.} JSON object + */ + Table.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Table.TableRow = (function() { + + /** + * Properties of a TableRow. + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table + * @interface ITableRow + * @property {Array.|null} [cells] TableRow cells + */ + + /** + * Constructs a new TableRow. + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table + * @classdesc Represents a TableRow. + * @implements ITableRow + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.Page.Table.ITableRow=} [properties] Properties to set + */ + function TableRow(properties) { + this.cells = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TableRow cells. + * @member {Array.} cells + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableRow + * @instance + */ + TableRow.prototype.cells = $util.emptyArray; + + /** + * Creates a new TableRow instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableRow + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.Table.ITableRow=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.Page.Table.TableRow} TableRow instance + */ + TableRow.create = function create(properties) { + return new TableRow(properties); + }; + + /** + * Encodes the specified TableRow message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Table.TableRow.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableRow + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.Table.ITableRow} message TableRow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableRow.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cells != null && message.cells.length) + for (var i = 0; i < message.cells.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.Table.TableCell.encode(message.cells[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TableRow message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Table.TableRow.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableRow + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.Table.ITableRow} message TableRow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableRow.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableRow message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableRow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.Page.Table.TableRow} TableRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableRow.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.Page.Table.TableRow(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.cells && message.cells.length)) + message.cells = []; + message.cells.push($root.google.cloud.documentai.v1beta1.Document.Page.Table.TableCell.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableRow message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableRow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.Page.Table.TableRow} TableRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableRow.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableRow message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableRow + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableRow.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cells != null && message.hasOwnProperty("cells")) { + if (!Array.isArray(message.cells)) + return "cells: array expected"; + for (var i = 0; i < message.cells.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.Table.TableCell.verify(message.cells[i]); + if (error) + return "cells." + error; + } + } + return null; + }; + + /** + * Creates a TableRow message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableRow + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.Page.Table.TableRow} TableRow + */ + TableRow.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.Page.Table.TableRow) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.Page.Table.TableRow(); + if (object.cells) { + if (!Array.isArray(object.cells)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Table.TableRow.cells: array expected"); + message.cells = []; + for (var i = 0; i < object.cells.length; ++i) { + if (typeof object.cells[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Table.TableRow.cells: object expected"); + message.cells[i] = $root.google.cloud.documentai.v1beta1.Document.Page.Table.TableCell.fromObject(object.cells[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TableRow message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableRow + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.Table.TableRow} message TableRow + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableRow.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.cells = []; + if (message.cells && message.cells.length) { + object.cells = []; + for (var j = 0; j < message.cells.length; ++j) + object.cells[j] = $root.google.cloud.documentai.v1beta1.Document.Page.Table.TableCell.toObject(message.cells[j], options); + } + return object; + }; + + /** + * Converts this TableRow to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableRow + * @instance + * @returns {Object.} JSON object + */ + TableRow.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TableRow; + })(); + + Table.TableCell = (function() { + + /** + * Properties of a TableCell. + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table + * @interface ITableCell + * @property {google.cloud.documentai.v1beta1.Document.Page.ILayout|null} [layout] TableCell layout + * @property {number|null} [rowSpan] TableCell rowSpan + * @property {number|null} [colSpan] TableCell colSpan + * @property {Array.|null} [detectedLanguages] TableCell detectedLanguages + */ + + /** + * Constructs a new TableCell. + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table + * @classdesc Represents a TableCell. + * @implements ITableCell + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.Page.Table.ITableCell=} [properties] Properties to set + */ + function TableCell(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TableCell layout. + * @member {google.cloud.documentai.v1beta1.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableCell + * @instance + */ + TableCell.prototype.layout = null; + + /** + * TableCell rowSpan. + * @member {number} rowSpan + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableCell + * @instance + */ + TableCell.prototype.rowSpan = 0; + + /** + * TableCell colSpan. + * @member {number} colSpan + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableCell + * @instance + */ + TableCell.prototype.colSpan = 0; + + /** + * TableCell detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableCell + * @instance + */ + TableCell.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new TableCell instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableCell + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.Table.ITableCell=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.Page.Table.TableCell} TableCell instance + */ + TableCell.create = function create(properties) { + return new TableCell(properties); + }; + + /** + * Encodes the specified TableCell message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Table.TableCell.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableCell + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.Table.ITableCell} message TableCell message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableCell.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1beta1.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.rowSpan != null && Object.hasOwnProperty.call(message, "rowSpan")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.rowSpan); + if (message.colSpan != null && Object.hasOwnProperty.call(message, "colSpan")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.colSpan); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TableCell message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.Table.TableCell.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableCell + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.Table.ITableCell} message TableCell message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableCell.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableCell message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableCell + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.Page.Table.TableCell} TableCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableCell.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.Page.Table.TableCell(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + message.rowSpan = reader.int32(); + break; + case 3: + message.colSpan = reader.int32(); + break; + case 4: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableCell message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableCell + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.Page.Table.TableCell} TableCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableCell.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableCell message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableCell + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableCell.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.rowSpan != null && message.hasOwnProperty("rowSpan")) + if (!$util.isInteger(message.rowSpan)) + return "rowSpan: integer expected"; + if (message.colSpan != null && message.hasOwnProperty("colSpan")) + if (!$util.isInteger(message.colSpan)) + return "colSpan: integer expected"; + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a TableCell message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableCell + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.Page.Table.TableCell} TableCell + */ + TableCell.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.Page.Table.TableCell) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.Page.Table.TableCell(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Table.TableCell.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.fromObject(object.layout); + } + if (object.rowSpan != null) + message.rowSpan = object.rowSpan | 0; + if (object.colSpan != null) + message.colSpan = object.colSpan | 0; + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Table.TableCell.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.Table.TableCell.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TableCell message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableCell + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.Table.TableCell} message TableCell + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableCell.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) { + object.layout = null; + object.rowSpan = 0; + object.colSpan = 0; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.toObject(message.layout, options); + if (message.rowSpan != null && message.hasOwnProperty("rowSpan")) + object.rowSpan = message.rowSpan; + if (message.colSpan != null && message.hasOwnProperty("colSpan")) + object.colSpan = message.colSpan; + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this TableCell to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableCell + * @instance + * @returns {Object.} JSON object + */ + TableCell.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TableCell; + })(); + + return Table; + })(); + + Page.FormField = (function() { + + /** + * Properties of a FormField. + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @interface IFormField + * @property {google.cloud.documentai.v1beta1.Document.Page.ILayout|null} [fieldName] FormField fieldName + * @property {google.cloud.documentai.v1beta1.Document.Page.ILayout|null} [fieldValue] FormField fieldValue + * @property {Array.|null} [nameDetectedLanguages] FormField nameDetectedLanguages + * @property {Array.|null} [valueDetectedLanguages] FormField valueDetectedLanguages + */ + + /** + * Constructs a new FormField. + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @classdesc Represents a FormField. + * @implements IFormField + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.Page.IFormField=} [properties] Properties to set + */ + function FormField(properties) { + this.nameDetectedLanguages = []; + this.valueDetectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FormField fieldName. + * @member {google.cloud.documentai.v1beta1.Document.Page.ILayout|null|undefined} fieldName + * @memberof google.cloud.documentai.v1beta1.Document.Page.FormField + * @instance + */ + FormField.prototype.fieldName = null; + + /** + * FormField fieldValue. + * @member {google.cloud.documentai.v1beta1.Document.Page.ILayout|null|undefined} fieldValue + * @memberof google.cloud.documentai.v1beta1.Document.Page.FormField + * @instance + */ + FormField.prototype.fieldValue = null; + + /** + * FormField nameDetectedLanguages. + * @member {Array.} nameDetectedLanguages + * @memberof google.cloud.documentai.v1beta1.Document.Page.FormField + * @instance + */ + FormField.prototype.nameDetectedLanguages = $util.emptyArray; + + /** + * FormField valueDetectedLanguages. + * @member {Array.} valueDetectedLanguages + * @memberof google.cloud.documentai.v1beta1.Document.Page.FormField + * @instance + */ + FormField.prototype.valueDetectedLanguages = $util.emptyArray; + + /** + * Creates a new FormField instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.Page.FormField + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IFormField=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.Page.FormField} FormField instance + */ + FormField.create = function create(properties) { + return new FormField(properties); + }; + + /** + * Encodes the specified FormField message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.FormField.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.Page.FormField + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IFormField} message FormField message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FormField.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fieldName != null && Object.hasOwnProperty.call(message, "fieldName")) + $root.google.cloud.documentai.v1beta1.Document.Page.Layout.encode(message.fieldName, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fieldValue != null && Object.hasOwnProperty.call(message, "fieldValue")) + $root.google.cloud.documentai.v1beta1.Document.Page.Layout.encode(message.fieldValue, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nameDetectedLanguages != null && message.nameDetectedLanguages.length) + for (var i = 0; i < message.nameDetectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.encode(message.nameDetectedLanguages[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.valueDetectedLanguages != null && message.valueDetectedLanguages.length) + for (var i = 0; i < message.valueDetectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.encode(message.valueDetectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FormField message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.FormField.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.FormField + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IFormField} message FormField message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FormField.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FormField message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.Page.FormField + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.Page.FormField} FormField + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FormField.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.Page.FormField(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fieldName = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + message.fieldValue = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 3: + if (!(message.nameDetectedLanguages && message.nameDetectedLanguages.length)) + message.nameDetectedLanguages = []; + message.nameDetectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.valueDetectedLanguages && message.valueDetectedLanguages.length)) + message.valueDetectedLanguages = []; + message.valueDetectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FormField message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.FormField + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.Page.FormField} FormField + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FormField.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FormField message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.Page.FormField + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FormField.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fieldName != null && message.hasOwnProperty("fieldName")) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.verify(message.fieldName); + if (error) + return "fieldName." + error; + } + if (message.fieldValue != null && message.hasOwnProperty("fieldValue")) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.verify(message.fieldValue); + if (error) + return "fieldValue." + error; + } + if (message.nameDetectedLanguages != null && message.hasOwnProperty("nameDetectedLanguages")) { + if (!Array.isArray(message.nameDetectedLanguages)) + return "nameDetectedLanguages: array expected"; + for (var i = 0; i < message.nameDetectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.verify(message.nameDetectedLanguages[i]); + if (error) + return "nameDetectedLanguages." + error; + } + } + if (message.valueDetectedLanguages != null && message.hasOwnProperty("valueDetectedLanguages")) { + if (!Array.isArray(message.valueDetectedLanguages)) + return "valueDetectedLanguages: array expected"; + for (var i = 0; i < message.valueDetectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.verify(message.valueDetectedLanguages[i]); + if (error) + return "valueDetectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a FormField message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.FormField + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.Page.FormField} FormField + */ + FormField.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.Page.FormField) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.Page.FormField(); + if (object.fieldName != null) { + if (typeof object.fieldName !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.FormField.fieldName: object expected"); + message.fieldName = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.fromObject(object.fieldName); + } + if (object.fieldValue != null) { + if (typeof object.fieldValue !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.FormField.fieldValue: object expected"); + message.fieldValue = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.fromObject(object.fieldValue); + } + if (object.nameDetectedLanguages) { + if (!Array.isArray(object.nameDetectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.FormField.nameDetectedLanguages: array expected"); + message.nameDetectedLanguages = []; + for (var i = 0; i < object.nameDetectedLanguages.length; ++i) { + if (typeof object.nameDetectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.FormField.nameDetectedLanguages: object expected"); + message.nameDetectedLanguages[i] = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.fromObject(object.nameDetectedLanguages[i]); + } + } + if (object.valueDetectedLanguages) { + if (!Array.isArray(object.valueDetectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.FormField.valueDetectedLanguages: array expected"); + message.valueDetectedLanguages = []; + for (var i = 0; i < object.valueDetectedLanguages.length; ++i) { + if (typeof object.valueDetectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Page.FormField.valueDetectedLanguages: object expected"); + message.valueDetectedLanguages[i] = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.fromObject(object.valueDetectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FormField message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.FormField + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.FormField} message FormField + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FormField.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.nameDetectedLanguages = []; + object.valueDetectedLanguages = []; + } + if (options.defaults) { + object.fieldName = null; + object.fieldValue = null; + } + if (message.fieldName != null && message.hasOwnProperty("fieldName")) + object.fieldName = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.toObject(message.fieldName, options); + if (message.fieldValue != null && message.hasOwnProperty("fieldValue")) + object.fieldValue = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.toObject(message.fieldValue, options); + if (message.nameDetectedLanguages && message.nameDetectedLanguages.length) { + object.nameDetectedLanguages = []; + for (var j = 0; j < message.nameDetectedLanguages.length; ++j) + object.nameDetectedLanguages[j] = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.toObject(message.nameDetectedLanguages[j], options); + } + if (message.valueDetectedLanguages && message.valueDetectedLanguages.length) { + object.valueDetectedLanguages = []; + for (var j = 0; j < message.valueDetectedLanguages.length; ++j) + object.valueDetectedLanguages[j] = $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.toObject(message.valueDetectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this FormField to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.Page.FormField + * @instance + * @returns {Object.} JSON object + */ + FormField.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FormField; + })(); + + Page.DetectedLanguage = (function() { + + /** + * Properties of a DetectedLanguage. + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @interface IDetectedLanguage + * @property {string|null} [languageCode] DetectedLanguage languageCode + * @property {number|null} [confidence] DetectedLanguage confidence + */ + + /** + * Constructs a new DetectedLanguage. + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @classdesc Represents a DetectedLanguage. + * @implements IDetectedLanguage + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage=} [properties] Properties to set + */ + function DetectedLanguage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DetectedLanguage languageCode. + * @member {string} languageCode + * @memberof google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage + * @instance + */ + DetectedLanguage.prototype.languageCode = ""; + + /** + * DetectedLanguage confidence. + * @member {number} confidence + * @memberof google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage + * @instance + */ + DetectedLanguage.prototype.confidence = 0; + + /** + * Creates a new DetectedLanguage instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage} DetectedLanguage instance + */ + DetectedLanguage.create = function create(properties) { + return new DetectedLanguage(properties); + }; + + /** + * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage} message DetectedLanguage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedLanguage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.languageCode); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + return writer; + }; + + /** + * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.IDetectedLanguage} message DetectedLanguage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedLanguage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectedLanguage message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage} DetectedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedLanguage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.languageCode = reader.string(); + break; + case 2: + message.confidence = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectedLanguage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage} DetectedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedLanguage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectedLanguage message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectedLanguage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + return null; + }; + + /** + * Creates a DetectedLanguage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage} DetectedLanguage + */ + DetectedLanguage.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage(); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.confidence != null) + message.confidence = Number(object.confidence); + return message; + }; + + /** + * Creates a plain object from a DetectedLanguage message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage + * @static + * @param {google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage} message DetectedLanguage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectedLanguage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.languageCode = ""; + object.confidence = 0; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + return object; + }; + + /** + * Converts this DetectedLanguage to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage + * @instance + * @returns {Object.} JSON object + */ + DetectedLanguage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DetectedLanguage; + })(); + + return Page; + })(); + + Document.Entity = (function() { + + /** + * Properties of an Entity. + * @memberof google.cloud.documentai.v1beta1.Document + * @interface IEntity + * @property {google.cloud.documentai.v1beta1.Document.ITextAnchor|null} [textAnchor] Entity textAnchor + * @property {string|null} [type] Entity type + * @property {string|null} [mentionText] Entity mentionText + * @property {string|null} [mentionId] Entity mentionId + */ + + /** + * Constructs a new Entity. + * @memberof google.cloud.documentai.v1beta1.Document + * @classdesc Represents an Entity. + * @implements IEntity + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.IEntity=} [properties] Properties to set + */ + function Entity(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Entity textAnchor. + * @member {google.cloud.documentai.v1beta1.Document.ITextAnchor|null|undefined} textAnchor + * @memberof google.cloud.documentai.v1beta1.Document.Entity + * @instance + */ + Entity.prototype.textAnchor = null; + + /** + * Entity type. + * @member {string} type + * @memberof google.cloud.documentai.v1beta1.Document.Entity + * @instance + */ + Entity.prototype.type = ""; + + /** + * Entity mentionText. + * @member {string} mentionText + * @memberof google.cloud.documentai.v1beta1.Document.Entity + * @instance + */ + Entity.prototype.mentionText = ""; + + /** + * Entity mentionId. + * @member {string} mentionId + * @memberof google.cloud.documentai.v1beta1.Document.Entity + * @instance + */ + Entity.prototype.mentionId = ""; + + /** + * Creates a new Entity instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.Entity + * @static + * @param {google.cloud.documentai.v1beta1.Document.IEntity=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.Entity} Entity instance + */ + Entity.create = function create(properties) { + return new Entity(properties); + }; + + /** + * Encodes the specified Entity message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Entity.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.Entity + * @static + * @param {google.cloud.documentai.v1beta1.Document.IEntity} message Entity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entity.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textAnchor != null && Object.hasOwnProperty.call(message, "textAnchor")) + $root.google.cloud.documentai.v1beta1.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.mentionText != null && Object.hasOwnProperty.call(message, "mentionText")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.mentionText); + if (message.mentionId != null && Object.hasOwnProperty.call(message, "mentionId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.mentionId); + return writer; + }; + + /** + * Encodes the specified Entity message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.Entity.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Entity + * @static + * @param {google.cloud.documentai.v1beta1.Document.IEntity} message Entity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entity.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Entity message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.Entity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.Entity} Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entity.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.Entity(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.textAnchor = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.decode(reader, reader.uint32()); + break; + case 2: + message.type = reader.string(); + break; + case 3: + message.mentionText = reader.string(); + break; + case 4: + message.mentionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Entity message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.Entity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.Entity} Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entity.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Entity message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.Entity + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Entity.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) { + var error = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.verify(message.textAnchor); + if (error) + return "textAnchor." + error; + } + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.mentionText != null && message.hasOwnProperty("mentionText")) + if (!$util.isString(message.mentionText)) + return "mentionText: string expected"; + if (message.mentionId != null && message.hasOwnProperty("mentionId")) + if (!$util.isString(message.mentionId)) + return "mentionId: string expected"; + return null; + }; + + /** + * Creates an Entity message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.Entity + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.Entity} Entity + */ + Entity.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.Entity) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.Entity(); + if (object.textAnchor != null) { + if (typeof object.textAnchor !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.Entity.textAnchor: object expected"); + message.textAnchor = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.fromObject(object.textAnchor); + } + if (object.type != null) + message.type = String(object.type); + if (object.mentionText != null) + message.mentionText = String(object.mentionText); + if (object.mentionId != null) + message.mentionId = String(object.mentionId); + return message; + }; + + /** + * Creates a plain object from an Entity message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.Entity + * @static + * @param {google.cloud.documentai.v1beta1.Document.Entity} message Entity + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Entity.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.textAnchor = null; + object.type = ""; + object.mentionText = ""; + object.mentionId = ""; + } + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) + object.textAnchor = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.toObject(message.textAnchor, options); + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.mentionText != null && message.hasOwnProperty("mentionText")) + object.mentionText = message.mentionText; + if (message.mentionId != null && message.hasOwnProperty("mentionId")) + object.mentionId = message.mentionId; + return object; + }; + + /** + * Converts this Entity to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.Entity + * @instance + * @returns {Object.} JSON object + */ + Entity.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Entity; + })(); + + Document.EntityRelation = (function() { + + /** + * Properties of an EntityRelation. + * @memberof google.cloud.documentai.v1beta1.Document + * @interface IEntityRelation + * @property {string|null} [subjectId] EntityRelation subjectId + * @property {string|null} [objectId] EntityRelation objectId + * @property {string|null} [relation] EntityRelation relation + */ + + /** + * Constructs a new EntityRelation. + * @memberof google.cloud.documentai.v1beta1.Document + * @classdesc Represents an EntityRelation. + * @implements IEntityRelation + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.IEntityRelation=} [properties] Properties to set + */ + function EntityRelation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EntityRelation subjectId. + * @member {string} subjectId + * @memberof google.cloud.documentai.v1beta1.Document.EntityRelation + * @instance + */ + EntityRelation.prototype.subjectId = ""; + + /** + * EntityRelation objectId. + * @member {string} objectId + * @memberof google.cloud.documentai.v1beta1.Document.EntityRelation + * @instance + */ + EntityRelation.prototype.objectId = ""; + + /** + * EntityRelation relation. + * @member {string} relation + * @memberof google.cloud.documentai.v1beta1.Document.EntityRelation + * @instance + */ + EntityRelation.prototype.relation = ""; + + /** + * Creates a new EntityRelation instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.EntityRelation + * @static + * @param {google.cloud.documentai.v1beta1.Document.IEntityRelation=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.EntityRelation} EntityRelation instance + */ + EntityRelation.create = function create(properties) { + return new EntityRelation(properties); + }; + + /** + * Encodes the specified EntityRelation message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.EntityRelation.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.EntityRelation + * @static + * @param {google.cloud.documentai.v1beta1.Document.IEntityRelation} message EntityRelation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityRelation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.subjectId != null && Object.hasOwnProperty.call(message, "subjectId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.subjectId); + if (message.objectId != null && Object.hasOwnProperty.call(message, "objectId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.objectId); + if (message.relation != null && Object.hasOwnProperty.call(message, "relation")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.relation); + return writer; + }; + + /** + * Encodes the specified EntityRelation message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.EntityRelation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.EntityRelation + * @static + * @param {google.cloud.documentai.v1beta1.Document.IEntityRelation} message EntityRelation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityRelation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EntityRelation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.EntityRelation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.EntityRelation} EntityRelation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityRelation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.EntityRelation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subjectId = reader.string(); + break; + case 2: + message.objectId = reader.string(); + break; + case 3: + message.relation = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EntityRelation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.EntityRelation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.EntityRelation} EntityRelation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityRelation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EntityRelation message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.EntityRelation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EntityRelation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.subjectId != null && message.hasOwnProperty("subjectId")) + if (!$util.isString(message.subjectId)) + return "subjectId: string expected"; + if (message.objectId != null && message.hasOwnProperty("objectId")) + if (!$util.isString(message.objectId)) + return "objectId: string expected"; + if (message.relation != null && message.hasOwnProperty("relation")) + if (!$util.isString(message.relation)) + return "relation: string expected"; + return null; + }; + + /** + * Creates an EntityRelation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.EntityRelation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.EntityRelation} EntityRelation + */ + EntityRelation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.EntityRelation) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.EntityRelation(); + if (object.subjectId != null) + message.subjectId = String(object.subjectId); + if (object.objectId != null) + message.objectId = String(object.objectId); + if (object.relation != null) + message.relation = String(object.relation); + return message; + }; + + /** + * Creates a plain object from an EntityRelation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.EntityRelation + * @static + * @param {google.cloud.documentai.v1beta1.Document.EntityRelation} message EntityRelation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EntityRelation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.subjectId = ""; + object.objectId = ""; + object.relation = ""; + } + if (message.subjectId != null && message.hasOwnProperty("subjectId")) + object.subjectId = message.subjectId; + if (message.objectId != null && message.hasOwnProperty("objectId")) + object.objectId = message.objectId; + if (message.relation != null && message.hasOwnProperty("relation")) + object.relation = message.relation; + return object; + }; + + /** + * Converts this EntityRelation to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.EntityRelation + * @instance + * @returns {Object.} JSON object + */ + EntityRelation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EntityRelation; + })(); + + Document.TextAnchor = (function() { + + /** + * Properties of a TextAnchor. + * @memberof google.cloud.documentai.v1beta1.Document + * @interface ITextAnchor + * @property {Array.|null} [textSegments] TextAnchor textSegments + */ + + /** + * Constructs a new TextAnchor. + * @memberof google.cloud.documentai.v1beta1.Document + * @classdesc Represents a TextAnchor. + * @implements ITextAnchor + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.ITextAnchor=} [properties] Properties to set + */ + function TextAnchor(properties) { + this.textSegments = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TextAnchor textSegments. + * @member {Array.} textSegments + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor + * @instance + */ + TextAnchor.prototype.textSegments = $util.emptyArray; + + /** + * Creates a new TextAnchor instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor + * @static + * @param {google.cloud.documentai.v1beta1.Document.ITextAnchor=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.TextAnchor} TextAnchor instance + */ + TextAnchor.create = function create(properties) { + return new TextAnchor(properties); + }; + + /** + * Encodes the specified TextAnchor message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.TextAnchor.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor + * @static + * @param {google.cloud.documentai.v1beta1.Document.ITextAnchor} message TextAnchor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextAnchor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textSegments != null && message.textSegments.length) + for (var i = 0; i < message.textSegments.length; ++i) + $root.google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment.encode(message.textSegments[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TextAnchor message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.TextAnchor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor + * @static + * @param {google.cloud.documentai.v1beta1.Document.ITextAnchor} message TextAnchor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextAnchor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextAnchor message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.TextAnchor} TextAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextAnchor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.TextAnchor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.textSegments && message.textSegments.length)) + message.textSegments = []; + message.textSegments.push($root.google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TextAnchor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.TextAnchor} TextAnchor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextAnchor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextAnchor message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextAnchor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textSegments != null && message.hasOwnProperty("textSegments")) { + if (!Array.isArray(message.textSegments)) + return "textSegments: array expected"; + for (var i = 0; i < message.textSegments.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment.verify(message.textSegments[i]); + if (error) + return "textSegments." + error; + } + } + return null; + }; + + /** + * Creates a TextAnchor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.TextAnchor} TextAnchor + */ + TextAnchor.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.TextAnchor) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.TextAnchor(); + if (object.textSegments) { + if (!Array.isArray(object.textSegments)) + throw TypeError(".google.cloud.documentai.v1beta1.Document.TextAnchor.textSegments: array expected"); + message.textSegments = []; + for (var i = 0; i < object.textSegments.length; ++i) { + if (typeof object.textSegments[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.Document.TextAnchor.textSegments: object expected"); + message.textSegments[i] = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment.fromObject(object.textSegments[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TextAnchor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor + * @static + * @param {google.cloud.documentai.v1beta1.Document.TextAnchor} message TextAnchor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TextAnchor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.textSegments = []; + if (message.textSegments && message.textSegments.length) { + object.textSegments = []; + for (var j = 0; j < message.textSegments.length; ++j) + object.textSegments[j] = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment.toObject(message.textSegments[j], options); + } + return object; + }; + + /** + * Converts this TextAnchor to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor + * @instance + * @returns {Object.} JSON object + */ + TextAnchor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + TextAnchor.TextSegment = (function() { + + /** + * Properties of a TextSegment. + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor + * @interface ITextSegment + * @property {number|Long|null} [startIndex] TextSegment startIndex + * @property {number|Long|null} [endIndex] TextSegment endIndex + */ + + /** + * Constructs a new TextSegment. + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor + * @classdesc Represents a TextSegment. + * @implements ITextSegment + * @constructor + * @param {google.cloud.documentai.v1beta1.Document.TextAnchor.ITextSegment=} [properties] Properties to set + */ + function TextSegment(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TextSegment startIndex. + * @member {number|Long} startIndex + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment + * @instance + */ + TextSegment.prototype.startIndex = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * TextSegment endIndex. + * @member {number|Long} endIndex + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment + * @instance + */ + TextSegment.prototype.endIndex = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new TextSegment instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment + * @static + * @param {google.cloud.documentai.v1beta1.Document.TextAnchor.ITextSegment=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment} TextSegment instance + */ + TextSegment.create = function create(properties) { + return new TextSegment(properties); + }; + + /** + * Encodes the specified TextSegment message. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment + * @static + * @param {google.cloud.documentai.v1beta1.Document.TextAnchor.ITextSegment} message TextSegment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextSegment.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startIndex != null && Object.hasOwnProperty.call(message, "startIndex")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.startIndex); + if (message.endIndex != null && Object.hasOwnProperty.call(message, "endIndex")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.endIndex); + return writer; + }; + + /** + * Encodes the specified TextSegment message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment + * @static + * @param {google.cloud.documentai.v1beta1.Document.TextAnchor.ITextSegment} message TextSegment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextSegment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextSegment message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment} TextSegment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextSegment.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.startIndex = reader.int64(); + break; + case 2: + message.endIndex = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TextSegment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment} TextSegment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextSegment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextSegment message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextSegment.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startIndex != null && message.hasOwnProperty("startIndex")) + if (!$util.isInteger(message.startIndex) && !(message.startIndex && $util.isInteger(message.startIndex.low) && $util.isInteger(message.startIndex.high))) + return "startIndex: integer|Long expected"; + if (message.endIndex != null && message.hasOwnProperty("endIndex")) + if (!$util.isInteger(message.endIndex) && !(message.endIndex && $util.isInteger(message.endIndex.low) && $util.isInteger(message.endIndex.high))) + return "endIndex: integer|Long expected"; + return null; + }; + + /** + * Creates a TextSegment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment} TextSegment + */ + TextSegment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment(); + if (object.startIndex != null) + if ($util.Long) + (message.startIndex = $util.Long.fromValue(object.startIndex)).unsigned = false; + else if (typeof object.startIndex === "string") + message.startIndex = parseInt(object.startIndex, 10); + else if (typeof object.startIndex === "number") + message.startIndex = object.startIndex; + else if (typeof object.startIndex === "object") + message.startIndex = new $util.LongBits(object.startIndex.low >>> 0, object.startIndex.high >>> 0).toNumber(); + if (object.endIndex != null) + if ($util.Long) + (message.endIndex = $util.Long.fromValue(object.endIndex)).unsigned = false; + else if (typeof object.endIndex === "string") + message.endIndex = parseInt(object.endIndex, 10); + else if (typeof object.endIndex === "number") + message.endIndex = object.endIndex; + else if (typeof object.endIndex === "object") + message.endIndex = new $util.LongBits(object.endIndex.low >>> 0, object.endIndex.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a TextSegment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment + * @static + * @param {google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment} message TextSegment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TextSegment.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.startIndex = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.startIndex = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.endIndex = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.endIndex = options.longs === String ? "0" : 0; + } + if (message.startIndex != null && message.hasOwnProperty("startIndex")) + if (typeof message.startIndex === "number") + object.startIndex = options.longs === String ? String(message.startIndex) : message.startIndex; + else + object.startIndex = options.longs === String ? $util.Long.prototype.toString.call(message.startIndex) : options.longs === Number ? new $util.LongBits(message.startIndex.low >>> 0, message.startIndex.high >>> 0).toNumber() : message.startIndex; + if (message.endIndex != null && message.hasOwnProperty("endIndex")) + if (typeof message.endIndex === "number") + object.endIndex = options.longs === String ? String(message.endIndex) : message.endIndex; + else + object.endIndex = options.longs === String ? $util.Long.prototype.toString.call(message.endIndex) : options.longs === Number ? new $util.LongBits(message.endIndex.low >>> 0, message.endIndex.high >>> 0).toNumber() : message.endIndex; + return object; + }; + + /** + * Converts this TextSegment to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment + * @instance + * @returns {Object.} JSON object + */ + TextSegment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TextSegment; + })(); + + return TextAnchor; + })(); + + return Document; + })(); + + v1beta1.Vertex = (function() { + + /** + * Properties of a Vertex. + * @memberof google.cloud.documentai.v1beta1 + * @interface IVertex + * @property {number|null} [x] Vertex x + * @property {number|null} [y] Vertex y + */ + + /** + * Constructs a new Vertex. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a Vertex. + * @implements IVertex + * @constructor + * @param {google.cloud.documentai.v1beta1.IVertex=} [properties] Properties to set + */ + function Vertex(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Vertex x. + * @member {number} x + * @memberof google.cloud.documentai.v1beta1.Vertex + * @instance + */ + Vertex.prototype.x = 0; + + /** + * Vertex y. + * @member {number} y + * @memberof google.cloud.documentai.v1beta1.Vertex + * @instance + */ + Vertex.prototype.y = 0; + + /** + * Creates a new Vertex instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.Vertex + * @static + * @param {google.cloud.documentai.v1beta1.IVertex=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.Vertex} Vertex instance + */ + Vertex.create = function create(properties) { + return new Vertex(properties); + }; + + /** + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.documentai.v1beta1.Vertex.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.Vertex + * @static + * @param {google.cloud.documentai.v1beta1.IVertex} message Vertex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Vertex.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.x != null && Object.hasOwnProperty.call(message, "x")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); + if (message.y != null && Object.hasOwnProperty.call(message, "y")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); + return writer; + }; + + /** + * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.Vertex.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.Vertex + * @static + * @param {google.cloud.documentai.v1beta1.IVertex} message Vertex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Vertex.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Vertex message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.Vertex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.Vertex} Vertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Vertex.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.Vertex(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.x = reader.int32(); + break; + case 2: + message.y = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Vertex message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.Vertex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.Vertex} Vertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Vertex.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Vertex message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.Vertex + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Vertex.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.x != null && message.hasOwnProperty("x")) + if (!$util.isInteger(message.x)) + return "x: integer expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (!$util.isInteger(message.y)) + return "y: integer expected"; + return null; + }; + + /** + * Creates a Vertex message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.Vertex + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.Vertex} Vertex + */ + Vertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.Vertex) + return object; + var message = new $root.google.cloud.documentai.v1beta1.Vertex(); + if (object.x != null) + message.x = object.x | 0; + if (object.y != null) + message.y = object.y | 0; + return message; + }; + + /** + * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.Vertex + * @static + * @param {google.cloud.documentai.v1beta1.Vertex} message Vertex + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Vertex.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.x = 0; + object.y = 0; + } + if (message.x != null && message.hasOwnProperty("x")) + object.x = message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = message.y; + return object; + }; + + /** + * Converts this Vertex to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.Vertex + * @instance + * @returns {Object.} JSON object + */ + Vertex.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Vertex; + })(); + + v1beta1.NormalizedVertex = (function() { + + /** + * Properties of a NormalizedVertex. + * @memberof google.cloud.documentai.v1beta1 + * @interface INormalizedVertex + * @property {number|null} [x] NormalizedVertex x + * @property {number|null} [y] NormalizedVertex y + */ + + /** + * Constructs a new NormalizedVertex. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a NormalizedVertex. + * @implements INormalizedVertex + * @constructor + * @param {google.cloud.documentai.v1beta1.INormalizedVertex=} [properties] Properties to set + */ + function NormalizedVertex(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NormalizedVertex x. + * @member {number} x + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @instance + */ + NormalizedVertex.prototype.x = 0; + + /** + * NormalizedVertex y. + * @member {number} y + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @instance + */ + NormalizedVertex.prototype.y = 0; + + /** + * Creates a new NormalizedVertex instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @static + * @param {google.cloud.documentai.v1beta1.INormalizedVertex=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.NormalizedVertex} NormalizedVertex instance + */ + NormalizedVertex.create = function create(properties) { + return new NormalizedVertex(properties); + }; + + /** + * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.documentai.v1beta1.NormalizedVertex.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @static + * @param {google.cloud.documentai.v1beta1.INormalizedVertex} message NormalizedVertex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NormalizedVertex.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.x != null && Object.hasOwnProperty.call(message, "x")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); + if (message.y != null && Object.hasOwnProperty.call(message, "y")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); + return writer; + }; + + /** + * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.NormalizedVertex.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @static + * @param {google.cloud.documentai.v1beta1.INormalizedVertex} message NormalizedVertex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NormalizedVertex.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.NormalizedVertex} NormalizedVertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NormalizedVertex.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.NormalizedVertex(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.x = reader.float(); + break; + case 2: + message.y = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.NormalizedVertex} NormalizedVertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NormalizedVertex.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NormalizedVertex message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NormalizedVertex.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.x != null && message.hasOwnProperty("x")) + if (typeof message.x !== "number") + return "x: number expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (typeof message.y !== "number") + return "y: number expected"; + return null; + }; + + /** + * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.NormalizedVertex} NormalizedVertex + */ + NormalizedVertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.NormalizedVertex) + return object; + var message = new $root.google.cloud.documentai.v1beta1.NormalizedVertex(); + if (object.x != null) + message.x = Number(object.x); + if (object.y != null) + message.y = Number(object.y); + return message; + }; + + /** + * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @static + * @param {google.cloud.documentai.v1beta1.NormalizedVertex} message NormalizedVertex + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NormalizedVertex.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.x = 0; + object.y = 0; + } + if (message.x != null && message.hasOwnProperty("x")) + object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; + return object; + }; + + /** + * Converts this NormalizedVertex to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @instance + * @returns {Object.} JSON object + */ + NormalizedVertex.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NormalizedVertex; + })(); + + v1beta1.BoundingPoly = (function() { + + /** + * Properties of a BoundingPoly. + * @memberof google.cloud.documentai.v1beta1 + * @interface IBoundingPoly + * @property {Array.|null} [vertices] BoundingPoly vertices + * @property {Array.|null} [normalizedVertices] BoundingPoly normalizedVertices + */ + + /** + * Constructs a new BoundingPoly. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a BoundingPoly. + * @implements IBoundingPoly + * @constructor + * @param {google.cloud.documentai.v1beta1.IBoundingPoly=} [properties] Properties to set + */ + function BoundingPoly(properties) { + this.vertices = []; + this.normalizedVertices = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BoundingPoly vertices. + * @member {Array.} vertices + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @instance + */ + BoundingPoly.prototype.vertices = $util.emptyArray; + + /** + * BoundingPoly normalizedVertices. + * @member {Array.} normalizedVertices + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @instance + */ + BoundingPoly.prototype.normalizedVertices = $util.emptyArray; + + /** + * Creates a new BoundingPoly instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @static + * @param {google.cloud.documentai.v1beta1.IBoundingPoly=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.BoundingPoly} BoundingPoly instance + */ + BoundingPoly.create = function create(properties) { + return new BoundingPoly(properties); + }; + + /** + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.documentai.v1beta1.BoundingPoly.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @static + * @param {google.cloud.documentai.v1beta1.IBoundingPoly} message BoundingPoly message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoundingPoly.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.vertices != null && message.vertices.length) + for (var i = 0; i < message.vertices.length; ++i) + $root.google.cloud.documentai.v1beta1.Vertex.encode(message.vertices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.normalizedVertices != null && message.normalizedVertices.length) + for (var i = 0; i < message.normalizedVertices.length; ++i) + $root.google.cloud.documentai.v1beta1.NormalizedVertex.encode(message.normalizedVertices[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.BoundingPoly.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @static + * @param {google.cloud.documentai.v1beta1.IBoundingPoly} message BoundingPoly message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.BoundingPoly} BoundingPoly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoundingPoly.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.BoundingPoly(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.vertices && message.vertices.length)) + message.vertices = []; + message.vertices.push($root.google.cloud.documentai.v1beta1.Vertex.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.normalizedVertices && message.normalizedVertices.length)) + message.normalizedVertices = []; + message.normalizedVertices.push($root.google.cloud.documentai.v1beta1.NormalizedVertex.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.BoundingPoly} BoundingPoly + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoundingPoly.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BoundingPoly message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoundingPoly.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.vertices != null && message.hasOwnProperty("vertices")) { + if (!Array.isArray(message.vertices)) + return "vertices: array expected"; + for (var i = 0; i < message.vertices.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.Vertex.verify(message.vertices[i]); + if (error) + return "vertices." + error; + } + } + if (message.normalizedVertices != null && message.hasOwnProperty("normalizedVertices")) { + if (!Array.isArray(message.normalizedVertices)) + return "normalizedVertices: array expected"; + for (var i = 0; i < message.normalizedVertices.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.NormalizedVertex.verify(message.normalizedVertices[i]); + if (error) + return "normalizedVertices." + error; + } + } + return null; + }; + + /** + * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.BoundingPoly} BoundingPoly + */ + BoundingPoly.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.BoundingPoly) + return object; + var message = new $root.google.cloud.documentai.v1beta1.BoundingPoly(); + if (object.vertices) { + if (!Array.isArray(object.vertices)) + throw TypeError(".google.cloud.documentai.v1beta1.BoundingPoly.vertices: array expected"); + message.vertices = []; + for (var i = 0; i < object.vertices.length; ++i) { + if (typeof object.vertices[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.BoundingPoly.vertices: object expected"); + message.vertices[i] = $root.google.cloud.documentai.v1beta1.Vertex.fromObject(object.vertices[i]); + } + } + if (object.normalizedVertices) { + if (!Array.isArray(object.normalizedVertices)) + throw TypeError(".google.cloud.documentai.v1beta1.BoundingPoly.normalizedVertices: array expected"); + message.normalizedVertices = []; + for (var i = 0; i < object.normalizedVertices.length; ++i) { + if (typeof object.normalizedVertices[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.BoundingPoly.normalizedVertices: object expected"); + message.normalizedVertices[i] = $root.google.cloud.documentai.v1beta1.NormalizedVertex.fromObject(object.normalizedVertices[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @static + * @param {google.cloud.documentai.v1beta1.BoundingPoly} message BoundingPoly + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoundingPoly.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.vertices = []; + object.normalizedVertices = []; + } + if (message.vertices && message.vertices.length) { + object.vertices = []; + for (var j = 0; j < message.vertices.length; ++j) + object.vertices[j] = $root.google.cloud.documentai.v1beta1.Vertex.toObject(message.vertices[j], options); + } + if (message.normalizedVertices && message.normalizedVertices.length) { + object.normalizedVertices = []; + for (var j = 0; j < message.normalizedVertices.length; ++j) + object.normalizedVertices[j] = $root.google.cloud.documentai.v1beta1.NormalizedVertex.toObject(message.normalizedVertices[j], options); + } + return object; + }; + + /** + * Converts this BoundingPoly to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @instance + * @returns {Object.} JSON object + */ + BoundingPoly.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BoundingPoly; + })(); + + v1beta1.DocumentUnderstandingService = (function() { + + /** + * Constructs a new DocumentUnderstandingService service. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a DocumentUnderstandingService + * @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 DocumentUnderstandingService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (DocumentUnderstandingService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = DocumentUnderstandingService; + + /** + * Creates new DocumentUnderstandingService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.documentai.v1beta1.DocumentUnderstandingService + * @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 {DocumentUnderstandingService} RPC service. Useful where requests and/or responses are streamed. + */ + DocumentUnderstandingService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.documentai.v1beta1.DocumentUnderstandingService#batchProcessDocuments}. + * @memberof google.cloud.documentai.v1beta1.DocumentUnderstandingService + * @typedef BatchProcessDocumentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchProcessDocuments. + * @function batchProcessDocuments + * @memberof google.cloud.documentai.v1beta1.DocumentUnderstandingService + * @instance + * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest} request BatchProcessDocumentsRequest message or plain object + * @param {google.cloud.documentai.v1beta1.DocumentUnderstandingService.BatchProcessDocumentsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentUnderstandingService.prototype.batchProcessDocuments = function batchProcessDocuments(request, callback) { + return this.rpcCall(batchProcessDocuments, $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchProcessDocuments" }); + + /** + * Calls BatchProcessDocuments. + * @function batchProcessDocuments + * @memberof google.cloud.documentai.v1beta1.DocumentUnderstandingService + * @instance + * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest} request BatchProcessDocumentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return DocumentUnderstandingService; + })(); + + v1beta1.BatchProcessDocumentsRequest = (function() { + + /** + * Properties of a BatchProcessDocumentsRequest. + * @memberof google.cloud.documentai.v1beta1 + * @interface IBatchProcessDocumentsRequest + * @property {Array.|null} [requests] BatchProcessDocumentsRequest requests + * @property {string|null} [parent] BatchProcessDocumentsRequest parent + */ + + /** + * Constructs a new BatchProcessDocumentsRequest. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a BatchProcessDocumentsRequest. + * @implements IBatchProcessDocumentsRequest + * @constructor + * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest=} [properties] Properties to set + */ + function BatchProcessDocumentsRequest(properties) { + this.requests = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchProcessDocumentsRequest requests. + * @member {Array.} requests + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @instance + */ + BatchProcessDocumentsRequest.prototype.requests = $util.emptyArray; + + /** + * BatchProcessDocumentsRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @instance + */ + BatchProcessDocumentsRequest.prototype.parent = ""; + + /** + * Creates a new BatchProcessDocumentsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @static + * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest} BatchProcessDocumentsRequest instance + */ + BatchProcessDocumentsRequest.create = function create(properties) { + return new BatchProcessDocumentsRequest(properties); + }; + + /** + * Encodes the specified BatchProcessDocumentsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @static + * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest} message BatchProcessDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProcessDocumentsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.requests != null && message.requests.length) + for (var i = 0; i < message.requests.length; ++i) + $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.parent); + return writer; + }; + + /** + * Encodes the specified BatchProcessDocumentsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @static + * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest} message BatchProcessDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProcessDocumentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchProcessDocumentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest} BatchProcessDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProcessDocumentsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.requests && message.requests.length)) + message.requests = []; + message.requests.push($root.google.cloud.documentai.v1beta1.ProcessDocumentRequest.decode(reader, reader.uint32())); + break; + case 2: + message.parent = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchProcessDocumentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest} BatchProcessDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProcessDocumentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchProcessDocumentsRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchProcessDocumentsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.requests != null && message.hasOwnProperty("requests")) { + if (!Array.isArray(message.requests)) + return "requests: array expected"; + for (var i = 0; i < message.requests.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest.verify(message.requests[i]); + if (error) + return "requests." + error; + } + } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + return null; + }; + + /** + * Creates a BatchProcessDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest} BatchProcessDocumentsRequest + */ + BatchProcessDocumentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest(); + if (object.requests) { + if (!Array.isArray(object.requests)) + throw TypeError(".google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.requests: array expected"); + message.requests = []; + for (var i = 0; i < object.requests.length; ++i) { + if (typeof object.requests[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.requests: object expected"); + message.requests[i] = $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest.fromObject(object.requests[i]); + } + } + if (object.parent != null) + message.parent = String(object.parent); + return message; + }; + + /** + * Creates a plain object from a BatchProcessDocumentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @static + * @param {google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest} message BatchProcessDocumentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchProcessDocumentsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.requests = []; + if (options.defaults) + object.parent = ""; + if (message.requests && message.requests.length) { + object.requests = []; + for (var j = 0; j < message.requests.length; ++j) + object.requests[j] = $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest.toObject(message.requests[j], options); + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this BatchProcessDocumentsRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @instance + * @returns {Object.} JSON object + */ + BatchProcessDocumentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BatchProcessDocumentsRequest; + })(); + + v1beta1.ProcessDocumentRequest = (function() { + + /** + * Properties of a ProcessDocumentRequest. + * @memberof google.cloud.documentai.v1beta1 + * @interface IProcessDocumentRequest + * @property {google.cloud.documentai.v1beta1.IInputConfig|null} [inputConfig] ProcessDocumentRequest inputConfig + * @property {google.cloud.documentai.v1beta1.IOutputConfig|null} [outputConfig] ProcessDocumentRequest outputConfig + * @property {string|null} [documentType] ProcessDocumentRequest documentType + * @property {google.cloud.documentai.v1beta1.ITableExtractionParams|null} [tableExtractionParams] ProcessDocumentRequest tableExtractionParams + * @property {google.cloud.documentai.v1beta1.IFormExtractionParams|null} [formExtractionParams] ProcessDocumentRequest formExtractionParams + * @property {google.cloud.documentai.v1beta1.IEntityExtractionParams|null} [entityExtractionParams] ProcessDocumentRequest entityExtractionParams + * @property {google.cloud.documentai.v1beta1.IOcrParams|null} [ocrParams] ProcessDocumentRequest ocrParams + */ + + /** + * Constructs a new ProcessDocumentRequest. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a ProcessDocumentRequest. + * @implements IProcessDocumentRequest + * @constructor + * @param {google.cloud.documentai.v1beta1.IProcessDocumentRequest=} [properties] Properties to set + */ + function ProcessDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProcessDocumentRequest inputConfig. + * @member {google.cloud.documentai.v1beta1.IInputConfig|null|undefined} inputConfig + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.inputConfig = null; + + /** + * ProcessDocumentRequest outputConfig. + * @member {google.cloud.documentai.v1beta1.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.outputConfig = null; + + /** + * ProcessDocumentRequest documentType. + * @member {string} documentType + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.documentType = ""; + + /** + * ProcessDocumentRequest tableExtractionParams. + * @member {google.cloud.documentai.v1beta1.ITableExtractionParams|null|undefined} tableExtractionParams + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.tableExtractionParams = null; + + /** + * ProcessDocumentRequest formExtractionParams. + * @member {google.cloud.documentai.v1beta1.IFormExtractionParams|null|undefined} formExtractionParams + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.formExtractionParams = null; + + /** + * ProcessDocumentRequest entityExtractionParams. + * @member {google.cloud.documentai.v1beta1.IEntityExtractionParams|null|undefined} entityExtractionParams + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.entityExtractionParams = null; + + /** + * ProcessDocumentRequest ocrParams. + * @member {google.cloud.documentai.v1beta1.IOcrParams|null|undefined} ocrParams + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.ocrParams = null; + + /** + * Creates a new ProcessDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta1.IProcessDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.ProcessDocumentRequest} ProcessDocumentRequest instance + */ + ProcessDocumentRequest.create = function create(properties) { + return new ProcessDocumentRequest(properties); + }; + + /** + * Encodes the specified ProcessDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta1.IProcessDocumentRequest} message ProcessDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessDocumentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.documentai.v1beta1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) + $root.google.cloud.documentai.v1beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.documentType != null && Object.hasOwnProperty.call(message, "documentType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.documentType); + if (message.tableExtractionParams != null && Object.hasOwnProperty.call(message, "tableExtractionParams")) + $root.google.cloud.documentai.v1beta1.TableExtractionParams.encode(message.tableExtractionParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.formExtractionParams != null && Object.hasOwnProperty.call(message, "formExtractionParams")) + $root.google.cloud.documentai.v1beta1.FormExtractionParams.encode(message.formExtractionParams, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.entityExtractionParams != null && Object.hasOwnProperty.call(message, "entityExtractionParams")) + $root.google.cloud.documentai.v1beta1.EntityExtractionParams.encode(message.entityExtractionParams, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.ocrParams != null && Object.hasOwnProperty.call(message, "ocrParams")) + $root.google.cloud.documentai.v1beta1.OcrParams.encode(message.ocrParams, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProcessDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta1.IProcessDocumentRequest} message ProcessDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProcessDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.ProcessDocumentRequest} ProcessDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.decode(reader, reader.uint32()); + break; + case 2: + message.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.decode(reader, reader.uint32()); + break; + case 3: + message.documentType = reader.string(); + break; + case 4: + message.tableExtractionParams = $root.google.cloud.documentai.v1beta1.TableExtractionParams.decode(reader, reader.uint32()); + break; + case 5: + message.formExtractionParams = $root.google.cloud.documentai.v1beta1.FormExtractionParams.decode(reader, reader.uint32()); + break; + case 6: + message.entityExtractionParams = $root.google.cloud.documentai.v1beta1.EntityExtractionParams.decode(reader, reader.uint32()); + break; + case 7: + message.ocrParams = $root.google.cloud.documentai.v1beta1.OcrParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProcessDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.ProcessDocumentRequest} ProcessDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProcessDocumentRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProcessDocumentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.documentai.v1beta1.InputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.documentai.v1beta1.OutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } + if (message.documentType != null && message.hasOwnProperty("documentType")) + if (!$util.isString(message.documentType)) + return "documentType: string expected"; + if (message.tableExtractionParams != null && message.hasOwnProperty("tableExtractionParams")) { + var error = $root.google.cloud.documentai.v1beta1.TableExtractionParams.verify(message.tableExtractionParams); + if (error) + return "tableExtractionParams." + error; + } + if (message.formExtractionParams != null && message.hasOwnProperty("formExtractionParams")) { + var error = $root.google.cloud.documentai.v1beta1.FormExtractionParams.verify(message.formExtractionParams); + if (error) + return "formExtractionParams." + error; + } + if (message.entityExtractionParams != null && message.hasOwnProperty("entityExtractionParams")) { + var error = $root.google.cloud.documentai.v1beta1.EntityExtractionParams.verify(message.entityExtractionParams); + if (error) + return "entityExtractionParams." + error; + } + if (message.ocrParams != null && message.hasOwnProperty("ocrParams")) { + var error = $root.google.cloud.documentai.v1beta1.OcrParams.verify(message.ocrParams); + if (error) + return "ocrParams." + error; + } + return null; + }; + + /** + * Creates a ProcessDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.ProcessDocumentRequest} ProcessDocumentRequest + */ + ProcessDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta1.ProcessDocumentRequest(); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.fromObject(object.inputConfig); + } + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentRequest.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.fromObject(object.outputConfig); + } + if (object.documentType != null) + message.documentType = String(object.documentType); + if (object.tableExtractionParams != null) { + if (typeof object.tableExtractionParams !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentRequest.tableExtractionParams: object expected"); + message.tableExtractionParams = $root.google.cloud.documentai.v1beta1.TableExtractionParams.fromObject(object.tableExtractionParams); + } + if (object.formExtractionParams != null) { + if (typeof object.formExtractionParams !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentRequest.formExtractionParams: object expected"); + message.formExtractionParams = $root.google.cloud.documentai.v1beta1.FormExtractionParams.fromObject(object.formExtractionParams); + } + if (object.entityExtractionParams != null) { + if (typeof object.entityExtractionParams !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentRequest.entityExtractionParams: object expected"); + message.entityExtractionParams = $root.google.cloud.documentai.v1beta1.EntityExtractionParams.fromObject(object.entityExtractionParams); + } + if (object.ocrParams != null) { + if (typeof object.ocrParams !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentRequest.ocrParams: object expected"); + message.ocrParams = $root.google.cloud.documentai.v1beta1.OcrParams.fromObject(object.ocrParams); + } + return message; + }; + + /** + * Creates a plain object from a ProcessDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta1.ProcessDocumentRequest} message ProcessDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProcessDocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.inputConfig = null; + object.outputConfig = null; + object.documentType = ""; + object.tableExtractionParams = null; + object.formExtractionParams = null; + object.entityExtractionParams = null; + object.ocrParams = null; + } + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.toObject(message.inputConfig, options); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.toObject(message.outputConfig, options); + if (message.documentType != null && message.hasOwnProperty("documentType")) + object.documentType = message.documentType; + if (message.tableExtractionParams != null && message.hasOwnProperty("tableExtractionParams")) + object.tableExtractionParams = $root.google.cloud.documentai.v1beta1.TableExtractionParams.toObject(message.tableExtractionParams, options); + if (message.formExtractionParams != null && message.hasOwnProperty("formExtractionParams")) + object.formExtractionParams = $root.google.cloud.documentai.v1beta1.FormExtractionParams.toObject(message.formExtractionParams, options); + if (message.entityExtractionParams != null && message.hasOwnProperty("entityExtractionParams")) + object.entityExtractionParams = $root.google.cloud.documentai.v1beta1.EntityExtractionParams.toObject(message.entityExtractionParams, options); + if (message.ocrParams != null && message.hasOwnProperty("ocrParams")) + object.ocrParams = $root.google.cloud.documentai.v1beta1.OcrParams.toObject(message.ocrParams, options); + return object; + }; + + /** + * Converts this ProcessDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + ProcessDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProcessDocumentRequest; + })(); + + v1beta1.BatchProcessDocumentsResponse = (function() { + + /** + * Properties of a BatchProcessDocumentsResponse. + * @memberof google.cloud.documentai.v1beta1 + * @interface IBatchProcessDocumentsResponse + * @property {Array.|null} [responses] BatchProcessDocumentsResponse responses + */ + + /** + * Constructs a new BatchProcessDocumentsResponse. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a BatchProcessDocumentsResponse. + * @implements IBatchProcessDocumentsResponse + * @constructor + * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse=} [properties] Properties to set + */ + function BatchProcessDocumentsResponse(properties) { + this.responses = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchProcessDocumentsResponse responses. + * @member {Array.} responses + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @instance + */ + BatchProcessDocumentsResponse.prototype.responses = $util.emptyArray; + + /** + * Creates a new BatchProcessDocumentsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @static + * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse} BatchProcessDocumentsResponse instance + */ + BatchProcessDocumentsResponse.create = function create(properties) { + return new BatchProcessDocumentsResponse(properties); + }; + + /** + * Encodes the specified BatchProcessDocumentsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @static + * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse} message BatchProcessDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProcessDocumentsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.responses != null && message.responses.length) + for (var i = 0; i < message.responses.length; ++i) + $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchProcessDocumentsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @static + * @param {google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse} message BatchProcessDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProcessDocumentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchProcessDocumentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse} BatchProcessDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProcessDocumentsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.responses && message.responses.length)) + message.responses = []; + message.responses.push($root.google.cloud.documentai.v1beta1.ProcessDocumentResponse.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchProcessDocumentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse} BatchProcessDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProcessDocumentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchProcessDocumentsResponse message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchProcessDocumentsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.responses != null && message.hasOwnProperty("responses")) { + if (!Array.isArray(message.responses)) + return "responses: array expected"; + for (var i = 0; i < message.responses.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse.verify(message.responses[i]); + if (error) + return "responses." + error; + } + } + return null; + }; + + /** + * Creates a BatchProcessDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse} BatchProcessDocumentsResponse + */ + BatchProcessDocumentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse) + return object; + var message = new $root.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse(); + if (object.responses) { + if (!Array.isArray(object.responses)) + throw TypeError(".google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.responses: array expected"); + message.responses = []; + for (var i = 0; i < object.responses.length; ++i) { + if (typeof object.responses[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.responses: object expected"); + message.responses[i] = $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse.fromObject(object.responses[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BatchProcessDocumentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @static + * @param {google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse} message BatchProcessDocumentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchProcessDocumentsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.responses = []; + if (message.responses && message.responses.length) { + object.responses = []; + for (var j = 0; j < message.responses.length; ++j) + object.responses[j] = $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse.toObject(message.responses[j], options); + } + return object; + }; + + /** + * Converts this BatchProcessDocumentsResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @instance + * @returns {Object.} JSON object + */ + BatchProcessDocumentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BatchProcessDocumentsResponse; + })(); + + v1beta1.ProcessDocumentResponse = (function() { + + /** + * Properties of a ProcessDocumentResponse. + * @memberof google.cloud.documentai.v1beta1 + * @interface IProcessDocumentResponse + * @property {google.cloud.documentai.v1beta1.IInputConfig|null} [inputConfig] ProcessDocumentResponse inputConfig + * @property {google.cloud.documentai.v1beta1.IOutputConfig|null} [outputConfig] ProcessDocumentResponse outputConfig + */ + + /** + * Constructs a new ProcessDocumentResponse. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a ProcessDocumentResponse. + * @implements IProcessDocumentResponse + * @constructor + * @param {google.cloud.documentai.v1beta1.IProcessDocumentResponse=} [properties] Properties to set + */ + function ProcessDocumentResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProcessDocumentResponse inputConfig. + * @member {google.cloud.documentai.v1beta1.IInputConfig|null|undefined} inputConfig + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @instance + */ + ProcessDocumentResponse.prototype.inputConfig = null; + + /** + * ProcessDocumentResponse outputConfig. + * @member {google.cloud.documentai.v1beta1.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @instance + */ + ProcessDocumentResponse.prototype.outputConfig = null; + + /** + * Creates a new ProcessDocumentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta1.IProcessDocumentResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.ProcessDocumentResponse} ProcessDocumentResponse instance + */ + ProcessDocumentResponse.create = function create(properties) { + return new ProcessDocumentResponse(properties); + }; + + /** + * Encodes the specified ProcessDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta1.IProcessDocumentResponse} message ProcessDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessDocumentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.documentai.v1beta1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) + $root.google.cloud.documentai.v1beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProcessDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.ProcessDocumentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta1.IProcessDocumentResponse} message ProcessDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProcessDocumentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.ProcessDocumentResponse} ProcessDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessDocumentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.decode(reader, reader.uint32()); + break; + case 2: + message.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProcessDocumentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.ProcessDocumentResponse} ProcessDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessDocumentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProcessDocumentResponse message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProcessDocumentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.documentai.v1beta1.InputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.documentai.v1beta1.OutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } + return null; + }; + + /** + * Creates a ProcessDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.ProcessDocumentResponse} ProcessDocumentResponse + */ + ProcessDocumentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse) + return object; + var message = new $root.google.cloud.documentai.v1beta1.ProcessDocumentResponse(); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentResponse.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.fromObject(object.inputConfig); + } + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.ProcessDocumentResponse.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.fromObject(object.outputConfig); + } + return message; + }; + + /** + * Creates a plain object from a ProcessDocumentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta1.ProcessDocumentResponse} message ProcessDocumentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProcessDocumentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.inputConfig = null; + object.outputConfig = null; + } + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.toObject(message.inputConfig, options); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.toObject(message.outputConfig, options); + return object; + }; + + /** + * Converts this ProcessDocumentResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @instance + * @returns {Object.} JSON object + */ + ProcessDocumentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProcessDocumentResponse; + })(); + + v1beta1.OcrParams = (function() { + + /** + * Properties of an OcrParams. + * @memberof google.cloud.documentai.v1beta1 + * @interface IOcrParams + * @property {Array.|null} [languageHints] OcrParams languageHints + */ + + /** + * Constructs a new OcrParams. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents an OcrParams. + * @implements IOcrParams + * @constructor + * @param {google.cloud.documentai.v1beta1.IOcrParams=} [properties] Properties to set + */ + function OcrParams(properties) { + this.languageHints = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OcrParams languageHints. + * @member {Array.} languageHints + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @instance + */ + OcrParams.prototype.languageHints = $util.emptyArray; + + /** + * Creates a new OcrParams instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @static + * @param {google.cloud.documentai.v1beta1.IOcrParams=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.OcrParams} OcrParams instance + */ + OcrParams.create = function create(properties) { + return new OcrParams(properties); + }; + + /** + * Encodes the specified OcrParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.OcrParams.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @static + * @param {google.cloud.documentai.v1beta1.IOcrParams} message OcrParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OcrParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.languageHints != null && message.languageHints.length) + for (var i = 0; i < message.languageHints.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.languageHints[i]); + return writer; + }; + + /** + * Encodes the specified OcrParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.OcrParams.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @static + * @param {google.cloud.documentai.v1beta1.IOcrParams} message OcrParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OcrParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OcrParams message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.OcrParams} OcrParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OcrParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.OcrParams(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.languageHints && message.languageHints.length)) + message.languageHints = []; + message.languageHints.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OcrParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.OcrParams} OcrParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OcrParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OcrParams message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OcrParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.languageHints != null && message.hasOwnProperty("languageHints")) { + if (!Array.isArray(message.languageHints)) + return "languageHints: array expected"; + for (var i = 0; i < message.languageHints.length; ++i) + if (!$util.isString(message.languageHints[i])) + return "languageHints: string[] expected"; + } + return null; + }; + + /** + * Creates an OcrParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.OcrParams} OcrParams + */ + OcrParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.OcrParams) + return object; + var message = new $root.google.cloud.documentai.v1beta1.OcrParams(); + if (object.languageHints) { + if (!Array.isArray(object.languageHints)) + throw TypeError(".google.cloud.documentai.v1beta1.OcrParams.languageHints: array expected"); + message.languageHints = []; + for (var i = 0; i < object.languageHints.length; ++i) + message.languageHints[i] = String(object.languageHints[i]); + } + return message; + }; + + /** + * Creates a plain object from an OcrParams message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @static + * @param {google.cloud.documentai.v1beta1.OcrParams} message OcrParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OcrParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.languageHints = []; + if (message.languageHints && message.languageHints.length) { + object.languageHints = []; + for (var j = 0; j < message.languageHints.length; ++j) + object.languageHints[j] = message.languageHints[j]; + } + return object; + }; + + /** + * Converts this OcrParams to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @instance + * @returns {Object.} JSON object + */ + OcrParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OcrParams; + })(); + + v1beta1.TableExtractionParams = (function() { + + /** + * Properties of a TableExtractionParams. + * @memberof google.cloud.documentai.v1beta1 + * @interface ITableExtractionParams + * @property {boolean|null} [enabled] TableExtractionParams enabled + * @property {Array.|null} [tableBoundHints] TableExtractionParams tableBoundHints + * @property {Array.|null} [headerHints] TableExtractionParams headerHints + * @property {string|null} [modelVersion] TableExtractionParams modelVersion + */ + + /** + * Constructs a new TableExtractionParams. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a TableExtractionParams. + * @implements ITableExtractionParams + * @constructor + * @param {google.cloud.documentai.v1beta1.ITableExtractionParams=} [properties] Properties to set + */ + function TableExtractionParams(properties) { + this.tableBoundHints = []; + this.headerHints = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TableExtractionParams enabled. + * @member {boolean} enabled + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @instance + */ + TableExtractionParams.prototype.enabled = false; + + /** + * TableExtractionParams tableBoundHints. + * @member {Array.} tableBoundHints + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @instance + */ + TableExtractionParams.prototype.tableBoundHints = $util.emptyArray; + + /** + * TableExtractionParams headerHints. + * @member {Array.} headerHints + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @instance + */ + TableExtractionParams.prototype.headerHints = $util.emptyArray; + + /** + * TableExtractionParams modelVersion. + * @member {string} modelVersion + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @instance + */ + TableExtractionParams.prototype.modelVersion = ""; + + /** + * Creates a new TableExtractionParams instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.ITableExtractionParams=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.TableExtractionParams} TableExtractionParams instance + */ + TableExtractionParams.create = function create(properties) { + return new TableExtractionParams(properties); + }; + + /** + * Encodes the specified TableExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.TableExtractionParams.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.ITableExtractionParams} message TableExtractionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableExtractionParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); + if (message.tableBoundHints != null && message.tableBoundHints.length) + for (var i = 0; i < message.tableBoundHints.length; ++i) + $root.google.cloud.documentai.v1beta1.TableBoundHint.encode(message.tableBoundHints[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.headerHints != null && message.headerHints.length) + for (var i = 0; i < message.headerHints.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.headerHints[i]); + if (message.modelVersion != null && Object.hasOwnProperty.call(message, "modelVersion")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.modelVersion); + return writer; + }; + + /** + * Encodes the specified TableExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.TableExtractionParams.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.ITableExtractionParams} message TableExtractionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableExtractionParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableExtractionParams message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.TableExtractionParams} TableExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableExtractionParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.TableExtractionParams(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.enabled = reader.bool(); + break; + case 2: + if (!(message.tableBoundHints && message.tableBoundHints.length)) + message.tableBoundHints = []; + message.tableBoundHints.push($root.google.cloud.documentai.v1beta1.TableBoundHint.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.headerHints && message.headerHints.length)) + message.headerHints = []; + message.headerHints.push(reader.string()); + break; + case 4: + message.modelVersion = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableExtractionParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.TableExtractionParams} TableExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableExtractionParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableExtractionParams message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableExtractionParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.enabled != null && message.hasOwnProperty("enabled")) + if (typeof message.enabled !== "boolean") + return "enabled: boolean expected"; + if (message.tableBoundHints != null && message.hasOwnProperty("tableBoundHints")) { + if (!Array.isArray(message.tableBoundHints)) + return "tableBoundHints: array expected"; + for (var i = 0; i < message.tableBoundHints.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.TableBoundHint.verify(message.tableBoundHints[i]); + if (error) + return "tableBoundHints." + error; + } + } + if (message.headerHints != null && message.hasOwnProperty("headerHints")) { + if (!Array.isArray(message.headerHints)) + return "headerHints: array expected"; + for (var i = 0; i < message.headerHints.length; ++i) + if (!$util.isString(message.headerHints[i])) + return "headerHints: string[] expected"; + } + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + if (!$util.isString(message.modelVersion)) + return "modelVersion: string expected"; + return null; + }; + + /** + * Creates a TableExtractionParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.TableExtractionParams} TableExtractionParams + */ + TableExtractionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.TableExtractionParams) + return object; + var message = new $root.google.cloud.documentai.v1beta1.TableExtractionParams(); + if (object.enabled != null) + message.enabled = Boolean(object.enabled); + if (object.tableBoundHints) { + if (!Array.isArray(object.tableBoundHints)) + throw TypeError(".google.cloud.documentai.v1beta1.TableExtractionParams.tableBoundHints: array expected"); + message.tableBoundHints = []; + for (var i = 0; i < object.tableBoundHints.length; ++i) { + if (typeof object.tableBoundHints[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.TableExtractionParams.tableBoundHints: object expected"); + message.tableBoundHints[i] = $root.google.cloud.documentai.v1beta1.TableBoundHint.fromObject(object.tableBoundHints[i]); + } + } + if (object.headerHints) { + if (!Array.isArray(object.headerHints)) + throw TypeError(".google.cloud.documentai.v1beta1.TableExtractionParams.headerHints: array expected"); + message.headerHints = []; + for (var i = 0; i < object.headerHints.length; ++i) + message.headerHints[i] = String(object.headerHints[i]); + } + if (object.modelVersion != null) + message.modelVersion = String(object.modelVersion); + return message; + }; + + /** + * Creates a plain object from a TableExtractionParams message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.TableExtractionParams} message TableExtractionParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableExtractionParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.tableBoundHints = []; + object.headerHints = []; + } + if (options.defaults) { + object.enabled = false; + object.modelVersion = ""; + } + if (message.enabled != null && message.hasOwnProperty("enabled")) + object.enabled = message.enabled; + if (message.tableBoundHints && message.tableBoundHints.length) { + object.tableBoundHints = []; + for (var j = 0; j < message.tableBoundHints.length; ++j) + object.tableBoundHints[j] = $root.google.cloud.documentai.v1beta1.TableBoundHint.toObject(message.tableBoundHints[j], options); + } + if (message.headerHints && message.headerHints.length) { + object.headerHints = []; + for (var j = 0; j < message.headerHints.length; ++j) + object.headerHints[j] = message.headerHints[j]; + } + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + object.modelVersion = message.modelVersion; + return object; + }; + + /** + * Converts this TableExtractionParams to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @instance + * @returns {Object.} JSON object + */ + TableExtractionParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TableExtractionParams; + })(); + + v1beta1.TableBoundHint = (function() { + + /** + * Properties of a TableBoundHint. + * @memberof google.cloud.documentai.v1beta1 + * @interface ITableBoundHint + * @property {number|null} [pageNumber] TableBoundHint pageNumber + * @property {google.cloud.documentai.v1beta1.IBoundingPoly|null} [boundingBox] TableBoundHint boundingBox + */ + + /** + * Constructs a new TableBoundHint. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a TableBoundHint. + * @implements ITableBoundHint + * @constructor + * @param {google.cloud.documentai.v1beta1.ITableBoundHint=} [properties] Properties to set + */ + function TableBoundHint(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TableBoundHint pageNumber. + * @member {number} pageNumber + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @instance + */ + TableBoundHint.prototype.pageNumber = 0; + + /** + * TableBoundHint boundingBox. + * @member {google.cloud.documentai.v1beta1.IBoundingPoly|null|undefined} boundingBox + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @instance + */ + TableBoundHint.prototype.boundingBox = null; + + /** + * Creates a new TableBoundHint instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @static + * @param {google.cloud.documentai.v1beta1.ITableBoundHint=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.TableBoundHint} TableBoundHint instance + */ + TableBoundHint.create = function create(properties) { + return new TableBoundHint(properties); + }; + + /** + * Encodes the specified TableBoundHint message. Does not implicitly {@link google.cloud.documentai.v1beta1.TableBoundHint.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @static + * @param {google.cloud.documentai.v1beta1.ITableBoundHint} message TableBoundHint message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableBoundHint.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageNumber != null && Object.hasOwnProperty.call(message, "pageNumber")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.pageNumber); + if (message.boundingBox != null && Object.hasOwnProperty.call(message, "boundingBox")) + $root.google.cloud.documentai.v1beta1.BoundingPoly.encode(message.boundingBox, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TableBoundHint message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.TableBoundHint.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @static + * @param {google.cloud.documentai.v1beta1.ITableBoundHint} message TableBoundHint message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableBoundHint.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableBoundHint message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.TableBoundHint} TableBoundHint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableBoundHint.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.TableBoundHint(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pageNumber = reader.int32(); + break; + case 2: + message.boundingBox = $root.google.cloud.documentai.v1beta1.BoundingPoly.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableBoundHint message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.TableBoundHint} TableBoundHint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableBoundHint.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableBoundHint message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableBoundHint.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + if (!$util.isInteger(message.pageNumber)) + return "pageNumber: integer expected"; + if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { + var error = $root.google.cloud.documentai.v1beta1.BoundingPoly.verify(message.boundingBox); + if (error) + return "boundingBox." + error; + } + return null; + }; + + /** + * Creates a TableBoundHint message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.TableBoundHint} TableBoundHint + */ + TableBoundHint.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.TableBoundHint) + return object; + var message = new $root.google.cloud.documentai.v1beta1.TableBoundHint(); + if (object.pageNumber != null) + message.pageNumber = object.pageNumber | 0; + if (object.boundingBox != null) { + if (typeof object.boundingBox !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.TableBoundHint.boundingBox: object expected"); + message.boundingBox = $root.google.cloud.documentai.v1beta1.BoundingPoly.fromObject(object.boundingBox); + } + return message; + }; + + /** + * Creates a plain object from a TableBoundHint message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @static + * @param {google.cloud.documentai.v1beta1.TableBoundHint} message TableBoundHint + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableBoundHint.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.pageNumber = 0; + object.boundingBox = null; + } + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + object.pageNumber = message.pageNumber; + if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) + object.boundingBox = $root.google.cloud.documentai.v1beta1.BoundingPoly.toObject(message.boundingBox, options); + return object; + }; + + /** + * Converts this TableBoundHint to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @instance + * @returns {Object.} JSON object + */ + TableBoundHint.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TableBoundHint; + })(); + + v1beta1.FormExtractionParams = (function() { + + /** + * Properties of a FormExtractionParams. + * @memberof google.cloud.documentai.v1beta1 + * @interface IFormExtractionParams + * @property {boolean|null} [enabled] FormExtractionParams enabled + * @property {Array.|null} [keyValuePairHints] FormExtractionParams keyValuePairHints + * @property {string|null} [modelVersion] FormExtractionParams modelVersion + */ + + /** + * Constructs a new FormExtractionParams. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a FormExtractionParams. + * @implements IFormExtractionParams + * @constructor + * @param {google.cloud.documentai.v1beta1.IFormExtractionParams=} [properties] Properties to set + */ + function FormExtractionParams(properties) { + this.keyValuePairHints = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FormExtractionParams enabled. + * @member {boolean} enabled + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @instance + */ + FormExtractionParams.prototype.enabled = false; + + /** + * FormExtractionParams keyValuePairHints. + * @member {Array.} keyValuePairHints + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @instance + */ + FormExtractionParams.prototype.keyValuePairHints = $util.emptyArray; + + /** + * FormExtractionParams modelVersion. + * @member {string} modelVersion + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @instance + */ + FormExtractionParams.prototype.modelVersion = ""; + + /** + * Creates a new FormExtractionParams instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.IFormExtractionParams=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.FormExtractionParams} FormExtractionParams instance + */ + FormExtractionParams.create = function create(properties) { + return new FormExtractionParams(properties); + }; + + /** + * Encodes the specified FormExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.FormExtractionParams.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.IFormExtractionParams} message FormExtractionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FormExtractionParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); + if (message.keyValuePairHints != null && message.keyValuePairHints.length) + for (var i = 0; i < message.keyValuePairHints.length; ++i) + $root.google.cloud.documentai.v1beta1.KeyValuePairHint.encode(message.keyValuePairHints[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.modelVersion != null && Object.hasOwnProperty.call(message, "modelVersion")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.modelVersion); + return writer; + }; + + /** + * Encodes the specified FormExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.FormExtractionParams.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.IFormExtractionParams} message FormExtractionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FormExtractionParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FormExtractionParams message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.FormExtractionParams} FormExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FormExtractionParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.FormExtractionParams(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.enabled = reader.bool(); + break; + case 2: + if (!(message.keyValuePairHints && message.keyValuePairHints.length)) + message.keyValuePairHints = []; + message.keyValuePairHints.push($root.google.cloud.documentai.v1beta1.KeyValuePairHint.decode(reader, reader.uint32())); + break; + case 3: + message.modelVersion = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FormExtractionParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.FormExtractionParams} FormExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FormExtractionParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FormExtractionParams message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FormExtractionParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.enabled != null && message.hasOwnProperty("enabled")) + if (typeof message.enabled !== "boolean") + return "enabled: boolean expected"; + if (message.keyValuePairHints != null && message.hasOwnProperty("keyValuePairHints")) { + if (!Array.isArray(message.keyValuePairHints)) + return "keyValuePairHints: array expected"; + for (var i = 0; i < message.keyValuePairHints.length; ++i) { + var error = $root.google.cloud.documentai.v1beta1.KeyValuePairHint.verify(message.keyValuePairHints[i]); + if (error) + return "keyValuePairHints." + error; + } + } + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + if (!$util.isString(message.modelVersion)) + return "modelVersion: string expected"; + return null; + }; + + /** + * Creates a FormExtractionParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.FormExtractionParams} FormExtractionParams + */ + FormExtractionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.FormExtractionParams) + return object; + var message = new $root.google.cloud.documentai.v1beta1.FormExtractionParams(); + if (object.enabled != null) + message.enabled = Boolean(object.enabled); + if (object.keyValuePairHints) { + if (!Array.isArray(object.keyValuePairHints)) + throw TypeError(".google.cloud.documentai.v1beta1.FormExtractionParams.keyValuePairHints: array expected"); + message.keyValuePairHints = []; + for (var i = 0; i < object.keyValuePairHints.length; ++i) { + if (typeof object.keyValuePairHints[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.FormExtractionParams.keyValuePairHints: object expected"); + message.keyValuePairHints[i] = $root.google.cloud.documentai.v1beta1.KeyValuePairHint.fromObject(object.keyValuePairHints[i]); + } + } + if (object.modelVersion != null) + message.modelVersion = String(object.modelVersion); + return message; + }; + + /** + * Creates a plain object from a FormExtractionParams message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.FormExtractionParams} message FormExtractionParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FormExtractionParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.keyValuePairHints = []; + if (options.defaults) { + object.enabled = false; + object.modelVersion = ""; + } + if (message.enabled != null && message.hasOwnProperty("enabled")) + object.enabled = message.enabled; + if (message.keyValuePairHints && message.keyValuePairHints.length) { + object.keyValuePairHints = []; + for (var j = 0; j < message.keyValuePairHints.length; ++j) + object.keyValuePairHints[j] = $root.google.cloud.documentai.v1beta1.KeyValuePairHint.toObject(message.keyValuePairHints[j], options); + } + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + object.modelVersion = message.modelVersion; + return object; + }; + + /** + * Converts this FormExtractionParams to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @instance + * @returns {Object.} JSON object + */ + FormExtractionParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FormExtractionParams; + })(); + + v1beta1.KeyValuePairHint = (function() { + + /** + * Properties of a KeyValuePairHint. + * @memberof google.cloud.documentai.v1beta1 + * @interface IKeyValuePairHint + * @property {string|null} [key] KeyValuePairHint key + * @property {Array.|null} [valueTypes] KeyValuePairHint valueTypes + */ + + /** + * Constructs a new KeyValuePairHint. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a KeyValuePairHint. + * @implements IKeyValuePairHint + * @constructor + * @param {google.cloud.documentai.v1beta1.IKeyValuePairHint=} [properties] Properties to set + */ + function KeyValuePairHint(properties) { + this.valueTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * KeyValuePairHint key. + * @member {string} key + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @instance + */ + KeyValuePairHint.prototype.key = ""; + + /** + * KeyValuePairHint valueTypes. + * @member {Array.} valueTypes + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @instance + */ + KeyValuePairHint.prototype.valueTypes = $util.emptyArray; + + /** + * Creates a new KeyValuePairHint instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @static + * @param {google.cloud.documentai.v1beta1.IKeyValuePairHint=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.KeyValuePairHint} KeyValuePairHint instance + */ + KeyValuePairHint.create = function create(properties) { + return new KeyValuePairHint(properties); + }; + + /** + * Encodes the specified KeyValuePairHint message. Does not implicitly {@link google.cloud.documentai.v1beta1.KeyValuePairHint.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @static + * @param {google.cloud.documentai.v1beta1.IKeyValuePairHint} message KeyValuePairHint message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KeyValuePairHint.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.valueTypes != null && message.valueTypes.length) + for (var i = 0; i < message.valueTypes.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.valueTypes[i]); + return writer; + }; + + /** + * Encodes the specified KeyValuePairHint message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.KeyValuePairHint.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @static + * @param {google.cloud.documentai.v1beta1.IKeyValuePairHint} message KeyValuePairHint message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KeyValuePairHint.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a KeyValuePairHint message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.KeyValuePairHint} KeyValuePairHint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KeyValuePairHint.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.KeyValuePairHint(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + if (!(message.valueTypes && message.valueTypes.length)) + message.valueTypes = []; + message.valueTypes.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a KeyValuePairHint message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.KeyValuePairHint} KeyValuePairHint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KeyValuePairHint.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a KeyValuePairHint message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + KeyValuePairHint.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.valueTypes != null && message.hasOwnProperty("valueTypes")) { + if (!Array.isArray(message.valueTypes)) + return "valueTypes: array expected"; + for (var i = 0; i < message.valueTypes.length; ++i) + if (!$util.isString(message.valueTypes[i])) + return "valueTypes: string[] expected"; + } + return null; + }; + + /** + * Creates a KeyValuePairHint message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.KeyValuePairHint} KeyValuePairHint + */ + KeyValuePairHint.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.KeyValuePairHint) + return object; + var message = new $root.google.cloud.documentai.v1beta1.KeyValuePairHint(); + if (object.key != null) + message.key = String(object.key); + if (object.valueTypes) { + if (!Array.isArray(object.valueTypes)) + throw TypeError(".google.cloud.documentai.v1beta1.KeyValuePairHint.valueTypes: array expected"); + message.valueTypes = []; + for (var i = 0; i < object.valueTypes.length; ++i) + message.valueTypes[i] = String(object.valueTypes[i]); + } + return message; + }; + + /** + * Creates a plain object from a KeyValuePairHint message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @static + * @param {google.cloud.documentai.v1beta1.KeyValuePairHint} message KeyValuePairHint + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + KeyValuePairHint.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.valueTypes = []; + if (options.defaults) + object.key = ""; + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.valueTypes && message.valueTypes.length) { + object.valueTypes = []; + for (var j = 0; j < message.valueTypes.length; ++j) + object.valueTypes[j] = message.valueTypes[j]; + } + return object; + }; + + /** + * Converts this KeyValuePairHint to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @instance + * @returns {Object.} JSON object + */ + KeyValuePairHint.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return KeyValuePairHint; + })(); + + v1beta1.EntityExtractionParams = (function() { + + /** + * Properties of an EntityExtractionParams. + * @memberof google.cloud.documentai.v1beta1 + * @interface IEntityExtractionParams + * @property {boolean|null} [enabled] EntityExtractionParams enabled + * @property {string|null} [modelVersion] EntityExtractionParams modelVersion + */ + + /** + * Constructs a new EntityExtractionParams. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents an EntityExtractionParams. + * @implements IEntityExtractionParams + * @constructor + * @param {google.cloud.documentai.v1beta1.IEntityExtractionParams=} [properties] Properties to set + */ + function EntityExtractionParams(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EntityExtractionParams enabled. + * @member {boolean} enabled + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @instance + */ + EntityExtractionParams.prototype.enabled = false; + + /** + * EntityExtractionParams modelVersion. + * @member {string} modelVersion + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @instance + */ + EntityExtractionParams.prototype.modelVersion = ""; + + /** + * Creates a new EntityExtractionParams instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.IEntityExtractionParams=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.EntityExtractionParams} EntityExtractionParams instance + */ + EntityExtractionParams.create = function create(properties) { + return new EntityExtractionParams(properties); + }; + + /** + * Encodes the specified EntityExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta1.EntityExtractionParams.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.IEntityExtractionParams} message EntityExtractionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityExtractionParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); + if (message.modelVersion != null && Object.hasOwnProperty.call(message, "modelVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.modelVersion); + return writer; + }; + + /** + * Encodes the specified EntityExtractionParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.EntityExtractionParams.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.IEntityExtractionParams} message EntityExtractionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityExtractionParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EntityExtractionParams message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.EntityExtractionParams} EntityExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityExtractionParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.EntityExtractionParams(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.enabled = reader.bool(); + break; + case 2: + message.modelVersion = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EntityExtractionParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.EntityExtractionParams} EntityExtractionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityExtractionParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EntityExtractionParams message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EntityExtractionParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.enabled != null && message.hasOwnProperty("enabled")) + if (typeof message.enabled !== "boolean") + return "enabled: boolean expected"; + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + if (!$util.isString(message.modelVersion)) + return "modelVersion: string expected"; + return null; + }; + + /** + * Creates an EntityExtractionParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.EntityExtractionParams} EntityExtractionParams + */ + EntityExtractionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.EntityExtractionParams) + return object; + var message = new $root.google.cloud.documentai.v1beta1.EntityExtractionParams(); + if (object.enabled != null) + message.enabled = Boolean(object.enabled); + if (object.modelVersion != null) + message.modelVersion = String(object.modelVersion); + return message; + }; + + /** + * Creates a plain object from an EntityExtractionParams message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @static + * @param {google.cloud.documentai.v1beta1.EntityExtractionParams} message EntityExtractionParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EntityExtractionParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.enabled = false; + object.modelVersion = ""; + } + if (message.enabled != null && message.hasOwnProperty("enabled")) + object.enabled = message.enabled; + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + object.modelVersion = message.modelVersion; + return object; + }; + + /** + * Converts this EntityExtractionParams to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @instance + * @returns {Object.} JSON object + */ + EntityExtractionParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EntityExtractionParams; + })(); + + v1beta1.InputConfig = (function() { + + /** + * Properties of an InputConfig. + * @memberof google.cloud.documentai.v1beta1 + * @interface IInputConfig + * @property {google.cloud.documentai.v1beta1.IGcsSource|null} [gcsSource] InputConfig gcsSource + * @property {string|null} [mimeType] InputConfig mimeType + */ + + /** + * Constructs a new InputConfig. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents an InputConfig. + * @implements IInputConfig + * @constructor + * @param {google.cloud.documentai.v1beta1.IInputConfig=} [properties] Properties to set + */ + function InputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InputConfig gcsSource. + * @member {google.cloud.documentai.v1beta1.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @instance + */ + InputConfig.prototype.gcsSource = null; + + /** + * InputConfig mimeType. + * @member {string} mimeType + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @instance + */ + InputConfig.prototype.mimeType = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * InputConfig source. + * @member {"gcsSource"|undefined} source + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @instance + */ + Object.defineProperty(InputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["gcsSource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new InputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @static + * @param {google.cloud.documentai.v1beta1.IInputConfig=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.InputConfig} InputConfig instance + */ + InputConfig.create = function create(properties) { + return new InputConfig(properties); + }; + + /** + * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta1.InputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @static + * @param {google.cloud.documentai.v1beta1.IInputConfig} message InputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.documentai.v1beta1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); + return writer; + }; + + /** + * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.InputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @static + * @param {google.cloud.documentai.v1beta1.IInputConfig} message InputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.InputConfig} InputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.InputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsSource = $root.google.cloud.documentai.v1beta1.GcsSource.decode(reader, reader.uint32()); + break; + case 2: + message.mimeType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.InputConfig} InputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InputConfig message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + properties.source = 1; + { + var error = $root.google.cloud.documentai.v1beta1.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + return null; + }; + + /** + * Creates an InputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.InputConfig} InputConfig + */ + InputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.InputConfig) + return object; + var message = new $root.google.cloud.documentai.v1beta1.InputConfig(); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.InputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.documentai.v1beta1.GcsSource.fromObject(object.gcsSource); + } + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + return message; + }; + + /** + * Creates a plain object from an InputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @static + * @param {google.cloud.documentai.v1beta1.InputConfig} message InputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.mimeType = ""; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.documentai.v1beta1.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + return object; + }; + + /** + * Converts this InputConfig to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @instance + * @returns {Object.} JSON object + */ + InputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return InputConfig; + })(); + + v1beta1.OutputConfig = (function() { + + /** + * Properties of an OutputConfig. + * @memberof google.cloud.documentai.v1beta1 + * @interface IOutputConfig + * @property {google.cloud.documentai.v1beta1.IGcsDestination|null} [gcsDestination] OutputConfig gcsDestination + * @property {number|null} [pagesPerShard] OutputConfig pagesPerShard + */ + + /** + * Constructs a new OutputConfig. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents an OutputConfig. + * @implements IOutputConfig + * @constructor + * @param {google.cloud.documentai.v1beta1.IOutputConfig=} [properties] Properties to set + */ + function OutputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OutputConfig gcsDestination. + * @member {google.cloud.documentai.v1beta1.IGcsDestination|null|undefined} gcsDestination + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @instance + */ + OutputConfig.prototype.gcsDestination = null; + + /** + * OutputConfig pagesPerShard. + * @member {number} pagesPerShard + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @instance + */ + OutputConfig.prototype.pagesPerShard = 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * OutputConfig destination. + * @member {"gcsDestination"|undefined} destination + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @instance + */ + Object.defineProperty(OutputConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsDestination"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new OutputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @static + * @param {google.cloud.documentai.v1beta1.IOutputConfig=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.OutputConfig} OutputConfig instance + */ + OutputConfig.create = function create(properties) { + return new OutputConfig(properties); + }; + + /** + * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta1.OutputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @static + * @param {google.cloud.documentai.v1beta1.IOutputConfig} message OutputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) + $root.google.cloud.documentai.v1beta1.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagesPerShard != null && Object.hasOwnProperty.call(message, "pagesPerShard")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pagesPerShard); + return writer; + }; + + /** + * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.OutputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @static + * @param {google.cloud.documentai.v1beta1.IOutputConfig} message OutputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OutputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.OutputConfig} OutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.OutputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsDestination = $root.google.cloud.documentai.v1beta1.GcsDestination.decode(reader, reader.uint32()); + break; + case 2: + message.pagesPerShard = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OutputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.OutputConfig} OutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OutputConfig message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OutputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + properties.destination = 1; + { + var error = $root.google.cloud.documentai.v1beta1.GcsDestination.verify(message.gcsDestination); + if (error) + return "gcsDestination." + error; + } + } + if (message.pagesPerShard != null && message.hasOwnProperty("pagesPerShard")) + if (!$util.isInteger(message.pagesPerShard)) + return "pagesPerShard: integer expected"; + return null; + }; + + /** + * Creates an OutputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.OutputConfig} OutputConfig + */ + OutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.OutputConfig) + return object; + var message = new $root.google.cloud.documentai.v1beta1.OutputConfig(); + if (object.gcsDestination != null) { + if (typeof object.gcsDestination !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.OutputConfig.gcsDestination: object expected"); + message.gcsDestination = $root.google.cloud.documentai.v1beta1.GcsDestination.fromObject(object.gcsDestination); + } + if (object.pagesPerShard != null) + message.pagesPerShard = object.pagesPerShard | 0; + return message; + }; + + /** + * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @static + * @param {google.cloud.documentai.v1beta1.OutputConfig} message OutputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OutputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.pagesPerShard = 0; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + object.gcsDestination = $root.google.cloud.documentai.v1beta1.GcsDestination.toObject(message.gcsDestination, options); + if (options.oneofs) + object.destination = "gcsDestination"; + } + if (message.pagesPerShard != null && message.hasOwnProperty("pagesPerShard")) + object.pagesPerShard = message.pagesPerShard; + return object; + }; + + /** + * Converts this OutputConfig to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @instance + * @returns {Object.} JSON object + */ + OutputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OutputConfig; + })(); + + v1beta1.GcsSource = (function() { + + /** + * Properties of a GcsSource. + * @memberof google.cloud.documentai.v1beta1 + * @interface IGcsSource + * @property {string|null} [uri] GcsSource uri + */ + + /** + * Constructs a new GcsSource. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a GcsSource. + * @implements IGcsSource + * @constructor + * @param {google.cloud.documentai.v1beta1.IGcsSource=} [properties] Properties to set + */ + function GcsSource(properties) { + if (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 uri. + * @member {string} uri + * @memberof google.cloud.documentai.v1beta1.GcsSource + * @instance + */ + GcsSource.prototype.uri = ""; + + /** + * Creates a new GcsSource instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.GcsSource + * @static + * @param {google.cloud.documentai.v1beta1.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.GcsSource} GcsSource instance + */ + GcsSource.create = function create(properties) { + return new GcsSource(properties); + }; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.documentai.v1beta1.GcsSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.GcsSource + * @static + * @param {google.cloud.documentai.v1beta1.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.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + return writer; + }; + + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.GcsSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.GcsSource + * @static + * @param {google.cloud.documentai.v1beta1.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.documentai.v1beta1.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.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.documentai.v1beta1.GcsSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uri = 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.documentai.v1beta1.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.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.documentai.v1beta1.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.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: 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.documentai.v1beta1.GcsSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.GcsSource} GcsSource + */ + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.GcsSource) + return object; + var message = new $root.google.cloud.documentai.v1beta1.GcsSource(); + if (object.uri != null) + message.uri = String(object.uri); + return message; + }; + + /** + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.GcsSource + * @static + * @param {google.cloud.documentai.v1beta1.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.defaults) + object.uri = ""; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + return object; + }; + + /** + * Converts this GcsSource to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.GcsSource + * @instance + * @returns {Object.} JSON object + */ + GcsSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GcsSource; + })(); + + v1beta1.GcsDestination = (function() { + + /** + * Properties of a GcsDestination. + * @memberof google.cloud.documentai.v1beta1 + * @interface IGcsDestination + * @property {string|null} [uri] GcsDestination uri + */ + + /** + * Constructs a new GcsDestination. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents a GcsDestination. + * @implements IGcsDestination + * @constructor + * @param {google.cloud.documentai.v1beta1.IGcsDestination=} [properties] Properties to set + */ + function GcsDestination(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GcsDestination uri. + * @member {string} uri + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @instance + */ + GcsDestination.prototype.uri = ""; + + /** + * Creates a new GcsDestination instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @static + * @param {google.cloud.documentai.v1beta1.IGcsDestination=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.GcsDestination} GcsDestination instance + */ + GcsDestination.create = function create(properties) { + return new GcsDestination(properties); + }; + + /** + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.documentai.v1beta1.GcsDestination.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @static + * @param {google.cloud.documentai.v1beta1.IGcsDestination} message GcsDestination message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsDestination.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); + return writer; + }; + + /** + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.GcsDestination.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @static + * @param {google.cloud.documentai.v1beta1.IGcsDestination} message GcsDestination message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsDestination.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GcsDestination message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.GcsDestination} GcsDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsDestination.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.GcsDestination(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uri = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GcsDestination message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.GcsDestination} GcsDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsDestination.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GcsDestination message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsDestination.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"; + return null; + }; + + /** + * Creates a GcsDestination message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.GcsDestination} GcsDestination + */ + GcsDestination.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.GcsDestination) + return object; + var message = new $root.google.cloud.documentai.v1beta1.GcsDestination(); + if (object.uri != null) + message.uri = String(object.uri); + return message; + }; + + /** + * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @static + * @param {google.cloud.documentai.v1beta1.GcsDestination} message GcsDestination + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsDestination.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.uri = ""; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + return object; + }; + + /** + * Converts this GcsDestination to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @instance + * @returns {Object.} JSON object + */ + GcsDestination.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GcsDestination; + })(); + + v1beta1.OperationMetadata = (function() { + + /** + * Properties of an OperationMetadata. + * @memberof google.cloud.documentai.v1beta1 + * @interface IOperationMetadata + * @property {google.cloud.documentai.v1beta1.OperationMetadata.State|null} [state] OperationMetadata state + * @property {string|null} [stateMessage] OperationMetadata stateMessage + * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] OperationMetadata updateTime + */ + + /** + * Constructs a new OperationMetadata. + * @memberof google.cloud.documentai.v1beta1 + * @classdesc Represents an OperationMetadata. + * @implements IOperationMetadata + * @constructor + * @param {google.cloud.documentai.v1beta1.IOperationMetadata=} [properties] Properties to set + */ + function OperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OperationMetadata state. + * @member {google.cloud.documentai.v1beta1.OperationMetadata.State} state + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.state = 0; + + /** + * OperationMetadata stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.stateMessage = ""; + + /** + * OperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.createTime = null; + + /** + * OperationMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.updateTime = null; + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @static + * @param {google.cloud.documentai.v1beta1.IOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta1.OperationMetadata} OperationMetadata instance + */ + OperationMetadata.create = function create(properties) { + return new OperationMetadata(properties); + }; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta1.OperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @static + * @param {google.cloud.documentai.v1beta1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta1.OperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @static + * @param {google.cloud.documentai.v1beta1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta1.OperationMetadata} OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta1.OperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.int32(); + break; + case 2: + message.stateMessage = reader.string(); + break; + case 3: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta1.OperationMetadata} OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + if (!$util.isString(message.stateMessage)) + return "stateMessage: string 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 OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta1.OperationMetadata} OperationMetadata + */ + OperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta1.OperationMetadata) + return object; + var message = new $root.google.cloud.documentai.v1beta1.OperationMetadata(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "ACCEPTED": + case 1: + message.state = 1; + break; + case "WAITING": + case 2: + message.state = 2; + break; + case "RUNNING": + case 3: + message.state = 3; + break; + case "SUCCEEDED": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + case "FAILED": + case 6: + message.state = 6; + break; + } + if (object.stateMessage != null) + message.stateMessage = String(object.stateMessage); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1beta1.OperationMetadata.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.documentai.v1beta1.OperationMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + return message; + }; + + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @static + * @param {google.cloud.documentai.v1beta1.OperationMetadata} message OperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.stateMessage = ""; + object.createTime = null; + object.updateTime = null; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta1.OperationMetadata.State[message.state] : message.state; + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + object.stateMessage = message.stateMessage; + 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 OperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @instance + * @returns {Object.} JSON object + */ + OperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.documentai.v1beta1.OperationMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} ACCEPTED=1 ACCEPTED value + * @property {number} WAITING=2 WAITING value + * @property {number} RUNNING=3 RUNNING value + * @property {number} SUCCEEDED=4 SUCCEEDED value + * @property {number} CANCELLED=5 CANCELLED value + * @property {number} FAILED=6 FAILED value + */ + OperationMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ACCEPTED"] = 1; + values[valuesById[2] = "WAITING"] = 2; + values[valuesById[3] = "RUNNING"] = 3; + values[valuesById[4] = "SUCCEEDED"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + values[valuesById[6] = "FAILED"] = 6; + return values; + })(); + + return OperationMetadata; + })(); + + return v1beta1; + })(); + documentai.v1beta2 = (function() { /** @@ -37476,6 +62574,230 @@ return GeneratedCodeInfo; })(); + 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.Any = (function() { /** @@ -39799,230 +65121,6 @@ return Empty; })(); - 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.FieldMask = (function() { /** diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 7c87e1b67df..ef4cd1b0728 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -6,6 +6,2113 @@ "nested": { "documentai": { "nested": { + "v1": { + "options": { + "csharp_namespace": "Google.Cloud.DocumentAI.V1", + "go_package": "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai", + "java_multiple_files": true, + "java_outer_classname": "DocumentAiProcessorService", + "java_package": "com.google.cloud.documentai.v1", + "php_namespace": "Google\\Cloud\\DocumentAI\\V1", + "ruby_package": "Google::Cloud::DocumentAI::V1", + "(google.api.resource_definition).type": "documentai.googleapis.com/HumanReviewConfig", + "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig" + }, + "nested": { + "Document": { + "oneofs": { + "source": { + "oneof": [ + "uri", + "content" + ] + } + }, + "fields": { + "uri": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "content": { + "type": "bytes", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "mimeType": { + "type": "string", + "id": 3 + }, + "text": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "textStyles": { + "rule": "repeated", + "type": "Style", + "id": 5 + }, + "pages": { + "rule": "repeated", + "type": "Page", + "id": 6 + }, + "entities": { + "rule": "repeated", + "type": "Entity", + "id": 7 + }, + "entityRelations": { + "rule": "repeated", + "type": "EntityRelation", + "id": 8 + }, + "textChanges": { + "rule": "repeated", + "type": "TextChange", + "id": 14 + }, + "shardInfo": { + "type": "ShardInfo", + "id": 9 + }, + "error": { + "type": "google.rpc.Status", + "id": 10 + }, + "revisions": { + "rule": "repeated", + "type": "Revision", + "id": 13 + } + }, + "nested": { + "ShardInfo": { + "fields": { + "shardIndex": { + "type": "int64", + "id": 1 + }, + "shardCount": { + "type": "int64", + "id": 2 + }, + "textOffset": { + "type": "int64", + "id": 3 + } + } + }, + "Style": { + "fields": { + "textAnchor": { + "type": "TextAnchor", + "id": 1 + }, + "color": { + "type": "google.type.Color", + "id": 2 + }, + "backgroundColor": { + "type": "google.type.Color", + "id": 3 + }, + "fontWeight": { + "type": "string", + "id": 4 + }, + "textStyle": { + "type": "string", + "id": 5 + }, + "textDecoration": { + "type": "string", + "id": 6 + }, + "fontSize": { + "type": "FontSize", + "id": 7 + } + }, + "nested": { + "FontSize": { + "fields": { + "size": { + "type": "float", + "id": 1 + }, + "unit": { + "type": "string", + "id": 2 + } + } + } + } + }, + "Page": { + "fields": { + "pageNumber": { + "type": "int32", + "id": 1 + }, + "image": { + "type": "Image", + "id": 13 + }, + "transforms": { + "rule": "repeated", + "type": "Matrix", + "id": 14 + }, + "dimension": { + "type": "Dimension", + "id": 2 + }, + "layout": { + "type": "Layout", + "id": 3 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 4 + }, + "blocks": { + "rule": "repeated", + "type": "Block", + "id": 5 + }, + "paragraphs": { + "rule": "repeated", + "type": "Paragraph", + "id": 6 + }, + "lines": { + "rule": "repeated", + "type": "Line", + "id": 7 + }, + "tokens": { + "rule": "repeated", + "type": "Token", + "id": 8 + }, + "visualElements": { + "rule": "repeated", + "type": "VisualElement", + "id": 9 + }, + "tables": { + "rule": "repeated", + "type": "Table", + "id": 10 + }, + "formFields": { + "rule": "repeated", + "type": "FormField", + "id": 11 + } + }, + "nested": { + "Dimension": { + "fields": { + "width": { + "type": "float", + "id": 1 + }, + "height": { + "type": "float", + "id": 2 + }, + "unit": { + "type": "string", + "id": 3 + } + } + }, + "Image": { + "fields": { + "content": { + "type": "bytes", + "id": 1 + }, + "mimeType": { + "type": "string", + "id": 2 + }, + "width": { + "type": "int32", + "id": 3 + }, + "height": { + "type": "int32", + "id": 4 + } + } + }, + "Matrix": { + "fields": { + "rows": { + "type": "int32", + "id": 1 + }, + "cols": { + "type": "int32", + "id": 2 + }, + "type": { + "type": "int32", + "id": 3 + }, + "data": { + "type": "bytes", + "id": 4 + } + } + }, + "Layout": { + "fields": { + "textAnchor": { + "type": "TextAnchor", + "id": 1 + }, + "confidence": { + "type": "float", + "id": 2 + }, + "boundingPoly": { + "type": "BoundingPoly", + "id": 3 + }, + "orientation": { + "type": "Orientation", + "id": 4 + } + }, + "nested": { + "Orientation": { + "values": { + "ORIENTATION_UNSPECIFIED": 0, + "PAGE_UP": 1, + "PAGE_RIGHT": 2, + "PAGE_DOWN": 3, + "PAGE_LEFT": 4 + } + } + } + }, + "Block": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 2 + }, + "provenance": { + "type": "Provenance", + "id": 3 + } + } + }, + "Paragraph": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 2 + }, + "provenance": { + "type": "Provenance", + "id": 3 + } + } + }, + "Line": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 2 + }, + "provenance": { + "type": "Provenance", + "id": 3 + } + } + }, + "Token": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedBreak": { + "type": "DetectedBreak", + "id": 2 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 3 + }, + "provenance": { + "type": "Provenance", + "id": 4 + } + }, + "nested": { + "DetectedBreak": { + "fields": { + "type": { + "type": "Type", + "id": 1 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_UNSPECIFIED": 0, + "SPACE": 1, + "WIDE_SPACE": 2, + "HYPHEN": 3 + } + } + } + } + } + }, + "VisualElement": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "type": { + "type": "string", + "id": 2 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 3 + } + } + }, + "Table": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "headerRows": { + "rule": "repeated", + "type": "TableRow", + "id": 2 + }, + "bodyRows": { + "rule": "repeated", + "type": "TableRow", + "id": 3 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 4 + } + }, + "nested": { + "TableRow": { + "fields": { + "cells": { + "rule": "repeated", + "type": "TableCell", + "id": 1 + } + } + }, + "TableCell": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "rowSpan": { + "type": "int32", + "id": 2 + }, + "colSpan": { + "type": "int32", + "id": 3 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 4 + } + } + } + } + }, + "FormField": { + "fields": { + "fieldName": { + "type": "Layout", + "id": 1 + }, + "fieldValue": { + "type": "Layout", + "id": 2 + }, + "nameDetectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 3 + }, + "valueDetectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 4 + }, + "valueType": { + "type": "string", + "id": 5 + } + } + }, + "DetectedLanguage": { + "fields": { + "languageCode": { + "type": "string", + "id": 1 + }, + "confidence": { + "type": "float", + "id": 2 + } + } + } + } + }, + "Entity": { + "fields": { + "textAnchor": { + "type": "TextAnchor", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "type": { + "type": "string", + "id": 2 + }, + "mentionText": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "mentionId": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "confidence": { + "type": "float", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageAnchor": { + "type": "PageAnchor", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "id": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "normalizedValue": { + "type": "NormalizedValue", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "properties": { + "rule": "repeated", + "type": "Entity", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "provenance": { + "type": "Provenance", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "redacted": { + "type": "bool", + "id": 12, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "NormalizedValue": { + "oneofs": { + "structuredValue": { + "oneof": [ + "moneyValue", + "dateValue", + "datetimeValue", + "addressValue", + "booleanValue" + ] + } + }, + "fields": { + "moneyValue": { + "type": "google.type.Money", + "id": 2 + }, + "dateValue": { + "type": "google.type.Date", + "id": 3 + }, + "datetimeValue": { + "type": "google.type.DateTime", + "id": 4 + }, + "addressValue": { + "type": "google.type.PostalAddress", + "id": 5 + }, + "booleanValue": { + "type": "bool", + "id": 6 + }, + "text": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + } + } + }, + "EntityRelation": { + "fields": { + "subjectId": { + "type": "string", + "id": 1 + }, + "objectId": { + "type": "string", + "id": 2 + }, + "relation": { + "type": "string", + "id": 3 + } + } + }, + "TextAnchor": { + "fields": { + "textSegments": { + "rule": "repeated", + "type": "TextSegment", + "id": 1 + }, + "content": { + "type": "string", + "id": 2 + } + }, + "nested": { + "TextSegment": { + "fields": { + "startIndex": { + "type": "int64", + "id": 1 + }, + "endIndex": { + "type": "int64", + "id": 2 + } + } + } + } + }, + "PageAnchor": { + "fields": { + "pageRefs": { + "rule": "repeated", + "type": "PageRef", + "id": 1 + } + }, + "nested": { + "PageRef": { + "fields": { + "page": { + "type": "int64", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "layoutType": { + "type": "LayoutType", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "layoutId": { + "type": "string", + "id": 3, + "options": { + "deprecated": true, + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "boundingPoly": { + "type": "BoundingPoly", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "LayoutType": { + "values": { + "LAYOUT_TYPE_UNSPECIFIED": 0, + "BLOCK": 1, + "PARAGRAPH": 2, + "LINE": 3, + "TOKEN": 4, + "VISUAL_ELEMENT": 5, + "TABLE": 6, + "FORM_FIELD": 7 + } + } + } + } + } + }, + "Provenance": { + "fields": { + "revision": { + "type": "int32", + "id": 1 + }, + "id": { + "type": "int32", + "id": 2 + }, + "parents": { + "rule": "repeated", + "type": "Parent", + "id": 3 + }, + "type": { + "type": "OperationType", + "id": 4 + } + }, + "nested": { + "Parent": { + "fields": { + "revision": { + "type": "int32", + "id": 1 + }, + "id": { + "type": "int32", + "id": 2 + } + } + }, + "OperationType": { + "values": { + "OPERATION_TYPE_UNSPECIFIED": 0, + "ADD": 1, + "REMOVE": 2, + "REPLACE": 3, + "EVAL_REQUESTED": 4, + "EVAL_APPROVED": 5, + "EVAL_SKIPPED": 6 + } + } + } + }, + "Revision": { + "oneofs": { + "source": { + "oneof": [ + "agent", + "processor" + ] + } + }, + "fields": { + "agent": { + "type": "string", + "id": 4 + }, + "processor": { + "type": "string", + "id": 5 + }, + "id": { + "type": "string", + "id": 1 + }, + "parent": { + "rule": "repeated", + "type": "int32", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "humanReview": { + "type": "HumanReview", + "id": 6 + } + }, + "nested": { + "HumanReview": { + "fields": { + "state": { + "type": "string", + "id": 1 + }, + "stateMessage": { + "type": "string", + "id": 2 + } + } + } + } + }, + "TextChange": { + "fields": { + "textAnchor": { + "type": "TextAnchor", + "id": 1 + }, + "changedText": { + "type": "string", + "id": 2 + }, + "provenance": { + "rule": "repeated", + "type": "Provenance", + "id": 3 + } + } + } + } + }, + "Vertex": { + "fields": { + "x": { + "type": "int32", + "id": 1 + }, + "y": { + "type": "int32", + "id": 2 + } + } + }, + "NormalizedVertex": { + "fields": { + "x": { + "type": "float", + "id": 1 + }, + "y": { + "type": "float", + "id": 2 + } + } + }, + "BoundingPoly": { + "fields": { + "vertices": { + "rule": "repeated", + "type": "Vertex", + "id": 1 + }, + "normalizedVertices": { + "rule": "repeated", + "type": "NormalizedVertex", + "id": 2 + } + } + }, + "RawDocument": { + "fields": { + "content": { + "type": "bytes", + "id": 1 + }, + "mimeType": { + "type": "string", + "id": 2 + } + } + }, + "GcsDocument": { + "fields": { + "gcsUri": { + "type": "string", + "id": 1 + }, + "mimeType": { + "type": "string", + "id": 2 + } + } + }, + "GcsDocuments": { + "fields": { + "documents": { + "rule": "repeated", + "type": "GcsDocument", + "id": 1 + } + } + }, + "GcsPrefix": { + "fields": { + "gcsUriPrefix": { + "type": "string", + "id": 1 + } + } + }, + "BatchDocumentsInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "gcsPrefix", + "gcsDocuments" + ] + } + }, + "fields": { + "gcsPrefix": { + "type": "GcsPrefix", + "id": 1 + }, + "gcsDocuments": { + "type": "GcsDocuments", + "id": 2 + } + } + }, + "DocumentOutputConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsOutputConfig" + ] + } + }, + "fields": { + "gcsOutputConfig": { + "type": "GcsOutputConfig", + "id": 1 + } + }, + "nested": { + "GcsOutputConfig": { + "fields": { + "gcsUri": { + "type": "string", + "id": 1 + } + } + } + } + }, + "DocumentProcessorService": { + "options": { + "(google.api.default_host)": "us-documentai.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ProcessDocument": { + "requestType": "ProcessRequest", + "responseType": "ProcessResponse", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/processors/*}:process", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/processors/*}:process", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "BatchProcessDocuments": { + "requestType": "BatchProcessRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/processors/*}:batchProcess", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "BatchProcessResponse", + "(google.longrunning.operation_info).metadata_type": "BatchProcessMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/processors/*}:batchProcess", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "BatchProcessResponse", + "metadata_type": "BatchProcessMetadata" + } + } + ] + }, + "ReviewDocument": { + "requestType": "ReviewDocumentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{human_review_config=projects/*/locations/*/processors/*/humanReviewConfig}:reviewDocument", + "(google.api.http).body": "*", + "(google.api.method_signature)": "human_review_config", + "(google.longrunning.operation_info).response_type": "ReviewDocumentResponse", + "(google.longrunning.operation_info).metadata_type": "ReviewDocumentOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{human_review_config=projects/*/locations/*/processors/*/humanReviewConfig}:reviewDocument", + "body": "*" + } + }, + { + "(google.api.method_signature)": "human_review_config" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "ReviewDocumentResponse", + "metadata_type": "ReviewDocumentOperationMetadata" + } + } + ] + } + } + }, + "ProcessRequest": { + "oneofs": { + "source": { + "oneof": [ + "inlineDocument", + "rawDocument" + ] + } + }, + "fields": { + "inlineDocument": { + "type": "Document", + "id": 4 + }, + "rawDocument": { + "type": "RawDocument", + "id": 5 + }, + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + } + }, + "skipHumanReview": { + "type": "bool", + "id": 3 + } + } + }, + "HumanReviewStatus": { + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "stateMessage": { + "type": "string", + "id": 2 + }, + "humanReviewOperation": { + "type": "string", + "id": 3 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "SKIPPED": 1, + "VALIDATION_PASSED": 2, + "IN_PROGRESS": 3, + "ERROR": 4 + } + } + } + }, + "ProcessResponse": { + "fields": { + "document": { + "type": "Document", + "id": 1 + }, + "humanReviewStatus": { + "type": "HumanReviewStatus", + "id": 3 + } + } + }, + "BatchProcessRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + } + }, + "inputDocuments": { + "type": "BatchDocumentsInputConfig", + "id": 5 + }, + "documentOutputConfig": { + "type": "DocumentOutputConfig", + "id": 6 + }, + "skipHumanReview": { + "type": "bool", + "id": 4 + } + } + }, + "BatchProcessResponse": { + "fields": {} + }, + "BatchProcessMetadata": { + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "stateMessage": { + "type": "string", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + }, + "individualProcessStatuses": { + "rule": "repeated", + "type": "IndividualProcessStatus", + "id": 5 + } + }, + "nested": { + "IndividualProcessStatus": { + "fields": { + "inputGcsSource": { + "type": "string", + "id": 1 + }, + "status": { + "type": "google.rpc.Status", + "id": 2 + }, + "outputGcsDestination": { + "type": "string", + "id": 3 + }, + "humanReviewStatus": { + "type": "HumanReviewStatus", + "id": 5 + } + } + }, + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "WAITING": 1, + "RUNNING": 2, + "SUCCEEDED": 3, + "CANCELLING": 4, + "CANCELLED": 5, + "FAILED": 6 + } + } + } + }, + "ReviewDocumentRequest": { + "oneofs": { + "source": { + "oneof": [ + "inlineDocument" + ] + } + }, + "fields": { + "inlineDocument": { + "type": "Document", + "id": 4 + }, + "humanReviewConfig": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/HumanReviewConfig" + } + } + } + }, + "ReviewDocumentResponse": { + "fields": { + "gcsDestination": { + "type": "string", + "id": 1 + } + } + }, + "ReviewDocumentOperationMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 5 + } + } + }, + "CommonOperationMetadata": { + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "stateMessage": { + "type": "string", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "RUNNING": 1, + "CANCELLING": 2, + "SUCCEEDED": 3, + "FAILED": 4, + "CANCELLED": 5 + } + } + } + } + } + }, + "v1beta1": { + "options": { + "csharp_namespace": "Google.Cloud.DocumentAI.V1Beta1", + "go_package": "google.golang.org/genproto/googleapis/cloud/documentai/v1beta1;documentai", + "java_multiple_files": true, + "java_outer_classname": "DocumentAiProto", + "java_package": "com.google.cloud.documentai.v1beta1", + "php_namespace": "Google\\Cloud\\DocumentAI\\V1beta1", + "ruby_package": "Google::Cloud::DocumentAI::V1beta1" + }, + "nested": { + "Document": { + "oneofs": { + "source": { + "oneof": [ + "uri", + "content" + ] + } + }, + "fields": { + "uri": { + "type": "string", + "id": 1 + }, + "content": { + "type": "bytes", + "id": 2 + }, + "mimeType": { + "type": "string", + "id": 3 + }, + "text": { + "type": "string", + "id": 4 + }, + "textStyles": { + "rule": "repeated", + "type": "Style", + "id": 5 + }, + "pages": { + "rule": "repeated", + "type": "Page", + "id": 6 + }, + "entities": { + "rule": "repeated", + "type": "Entity", + "id": 7 + }, + "entityRelations": { + "rule": "repeated", + "type": "EntityRelation", + "id": 8 + }, + "shardInfo": { + "type": "ShardInfo", + "id": 9 + }, + "error": { + "type": "google.rpc.Status", + "id": 10 + } + }, + "nested": { + "ShardInfo": { + "fields": { + "shardIndex": { + "type": "int64", + "id": 1 + }, + "shardCount": { + "type": "int64", + "id": 2 + }, + "textOffset": { + "type": "int64", + "id": 3 + } + } + }, + "Style": { + "fields": { + "textAnchor": { + "type": "TextAnchor", + "id": 1 + }, + "color": { + "type": "google.type.Color", + "id": 2 + }, + "backgroundColor": { + "type": "google.type.Color", + "id": 3 + }, + "fontWeight": { + "type": "string", + "id": 4 + }, + "textStyle": { + "type": "string", + "id": 5 + }, + "textDecoration": { + "type": "string", + "id": 6 + }, + "fontSize": { + "type": "FontSize", + "id": 7 + } + }, + "nested": { + "FontSize": { + "fields": { + "size": { + "type": "float", + "id": 1 + }, + "unit": { + "type": "string", + "id": 2 + } + } + } + } + }, + "Page": { + "fields": { + "pageNumber": { + "type": "int32", + "id": 1 + }, + "dimension": { + "type": "Dimension", + "id": 2 + }, + "layout": { + "type": "Layout", + "id": 3 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 4 + }, + "blocks": { + "rule": "repeated", + "type": "Block", + "id": 5 + }, + "paragraphs": { + "rule": "repeated", + "type": "Paragraph", + "id": 6 + }, + "lines": { + "rule": "repeated", + "type": "Line", + "id": 7 + }, + "tokens": { + "rule": "repeated", + "type": "Token", + "id": 8 + }, + "visualElements": { + "rule": "repeated", + "type": "VisualElement", + "id": 9 + }, + "tables": { + "rule": "repeated", + "type": "Table", + "id": 10 + }, + "formFields": { + "rule": "repeated", + "type": "FormField", + "id": 11 + } + }, + "nested": { + "Dimension": { + "fields": { + "width": { + "type": "float", + "id": 1 + }, + "height": { + "type": "float", + "id": 2 + }, + "unit": { + "type": "string", + "id": 3 + } + } + }, + "Layout": { + "fields": { + "textAnchor": { + "type": "TextAnchor", + "id": 1 + }, + "confidence": { + "type": "float", + "id": 2 + }, + "boundingPoly": { + "type": "BoundingPoly", + "id": 3 + }, + "orientation": { + "type": "Orientation", + "id": 4 + } + }, + "nested": { + "Orientation": { + "values": { + "ORIENTATION_UNSPECIFIED": 0, + "PAGE_UP": 1, + "PAGE_RIGHT": 2, + "PAGE_DOWN": 3, + "PAGE_LEFT": 4 + } + } + } + }, + "Block": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 2 + } + } + }, + "Paragraph": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 2 + } + } + }, + "Line": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 2 + } + } + }, + "Token": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedBreak": { + "type": "DetectedBreak", + "id": 2 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 3 + } + }, + "nested": { + "DetectedBreak": { + "fields": { + "type": { + "type": "Type", + "id": 1 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_UNSPECIFIED": 0, + "SPACE": 1, + "WIDE_SPACE": 2, + "HYPHEN": 3 + } + } + } + } + } + }, + "VisualElement": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "type": { + "type": "string", + "id": 2 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 3 + } + } + }, + "Table": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "headerRows": { + "rule": "repeated", + "type": "TableRow", + "id": 2 + }, + "bodyRows": { + "rule": "repeated", + "type": "TableRow", + "id": 3 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 4 + } + }, + "nested": { + "TableRow": { + "fields": { + "cells": { + "rule": "repeated", + "type": "TableCell", + "id": 1 + } + } + }, + "TableCell": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "rowSpan": { + "type": "int32", + "id": 2 + }, + "colSpan": { + "type": "int32", + "id": 3 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 4 + } + } + } + } + }, + "FormField": { + "fields": { + "fieldName": { + "type": "Layout", + "id": 1 + }, + "fieldValue": { + "type": "Layout", + "id": 2 + }, + "nameDetectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 3 + }, + "valueDetectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 4 + } + } + }, + "DetectedLanguage": { + "fields": { + "languageCode": { + "type": "string", + "id": 1 + }, + "confidence": { + "type": "float", + "id": 2 + } + } + } + } + }, + "Entity": { + "fields": { + "textAnchor": { + "type": "TextAnchor", + "id": 1 + }, + "type": { + "type": "string", + "id": 2 + }, + "mentionText": { + "type": "string", + "id": 3 + }, + "mentionId": { + "type": "string", + "id": 4 + } + } + }, + "EntityRelation": { + "fields": { + "subjectId": { + "type": "string", + "id": 1 + }, + "objectId": { + "type": "string", + "id": 2 + }, + "relation": { + "type": "string", + "id": 3 + } + } + }, + "TextAnchor": { + "fields": { + "textSegments": { + "rule": "repeated", + "type": "TextSegment", + "id": 1 + } + }, + "nested": { + "TextSegment": { + "fields": { + "startIndex": { + "type": "int64", + "id": 1 + }, + "endIndex": { + "type": "int64", + "id": 2 + } + } + } + } + } + } + }, + "Vertex": { + "fields": { + "x": { + "type": "int32", + "id": 1 + }, + "y": { + "type": "int32", + "id": 2 + } + } + }, + "NormalizedVertex": { + "fields": { + "x": { + "type": "float", + "id": 1 + }, + "y": { + "type": "float", + "id": 2 + } + } + }, + "BoundingPoly": { + "fields": { + "vertices": { + "rule": "repeated", + "type": "Vertex", + "id": 1 + }, + "normalizedVertices": { + "rule": "repeated", + "type": "NormalizedVertex", + "id": 2 + } + } + }, + "DocumentUnderstandingService": { + "options": { + "(google.api.default_host)": "documentai.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "BatchProcessDocuments": { + "requestType": "BatchProcessDocumentsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1beta1/{parent=projects/*/locations/*}/documents:batchProcess", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v1beta1/{parent=projects/*}/documents:batchProcess", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "requests", + "(google.longrunning.operation_info).response_type": "BatchProcessDocumentsResponse", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{parent=projects/*/locations/*}/documents:batchProcess", + "body": "*", + "additional_bindings": { + "post": "/v1beta1/{parent=projects/*}/documents:batchProcess", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "requests" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "BatchProcessDocumentsResponse", + "metadata_type": "OperationMetadata" + } + } + ] + } + } + }, + "BatchProcessDocumentsRequest": { + "fields": { + "requests": { + "rule": "repeated", + "type": "ProcessDocumentRequest", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "parent": { + "type": "string", + "id": 2 + } + } + }, + "ProcessDocumentRequest": { + "fields": { + "inputConfig": { + "type": "InputConfig", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "outputConfig": { + "type": "OutputConfig", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "documentType": { + "type": "string", + "id": 3 + }, + "tableExtractionParams": { + "type": "TableExtractionParams", + "id": 4 + }, + "formExtractionParams": { + "type": "FormExtractionParams", + "id": 5 + }, + "entityExtractionParams": { + "type": "EntityExtractionParams", + "id": 6 + }, + "ocrParams": { + "type": "OcrParams", + "id": 7 + } + } + }, + "BatchProcessDocumentsResponse": { + "fields": { + "responses": { + "rule": "repeated", + "type": "ProcessDocumentResponse", + "id": 1 + } + } + }, + "ProcessDocumentResponse": { + "fields": { + "inputConfig": { + "type": "InputConfig", + "id": 1 + }, + "outputConfig": { + "type": "OutputConfig", + "id": 2 + } + } + }, + "OcrParams": { + "fields": { + "languageHints": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "TableExtractionParams": { + "fields": { + "enabled": { + "type": "bool", + "id": 1 + }, + "tableBoundHints": { + "rule": "repeated", + "type": "TableBoundHint", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "headerHints": { + "rule": "repeated", + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "modelVersion": { + "type": "string", + "id": 4 + } + } + }, + "TableBoundHint": { + "fields": { + "pageNumber": { + "type": "int32", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "boundingBox": { + "type": "BoundingPoly", + "id": 2 + } + } + }, + "FormExtractionParams": { + "fields": { + "enabled": { + "type": "bool", + "id": 1 + }, + "keyValuePairHints": { + "rule": "repeated", + "type": "KeyValuePairHint", + "id": 2 + }, + "modelVersion": { + "type": "string", + "id": 3 + } + } + }, + "KeyValuePairHint": { + "fields": { + "key": { + "type": "string", + "id": 1 + }, + "valueTypes": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, + "EntityExtractionParams": { + "fields": { + "enabled": { + "type": "bool", + "id": 1 + }, + "modelVersion": { + "type": "string", + "id": 2 + } + } + }, + "InputConfig": { + "oneofs": { + "source": { + "oneof": [ + "gcsSource" + ] + } + }, + "fields": { + "gcsSource": { + "type": "GcsSource", + "id": 1 + }, + "mimeType": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "OutputConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsDestination" + ] + } + }, + "fields": { + "gcsDestination": { + "type": "GcsDestination", + "id": 1 + }, + "pagesPerShard": { + "type": "int32", + "id": 2 + } + } + }, + "GcsSource": { + "fields": { + "uri": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GcsDestination": { + "fields": { + "uri": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "OperationMetadata": { + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "stateMessage": { + "type": "string", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "ACCEPTED": 1, + "WAITING": 2, + "RUNNING": 3, + "SUCCEEDED": 4, + "CANCELLED": 5, + "FAILED": 6 + } + } + } + } + } + }, "v1beta2": { "options": { "csharp_namespace": "Google.Cloud.DocumentAI.V1Beta2", @@ -3488,6 +5595,18 @@ } } }, + "Timestamp": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + }, "Any": { "fields": { "type_url": { @@ -3587,18 +5706,6 @@ "Empty": { "fields": {} }, - "Timestamp": { - "fields": { - "seconds": { - "type": "int64", - "id": 1 - }, - "nanos": { - "type": "int32", - "id": 2 - } - } - }, "FieldMask": { "fields": { "paths": { diff --git a/packages/google-cloud-documentai/src/index.ts b/packages/google-cloud-documentai/src/index.ts index 3d86b2bd3a0..7a727eb9ac2 100644 --- a/packages/google-cloud-documentai/src/index.ts +++ b/packages/google-cloud-documentai/src/index.ts @@ -16,13 +16,15 @@ // ** https://github.com/googleapis/synthtool ** // ** All changes to this file may be overwritten. ** +import * as v1 from './v1'; +import * as v1beta1 from './v1beta1'; import * as v1beta2 from './v1beta2'; import * as v1beta3 from './v1beta3'; const DocumentProcessorServiceClient = v1beta3.DocumentProcessorServiceClient; type DocumentProcessorServiceClient = v1beta3.DocumentProcessorServiceClient; -export {v1beta2, v1beta3, DocumentProcessorServiceClient}; -export default {v1beta2, v1beta3, DocumentProcessorServiceClient}; +export {v1, v1beta1, v1beta2, v1beta3, DocumentProcessorServiceClient}; +export default {v1, v1beta1, v1beta2, v1beta3, DocumentProcessorServiceClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts new file mode 100644 index 00000000000..29d3ac5f8c9 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts @@ -0,0 +1,864 @@ +// 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/v1/document_processor_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './document_processor_service_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service to call Cloud DocumentAI to process documents according to the + * processor's definition. Processors are built using state-of-the-art Google + * AI such as natural language, computer vision, and translation to extract + * structured information from unstructured or semi-structured documents. + * @class + * @memberof v1 + */ +export class DocumentProcessorServiceClient { + 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; + documentProcessorServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DocumentProcessorServiceClient. + * + * @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 DocumentProcessorServiceClient; + 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 set scopes. + if (!('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; + + // 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 = { + humanReviewConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig' + ), + processorPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/processors/{processor}' + ), + }; + + // 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 batchProcessDocumentsResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.BatchProcessResponse' + ) as gax.protobuf.Type; + const batchProcessDocumentsMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.BatchProcessMetadata' + ) as gax.protobuf.Type; + const reviewDocumentResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.ReviewDocumentResponse' + ) as gax.protobuf.Type; + const reviewDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.ReviewDocumentOperationMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + batchProcessDocuments: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchProcessDocumentsResponse.decode.bind( + batchProcessDocumentsResponse + ), + batchProcessDocumentsMetadata.decode.bind(batchProcessDocumentsMetadata) + ), + reviewDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + reviewDocumentResponse.decode.bind(reviewDocumentResponse), + reviewDocumentMetadata.decode.bind(reviewDocumentMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.documentai.v1.DocumentProcessorService', + 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.documentProcessorServiceStub) { + return this.documentProcessorServiceStub; + } + + // Put together the "service stub" for + // google.cloud.documentai.v1.DocumentProcessorService. + this.documentProcessorServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.documentai.v1.DocumentProcessorService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.documentai.v1 + .DocumentProcessorService, + 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 documentProcessorServiceStubMethods = [ + 'processDocument', + 'batchProcessDocuments', + 'reviewDocument', + ]; + for (const methodName of documentProcessorServiceStubMethods) { + const callPromise = this.documentProcessorServiceStub.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.documentProcessorServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'us-documentai.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 'us-documentai.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 -- + // ------------------- + processDocument( + request: protos.google.cloud.documentai.v1.IProcessRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessResponse, + protos.google.cloud.documentai.v1.IProcessRequest | undefined, + {} | undefined + ] + >; + processDocument( + request: protos.google.cloud.documentai.v1.IProcessRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.documentai.v1.IProcessResponse, + protos.google.cloud.documentai.v1.IProcessRequest | null | undefined, + {} | null | undefined + > + ): void; + processDocument( + request: protos.google.cloud.documentai.v1.IProcessRequest, + callback: Callback< + protos.google.cloud.documentai.v1.IProcessResponse, + protos.google.cloud.documentai.v1.IProcessRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Processes a single document. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.documentai.v1.Document} request.inlineDocument + * An inline document proto. + * @param {google.cloud.documentai.v1.RawDocument} request.rawDocument + * A raw document content (bytes). + * @param {string} request.name + * Required. The processor resource name. + * @param {boolean} request.skipHumanReview + * Whether Human Review feature should be skipped for this request. Default to + * false. + * @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 [ProcessResponse]{@link google.cloud.documentai.v1.ProcessResponse}. + * 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.processDocument(request); + */ + processDocument( + request: protos.google.cloud.documentai.v1.IProcessRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.documentai.v1.IProcessResponse, + protos.google.cloud.documentai.v1.IProcessRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.documentai.v1.IProcessResponse, + protos.google.cloud.documentai.v1.IProcessRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessResponse, + protos.google.cloud.documentai.v1.IProcessRequest | 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.processDocument(request, options, callback); + } + + batchProcessDocuments( + request: protos.google.cloud.documentai.v1.IBatchProcessRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchProcessDocuments( + request: protos.google.cloud.documentai.v1.IBatchProcessRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchProcessDocuments( + request: protos.google.cloud.documentai.v1.IBatchProcessRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * LRO endpoint to batch process many documents. The output is written + * to Cloud Storage as JSON in the [Document] format. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name. + * @param {google.cloud.documentai.v1.BatchDocumentsInputConfig} request.inputDocuments + * The input documents for batch process. + * @param {google.cloud.documentai.v1.DocumentOutputConfig} request.documentOutputConfig + * The overall output config for batch process. + * @param {boolean} request.skipHumanReview + * Whether Human Review feature should be skipped for this request. Default to + * false. + * @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.batchProcessDocuments(request); + * const [response] = await operation.promise(); + */ + batchProcessDocuments( + request: protos.google.cloud.documentai.v1.IBatchProcessRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >, + 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.batchProcessDocuments(request, options, callback); + } + /** + * Check the status of the long running operation returned by `batchProcessDocuments()`. + * @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 checkBatchProcessDocumentsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchProcessDocumentsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1.BatchProcessResponse, + protos.google.cloud.documentai.v1.BatchProcessMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.batchProcessDocuments, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1.BatchProcessResponse, + protos.google.cloud.documentai.v1.BatchProcessMetadata + >; + } + reviewDocument( + request: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + reviewDocument( + request: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + reviewDocument( + request: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Send a document for Human Review. The input document should be processed by + * the specified processor. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.documentai.v1.Document} request.inlineDocument + * An inline document proto. + * @param {string} request.humanReviewConfig + * Required. The resource name of the HumanReviewConfig that the document will be + * reviewed with. + * @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.reviewDocument(request); + * const [response] = await operation.promise(); + */ + reviewDocument( + request: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >, + 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({ + human_review_config: request.humanReviewConfig || '', + }); + this.initialize(); + return this.innerApiCalls.reviewDocument(request, options, callback); + } + /** + * Check the status of the long running operation returned by `reviewDocument()`. + * @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 checkReviewDocumentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkReviewDocumentProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1.ReviewDocumentResponse, + protos.google.cloud.documentai.v1.ReviewDocumentOperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.reviewDocument, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1.ReviewDocumentResponse, + protos.google.cloud.documentai.v1.ReviewDocumentOperationMetadata + >; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified humanReviewConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} processor + * @returns {string} Resource name string. + */ + humanReviewConfigPath(project: string, location: string, processor: string) { + return this.pathTemplates.humanReviewConfigPathTemplate.render({ + project: project, + location: location, + processor: processor, + }); + } + + /** + * Parse the project from HumanReviewConfig resource. + * + * @param {string} humanReviewConfigName + * A fully-qualified path representing HumanReviewConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromHumanReviewConfigName(humanReviewConfigName: string) { + return this.pathTemplates.humanReviewConfigPathTemplate.match( + humanReviewConfigName + ).project; + } + + /** + * Parse the location from HumanReviewConfig resource. + * + * @param {string} humanReviewConfigName + * A fully-qualified path representing HumanReviewConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromHumanReviewConfigName(humanReviewConfigName: string) { + return this.pathTemplates.humanReviewConfigPathTemplate.match( + humanReviewConfigName + ).location; + } + + /** + * Parse the processor from HumanReviewConfig resource. + * + * @param {string} humanReviewConfigName + * A fully-qualified path representing HumanReviewConfig resource. + * @returns {string} A string representing the processor. + */ + matchProcessorFromHumanReviewConfigName(humanReviewConfigName: string) { + return this.pathTemplates.humanReviewConfigPathTemplate.match( + humanReviewConfigName + ).processor; + } + + /** + * Return a fully-qualified processor resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} processor + * @returns {string} Resource name string. + */ + processorPath(project: string, location: string, processor: string) { + return this.pathTemplates.processorPathTemplate.render({ + project: project, + location: location, + processor: processor, + }); + } + + /** + * Parse the project from Processor resource. + * + * @param {string} processorName + * A fully-qualified path representing Processor resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProcessorName(processorName: string) { + return this.pathTemplates.processorPathTemplate.match(processorName) + .project; + } + + /** + * Parse the location from Processor resource. + * + * @param {string} processorName + * A fully-qualified path representing Processor resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProcessorName(processorName: string) { + return this.pathTemplates.processorPathTemplate.match(processorName) + .location; + } + + /** + * Parse the processor from Processor resource. + * + * @param {string} processorName + * A fully-qualified path representing Processor resource. + * @returns {string} A string representing the processor. + */ + matchProcessorFromProcessorName(processorName: string) { + return this.pathTemplates.processorPathTemplate.match(processorName) + .processor; + } + + /** + * 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.documentProcessorServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client_config.json b/packages/google-cloud-documentai/src/v1/document_processor_service_client_config.json new file mode 100644 index 00000000000..0ded43290cc --- /dev/null +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client_config.json @@ -0,0 +1,41 @@ +{ + "interfaces": { + "google.cloud.documentai.v1.DocumentProcessorService": { + "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": { + "ProcessDocument": { + "timeout_millis": 120000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "BatchProcessDocuments": { + "timeout_millis": 120000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ReviewDocument": { + "timeout_millis": 120000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_proto_list.json b/packages/google-cloud-documentai/src/v1/document_processor_service_proto_list.json new file mode 100644 index 00000000000..e7df1c477a3 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_proto_list.json @@ -0,0 +1,6 @@ +[ + "../../protos/google/cloud/documentai/v1/document.proto", + "../../protos/google/cloud/documentai/v1/document_io.proto", + "../../protos/google/cloud/documentai/v1/document_processor_service.proto", + "../../protos/google/cloud/documentai/v1/geometry.proto" +] diff --git a/packages/google-cloud-documentai/src/v1/gapic_metadata.json b/packages/google-cloud-documentai/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..05ebff671a8 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1/gapic_metadata.json @@ -0,0 +1,53 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.documentai.v1", + "libraryPackage": "@google-cloud/documentai", + "services": { + "DocumentProcessorService": { + "clients": { + "grpc": { + "libraryClient": "DocumentProcessorServiceClient", + "rpcs": { + "ProcessDocument": { + "methods": [ + "processDocument" + ] + }, + "BatchProcessDocuments": { + "methods": [ + "batchProcessDocuments" + ] + }, + "ReviewDocument": { + "methods": [ + "reviewDocument" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DocumentProcessorServiceClient", + "rpcs": { + "ProcessDocument": { + "methods": [ + "processDocument" + ] + }, + "BatchProcessDocuments": { + "methods": [ + "batchProcessDocuments" + ] + }, + "ReviewDocument": { + "methods": [ + "reviewDocument" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-documentai/src/v1/index.ts b/packages/google-cloud-documentai/src/v1/index.ts new file mode 100644 index 00000000000..2f6c91a4251 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1/index.ts @@ -0,0 +1,19 @@ +// 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 {DocumentProcessorServiceClient} from './document_processor_service_client'; diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts new file mode 100644 index 00000000000..a780c5f5d33 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts @@ -0,0 +1,486 @@ +// 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/v1beta1/document_understanding_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './document_understanding_service_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service to parse structured information from unstructured or semi-structured + * documents using state-of-the-art Google AI such as natural language, + * computer vision, and translation. + * @class + * @memberof v1beta1 + */ +export class DocumentUnderstandingServiceClient { + 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}; + operationsClient: gax.OperationsClient; + documentUnderstandingServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DocumentUnderstandingServiceClient. + * + * @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 DocumentUnderstandingServiceClient; + 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 set scopes. + if (!('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; + + // 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 "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 batchProcessDocumentsResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse' + ) as gax.protobuf.Type; + const batchProcessDocumentsMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta1.OperationMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + batchProcessDocuments: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchProcessDocumentsResponse.decode.bind( + batchProcessDocumentsResponse + ), + batchProcessDocumentsMetadata.decode.bind(batchProcessDocumentsMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.documentai.v1beta1.DocumentUnderstandingService', + 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.documentUnderstandingServiceStub) { + return this.documentUnderstandingServiceStub; + } + + // Put together the "service stub" for + // google.cloud.documentai.v1beta1.DocumentUnderstandingService. + this.documentUnderstandingServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.documentai.v1beta1.DocumentUnderstandingService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.documentai.v1beta1 + .DocumentUnderstandingService, + 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 documentUnderstandingServiceStubMethods = ['batchProcessDocuments']; + for (const methodName of documentUnderstandingServiceStubMethods) { + const callPromise = this.documentUnderstandingServiceStub.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.documentUnderstandingServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'documentai.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 'documentai.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 -- + // ------------------- + + batchProcessDocuments( + request: protos.google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchProcessDocuments( + request: protos.google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchProcessDocuments( + request: protos.google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * LRO endpoint to batch process many documents. + * + * @param {Object} request + * The request object that will be sent. + * @param {number[]} request.requests + * Required. Individual requests for each document. + * @param {string} request.parent + * Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no location is specified, a region will be chosen automatically. + * @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.batchProcessDocuments(request); + * const [response] = await operation.promise(); + */ + batchProcessDocuments( + request: protos.google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta1.IOperationMetadata + >, + 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.batchProcessDocuments(request, options, callback); + } + /** + * Check the status of the long running operation returned by `batchProcessDocuments()`. + * @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 checkBatchProcessDocumentsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchProcessDocumentsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta1.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.batchProcessDocuments, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta1.OperationMetadata + >; + } + + /** + * 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.documentUnderstandingServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client_config.json b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client_config.json new file mode 100644 index 00000000000..2b4b0aff793 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.documentai.v1beta1.DocumentUnderstandingService": { + "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": { + "BatchProcessDocuments": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_proto_list.json b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_proto_list.json new file mode 100644 index 00000000000..684a577c02a --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_proto_list.json @@ -0,0 +1,5 @@ +[ + "../../protos/google/cloud/documentai/v1beta1/document.proto", + "../../protos/google/cloud/documentai/v1beta1/document_understanding.proto", + "../../protos/google/cloud/documentai/v1beta1/geometry.proto" +] diff --git a/packages/google-cloud-documentai/src/v1beta1/gapic_metadata.json b/packages/google-cloud-documentai/src/v1beta1/gapic_metadata.json new file mode 100644 index 00000000000..ec68421d538 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta1/gapic_metadata.json @@ -0,0 +1,33 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.documentai.v1beta1", + "libraryPackage": "documentai", + "services": { + "DocumentUnderstandingService": { + "clients": { + "grpc": { + "libraryClient": "DocumentUnderstandingServiceClient", + "rpcs": { + "BatchProcessDocuments": { + "methods": [ + "batchProcessDocuments" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DocumentUnderstandingServiceClient", + "rpcs": { + "BatchProcessDocuments": { + "methods": [ + "batchProcessDocuments" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-documentai/src/v1beta1/index.ts b/packages/google-cloud-documentai/src/v1beta1/index.ts new file mode 100644 index 00000000000..1a00861f815 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta1/index.ts @@ -0,0 +1,19 @@ +// 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 {DocumentUnderstandingServiceClient} from './document_understanding_service_client'; diff --git a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts new file mode 100644 index 00000000000..699862cf061 --- /dev/null +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts @@ -0,0 +1,855 @@ +// 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 documentprocessorserviceModule 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('v1.DocumentProcessorServiceClient', () => { + it('has servicePath', () => { + const servicePath = + documentprocessorserviceModule.v1.DocumentProcessorServiceClient + .servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + documentprocessorserviceModule.v1.DocumentProcessorServiceClient + .apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = + documentprocessorserviceModule.v1.DocumentProcessorServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + fallback: true, + } + ); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.documentProcessorServiceStub, undefined); + await client.initialize(); + assert(client.documentProcessorServiceStub); + }); + + it('has close method', () => { + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + 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 documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + 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('processDocument', () => { + it('invokes processDocument without error', async () => { + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessResponse() + ); + client.innerApiCalls.processDocument = stubSimpleCall(expectedResponse); + const [response] = await client.processDocument(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.processDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes processDocument without error using callback', async () => { + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessResponse() + ); + client.innerApiCalls.processDocument = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.processDocument( + request, + ( + err?: Error | null, + result?: protos.google.cloud.documentai.v1.IProcessResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.processDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes processDocument with error', async () => { + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.processDocument = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.processDocument(request), expectedError); + assert( + (client.innerApiCalls.processDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('batchProcessDocuments', () => { + it('invokes batchProcessDocuments without error', async () => { + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.BatchProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.batchProcessDocuments(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes batchProcessDocuments without error using callback', async () => { + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.BatchProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchProcessDocuments = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.batchProcessDocuments( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes batchProcessDocuments with call error', async () => { + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.BatchProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.batchProcessDocuments(request), + expectedError + ); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes batchProcessDocuments with LRO error', async () => { + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.BatchProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchProcessDocuments(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkBatchProcessDocumentsProgress without error', async () => { + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + 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.checkBatchProcessDocumentsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchProcessDocumentsProgress with error', async () => { + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + 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.checkBatchProcessDocumentsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('reviewDocument', () => { + it('invokes reviewDocument without error', async () => { + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reviewDocument = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.reviewDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes reviewDocument without error using callback', async () => { + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reviewDocument = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.reviewDocument( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes reviewDocument with call error', async () => { + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.reviewDocument = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.reviewDocument(request), expectedError); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes reviewDocument with LRO error', async () => { + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.reviewDocument = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.reviewDocument(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkReviewDocumentProgress without error', async () => { + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + 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.checkReviewDocumentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkReviewDocumentProgress with error', async () => { + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + 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.checkReviewDocumentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('Path templates', () => { + describe('humanReviewConfig', () => { + const fakePath = '/rendered/path/humanReviewConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + processor: 'processorValue', + }; + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.humanReviewConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.humanReviewConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('humanReviewConfigPath', () => { + const result = client.humanReviewConfigPath( + 'projectValue', + 'locationValue', + 'processorValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.humanReviewConfigPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromHumanReviewConfigName', () => { + const result = client.matchProjectFromHumanReviewConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.humanReviewConfigPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromHumanReviewConfigName', () => { + const result = client.matchLocationFromHumanReviewConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.humanReviewConfigPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProcessorFromHumanReviewConfigName', () => { + const result = client.matchProcessorFromHumanReviewConfigName(fakePath); + assert.strictEqual(result, 'processorValue'); + assert( + (client.pathTemplates.humanReviewConfigPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('processor', () => { + const fakePath = '/rendered/path/processor'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + processor: 'processorValue', + }; + const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.processorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.processorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('processorPath', () => { + const result = client.processorPath( + 'projectValue', + 'locationValue', + 'processorValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.processorPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProcessorName', () => { + const result = client.matchProjectFromProcessorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProcessorName', () => { + const result = client.matchLocationFromProcessorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProcessorFromProcessorName', () => { + const result = client.matchProcessorFromProcessorName(fakePath); + assert.strictEqual(result, 'processorValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts new file mode 100644 index 00000000000..9beeb83ec29 --- /dev/null +++ b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts @@ -0,0 +1,383 @@ +// 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 documentunderstandingserviceModule 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 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('v1beta1.DocumentUnderstandingServiceClient', () => { + it('has servicePath', () => { + const servicePath = + documentunderstandingserviceModule.v1beta1 + .DocumentUnderstandingServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + documentunderstandingserviceModule.v1beta1 + .DocumentUnderstandingServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = + documentunderstandingserviceModule.v1beta1 + .DocumentUnderstandingServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + fallback: true, + } + ); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.documentUnderstandingServiceStub, undefined); + await client.initialize(); + assert(client.documentUnderstandingServiceStub); + }); + + it('has close method', () => { + const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + 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 documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + 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('batchProcessDocuments', () => { + it('invokes batchProcessDocuments without error', async () => { + const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.batchProcessDocuments(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes batchProcessDocuments without error using callback', async () => { + const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchProcessDocuments = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.batchProcessDocuments( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta1.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1beta1.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes batchProcessDocuments with call error', async () => { + const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.batchProcessDocuments(request), + expectedError + ); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes batchProcessDocuments with LRO error', async () => { + const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchProcessDocuments(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkBatchProcessDocumentsProgress without error', async () => { + const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + 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.checkBatchProcessDocumentsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchProcessDocumentsProgress with error', async () => { + const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + 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.checkBatchProcessDocumentsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); +}); From 8a2c51fce8c420ad52f681f0a493d86fc08e3d7b Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 13 Apr 2021 15:00:16 -0700 Subject: [PATCH 117/213] chore: release 2.8.0 (#197) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-documentai/CHANGELOG.md | 7 +++++++ packages/google-cloud-documentai/package.json | 2 +- packages/google-cloud-documentai/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index ad7bf2144e0..9bba2eabdc3 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [2.8.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.7.0...v2.8.0) (2021-04-13) + + +### Features + +* add v1 API surface ([#196](https://www.github.com/googleapis/nodejs-document-ai/issues/196)) ([54b1dc4](https://www.github.com/googleapis/nodejs-document-ai/commit/54b1dc4354c3700d2d729d745edf0de0657d1014)) + ## [2.7.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.6.0...v2.7.0) (2021-04-12) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index c54953828f9..a97cf5b5216 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "2.7.0", + "version": "2.8.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 4af410f4ff3..5dc8e67e8a5 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^2.7.0", + "@google-cloud/documentai": "^2.8.0", "@google-cloud/storage": "^5.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" From 86699651f204e40a8665799ecacefd7b01266e9b Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 14 Apr 2021 17:33:58 +0200 Subject: [PATCH 118/213] chore(deps): update dependency @types/sinon to v10 (#199) --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index a97cf5b5216..3e545033a72 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -34,7 +34,7 @@ "devDependencies": { "@types/mocha": "^8.0.0", "@types/node": "^12.12.29", - "@types/sinon": "^9.0.0", + "@types/sinon": "^10.0.0", "c8": "^7.1.0", "chai": "^4.2.0", "gts": "^2.0.0", From 179b0afb36fd66cdd3f8b870e6fc4a1ad09ed707 Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Wed, 14 Apr 2021 09:23:16 -0700 Subject: [PATCH 119/213] samples: updates v1beta3 to v1; renames v1beta2 samples (#198) --- packages/google-cloud-documentai/README.md | 20 ++--- .../google-cloud-documentai/samples/README.md | 80 +++++++++---------- .../samples/quickstart.js | 4 +- 3 files changed, 52 insertions(+), 52 deletions(-) diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index e02be017d68..a2f40b11762 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -68,7 +68,7 @@ npm install @google-cloud/documentai const { DocumentProcessorServiceClient, -} = require('@google-cloud/documentai').v1beta3; +} = require('@google-cloud/documentai').v1; // Instantiates a client const client = new DocumentProcessorServiceClient(); @@ -88,7 +88,7 @@ async function quickstart() { const request = { name, - document: { + rawDocument: { content: encodedImage, mimeType: 'application/pdf', }, @@ -135,15 +135,15 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-document-ai | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | -| Batch-process-document.v1beta3 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch-process-document.v1beta3.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-process-document.v1beta3.js,samples/README.md) | -| Batch_parse_form | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch_parse_form.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch_parse_form.js,samples/README.md) | -| Batch_parse_table | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch_parse_table.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch_parse_table.js,samples/README.md) | -| Parse_form | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse_form.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse_form.js,samples/README.md) | -| Parse_table | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse_table.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse_table.js,samples/README.md) | -| Parse_with_model | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse_with_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse_with_model.js,samples/README.md) | -| Process-document.v1beta3 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/process-document.v1beta3.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document.v1beta3.js,samples/README.md) | +| Batch-parse-form.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch-parse-form.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-parse-form.v1beta2.js,samples/README.md) | +| Batch-parse-table.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch-parse-table.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-parse-table.v1beta2.js,samples/README.md) | +| Batch-process-document | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch-process-document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-process-document.js,samples/README.md) | +| Parse-form.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse-form.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-form.v1beta2.js,samples/README.md) | +| Parse-table.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse-table.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-table.v1beta2.js,samples/README.md) | +| Parse-with-model.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse-with-model.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-with-model.v1beta2.js,samples/README.md) | +| Process-document | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/process-document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document.js,samples/README.md) | | Quickstart | [source code](https://github.com/googleapis/nodejs-document-ai/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-document-ai&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | -| Set_endpoint | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/set_endpoint.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/set_endpoint.js,samples/README.md) | +| Set-endpoint.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/set-endpoint.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/set-endpoint.v1beta2.js,samples/README.md) | diff --git a/packages/google-cloud-documentai/samples/README.md b/packages/google-cloud-documentai/samples/README.md index b84721691b1..6ac37ff71ea 100644 --- a/packages/google-cloud-documentai/samples/README.md +++ b/packages/google-cloud-documentai/samples/README.md @@ -12,15 +12,15 @@ * [Before you begin](#before-you-begin) * [Samples](#samples) - * [Batch-process-document.v1beta3](#batch-process-document.v1beta3) - * [Batch_parse_form](#batch_parse_form) - * [Batch_parse_table](#batch_parse_table) - * [Parse_form](#parse_form) - * [Parse_table](#parse_table) - * [Parse_with_model](#parse_with_model) - * [Process-document.v1beta3](#process-document.v1beta3) + * [Batch-parse-form.v1beta2](#batch-parse-form.v1beta2) + * [Batch-parse-table.v1beta2](#batch-parse-table.v1beta2) + * [Batch-process-document](#batch-process-document) + * [Parse-form.v1beta2](#parse-form.v1beta2) + * [Parse-table.v1beta2](#parse-table.v1beta2) + * [Parse-with-model.v1beta2](#parse-with-model.v1beta2) + * [Process-document](#process-document) * [Quickstart](#quickstart) - * [Set_endpoint](#set_endpoint) + * [Set-endpoint.v1beta2](#set-endpoint.v1beta2) ## Before you begin @@ -37,16 +37,16 @@ Before running the samples, make sure you've followed the steps outlined in -### Batch-process-document.v1beta3 +### Batch-parse-form.v1beta2 -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch-process-document.v1beta3.js). +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch-parse-form.v1beta2.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-process-document.v1beta3.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-parse-form.v1beta2.js,samples/README.md) __Usage:__ -`node samples/batch-process-document.v1beta3.js` +`node samples/batch-parse-form.v1beta2.js` ----- @@ -54,16 +54,16 @@ __Usage:__ -### Batch_parse_form +### Batch-parse-table.v1beta2 -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch_parse_form.js). +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch-parse-table.v1beta2.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch_parse_form.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-parse-table.v1beta2.js,samples/README.md) __Usage:__ -`node samples/batch_parse_form.js` +`node samples/batch-parse-table.v1beta2.js` ----- @@ -71,16 +71,16 @@ __Usage:__ -### Batch_parse_table +### Batch-process-document -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch_parse_table.js). +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch-process-document.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch_parse_table.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-process-document.js,samples/README.md) __Usage:__ -`node samples/batch_parse_table.js` +`node samples/batch-process-document.js` ----- @@ -88,16 +88,16 @@ __Usage:__ -### Parse_form +### Parse-form.v1beta2 -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse_form.js). +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse-form.v1beta2.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse_form.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-form.v1beta2.js,samples/README.md) __Usage:__ -`node samples/parse_form.js` +`node samples/parse-form.v1beta2.js` ----- @@ -105,16 +105,16 @@ __Usage:__ -### Parse_table +### Parse-table.v1beta2 -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse_table.js). +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse-table.v1beta2.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse_table.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-table.v1beta2.js,samples/README.md) __Usage:__ -`node samples/parse_table.js` +`node samples/parse-table.v1beta2.js` ----- @@ -122,16 +122,16 @@ __Usage:__ -### Parse_with_model +### Parse-with-model.v1beta2 -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse_with_model.js). +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse-with-model.v1beta2.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse_with_model.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-with-model.v1beta2.js,samples/README.md) __Usage:__ -`node samples/parse_with_model.js` +`node samples/parse-with-model.v1beta2.js` ----- @@ -139,16 +139,16 @@ __Usage:__ -### Process-document.v1beta3 +### Process-document -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/process-document.v1beta3.js). +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/process-document.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document.v1beta3.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document.js,samples/README.md) __Usage:__ -`node samples/process-document.v1beta3.js` +`node samples/process-document.js` ----- @@ -173,16 +173,16 @@ __Usage:__ -### Set_endpoint +### Set-endpoint.v1beta2 -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/set_endpoint.js). +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/set-endpoint.v1beta2.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/set_endpoint.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/set-endpoint.v1beta2.js,samples/README.md) __Usage:__ -`node samples/set_endpoint.js` +`node samples/set-endpoint.v1beta2.js` diff --git a/packages/google-cloud-documentai/samples/quickstart.js b/packages/google-cloud-documentai/samples/quickstart.js index 6f135c72bc4..8f1879bec7e 100644 --- a/packages/google-cloud-documentai/samples/quickstart.js +++ b/packages/google-cloud-documentai/samples/quickstart.js @@ -27,7 +27,7 @@ async function main(projectId, location, processorId, filePath) { const { DocumentProcessorServiceClient, - } = require('@google-cloud/documentai').v1beta3; + } = require('@google-cloud/documentai').v1; // Instantiates a client const client = new DocumentProcessorServiceClient(); @@ -47,7 +47,7 @@ async function main(projectId, location, processorId, filePath) { const request = { name, - document: { + rawDocument: { content: encodedImage, mimeType: 'application/pdf', }, From f683f3de216ff61adacf32caa263ad897384c116 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 20 Apr 2021 00:56:11 +0200 Subject: [PATCH 120/213] chore(deps): update dependency ts-loader to v9 (#203) [![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.0` -> `^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-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 3e545033a72..22cb601782e 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -46,7 +46,7 @@ "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", "sinon": "^10.0.0", - "ts-loader": "^8.0.0", + "ts-loader": "^9.0.0", "typescript": "^3.8.3", "webpack": "^5.0.0", "webpack-cli": "^4.0.0", From d7fef6b2215b153eea114f457a88477d24318ca5 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 26 Apr 2021 09:02:32 -0700 Subject: [PATCH 121/213] feat: add confidence field to the PageAnchor.PageRef in document.proto (#204) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add confidence field to the PageAnchor.PageRef in document.proto. PiperOrigin-RevId: 370028868 Source-Link: https://github.com/googleapis/googleapis/commit/f07131004bbcab3737d1241b34341d1b76ae7712 Source-Link: https://github.com/googleapis/googleapis-gen/commit/63fd399ef9d7f0a088f8a21150b009ec7cc2befd * 🦉 Updates from OwlBot * 🦉 Updates from OwlBot Co-authored-by: Owl Bot --- .../cloud/documentai/v1beta3/document.proto | 3 +++ .../protos/protos.d.ts | 6 +++++ .../google-cloud-documentai/protos/protos.js | 22 +++++++++++++++++++ .../protos/protos.json | 7 ++++++ 4 files changed, 38 insertions(+) diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto index e9345f01ad6..d461041f976 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto @@ -549,6 +549,9 @@ message Document { // Optional. Identifies the bounding polygon of a layout element on the page. BoundingPoly bounding_poly = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Confidence of detected page element, if applicable. Range [0, 1]. + float confidence = 5 [(google.api.field_behavior) = OPTIONAL]; } // One or more references to visual page elements diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index add8ef91d81..145e252835a 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -17566,6 +17566,9 @@ export namespace google { /** PageRef boundingPoly */ boundingPoly?: (google.cloud.documentai.v1beta3.IBoundingPoly|null); + + /** PageRef confidence */ + confidence?: (number|null); } /** Represents a PageRef. */ @@ -17589,6 +17592,9 @@ export namespace google { /** PageRef boundingPoly. */ public boundingPoly?: (google.cloud.documentai.v1beta3.IBoundingPoly|null); + /** PageRef confidence. */ + public confidence: number; + /** * Creates a new PageRef instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 8adb0eb6329..ee434c8a30f 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -44786,6 +44786,7 @@ * @property {google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.LayoutType|null} [layoutType] PageRef layoutType * @property {string|null} [layoutId] PageRef layoutId * @property {google.cloud.documentai.v1beta3.IBoundingPoly|null} [boundingPoly] PageRef boundingPoly + * @property {number|null} [confidence] PageRef confidence */ /** @@ -44835,6 +44836,14 @@ */ PageRef.prototype.boundingPoly = null; + /** + * PageRef confidence. + * @member {number} confidence + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef + * @instance + */ + PageRef.prototype.confidence = 0; + /** * Creates a new PageRef instance using the specified properties. * @function create @@ -44867,6 +44876,8 @@ writer.uint32(/* id 3, wireType 2 =*/26).string(message.layoutId); if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) $root.google.cloud.documentai.v1beta3.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); return writer; }; @@ -44913,6 +44924,9 @@ case 4: message.boundingPoly = $root.google.cloud.documentai.v1beta3.BoundingPoly.decode(reader, reader.uint32()); break; + case 5: + message.confidence = reader.float(); + break; default: reader.skipType(tag & 7); break; @@ -44973,6 +44987,9 @@ if (error) return "boundingPoly." + error; } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; return null; }; @@ -45038,6 +45055,8 @@ throw TypeError(".google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.boundingPoly: object expected"); message.boundingPoly = $root.google.cloud.documentai.v1beta3.BoundingPoly.fromObject(object.boundingPoly); } + if (object.confidence != null) + message.confidence = Number(object.confidence); return message; }; @@ -45063,6 +45082,7 @@ object.layoutType = options.enums === String ? "LAYOUT_TYPE_UNSPECIFIED" : 0; object.layoutId = ""; object.boundingPoly = null; + object.confidence = 0; } if (message.page != null && message.hasOwnProperty("page")) if (typeof message.page === "number") @@ -45075,6 +45095,8 @@ object.layoutId = message.layoutId; if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) object.boundingPoly = $root.google.cloud.documentai.v1beta3.BoundingPoly.toObject(message.boundingPoly, options); + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; return object; }; diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index ef4cd1b0728..1e4684ecb71 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -3816,6 +3816,13 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "confidence": { + "type": "float", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } }, "nested": { From 571834fcb2aae0c60d79abc10141a0655aa926ed Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 28 Apr 2021 23:30:31 +0000 Subject: [PATCH 122/213] chore: release 2.9.0 (#205) :robot: I have created a release \*beep\* \*boop\* --- ## [2.9.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.8.0...v2.9.0) (2021-04-26) ### Features * add confidence field to the PageAnchor.PageRef in document.proto ([#204](https://www.github.com/googleapis/nodejs-document-ai/issues/204)) ([580150b](https://www.github.com/googleapis/nodejs-document-ai/commit/580150bdb3b5f7bfac599ee7c122a3ffb9a624c7)) --- 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-documentai/CHANGELOG.md | 7 +++++++ packages/google-cloud-documentai/package.json | 2 +- packages/google-cloud-documentai/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index 9bba2eabdc3..778c781b951 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [2.9.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.8.0...v2.9.0) (2021-04-26) + + +### Features + +* add confidence field to the PageAnchor.PageRef in document.proto ([#204](https://www.github.com/googleapis/nodejs-document-ai/issues/204)) ([580150b](https://www.github.com/googleapis/nodejs-document-ai/commit/580150bdb3b5f7bfac599ee7c122a3ffb9a624c7)) + ## [2.8.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.7.0...v2.8.0) (2021-04-13) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 22cb601782e..d1e81070ded 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "2.8.0", + "version": "2.9.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 5dc8e67e8a5..a1fbb26f253 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^2.8.0", + "@google-cloud/documentai": "^2.9.0", "@google-cloud/storage": "^5.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" From 64502dcdad0132f227d8d934426106c4cbd9dc40 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Thu, 6 May 2021 17:54:13 -0700 Subject: [PATCH 123/213] fix(deps): require google-gax v2.12.0 (#210) --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index d1e81070ded..e2b1aa212e9 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -29,7 +29,7 @@ "api-documenter": "api-documenter yaml --input-folder=temp" }, "dependencies": { - "google-gax": "^2.9.2" + "google-gax": "^2.12.0" }, "devDependencies": { "@types/mocha": "^8.0.0", From bcfd6121ced0bc7d67bdc0faabd9e52e79369dfc 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:00:15 +0000 Subject: [PATCH 124/213] chore: new owl bot post processor docker image (#212) gcr.io/repo-automation-bots/owlbot-nodejs:latest@sha256:f93bb861d6f12574437bb9aee426b71eafd63b419669ff0ed029f4b7e7162e3f --- packages/google-cloud-documentai/README.md | 5 +- .../protos/protos.d.ts | 42 +-- .../google-cloud-documentai/protos/protos.js | 84 ++--- .../samples/quickstart.js | 5 +- .../samples/test/quickstart.test.js | 5 +- .../v1/document_processor_service_client.ts | 42 +-- .../document_understanding_service_client.ts | 24 +- .../document_understanding_service_client.ts | 33 +- .../document_processor_service_client.ts | 42 +-- .../system-test/fixtures/sample/src/index.js | 3 +- .../gapic_document_processor_service_v1.ts | 213 +++++------ ...apic_document_processor_service_v1beta3.ts | 343 ++++++++++-------- ..._document_understanding_service_v1beta1.ts | 161 ++++---- ..._document_understanding_service_v1beta2.ts | 205 ++++++----- 14 files changed, 613 insertions(+), 594 deletions(-) diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index a2f40b11762..ded13c7705e 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -66,9 +66,8 @@ npm install @google-cloud/documentai // const processorId = 'YOUR_PROCESSOR_ID'; // Create processor in Cloud Console // const filePath = '/path/to/local/pdf'; -const { - DocumentProcessorServiceClient, -} = require('@google-cloud/documentai').v1; +const {DocumentProcessorServiceClient} = + require('@google-cloud/documentai').v1; // Instantiates a client const client = new DocumentProcessorServiceClient(); diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 145e252835a..57ea84ff28b 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -76,10 +76,10 @@ export namespace google { constructor(properties?: google.cloud.documentai.v1.IDocument); /** Document uri. */ - public uri: string; + public uri?: (string|null); /** Document content. */ - public content: (Uint8Array|string); + public content?: (Uint8Array|string|null); /** Document mimeType. */ public mimeType: string; @@ -2452,7 +2452,7 @@ export namespace google { public addressValue?: (google.type.IPostalAddress|null); /** NormalizedValue booleanValue. */ - public booleanValue: boolean; + public booleanValue?: (boolean|null); /** NormalizedValue text. */ public text: string; @@ -3295,10 +3295,10 @@ export namespace google { constructor(properties?: google.cloud.documentai.v1.Document.IRevision); /** Revision agent. */ - public agent: string; + public agent?: (string|null); /** Revision processor. */ - public processor: string; + public processor?: (string|null); /** Revision id. */ public id: string; @@ -5817,10 +5817,10 @@ export namespace google { constructor(properties?: google.cloud.documentai.v1beta1.IDocument); /** Document uri. */ - public uri: string; + public uri?: (string|null); /** Document content. */ - public content: (Uint8Array|string); + public content?: (Uint8Array|string|null); /** Document mimeType. */ public mimeType: string; @@ -10013,10 +10013,10 @@ export namespace google { constructor(properties?: google.cloud.documentai.v1beta2.IDocument); /** Document uri. */ - public uri: string; + public uri?: (string|null); /** Document content. */ - public content: (Uint8Array|string); + public content?: (Uint8Array|string|null); /** Document mimeType. */ public mimeType: string; @@ -10246,7 +10246,7 @@ export namespace google { constructor(properties?: google.cloud.documentai.v1beta2.Document.ILabel); /** Label automlModel. */ - public automlModel: string; + public automlModel?: (string|null); /** Label name. */ public name: string; @@ -14173,7 +14173,7 @@ export namespace google { public gcsSource?: (google.cloud.documentai.v1beta2.IGcsSource|null); /** InputConfig contents. */ - public contents: (Uint8Array|string); + public contents?: (Uint8Array|string|null); /** InputConfig mimeType. */ public mimeType: string; @@ -14707,10 +14707,10 @@ export namespace google { constructor(properties?: google.cloud.documentai.v1beta3.IDocument); /** Document uri. */ - public uri: string; + public uri?: (string|null); /** Document content. */ - public content: (Uint8Array|string); + public content?: (Uint8Array|string|null); /** Document mimeType. */ public mimeType: string; @@ -17083,7 +17083,7 @@ export namespace google { public addressValue?: (google.type.IPostalAddress|null); /** NormalizedValue booleanValue. */ - public booleanValue: boolean; + public booleanValue?: (boolean|null); /** NormalizedValue text. */ public text: string; @@ -17932,10 +17932,10 @@ export namespace google { constructor(properties?: google.cloud.documentai.v1beta3.Document.IRevision); /** Revision agent. */ - public agent: string; + public agent?: (string|null); /** Revision processor. */ - public processor: string; + public processor?: (string|null); /** Revision id. */ public id: string; @@ -20828,19 +20828,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); diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index ee434c8a30f..42ad59bb6a0 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -109,19 +109,19 @@ /** * Document uri. - * @member {string} uri + * @member {string|null|undefined} uri * @memberof google.cloud.documentai.v1.Document * @instance */ - Document.prototype.uri = ""; + Document.prototype.uri = null; /** * Document content. - * @member {Uint8Array} content + * @member {Uint8Array|null|undefined} content * @memberof google.cloud.documentai.v1.Document * @instance */ - Document.prototype.content = $util.newBuffer([]); + Document.prototype.content = null; /** * Document mimeType. @@ -6643,11 +6643,11 @@ /** * NormalizedValue booleanValue. - * @member {boolean} booleanValue + * @member {boolean|null|undefined} booleanValue * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue * @instance */ - NormalizedValue.prototype.booleanValue = false; + NormalizedValue.prototype.booleanValue = null; /** * NormalizedValue text. @@ -8778,19 +8778,19 @@ /** * Revision agent. - * @member {string} agent + * @member {string|null|undefined} agent * @memberof google.cloud.documentai.v1.Document.Revision * @instance */ - Revision.prototype.agent = ""; + Revision.prototype.agent = null; /** * Revision processor. - * @member {string} processor + * @member {string|null|undefined} processor * @memberof google.cloud.documentai.v1.Document.Revision * @instance */ - Revision.prototype.processor = ""; + Revision.prototype.processor = null; /** * Revision id. @@ -14681,19 +14681,19 @@ /** * Document uri. - * @member {string} uri + * @member {string|null|undefined} uri * @memberof google.cloud.documentai.v1beta1.Document * @instance */ - Document.prototype.uri = ""; + Document.prototype.uri = null; /** * Document content. - * @member {Uint8Array} content + * @member {Uint8Array|null|undefined} content * @memberof google.cloud.documentai.v1beta1.Document * @instance */ - Document.prototype.content = $util.newBuffer([]); + Document.prototype.content = null; /** * Document mimeType. @@ -25205,19 +25205,19 @@ /** * Document uri. - * @member {string} uri + * @member {string|null|undefined} uri * @memberof google.cloud.documentai.v1beta2.Document * @instance */ - Document.prototype.uri = ""; + Document.prototype.uri = null; /** * Document content. - * @member {Uint8Array} content + * @member {Uint8Array|null|undefined} content * @memberof google.cloud.documentai.v1beta2.Document * @instance */ - Document.prototype.content = $util.newBuffer([]); + Document.prototype.content = null; /** * Document mimeType. @@ -26016,11 +26016,11 @@ /** * Label automlModel. - * @member {string} automlModel + * @member {string|null|undefined} automlModel * @memberof google.cloud.documentai.v1beta2.Document.Label * @instance */ - Label.prototype.automlModel = ""; + Label.prototype.automlModel = null; /** * Label name. @@ -35814,11 +35814,11 @@ /** * InputConfig contents. - * @member {Uint8Array} contents + * @member {Uint8Array|null|undefined} contents * @memberof google.cloud.documentai.v1beta2.InputConfig * @instance */ - InputConfig.prototype.contents = $util.newBuffer([]); + InputConfig.prototype.contents = null; /** * InputConfig mimeType. @@ -37032,19 +37032,19 @@ /** * Document uri. - * @member {string} uri + * @member {string|null|undefined} uri * @memberof google.cloud.documentai.v1beta3.Document * @instance */ - Document.prototype.uri = ""; + Document.prototype.uri = null; /** * Document content. - * @member {Uint8Array} content + * @member {Uint8Array|null|undefined} content * @memberof google.cloud.documentai.v1beta3.Document * @instance */ - Document.prototype.content = $util.newBuffer([]); + Document.prototype.content = null; /** * Document mimeType. @@ -43566,11 +43566,11 @@ /** * NormalizedValue booleanValue. - * @member {boolean} booleanValue + * @member {boolean|null|undefined} booleanValue * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue * @instance */ - NormalizedValue.prototype.booleanValue = false; + NormalizedValue.prototype.booleanValue = null; /** * NormalizedValue text. @@ -45723,19 +45723,19 @@ /** * Revision agent. - * @member {string} agent + * @member {string|null|undefined} agent * @memberof google.cloud.documentai.v1beta3.Document.Revision * @instance */ - Revision.prototype.agent = ""; + Revision.prototype.agent = null; /** * Revision processor. - * @member {string} processor + * @member {string|null|undefined} processor * @memberof google.cloud.documentai.v1beta3.Document.Revision * @instance */ - Revision.prototype.processor = ""; + Revision.prototype.processor = null; /** * Revision id. @@ -52613,43 +52613,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. diff --git a/packages/google-cloud-documentai/samples/quickstart.js b/packages/google-cloud-documentai/samples/quickstart.js index 8f1879bec7e..d282047cb3f 100644 --- a/packages/google-cloud-documentai/samples/quickstart.js +++ b/packages/google-cloud-documentai/samples/quickstart.js @@ -25,9 +25,8 @@ async function main(projectId, location, processorId, filePath) { // const processorId = 'YOUR_PROCESSOR_ID'; // Create processor in Cloud Console // const filePath = '/path/to/local/pdf'; - const { - DocumentProcessorServiceClient, - } = require('@google-cloud/documentai').v1; + const {DocumentProcessorServiceClient} = + require('@google-cloud/documentai').v1; // Instantiates a client const client = new DocumentProcessorServiceClient(); diff --git a/packages/google-cloud-documentai/samples/test/quickstart.test.js b/packages/google-cloud-documentai/samples/test/quickstart.test.js index d26e563275d..ae274f1d50b 100644 --- a/packages/google-cloud-documentai/samples/test/quickstart.test.js +++ b/packages/google-cloud-documentai/samples/test/quickstart.test.js @@ -19,9 +19,8 @@ const path = require('path'); const assert = require('assert'); const cp = require('child_process'); -const { - DocumentProcessorServiceClient, -} = require('@google-cloud/documentai').v1beta3; +const {DocumentProcessorServiceClient} = + require('@google-cloud/documentai').v1beta3; const client = new DocumentProcessorServiceClient({ apiEndpoint: 'us-documentai.googleapis.com', }); diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts index 29d3ac5f8c9..91b688d3889 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts @@ -268,13 +268,14 @@ export class DocumentProcessorServiceClient { ]; for (const methodName of documentProcessorServiceStubMethods) { const callPromise = this.documentProcessorServiceStub.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; } @@ -429,11 +430,10 @@ export class DocumentProcessorServiceClient { 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.processDocument(request, options, callback); } @@ -543,11 +543,10 @@ export class DocumentProcessorServiceClient { 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.batchProcessDocuments(request, options, callback); } @@ -689,11 +688,10 @@ export class DocumentProcessorServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - human_review_config: request.humanReviewConfig || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + human_review_config: request.humanReviewConfig || '', + }); this.initialize(); return this.innerApiCalls.reviewDocument(request, options, callback); } diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts index a780c5f5d33..8066d3ae052 100644 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts @@ -239,13 +239,14 @@ export class DocumentUnderstandingServiceClient { const documentUnderstandingServiceStubMethods = ['batchProcessDocuments']; for (const methodName of documentUnderstandingServiceStubMethods) { const callPromise = this.documentUnderstandingServiceStub.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; } @@ -421,11 +422,10 @@ export class DocumentUnderstandingServiceClient { 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.batchProcessDocuments(request, options, callback); } diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index efda8586957..9aa2c6e7e04 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -242,13 +242,14 @@ export class DocumentUnderstandingServiceClient { ]; for (const methodName of documentUnderstandingServiceStubMethods) { const callPromise = this.documentUnderstandingServiceStub.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; } @@ -439,11 +440,10 @@ export class DocumentUnderstandingServiceClient { 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.processDocument(request, options, callback); } @@ -552,11 +552,10 @@ export class DocumentUnderstandingServiceClient { 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.batchProcessDocuments(request, options, callback); } diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index dc79f91ed71..bfb6f734794 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts @@ -268,13 +268,14 @@ export class DocumentProcessorServiceClient { ]; for (const methodName of documentProcessorServiceStubMethods) { const callPromise = this.documentProcessorServiceStub.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; } @@ -433,11 +434,10 @@ export class DocumentProcessorServiceClient { 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.processDocument(request, options, callback); } @@ -551,11 +551,10 @@ export class DocumentProcessorServiceClient { 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.batchProcessDocuments(request, options, callback); } @@ -699,11 +698,10 @@ export class DocumentProcessorServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - human_review_config: request.humanReviewConfig || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + human_review_config: request.humanReviewConfig || '', + }); this.initialize(); return this.innerApiCalls.reviewDocument(request, options, callback); } diff --git a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js index cb78c76f928..2a311c0623f 100644 --- a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js @@ -20,7 +20,8 @@ const documentai = require('@google-cloud/documentai'); function main() { - const documentProcessorServiceClient = new documentai.DocumentProcessorServiceClient(); + const documentProcessorServiceClient = + new documentai.DocumentProcessorServiceClient(); } main(); diff --git a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts index 699862cf061..9b9c1289884 100644 --- a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts @@ -26,10 +26,9 @@ import * as documentprocessorserviceModule 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; @@ -105,49 +104,46 @@ describe('v1.DocumentProcessorServiceClient', () => { }); it('should create a client with no option', () => { - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient(); + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient(); assert(client); }); it('should create a client with gRPC fallback', () => { - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ fallback: true, - } - ); + }); assert(client); }); it('has initialize method and supports deferred initialization', async () => { - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); assert.strictEqual(client.documentProcessorServiceStub, undefined); await client.initialize(); assert(client.documentProcessorServiceStub); }); it('has close method', () => { - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.close(); }); it('has getProjectId method', async () => { const fakeProjectId = 'fake-project-id'; - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ 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); @@ -156,12 +152,11 @@ describe('v1.DocumentProcessorServiceClient', () => { it('has getProjectId method with callback', async () => { const fakeProjectId = 'fake-project-id'; - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.auth.getProjectId = sinon .stub() .callsArgWith(0, null, fakeProjectId); @@ -180,12 +175,11 @@ describe('v1.DocumentProcessorServiceClient', () => { describe('processDocument', () => { it('invokes processDocument without error', async () => { - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ProcessRequest() @@ -213,12 +207,11 @@ describe('v1.DocumentProcessorServiceClient', () => { }); it('invokes processDocument without error using callback', async () => { - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ProcessRequest() @@ -235,9 +228,8 @@ describe('v1.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1.ProcessResponse() ); - client.innerApiCalls.processDocument = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.processDocument = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.processDocument( request, @@ -263,12 +255,11 @@ describe('v1.DocumentProcessorServiceClient', () => { }); it('invokes processDocument with error', async () => { - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ProcessRequest() @@ -298,12 +289,11 @@ describe('v1.DocumentProcessorServiceClient', () => { describe('batchProcessDocuments', () => { it('invokes batchProcessDocuments without error', async () => { - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1.BatchProcessRequest() @@ -320,9 +310,8 @@ describe('v1.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.batchProcessDocuments = + stubLongRunningCall(expectedResponse); const [operation] = await client.batchProcessDocuments(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -334,12 +323,11 @@ describe('v1.DocumentProcessorServiceClient', () => { }); it('invokes batchProcessDocuments without error using callback', async () => { - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1.BatchProcessRequest() @@ -356,9 +344,8 @@ describe('v1.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.batchProcessDocuments = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.batchProcessDocuments = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.batchProcessDocuments( request, @@ -391,12 +378,11 @@ describe('v1.DocumentProcessorServiceClient', () => { }); it('invokes batchProcessDocuments with call error', async () => { - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1.BatchProcessRequest() @@ -427,12 +413,11 @@ describe('v1.DocumentProcessorServiceClient', () => { }); it('invokes batchProcessDocuments with LRO error', async () => { - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1.BatchProcessRequest() @@ -462,12 +447,11 @@ describe('v1.DocumentProcessorServiceClient', () => { }); it('invokes checkBatchProcessDocumentsProgress without error', async () => { - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedResponse = generateSampleMessage( new operationsProtos.google.longrunning.Operation() @@ -486,12 +470,11 @@ describe('v1.DocumentProcessorServiceClient', () => { }); it('invokes checkBatchProcessDocumentsProgress with error', async () => { - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedError = new Error('expected'); @@ -509,12 +492,11 @@ describe('v1.DocumentProcessorServiceClient', () => { describe('reviewDocument', () => { it('invokes reviewDocument without error', async () => { - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ReviewDocumentRequest() @@ -531,9 +513,8 @@ describe('v1.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.reviewDocument = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.reviewDocument = + stubLongRunningCall(expectedResponse); const [operation] = await client.reviewDocument(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -545,12 +526,11 @@ describe('v1.DocumentProcessorServiceClient', () => { }); it('invokes reviewDocument without error using callback', async () => { - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ReviewDocumentRequest() @@ -567,9 +547,8 @@ describe('v1.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.reviewDocument = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.reviewDocument = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.reviewDocument( request, @@ -602,12 +581,11 @@ describe('v1.DocumentProcessorServiceClient', () => { }); it('invokes reviewDocument with call error', async () => { - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ReviewDocumentRequest() @@ -635,12 +613,11 @@ describe('v1.DocumentProcessorServiceClient', () => { }); it('invokes reviewDocument with LRO error', async () => { - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ReviewDocumentRequest() @@ -670,12 +647,11 @@ describe('v1.DocumentProcessorServiceClient', () => { }); it('invokes checkReviewDocumentProgress without error', async () => { - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedResponse = generateSampleMessage( new operationsProtos.google.longrunning.Operation() @@ -694,12 +670,11 @@ describe('v1.DocumentProcessorServiceClient', () => { }); it('invokes checkReviewDocumentProgress with error', async () => { - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedError = new Error('expected'); @@ -723,12 +698,11 @@ describe('v1.DocumentProcessorServiceClient', () => { location: 'locationValue', processor: 'processorValue', }; - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.humanReviewConfigPathTemplate.render = sinon .stub() @@ -745,8 +719,10 @@ describe('v1.DocumentProcessorServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.humanReviewConfigPathTemplate - .render as SinonStub) + ( + client.pathTemplates.humanReviewConfigPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -756,8 +732,10 @@ describe('v1.DocumentProcessorServiceClient', () => { const result = client.matchProjectFromHumanReviewConfigName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.humanReviewConfigPathTemplate - .match as SinonStub) + ( + client.pathTemplates.humanReviewConfigPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -767,8 +745,10 @@ describe('v1.DocumentProcessorServiceClient', () => { const result = client.matchLocationFromHumanReviewConfigName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.humanReviewConfigPathTemplate - .match as SinonStub) + ( + client.pathTemplates.humanReviewConfigPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -778,8 +758,10 @@ describe('v1.DocumentProcessorServiceClient', () => { const result = client.matchProcessorFromHumanReviewConfigName(fakePath); assert.strictEqual(result, 'processorValue'); assert( - (client.pathTemplates.humanReviewConfigPathTemplate - .match as SinonStub) + ( + client.pathTemplates.humanReviewConfigPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -793,12 +775,11 @@ describe('v1.DocumentProcessorServiceClient', () => { location: 'locationValue', processor: 'processorValue', }; - const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient( - { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.processorPathTemplate.render = sinon .stub() diff --git a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts index b6dfbd2502c..0380c49a53a 100644 --- a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts @@ -26,10 +26,9 @@ import * as documentprocessorserviceModule 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; @@ -106,49 +105,54 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); it('should create a client with no option', () => { - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient(); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient(); assert(client); }); it('should create a client with gRPC fallback', () => { - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - fallback: true, - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + fallback: true, + } + ); assert(client); }); it('has initialize method and supports deferred initialization', async () => { - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); assert.strictEqual(client.documentProcessorServiceStub, undefined); await client.initialize(); assert(client.documentProcessorServiceStub); }); it('has close method', () => { - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.close(); }); it('has getProjectId method', async () => { const fakeProjectId = 'fake-project-id'; - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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); @@ -157,12 +161,13 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { it('has getProjectId method with callback', async () => { const fakeProjectId = 'fake-project-id'; - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.auth.getProjectId = sinon .stub() .callsArgWith(0, null, fakeProjectId); @@ -181,12 +186,13 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { describe('processDocument', () => { it('invokes processDocument without error', async () => { - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessRequest() @@ -214,12 +220,13 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); it('invokes processDocument without error using callback', async () => { - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessRequest() @@ -236,9 +243,8 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessResponse() ); - client.innerApiCalls.processDocument = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.processDocument = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.processDocument( request, @@ -264,12 +270,13 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); it('invokes processDocument with error', async () => { - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessRequest() @@ -299,12 +306,13 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { describe('batchProcessDocuments', () => { it('invokes batchProcessDocuments without error', async () => { - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.BatchProcessRequest() @@ -321,9 +329,8 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.batchProcessDocuments = + stubLongRunningCall(expectedResponse); const [operation] = await client.batchProcessDocuments(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -335,12 +342,13 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); it('invokes batchProcessDocuments without error using callback', async () => { - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.BatchProcessRequest() @@ -357,9 +365,8 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.batchProcessDocuments = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.batchProcessDocuments = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.batchProcessDocuments( request, @@ -392,12 +399,13 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); it('invokes batchProcessDocuments with call error', async () => { - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.BatchProcessRequest() @@ -428,12 +436,13 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); it('invokes batchProcessDocuments with LRO error', async () => { - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.BatchProcessRequest() @@ -463,12 +472,13 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); it('invokes checkBatchProcessDocumentsProgress without error', async () => { - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const expectedResponse = generateSampleMessage( new operationsProtos.google.longrunning.Operation() @@ -487,12 +497,13 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); it('invokes checkBatchProcessDocumentsProgress with error', async () => { - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const expectedError = new Error('expected'); @@ -510,12 +521,13 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { describe('reviewDocument', () => { it('invokes reviewDocument without error', async () => { - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() @@ -532,9 +544,8 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.reviewDocument = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.reviewDocument = + stubLongRunningCall(expectedResponse); const [operation] = await client.reviewDocument(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -546,12 +557,13 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); it('invokes reviewDocument without error using callback', async () => { - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() @@ -568,9 +580,8 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.reviewDocument = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.reviewDocument = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.reviewDocument( request, @@ -603,12 +614,13 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); it('invokes reviewDocument with call error', async () => { - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() @@ -636,12 +648,13 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); it('invokes reviewDocument with LRO error', async () => { - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() @@ -671,12 +684,13 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); it('invokes checkReviewDocumentProgress without error', async () => { - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const expectedResponse = generateSampleMessage( new operationsProtos.google.longrunning.Operation() @@ -695,12 +709,13 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); it('invokes checkReviewDocumentProgress with error', async () => { - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const expectedError = new Error('expected'); @@ -724,12 +739,13 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { location: 'locationValue', processor: 'processorValue', }; - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); client.pathTemplates.humanReviewConfigPathTemplate.render = sinon .stub() @@ -746,8 +762,10 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); assert.strictEqual(result, fakePath); assert( - (client.pathTemplates.humanReviewConfigPathTemplate - .render as SinonStub) + ( + client.pathTemplates.humanReviewConfigPathTemplate + .render as SinonStub + ) .getCall(-1) .calledWith(expectedParameters) ); @@ -757,8 +775,10 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const result = client.matchProjectFromHumanReviewConfigName(fakePath); assert.strictEqual(result, 'projectValue'); assert( - (client.pathTemplates.humanReviewConfigPathTemplate - .match as SinonStub) + ( + client.pathTemplates.humanReviewConfigPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -768,8 +788,10 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const result = client.matchLocationFromHumanReviewConfigName(fakePath); assert.strictEqual(result, 'locationValue'); assert( - (client.pathTemplates.humanReviewConfigPathTemplate - .match as SinonStub) + ( + client.pathTemplates.humanReviewConfigPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -779,8 +801,10 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const result = client.matchProcessorFromHumanReviewConfigName(fakePath); assert.strictEqual(result, 'processorValue'); assert( - (client.pathTemplates.humanReviewConfigPathTemplate - .match as SinonStub) + ( + client.pathTemplates.humanReviewConfigPathTemplate + .match as SinonStub + ) .getCall(-1) .calledWith(fakePath) ); @@ -794,12 +818,13 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { location: 'locationValue', processor: 'processorValue', }; - const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); client.pathTemplates.processorPathTemplate.render = sinon .stub() diff --git a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts index 9beeb83ec29..d5f75fdf143 100644 --- a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts +++ b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts @@ -26,10 +26,9 @@ import * as documentunderstandingserviceModule 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; @@ -97,49 +96,54 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { }); it('should create a client with no option', () => { - const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient(); + const client = + new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient(); assert(client); }); it('should create a client with gRPC fallback', () => { - const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( - { - fallback: true, - } - ); + const client = + new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + fallback: true, + } + ); assert(client); }); it('has initialize method and supports deferred initialization', async () => { - const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); assert.strictEqual(client.documentUnderstandingServiceStub, undefined); await client.initialize(); assert(client.documentUnderstandingServiceStub); }); it('has close method', () => { - const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.close(); }); it('has getProjectId method', async () => { const fakeProjectId = 'fake-project-id'; - const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + 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); @@ -148,12 +152,13 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { it('has getProjectId method with callback', async () => { const fakeProjectId = 'fake-project-id'; - const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.auth.getProjectId = sinon .stub() .callsArgWith(0, null, fakeProjectId); @@ -172,12 +177,13 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { describe('batchProcessDocuments', () => { it('invokes batchProcessDocuments without error', async () => { - const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest() @@ -194,9 +200,8 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.batchProcessDocuments = + stubLongRunningCall(expectedResponse); const [operation] = await client.batchProcessDocuments(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -208,12 +213,13 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { }); it('invokes batchProcessDocuments without error using callback', async () => { - const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest() @@ -230,9 +236,8 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.batchProcessDocuments = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.batchProcessDocuments = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.batchProcessDocuments( request, @@ -265,12 +270,13 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { }); it('invokes batchProcessDocuments with call error', async () => { - const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest() @@ -301,12 +307,13 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { }); it('invokes batchProcessDocuments with LRO error', async () => { - const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest() @@ -336,12 +343,13 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { }); it('invokes checkBatchProcessDocumentsProgress without error', async () => { - const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const expectedResponse = generateSampleMessage( new operationsProtos.google.longrunning.Operation() @@ -360,12 +368,13 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { }); it('invokes checkBatchProcessDocumentsProgress with error', async () => { - const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const expectedError = new Error('expected'); diff --git a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts index c047c152e42..ba8e872054a 100644 --- a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts +++ b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts @@ -26,10 +26,9 @@ import * as documentunderstandingserviceModule 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; @@ -106,49 +105,54 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { }); it('should create a client with no option', () => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient(); + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient(); assert(client); }); it('should create a client with gRPC fallback', () => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - fallback: true, - } - ); + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + fallback: true, + } + ); assert(client); }); it('has initialize method and supports deferred initialization', async () => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); assert.strictEqual(client.documentUnderstandingServiceStub, undefined); await client.initialize(); assert(client.documentUnderstandingServiceStub); }); it('has close method', () => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.close(); }); it('has getProjectId method', async () => { const fakeProjectId = 'fake-project-id'; - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + 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); @@ -157,12 +161,13 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { it('has getProjectId method with callback', async () => { const fakeProjectId = 'fake-project-id'; - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.auth.getProjectId = sinon .stub() .callsArgWith(0, null, fakeProjectId); @@ -181,12 +186,13 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { describe('processDocument', () => { it('invokes processDocument without error', async () => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta2.ProcessDocumentRequest() @@ -214,12 +220,13 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { }); it('invokes processDocument without error using callback', async () => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta2.ProcessDocumentRequest() @@ -236,9 +243,8 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1beta2.Document() ); - client.innerApiCalls.processDocument = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.processDocument = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.processDocument( request, @@ -264,12 +270,13 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { }); it('invokes processDocument with error', async () => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta2.ProcessDocumentRequest() @@ -299,12 +306,13 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { describe('batchProcessDocuments', () => { it('invokes batchProcessDocuments without error', async () => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest() @@ -321,9 +329,8 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.batchProcessDocuments = + stubLongRunningCall(expectedResponse); const [operation] = await client.batchProcessDocuments(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -335,12 +342,13 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { }); it('invokes batchProcessDocuments without error using callback', async () => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest() @@ -357,9 +365,8 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.batchProcessDocuments = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.batchProcessDocuments = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.batchProcessDocuments( request, @@ -392,12 +399,13 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { }); it('invokes batchProcessDocuments with call error', async () => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest() @@ -428,12 +436,13 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { }); it('invokes batchProcessDocuments with LRO error', async () => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest() @@ -463,12 +472,13 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { }); it('invokes checkBatchProcessDocumentsProgress without error', async () => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const expectedResponse = generateSampleMessage( new operationsProtos.google.longrunning.Operation() @@ -487,12 +497,13 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { }); it('invokes checkBatchProcessDocumentsProgress with error', async () => { - const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const expectedError = new Error('expected'); From 729403fdef7b959f2f5c52b0eb77a332e2ed5835 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:38:05 +0000 Subject: [PATCH 125/213] feat: add confidence field to the PageAnchor.PageRef in document.proto (#206) PiperOrigin-RevId: 370513265 Source-Link: https://github.com/googleapis/googleapis/commit/7713e2e860003a84b35b701de29dd0769795e1e3 Source-Link: https://github.com/googleapis/googleapis-gen/commit/97a9e19dd606c53a587a5f6c240fd6e5a12b15cc --- .../google/cloud/documentai/v1/document.proto | 3 +++ .../protos/protos.d.ts | 6 +++++ .../google-cloud-documentai/protos/protos.js | 22 +++++++++++++++++++ .../protos/protos.json | 7 ++++++ 4 files changed, 38 insertions(+) diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto index 21412e98300..eb4615c1845 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto @@ -549,6 +549,9 @@ message Document { // Optional. Identifies the bounding polygon of a layout element on the page. BoundingPoly bounding_poly = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Confidence of detected page element, if applicable. Range [0, 1]. + float confidence = 5 [(google.api.field_behavior) = OPTIONAL]; } // One or more references to visual page elements diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 57ea84ff28b..f5e3fe04879 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -2935,6 +2935,9 @@ export namespace google { /** PageRef boundingPoly */ boundingPoly?: (google.cloud.documentai.v1.IBoundingPoly|null); + + /** PageRef confidence */ + confidence?: (number|null); } /** Represents a PageRef. */ @@ -2958,6 +2961,9 @@ export namespace google { /** PageRef boundingPoly. */ public boundingPoly?: (google.cloud.documentai.v1.IBoundingPoly|null); + /** PageRef confidence. */ + public confidence: number; + /** * Creates a new PageRef instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 42ad59bb6a0..9016528a7a5 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -7863,6 +7863,7 @@ * @property {google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType|null} [layoutType] PageRef layoutType * @property {string|null} [layoutId] PageRef layoutId * @property {google.cloud.documentai.v1.IBoundingPoly|null} [boundingPoly] PageRef boundingPoly + * @property {number|null} [confidence] PageRef confidence */ /** @@ -7912,6 +7913,14 @@ */ PageRef.prototype.boundingPoly = null; + /** + * PageRef confidence. + * @member {number} confidence + * @memberof google.cloud.documentai.v1.Document.PageAnchor.PageRef + * @instance + */ + PageRef.prototype.confidence = 0; + /** * Creates a new PageRef instance using the specified properties. * @function create @@ -7944,6 +7953,8 @@ writer.uint32(/* id 3, wireType 2 =*/26).string(message.layoutId); if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) $root.google.cloud.documentai.v1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); return writer; }; @@ -7990,6 +8001,9 @@ case 4: message.boundingPoly = $root.google.cloud.documentai.v1.BoundingPoly.decode(reader, reader.uint32()); break; + case 5: + message.confidence = reader.float(); + break; default: reader.skipType(tag & 7); break; @@ -8050,6 +8064,9 @@ if (error) return "boundingPoly." + error; } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; return null; }; @@ -8115,6 +8132,8 @@ throw TypeError(".google.cloud.documentai.v1.Document.PageAnchor.PageRef.boundingPoly: object expected"); message.boundingPoly = $root.google.cloud.documentai.v1.BoundingPoly.fromObject(object.boundingPoly); } + if (object.confidence != null) + message.confidence = Number(object.confidence); return message; }; @@ -8140,6 +8159,7 @@ object.layoutType = options.enums === String ? "LAYOUT_TYPE_UNSPECIFIED" : 0; object.layoutId = ""; object.boundingPoly = null; + object.confidence = 0; } if (message.page != null && message.hasOwnProperty("page")) if (typeof message.page === "number") @@ -8152,6 +8172,8 @@ object.layoutId = message.layoutId; if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) object.boundingPoly = $root.google.cloud.documentai.v1.BoundingPoly.toObject(message.boundingPoly, options); + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; return object; }; diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 1e4684ecb71..c35422f270d 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -717,6 +717,13 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "confidence": { + "type": "float", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } }, "nested": { From 492c60fe04eda2b0d4e838483eafee7bc5102ec3 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:56:03 +0000 Subject: [PATCH 126/213] fix: use require() to load JSON protos (#214) 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 --- .../v1/document_processor_service_client.ts | 26 +++---------------- .../document_understanding_service_client.ts | 24 +++-------------- .../document_understanding_service_client.ts | 24 +++-------------- .../document_processor_service_client.ts | 26 +++---------------- 4 files changed, 14 insertions(+), 86 deletions(-) diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts index 91b688d3889..9796ee7f83c 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1/document_processor_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/v1/document_processor_service_client_config.json`. @@ -142,22 +143,7 @@ export class DocumentProcessorServiceClient { 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. @@ -171,15 +157,11 @@ export class DocumentProcessorServiceClient { ), }; + 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-documentai/src/v1beta1/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts index 8066d3ae052..208d20f8eb4 100644 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_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/v1beta1/document_understanding_service_client_config.json`. @@ -140,32 +141,13 @@ export class DocumentUnderstandingServiceClient { 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. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - 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 - ); + 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-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index 9aa2c6e7e04..31c77b47f6c 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_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/v1beta2/document_understanding_service_client_config.json`. @@ -140,32 +141,13 @@ export class DocumentUnderstandingServiceClient { 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. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - 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 - ); + 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-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index bfb6f734794..25adb3fa009 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_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/v1beta3/document_processor_service_client_config.json`. @@ -142,22 +143,7 @@ export class DocumentProcessorServiceClient { 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. @@ -171,15 +157,11 @@ export class DocumentProcessorServiceClient { ), }; + 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 f9a490d94a614550da2a1c93588c381a37de8515 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:12:12 +0000 Subject: [PATCH 127/213] chore: update gapic-generator-typescript to v1.3.2 (#215) 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 --- .../src/v1/document_processor_service_client.ts | 1 - .../src/v1beta1/document_understanding_service_client.ts | 1 - .../src/v1beta2/document_understanding_service_client.ts | 1 - .../src/v1beta3/document_processor_service_client.ts | 1 - 4 files changed, 4 deletions(-) diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts index 9796ee7f83c..77d39b177bb 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1/document_processor_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-documentai/src/v1beta1/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts index 208d20f8eb4..8e404028c57 100644 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_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-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index 31c77b47f6c..2cd7490affd 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_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-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index 25adb3fa009..7694507fff4 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_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 8dcbc2b4462ea60976e07acd8c742b03fb1300de 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:37:09 -0700 Subject: [PATCH 128/213] chore: release 2.10.0 (#213) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: release 2.10.0 * 🦉 Updates from OwlBot Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- packages/google-cloud-documentai/CHANGELOG.md | 13 +++++++++++++ packages/google-cloud-documentai/package.json | 2 +- .../google-cloud-documentai/samples/package.json | 2 +- packages/google-cloud-documentai/src/index.ts | 6 +++--- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index 778c781b951..ac36a7944b3 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [2.10.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.9.0...v2.10.0) (2021-05-12) + + +### Features + +* add confidence field to the PageAnchor.PageRef in document.proto ([#206](https://www.github.com/googleapis/nodejs-document-ai/issues/206)) ([f3154a9](https://www.github.com/googleapis/nodejs-document-ai/commit/f3154a9456c5727b317af34c5a76ca0c7cda9cbb)) + + +### Bug Fixes + +* **deps:** require google-gax v2.12.0 ([#210](https://www.github.com/googleapis/nodejs-document-ai/issues/210)) ([86d31c7](https://www.github.com/googleapis/nodejs-document-ai/commit/86d31c767881ee5524f4285bf828bf674a7d282e)) +* use require() to load JSON protos ([#214](https://www.github.com/googleapis/nodejs-document-ai/issues/214)) ([c73202d](https://www.github.com/googleapis/nodejs-document-ai/commit/c73202dba1d62a1b414abe8b1dc39b93c0eb2e7b)) + ## [2.9.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.8.0...v2.9.0) (2021-04-26) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index e2b1aa212e9..277adab84fa 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "2.9.0", + "version": "2.10.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index a1fbb26f253..a6ac3ef4e79 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^2.9.0", + "@google-cloud/documentai": "^2.10.0", "@google-cloud/storage": "^5.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" diff --git a/packages/google-cloud-documentai/src/index.ts b/packages/google-cloud-documentai/src/index.ts index 7a727eb9ac2..693fd40d77e 100644 --- a/packages/google-cloud-documentai/src/index.ts +++ b/packages/google-cloud-documentai/src/index.ts @@ -16,15 +16,15 @@ // ** https://github.com/googleapis/synthtool ** // ** All changes to this file may be overwritten. ** -import * as v1 from './v1'; import * as v1beta1 from './v1beta1'; +import * as v1 from './v1'; import * as v1beta2 from './v1beta2'; import * as v1beta3 from './v1beta3'; const DocumentProcessorServiceClient = v1beta3.DocumentProcessorServiceClient; type DocumentProcessorServiceClient = v1beta3.DocumentProcessorServiceClient; -export {v1, v1beta1, v1beta2, v1beta3, DocumentProcessorServiceClient}; -export default {v1, v1beta1, v1beta2, v1beta3, DocumentProcessorServiceClient}; +export {v1beta1, v1, v1beta2, v1beta3, DocumentProcessorServiceClient}; +export default {v1beta1, v1, v1beta2, v1beta3, DocumentProcessorServiceClient}; import * as protos from '../protos/protos'; export {protos}; From 8f8395357f666e676eb8a0468f4f206140665366 Mon Sep 17 00:00:00 2001 From: Martin Tannerfors Date: Thu, 20 May 2021 18:37:53 +0200 Subject: [PATCH 129/213] samples: Update quickstart.js (#189) include the required region if using EU based processor (defaults to US) Co-authored-by: Justin Beckwith --- packages/google-cloud-documentai/samples/quickstart.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/google-cloud-documentai/samples/quickstart.js b/packages/google-cloud-documentai/samples/quickstart.js index d282047cb3f..a1fe28e1ad5 100644 --- a/packages/google-cloud-documentai/samples/quickstart.js +++ b/packages/google-cloud-documentai/samples/quickstart.js @@ -29,6 +29,8 @@ async function main(projectId, location, processorId, filePath) { require('@google-cloud/documentai').v1; // Instantiates a client + // apiEndpoint regions available: eu-documentai.googleapis.com, us-documentai.googleapis.com (Required if using eu based processor) + // const client = new DocumentProcessorServiceClient({apiEndpoint: 'eu-documentai.googleapis.com'}); const client = new DocumentProcessorServiceClient(); async function quickstart() { From ab1cdb0ba85fd4f12929248b65ccce637409f81c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 20 May 2021 09:47:16 -0700 Subject: [PATCH 130/213] fix: update default host to documentai.googleapis.com (#217) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Combined commits from googleapis/googleapis. (#6) The oldest commit in this list broke all library generation. The newest commit in this list fixed library generation. Therefore, Owl bot cannot determine which of the following commits is responsible for changes in generated code. commit 556c373cd2706e54a2881235beddd3f47638fe64 Author: Google APIs Date: Thu May 13 11:08:54 2021 -0700 chore: restores missing BUILD.bazel build rules Committer: @telpirion PiperOrigin-RevId: 373615236 commit b19f9466457238d4f030f9622e8d681d554edc89 Author: Google APIs Date: Thu May 13 09:59:22 2021 -0700 feat: publish alertcenter/v1beta API and Bazel targets PiperOrigin-RevId: 373599033 commit 3c6c3d69b701ca7f7fdfc5227c97f71838e82f8e Author: Google APIs Date: Thu May 13 09:13:00 2021 -0700 feat!: migrate firestore/admin to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 373590133 commit 8275ca6ecfa0ad8a61eacf89727d86ee3175192b Author: Google APIs Date: Thu May 13 09:12:06 2021 -0700 chore: migrate audit to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 373589975 commit 7467f29ba8da21607bd74f32b86ae254a070a463 Author: Google APIs Date: Thu May 13 09:10:48 2021 -0700 chore: migrate maps/playablelocations to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 373589757 commit b29fb6b9fcdf3bc67487fa22ab7783915023041e Author: Google APIs Date: Wed May 12 22:04:27 2021 -0700 feat: Use non-regionalized default host name for documentai.googleapis.com PiperOrigin-RevId: 373516134 commit ac0cf1769f8001ae8a6fcd360e2f81a748770ba8 Author: Google APIs Date: Wed May 12 18:26:08 2021 -0700 chore: migrate devtools/source to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 373494082 commit 8d013cfaff6a04d65d02be65403dcf064a76c2ab Author: Google APIs Date: Wed May 12 18:24:55 2021 -0700 chore: migrate actions to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 373493952 commit 51e932d01c2ac41638fba70b8c17bd9cbb77fd3c Author: Google APIs Date: Wed May 12 18:20:45 2021 -0700 chore: migrate bigquery/connection to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 373493472 commit b0e8809d55bc9ee2eeba64ca405070693d56a1de Author: Google APIs Date: Wed May 12 18:19:20 2021 -0700 chore: migrate maps/routes to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 373493291 commit 38770cd1cbd9711b22f68d94e46044e62449c566 Author: Google APIs Date: Wed May 12 18:15:46 2021 -0700 chore: migrate recommendationengine to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 373492874 commit 862503ff2661a078d98c79a99ae86b841732ba56 Author: Google APIs Date: Wed May 12 18:12:40 2021 -0700 chore: migrate devtools/trace to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 373492514 commit 16d44bcb215d41503d8d2dd216b6e80b26923f98 Author: Google APIs Date: Wed May 12 18:10:03 2021 -0700 chore: migrate bigquery/logging to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 373492203 commit 6a66cdb58d933612eea98af77343f89d8a264a99 Author: Google APIs Date: Wed May 12 18:08:37 2021 -0700 chore: migrate identity/accesscontextmanager to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 373492050 commit 9f67f841f4350b3dc891dffed1c7686f236f0eea Author: Google APIs Date: Wed May 12 18:03:13 2021 -0700 chore: migrate api/expr to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 373491277 commit 8333535e2a7fb406109b1e38b44225397e0d1ff3 Author: Google APIs Date: Wed May 12 18:01:10 2021 -0700 chore: migrate appengine to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 373490960 commit f89b6712a556e92e3034d02b30943661c859cc0b Author: Google APIs Date: Wed May 12 17:59:03 2021 -0700 chore: migrate bigquery/v2 to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 373490690 commit 061b720855dfb88b1ca8d10216ce8ae66c0094d6 Author: Google APIs Date: Wed May 12 17:55:52 2021 -0700 chore: migrate clouddebugger to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 373490291 commit e67f6f06973bd024d1a624199b17f68d763f00b1 Author: Google APIs Date: Wed May 12 17:53:12 2021 -0700 chore: migrate datastore/admin to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 373489974 commit 87967b5cb933958680b8a0b5042f13d45b600adb Author: Google APIs Date: Wed May 12 17:43:57 2021 -0700 chore: migrate iam/admin to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 373488700 commit 22ce74e4a1720ac37209eff01b9615c0b0be2c7f Author: Google APIs Date: Wed May 12 16:23:13 2021 -0700 chore: migrate iam/credentials to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 373474691 commit 821ba0e5fd6243c6793b368a922109fb4c4c6fd0 Author: Google APIs Date: Wed May 12 16:21:36 2021 -0700 feat!: migrate bigquery/datatransfer to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 373474384 commit cc882d10fbdf18d1f31846a401b75452a53bf800 Author: Google APIs Date: Wed May 12 16:05:20 2021 -0700 feat: adds enhanced protos for time series forecasting Committer: @aribray PiperOrigin-RevId: 373471501 Source-Link: https://github.com/googleapis/googleapis/commit/2f652898bda8daa53d044a40b62db4bb1116d931 Change-Id: I6e388dbe586b839faa8f888b70ee421e6835c07d Source-Link: https://github.com/googleapis/googleapis-gen/commit/203c2eeb233fa1ceb7d4a187bdf4b736b19da3b0 * 🦉 Updates from OwlBot * 🦉 Updates from OwlBot Co-authored-by: Owl Bot Co-authored-by: Justin Beckwith --- .../cloud/documentai/v1/document_processor_service.proto | 2 +- .../cloud/documentai/v1beta3/document_processor_service.proto | 2 +- packages/google-cloud-documentai/protos/protos.json | 4 ++-- .../src/v1/document_processor_service_client.ts | 4 ++-- .../src/v1beta3/document_processor_service_client.ts | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto index 0d3e872ca62..033b3cb75a0 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto @@ -52,7 +52,7 @@ option (google.api.resource_definition) = { // AI such as natural language, computer vision, and translation to extract // structured information from unstructured or semi-structured documents. service DocumentProcessorService { - option (google.api.default_host) = "us-documentai.googleapis.com"; + option (google.api.default_host) = "documentai.googleapis.com"; option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; // Processes a single document. diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto index 7c37b406b35..d69689f7c09 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto @@ -57,7 +57,7 @@ option (google.api.resource_definition) = { // AI such as natural language, computer vision, and translation to extract // structured information from unstructured or semi-structured documents. service DocumentProcessorService { - option (google.api.default_host) = "us-documentai.googleapis.com"; + option (google.api.default_host) = "documentai.googleapis.com"; option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; // Processes a single document. diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index c35422f270d..5aea6b3717c 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -985,7 +985,7 @@ }, "DocumentProcessorService": { "options": { - "(google.api.default_host)": "us-documentai.googleapis.com", + "(google.api.default_host)": "documentai.googleapis.com", "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" }, "methods": { @@ -4091,7 +4091,7 @@ }, "DocumentProcessorService": { "options": { - "(google.api.default_host)": "us-documentai.googleapis.com", + "(google.api.default_host)": "documentai.googleapis.com", "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" }, "methods": { diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts index 77d39b177bb..578d2500d2f 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts @@ -280,7 +280,7 @@ export class DocumentProcessorServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - return 'us-documentai.googleapis.com'; + return 'documentai.googleapis.com'; } /** @@ -289,7 +289,7 @@ export class DocumentProcessorServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - return 'us-documentai.googleapis.com'; + return 'documentai.googleapis.com'; } /** diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index 7694507fff4..570cee2268f 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts @@ -280,7 +280,7 @@ export class DocumentProcessorServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - return 'us-documentai.googleapis.com'; + return 'documentai.googleapis.com'; } /** @@ -289,7 +289,7 @@ export class DocumentProcessorServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - return 'us-documentai.googleapis.com'; + return 'documentai.googleapis.com'; } /** From 9a50b9e61f81d65ba1431856681c43a9f05871e6 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Thu, 20 May 2021 10:12:12 -0700 Subject: [PATCH 131/213] feat!: default to v1 of the API (#220) BREAKING CHANGE: The default version of the API has changed from `v1beta3` to `v1`. Co-authored-by: Owl Bot --- .../.repo-metadata.json | 2 +- packages/google-cloud-documentai/README.md | 2 + packages/google-cloud-documentai/src/index.ts | 12 ++--- .../google-cloud-documentai/synth.metadata | 46 ------------------- 4 files changed, 9 insertions(+), 53 deletions(-) delete mode 100644 packages/google-cloud-documentai/synth.metadata diff --git a/packages/google-cloud-documentai/.repo-metadata.json b/packages/google-cloud-documentai/.repo-metadata.json index 53fd814ceae..aa01608f573 100644 --- a/packages/google-cloud-documentai/.repo-metadata.json +++ b/packages/google-cloud-documentai/.repo-metadata.json @@ -11,5 +11,5 @@ "api_id": "documentai.googleapis.com", "requires_billing": true, "codeowner_team": "@googleapis/ml-apis", - "default_version": "v1beta3" + "default_version": "v1" } diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index ded13c7705e..8070b8f51c8 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -70,6 +70,8 @@ const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; // Instantiates a client +// apiEndpoint regions available: eu-documentai.googleapis.com, us-documentai.googleapis.com (Required if using eu based processor) +// const client = new DocumentProcessorServiceClient({apiEndpoint: 'eu-documentai.googleapis.com'}); const client = new DocumentProcessorServiceClient(); async function quickstart() { diff --git a/packages/google-cloud-documentai/src/index.ts b/packages/google-cloud-documentai/src/index.ts index 693fd40d77e..64fde9e6ecd 100644 --- a/packages/google-cloud-documentai/src/index.ts +++ b/packages/google-cloud-documentai/src/index.ts @@ -16,15 +16,15 @@ // ** https://github.com/googleapis/synthtool ** // ** All changes to this file may be overwritten. ** +import * as v1beta3 from './v1beta3'; import * as v1beta1 from './v1beta1'; -import * as v1 from './v1'; import * as v1beta2 from './v1beta2'; -import * as v1beta3 from './v1beta3'; +import * as v1 from './v1'; -const DocumentProcessorServiceClient = v1beta3.DocumentProcessorServiceClient; -type DocumentProcessorServiceClient = v1beta3.DocumentProcessorServiceClient; +const DocumentProcessorServiceClient = v1.DocumentProcessorServiceClient; +type DocumentProcessorServiceClient = v1.DocumentProcessorServiceClient; -export {v1beta1, v1, v1beta2, v1beta3, DocumentProcessorServiceClient}; -export default {v1beta1, v1, v1beta2, v1beta3, DocumentProcessorServiceClient}; +export {v1beta3, v1beta1, v1beta2, v1, DocumentProcessorServiceClient}; +export default {v1beta3, v1beta1, v1beta2, v1, DocumentProcessorServiceClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/packages/google-cloud-documentai/synth.metadata b/packages/google-cloud-documentai/synth.metadata deleted file mode 100644 index 0172dfb4437..00000000000 --- a/packages/google-cloud-documentai/synth.metadata +++ /dev/null @@ -1,46 +0,0 @@ -{ - "sources": [ - { - "git": { - "name": ".", - "remote": "https://github.com/googleapis/nodejs-document-ai.git", - "sha": "4cce9f0cb596ed92adb85ab5432804b654bf86c8" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "4fb2f3e141fb4a62c434e1964db0fd2f2763aa08", - "internalRef": "363478455" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "57c23fa5705499a4181095ced81f0ee0933b64f6" - } - } - ], - "destinations": [ - { - "client": { - "source": "googleapis", - "apiName": "documentai", - "apiVersion": "v1beta2", - "language": "nodejs", - "generator": "bazel" - } - }, - { - "client": { - "source": "googleapis", - "apiName": "documentai", - "apiVersion": "v1beta3", - "language": "nodejs", - "generator": "bazel" - } - } - ] -} \ No newline at end of file From 00dfa1745399706a30c1882e1910995a5441ddff Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 21 May 2021 19:06:06 +0200 Subject: [PATCH 132/213] chore(deps): update dependency @types/node to v14 (#222) 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) | [`^12.12.29` -> `^14.0.0`](https://renovatebot.com/diffs/npm/@types%2fnode/12.20.13/14.17.0) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fnode/14.17.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fnode/14.17.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fnode/14.17.0/compatibility-slim/12.20.13)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fnode/14.17.0/confidence-slim/12.20.13)](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, 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-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 277adab84fa..967a7819fb2 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -33,7 +33,7 @@ }, "devDependencies": { "@types/mocha": "^8.0.0", - "@types/node": "^12.12.29", + "@types/node": "^14.0.0", "@types/sinon": "^10.0.0", "c8": "^7.1.0", "chai": "^4.2.0", From 99b03a5a7b5202e043409bd581e0492bd68fc670 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 25 May 2021 17:58:11 +0200 Subject: [PATCH 133/213] chore(deps): update dependency sinon to v11 (#223) 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-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 967a7819fb2..fe184f15d77 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -45,7 +45,7 @@ "mocha": "^8.0.0", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", - "sinon": "^10.0.0", + "sinon": "^11.0.0", "ts-loader": "^9.0.0", "typescript": "^3.8.3", "webpack": "^5.0.0", From 9e5de3fc7686e5a233a7165ae3348e47c6d49369 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:14 +0000 Subject: [PATCH 134/213] fix: GoogleAdsError missing using generator version after 1.3.0 (#224) [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 --- .../src/v1/document_processor_service_client.ts | 2 ++ .../src/v1beta1/document_understanding_service_client.ts | 2 ++ .../src/v1beta2/document_understanding_service_client.ts | 2 ++ .../src/v1beta3/document_processor_service_client.ts | 2 ++ 4 files changed, 8 insertions(+) diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts index 578d2500d2f..91947a35a5f 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts @@ -137,6 +137,8 @@ export class DocumentProcessorServiceClient { } 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-documentai/src/v1beta1/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts index 8e404028c57..4e03441018e 100644 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts @@ -135,6 +135,8 @@ export class DocumentUnderstandingServiceClient { } 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-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index 2cd7490affd..e291f3059af 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -135,6 +135,8 @@ export class DocumentUnderstandingServiceClient { } 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-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index 570cee2268f..877a98aae0d 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts @@ -137,6 +137,8 @@ export class DocumentProcessorServiceClient { } 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 3111cfbd387ab8baa24113f934ff503ad752c490 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 29 May 2021 20:54:04 +0000 Subject: [PATCH 135/213] chore: make generate_index_ts() deterministic (#226) Fixes https://github.com/googleapis/synthtool/issues/1103 Source-Link: https://github.com/googleapis/synthtool/commit/c3e41da0fa256ad7f6b4bc76b9d069dedecdfef4 Post-Processor: gcr.io/repo-automation-bots/owlbot-nodejs:latest@sha256:e37a815333a6f3e14d8532efe90cba8aa0d34210f8c0fdbdd9e6a34dcbe51e96 --- packages/google-cloud-documentai/src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-documentai/src/index.ts b/packages/google-cloud-documentai/src/index.ts index 64fde9e6ecd..3486f063d88 100644 --- a/packages/google-cloud-documentai/src/index.ts +++ b/packages/google-cloud-documentai/src/index.ts @@ -16,15 +16,15 @@ // ** https://github.com/googleapis/synthtool ** // ** All changes to this file may be overwritten. ** -import * as v1beta3 from './v1beta3'; +import * as v1 from './v1'; import * as v1beta1 from './v1beta1'; import * as v1beta2 from './v1beta2'; -import * as v1 from './v1'; +import * as v1beta3 from './v1beta3'; const DocumentProcessorServiceClient = v1.DocumentProcessorServiceClient; type DocumentProcessorServiceClient = v1.DocumentProcessorServiceClient; -export {v1beta3, v1beta1, v1beta2, v1, DocumentProcessorServiceClient}; -export default {v1beta3, v1beta1, v1beta2, v1, DocumentProcessorServiceClient}; +export {v1, v1beta1, v1beta2, v1beta3, DocumentProcessorServiceClient}; +export default {v1, v1beta1, v1beta2, v1beta3, DocumentProcessorServiceClient}; import * as protos from '../protos/protos'; export {protos}; From 6e4844ea06ade827b5847869fc05522ad60a8446 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 2 Jun 2021 16:44:18 -0700 Subject: [PATCH 136/213] refactor: Move CommonOperationMetadata into a separate proto file for potential reuse. (#227) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Move CommonOperationMetadata into a separate proto file for potential reuse. PiperOrigin-RevId: 377114643 Source-Link: https://github.com/googleapis/googleapis/commit/204809ddb580527550e61a7ca524e837b5a8409d Source-Link: https://github.com/googleapis/googleapis-gen/commit/97c815b222ec8aac0174e71996639bea63f6cad6 * 🦉 Updates from OwlBot * 🦉 Updates from OwlBot Co-authored-by: Owl Bot --- .../v1beta3/document_processor_service.proto | 37 +---------- .../cloud/documentai/v1beta3/geometry.proto | 4 +- .../v1beta3/operation_metadata.proto | 64 +++++++++++++++++++ .../protos/protos.json | 2 +- ...document_processor_service_proto_list.json | 3 +- 5 files changed, 70 insertions(+), 40 deletions(-) create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/operation_metadata.proto diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto index d69689f7c09..e0620e434ed 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto @@ -22,6 +22,7 @@ import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/documentai/v1beta3/document.proto"; import "google/cloud/documentai/v1beta3/document_io.proto"; +import "google/cloud/documentai/v1beta3/operation_metadata.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; @@ -364,39 +365,3 @@ message ReviewDocumentOperationMetadata { // The basic metadata of the long running operation. CommonOperationMetadata common_metadata = 5; } - -// The common metadata for long running operations. -message CommonOperationMetadata { - // State of the longrunning operation. - enum State { - // Unspecified state. - STATE_UNSPECIFIED = 0; - - // Operation is still running. - RUNNING = 1; - - // Operation is being cancelled. - CANCELLING = 2; - - // Operation succeeded. - SUCCEEDED = 3; - - // Operation failed. - FAILED = 4; - - // Operation is cancelled. - CANCELLED = 5; - } - - // The state of the operation. - State state = 1; - - // A message providing more details about the current state of processing. - string state_message = 2; - - // The creation time of the operation. - google.protobuf.Timestamp create_time = 3; - - // The last update time of the operation. - google.protobuf.Timestamp update_time = 4; -} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/geometry.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/geometry.proto index 240faf1f45f..91cd956ea98 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/geometry.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/geometry.proto @@ -32,7 +32,7 @@ message Vertex { // X coordinate. int32 x = 1; - // Y coordinate. + // Y coordinate (starts from the top of the image). int32 y = 2; } @@ -43,7 +43,7 @@ message NormalizedVertex { // X coordinate. float x = 1; - // Y coordinate. + // Y coordinate (starts from the top of the image). float y = 2; } diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/operation_metadata.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/operation_metadata.proto new file mode 100644 index 00000000000..1d8624e8f79 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/operation_metadata.proto @@ -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. + +syntax = "proto3"; + +package google.cloud.documentai.v1beta3; + +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; +option java_multiple_files = true; +option java_outer_classname = "OperationMetadataProto"; +option java_package = "com.google.cloud.documentai.v1beta3"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta3"; +option ruby_package = "Google::Cloud::DocumentAI::V1beta3"; + +// The common metadata for long running operations. +message CommonOperationMetadata { + // State of the longrunning operation. + enum State { + // Unspecified state. + STATE_UNSPECIFIED = 0; + + // Operation is still running. + RUNNING = 1; + + // Operation is being cancelled. + CANCELLING = 2; + + // Operation succeeded. + SUCCEEDED = 3; + + // Operation failed. + FAILED = 4; + + // Operation is cancelled. + CANCELLED = 5; + } + + // The state of the operation. + State state = 1; + + // A message providing more details about the current state of processing. + string state_message = 2; + + // The creation time of the operation. + google.protobuf.Timestamp create_time = 3; + + // The last update time of the operation. + google.protobuf.Timestamp update_time = 4; +} diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 5aea6b3717c..9b88981b9ec 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -3117,7 +3117,7 @@ "csharp_namespace": "Google.Cloud.DocumentAI.V1Beta3", "go_package": "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai", "java_multiple_files": true, - "java_outer_classname": "DocumentAiProcessorService", + "java_outer_classname": "OperationMetadataProto", "java_package": "com.google.cloud.documentai.v1beta3", "php_namespace": "Google\\Cloud\\DocumentAI\\V1beta3", "ruby_package": "Google::Cloud::DocumentAI::V1beta3", diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json index 0b10d7411a1..3f71a31868d 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json @@ -2,5 +2,6 @@ "../../protos/google/cloud/documentai/v1beta3/document.proto", "../../protos/google/cloud/documentai/v1beta3/document_io.proto", "../../protos/google/cloud/documentai/v1beta3/document_processor_service.proto", - "../../protos/google/cloud/documentai/v1beta3/geometry.proto" + "../../protos/google/cloud/documentai/v1beta3/geometry.proto", + "../../protos/google/cloud/documentai/v1beta3/operation_metadata.proto" ] From 6ce6f24a8bb2e15f951257c5190112e63ee580a5 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sun, 6 Jun 2021 11:59:34 -0700 Subject: [PATCH 137/213] chore: Move CommonOperationMetadata into a separate proto file for potential reuse. (#228) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Move CommonOperationMetadata into a separate proto file for potential reuse. PiperOrigin-RevId: 377562108 Source-Link: https://github.com/googleapis/googleapis/commit/3e0f7ebfbbd2344412e7622fab4bc0c9004c5932 Source-Link: https://github.com/googleapis/googleapis-gen/commit/70f4e20f116713d800e280ce0479fa2adb47d53d * 🦉 Updates from OwlBot * 🦉 Updates from OwlBot Co-authored-by: Owl Bot --- .../v1/document_processor_service.proto | 37 +---------- .../google/cloud/documentai/v1/geometry.proto | 4 +- .../documentai/v1/operation_metadata.proto | 64 +++++++++++++++++++ .../protos/protos.json | 2 +- ...document_processor_service_proto_list.json | 3 +- 5 files changed, 70 insertions(+), 40 deletions(-) create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1/operation_metadata.proto diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto index 033b3cb75a0..9f0b11a74de 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto @@ -22,6 +22,7 @@ import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/documentai/v1/document.proto"; import "google/cloud/documentai/v1/document_io.proto"; +import "google/cloud/documentai/v1/operation_metadata.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; @@ -280,39 +281,3 @@ message ReviewDocumentOperationMetadata { // The basic metadata of the long running operation. CommonOperationMetadata common_metadata = 5; } - -// The common metadata for long running operations. -message CommonOperationMetadata { - // State of the longrunning operation. - enum State { - // Unspecified state. - STATE_UNSPECIFIED = 0; - - // Operation is still running. - RUNNING = 1; - - // Operation is being cancelled. - CANCELLING = 2; - - // Operation succeeded. - SUCCEEDED = 3; - - // Operation failed. - FAILED = 4; - - // Operation is cancelled. - CANCELLED = 5; - } - - // The state of the operation. - State state = 1; - - // A message providing more details about the current state of processing. - string state_message = 2; - - // The creation time of the operation. - google.protobuf.Timestamp create_time = 3; - - // The last update time of the operation. - google.protobuf.Timestamp update_time = 4; -} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto index 779e9664da9..19ced5073bc 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto @@ -32,7 +32,7 @@ message Vertex { // X coordinate. int32 x = 1; - // Y coordinate. + // Y coordinate (starts from the top of the image). int32 y = 2; } @@ -43,7 +43,7 @@ message NormalizedVertex { // X coordinate. float x = 1; - // Y coordinate. + // Y coordinate (starts from the top of the image). float y = 2; } diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/operation_metadata.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/operation_metadata.proto new file mode 100644 index 00000000000..503451bf272 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/operation_metadata.proto @@ -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. + +syntax = "proto3"; + +package google.cloud.documentai.v1; + +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.DocumentAI.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai"; +option java_multiple_files = true; +option java_outer_classname = "OperationMetadataProto"; +option java_package = "com.google.cloud.documentai.v1"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1"; +option ruby_package = "Google::Cloud::DocumentAI::V1"; + +// The common metadata for long running operations. +message CommonOperationMetadata { + // State of the longrunning operation. + enum State { + // Unspecified state. + STATE_UNSPECIFIED = 0; + + // Operation is still running. + RUNNING = 1; + + // Operation is being cancelled. + CANCELLING = 2; + + // Operation succeeded. + SUCCEEDED = 3; + + // Operation failed. + FAILED = 4; + + // Operation is cancelled. + CANCELLED = 5; + } + + // The state of the operation. + State state = 1; + + // A message providing more details about the current state of processing. + string state_message = 2; + + // The creation time of the operation. + google.protobuf.Timestamp create_time = 3; + + // The last update time of the operation. + google.protobuf.Timestamp update_time = 4; +} diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 9b88981b9ec..d21a9a1d180 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -11,7 +11,7 @@ "csharp_namespace": "Google.Cloud.DocumentAI.V1", "go_package": "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai", "java_multiple_files": true, - "java_outer_classname": "DocumentAiProcessorService", + "java_outer_classname": "OperationMetadataProto", "java_package": "com.google.cloud.documentai.v1", "php_namespace": "Google\\Cloud\\DocumentAI\\V1", "ruby_package": "Google::Cloud::DocumentAI::V1", diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_proto_list.json b/packages/google-cloud-documentai/src/v1/document_processor_service_proto_list.json index e7df1c477a3..49fea13a704 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_proto_list.json +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_proto_list.json @@ -2,5 +2,6 @@ "../../protos/google/cloud/documentai/v1/document.proto", "../../protos/google/cloud/documentai/v1/document_io.proto", "../../protos/google/cloud/documentai/v1/document_processor_service.proto", - "../../protos/google/cloud/documentai/v1/geometry.proto" + "../../protos/google/cloud/documentai/v1/geometry.proto", + "../../protos/google/cloud/documentai/v1/operation_metadata.proto" ] From 655457e0afbc2ef9df2dd70c620da00fa8fe11de Mon Sep 17 00:00:00 2001 From: "F. Hinkelmann" Date: Thu, 10 Jun 2021 23:04:24 +0200 Subject: [PATCH 138/213] chore(nodejs): remove api-extractor dependencies (#234) --- packages/google-cloud-documentai/package.json | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index fe184f15d77..5e45ac77010 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -24,9 +24,7 @@ "system-test": "c8 mocha build/system-test", "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", "test": "c8 mocha build/test", - "precompile": "gts clean", - "api-extractor": "api-extractor run --local", - "api-documenter": "api-documenter yaml --input-folder=temp" + "precompile": "gts clean" }, "dependencies": { "google-gax": "^2.12.0" @@ -49,9 +47,7 @@ "ts-loader": "^9.0.0", "typescript": "^3.8.3", "webpack": "^5.0.0", - "webpack-cli": "^4.0.0", - "@microsoft/api-documenter": "^7.8.10", - "@microsoft/api-extractor": "^7.8.10" + "webpack-cli": "^4.0.0" }, "engines": { "node": ">=10" From 299984400001a094718575eaf1cbd2b554da72c3 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 15 Jun 2021 18:15:28 -0700 Subject: [PATCH 139/213] feat: update document.proto, add the processor management methods. (#236) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: update document.proto, add the processor management methods. PiperOrigin-RevId: 379607978 Source-Link: https://github.com/googleapis/googleapis/commit/19906f9fc5f20c5b98984cf9facf54de90c43d66 Source-Link: https://github.com/googleapis/googleapis-gen/commit/38d233ad4b16e2f8c73ff3f16c2713573c112c07 * 🦉 Updates from OwlBot * 🦉 Updates from OwlBot Co-authored-by: Owl Bot --- .../cloud/documentai/v1beta3/document.proto | 16 +- .../v1beta3/document_processor_service.proto | 213 +- .../cloud/documentai/v1beta3/processor.proto | 99 + .../documentai/v1beta3/processor_type.proto | 60 + .../protos/protos.d.ts | 2041 ++++++- .../google-cloud-documentai/protos/protos.js | 4974 +++++++++++++++-- .../protos/protos.json | 411 +- .../document_processor_service_client.ts | 1166 +++- ...ument_processor_service_client_config.json | 24 + ...document_processor_service_proto_list.json | 4 +- .../src/v1beta3/gapic_metadata.json | 64 + ...apic_document_processor_service_v1beta3.ts | 1505 ++++- 12 files changed, 9681 insertions(+), 896 deletions(-) create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor.proto create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor_type.proto diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto index d461041f976..abba3ae1923 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto @@ -324,6 +324,9 @@ message Document { // - "unfilled_checkbox" // - "filled_checkbox" string value_type = 5; + + // The history of this annotation. + Provenance provenance = 8; } // Detected language for a structural component. @@ -385,6 +388,9 @@ message Document { // A list of visually detected form fields on the page. repeated FormField form_fields = 11; + + // The history of this page. + Provenance provenance = 16; } // A phrase in the text that is a known entity type, such as a person, an @@ -536,6 +542,8 @@ message Document { // Required. Index into the [Document.pages][google.cloud.documentai.v1beta3.Document.pages] element, for example using // [Document.pages][page_refs.page] to locate the related page element. + // This field is skipped when its value is the default 0. See + // https://developers.google.com/protocol-buffers/docs/proto3#json. int64 page = 1 [(google.api.field_behavior) = REQUIRED]; // Optional. The type of the layout element that is being referenced if any. @@ -568,8 +576,12 @@ message Document { // The index of the [Document.revisions] identifying the parent revision. int32 revision = 1; + // The index of the parent revisions corresponding collection of items + // (eg. list of entities, properties within entities, etc.) + int32 index = 3; + // The id of the parent provenance. - int32 id = 2; + int32 id = 2 [deprecated = true]; } // If a processor or agent does an explicit operation on existing elements. @@ -602,7 +614,7 @@ message Document { // The Id of this operation. Needs to be unique within the scope of the // revision. - int32 id = 2; + int32 id = 2 [deprecated = true]; // References to the original elements that are replaced. repeated Parent parents = 3; diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto index e0620e434ed..e76a0316463 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto @@ -23,6 +23,8 @@ import "google/api/resource.proto"; import "google/cloud/documentai/v1beta3/document.proto"; import "google/cloud/documentai/v1beta3/document_io.proto"; import "google/cloud/documentai/v1beta3/operation_metadata.proto"; +import "google/cloud/documentai/v1beta3/processor.proto"; +import "google/cloud/documentai/v1beta3/processor_type.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; @@ -44,10 +46,6 @@ option (google.api.resource_definition) = { type: "documentai.googleapis.com/Location" pattern: "projects/{project}/locations/{location}" }; -option (google.api.resource_definition) = { - type: "documentai.googleapis.com/Processor" - pattern: "projects/{project}/locations/{location}/processors/{processor}" -}; option (google.api.resource_definition) = { type: "documentai.googleapis.com/HumanReviewConfig" pattern: "projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig" @@ -84,6 +82,69 @@ service DocumentProcessorService { }; } + // Fetches processor types. + rpc FetchProcessorTypes(FetchProcessorTypesRequest) returns (FetchProcessorTypesResponse) { + option (google.api.http) = { + get: "/v1beta3/{parent=projects/*/locations/*}:fetchProcessorTypes" + }; + option (google.api.method_signature) = "parent"; + } + + // Lists all processors which belong to this project. + rpc ListProcessors(ListProcessorsRequest) returns (ListProcessorsResponse) { + option (google.api.http) = { + get: "/v1beta3/{parent=projects/*/locations/*}/processors" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a processor from the type processor that the user chose. + // The processor will be at "ENABLED" state by default after its creation. + rpc CreateProcessor(CreateProcessorRequest) returns (Processor) { + option (google.api.http) = { + post: "/v1beta3/{parent=projects/*/locations/*}/processors" + body: "processor" + }; + option (google.api.method_signature) = "parent,processor"; + } + + // Deletes the processor, unloads all deployed model artifacts if it was + // enabled and then deletes all artifacts associated with this processor. + rpc DeleteProcessor(DeleteProcessorRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta3/{name=projects/*/locations/*/processors/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "DeleteProcessorMetadata" + }; + } + + // Enables a processor + rpc EnableProcessor(EnableProcessorRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta3/{name=projects/*/locations/*/processors/*}:enable" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "EnableProcessorResponse" + metadata_type: "EnableProcessorMetadata" + }; + } + + // Disables a processor + rpc DisableProcessor(DisableProcessorRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta3/{name=projects/*/locations/*/processors/*}:disable" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "DisableProcessorResponse" + metadata_type: "DisableProcessorMetadata" + }; + } + // Send a document for Human Review. The input document should be processed by // the specified processor. rpc ReviewDocument(ReviewDocumentRequest) returns (google.longrunning.Operation) { @@ -299,8 +360,146 @@ message BatchProcessMetadata { repeated IndividualProcessStatus individual_process_statuses = 5; } +// Request message for fetch processor types. +message FetchProcessorTypesRequest { + // Required. The project of processor type to list. + // Format: projects/{project}/locations/{location} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "documentai.googleapis.com/ProcessorType" + } + ]; +} + +// Response message for fetch processor types. +message FetchProcessorTypesResponse { + // The list of processor types. + repeated ProcessorType processor_types = 1; +} + +// Request message for list all processors belongs to a project. +message ListProcessorsRequest { + // Required. The parent (project and location) which owns this collection of Processors. + // Format: projects/{project}/locations/{location} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "documentai.googleapis.com/Processor" + } + ]; + + // The maximum number of processors to return. + // If unspecified, at most 50 processors will be returned. + // The maximum value is 100; values above 100 will be coerced to 100. + int32 page_size = 2; + + // We will return the processors sorted by creation time. The page token + // will point to the next processor. + string page_token = 3; +} + +// Response message for list processors. +message ListProcessorsResponse { + // The list of processors. + repeated Processor processors = 1; + + // Points to the next processor, otherwise empty. + string next_page_token = 2; +} + +// Request message for create a processor. Notice this request is sent to +// a regionalized backend service, and if the processor type is not available +// on that region, the creation will fail. +message CreateProcessorRequest { + // Required. The parent (project and location) under which to create the processor. + // Format: projects/{project}/locations/{location} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "documentai.googleapis.com/Processor" + } + ]; + + // Required. The processor to be created, requires [processor_type] and [display_name] + // to be set. Also, the processor is under CMEK if CMEK fields are set. + Processor processor = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for the delete processor method. +message DeleteProcessorRequest { + // Required. The processor resource name to be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/Processor" + } + ]; +} + +// The long running operation metadata for delete processor method. +message DeleteProcessorMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 5; +} + +// Request message for the enable processor method. +message EnableProcessorRequest { + // Required. The processor resource name to be enabled. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/Processor" + } + ]; +} + +// Response message for the enable processor method. +message EnableProcessorResponse { + +} + +// The long running operation metadata for enable processor method. +message EnableProcessorMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 5; +} + +// Request message for the disable processor method. +message DisableProcessorRequest { + // Required. The processor resource name to be disabled. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/Processor" + } + ]; +} + +// Response message for the disable processor method. +message DisableProcessorResponse { + +} + +// The long running operation metadata for disable processor method. +message DisableProcessorMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 5; +} + // Request message for review document method. +// Next Id: 6. message ReviewDocumentRequest { + // The priority level of the human review task. + enum Priority { + // The default priority level. + DEFAULT = 0; + + // The urgent priority level. The labeling manager should allocate labeler + // resource to the urgent task queue to respect this priority level. + URGENT = 1; + } + // The document payload. oneof source { // An inline document proto. @@ -318,6 +517,12 @@ message ReviewDocumentRequest { // The document that needs human review. Document document = 2 [deprecated = true]; + + // Whether the validation should be performed on the ad-hoc review request. + bool enable_schema_validation = 3; + + // The priority of the human review task. + Priority priority = 5; } // Response message for review document method. diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor.proto new file mode 100644 index 00000000000..61cd14a26e6 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor.proto @@ -0,0 +1,99 @@ +// 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.documentai.v1beta3; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/documentai/v1beta3/document_io.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; +option java_multiple_files = true; +option java_outer_classname = "DocumentAiProcessor"; +option java_package = "com.google.cloud.documentai.v1beta3"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta3"; +option ruby_package = "Google::Cloud::DocumentAI::V1beta3"; + +// The first-class citizen for DocumentAI. Each processor defines how to extract +// structural information from a document. +message Processor { + option (google.api.resource) = { + type: "documentai.googleapis.com/Processor" + pattern: "projects/{project}/locations/{location}/processors/{processor}" + }; + + // The possible states of the processor. + enum State { + // The processor is in an unspecified state. + STATE_UNSPECIFIED = 0; + + // The processor is enabled. + ENABLED = 1; + + // The processor is disabled. + DISABLED = 2; + + // The processor is being enabled, will become ENABLED if successful. + ENABLING = 3; + + // The processor is being disabled, will become DISABLED if successful. + DISABLING = 4; + + // The processor is being created. + CREATING = 5; + + // The processor failed during creation. + FAILED = 6; + + // The processor is being deleted, will be removed if successful. + DELETING = 7; + } + + // Output only. Immutable. The resource name of the processor. + // Format: projects/{project}/locations/{location}/processors/{processor} + string name = 1 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = OUTPUT_ONLY + ]; + + // The processor type. + string type = 2; + + // The display name of the processor. + string display_name = 3; + + // Output only. The state of the processor. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The default processor version. + string default_processor_version = 9; + + // Output only. Immutable. The http endpoint that can be called to invoke processing. + string process_endpoint = 6 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = IMMUTABLE + ]; + + // The time the processor was created. + google.protobuf.Timestamp create_time = 7; + + // The KMS key used for encryption/decryption in CMEK scenarios. + // See https://cloud.google.com/security-key-management. + string kms_key_name = 8; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor_type.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor_type.proto new file mode 100644 index 00000000000..4bd4c16ab05 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor_type.proto @@ -0,0 +1,60 @@ +// 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.documentai.v1beta3; + +import "google/api/resource.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; +option java_multiple_files = true; +option java_outer_classname = "DocumentAiProcessorType"; +option java_package = "com.google.cloud.documentai.v1beta3"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta3"; +option ruby_package = "Google::Cloud::DocumentAI::V1beta3"; + +// A processor type is responsible for performing a certain document +// understanding task on a certain type of document. +message ProcessorType { + option (google.api.resource) = { + type: "documentai.googleapis.com/ProcessorType" + pattern: "projects/{project}/locations/{location}/processorTypes/{processor_type}" + }; + + // The location information about where the processor is available. + message LocationInfo { + // The location id. + string location_id = 1; + } + + // The resource name of the processor type. + string name = 1; + + // The type of the processor. + string type = 2; + + // The processor category. + string category = 3; + + // The locations in which this processor is available. + repeated LocationInfo available_locations = 4; + + // Whether the processor type allows creation. If yes, user can create a + // processor of this processor type. Otherwise, user needs to require for + // whitelisting. + bool allow_creation = 6; +} diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index f5e3fe04879..9c5d7578c3f 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -15192,6 +15192,9 @@ export namespace google { /** Page formFields */ formFields?: (google.cloud.documentai.v1beta3.Document.Page.IFormField[]|null); + + /** Page provenance */ + provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); } /** Represents a Page. */ @@ -15242,6 +15245,9 @@ export namespace google { /** Page formFields. */ public formFields: google.cloud.documentai.v1beta3.Document.Page.IFormField[]; + /** Page provenance. */ + public provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); + /** * Creates a new Page instance using the specified properties. * @param [properties] Properties to set @@ -16699,6 +16705,9 @@ export namespace google { /** FormField valueType */ valueType?: (string|null); + + /** FormField provenance */ + provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); } /** Represents a FormField. */ @@ -16725,6 +16734,9 @@ export namespace google { /** FormField valueType. */ public valueType: string; + /** FormField provenance. */ + public provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); + /** * Creates a new FormField instance using the specified properties. * @param [properties] Properties to set @@ -17804,6 +17816,9 @@ export namespace google { /** Parent revision */ revision?: (number|null); + /** Parent index */ + index?: (number|null); + /** Parent id */ id?: (number|null); } @@ -17820,6 +17835,9 @@ export namespace google { /** Parent revision. */ public revision: number; + /** Parent index. */ + public index: number; + /** Parent id. */ public id: number; @@ -19224,6 +19242,90 @@ export namespace google { */ public batchProcessDocuments(request: google.cloud.documentai.v1beta3.IBatchProcessRequest): Promise; + /** + * Calls FetchProcessorTypes. + * @param request FetchProcessorTypesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and FetchProcessorTypesResponse + */ + public fetchProcessorTypes(request: google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.FetchProcessorTypesCallback): void; + + /** + * Calls FetchProcessorTypes. + * @param request FetchProcessorTypesRequest message or plain object + * @returns Promise + */ + public fetchProcessorTypes(request: google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest): Promise; + + /** + * Calls ListProcessors. + * @param request ListProcessorsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListProcessorsResponse + */ + public listProcessors(request: google.cloud.documentai.v1beta3.IListProcessorsRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessorsCallback): void; + + /** + * Calls ListProcessors. + * @param request ListProcessorsRequest message or plain object + * @returns Promise + */ + public listProcessors(request: google.cloud.documentai.v1beta3.IListProcessorsRequest): Promise; + + /** + * Calls CreateProcessor. + * @param request CreateProcessorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Processor + */ + public createProcessor(request: google.cloud.documentai.v1beta3.ICreateProcessorRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.CreateProcessorCallback): void; + + /** + * Calls CreateProcessor. + * @param request CreateProcessorRequest message or plain object + * @returns Promise + */ + public createProcessor(request: google.cloud.documentai.v1beta3.ICreateProcessorRequest): Promise; + + /** + * Calls DeleteProcessor. + * @param request DeleteProcessorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteProcessor(request: google.cloud.documentai.v1beta3.IDeleteProcessorRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.DeleteProcessorCallback): void; + + /** + * Calls DeleteProcessor. + * @param request DeleteProcessorRequest message or plain object + * @returns Promise + */ + public deleteProcessor(request: google.cloud.documentai.v1beta3.IDeleteProcessorRequest): Promise; + + /** + * Calls EnableProcessor. + * @param request EnableProcessorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public enableProcessor(request: google.cloud.documentai.v1beta3.IEnableProcessorRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.EnableProcessorCallback): void; + + /** + * Calls EnableProcessor. + * @param request EnableProcessorRequest message or plain object + * @returns Promise + */ + public enableProcessor(request: google.cloud.documentai.v1beta3.IEnableProcessorRequest): Promise; + + /** + * Calls DisableProcessor. + * @param request DisableProcessorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public disableProcessor(request: google.cloud.documentai.v1beta3.IDisableProcessorRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.DisableProcessorCallback): void; + + /** + * Calls DisableProcessor. + * @param request DisableProcessorRequest message or plain object + * @returns Promise + */ + public disableProcessor(request: google.cloud.documentai.v1beta3.IDisableProcessorRequest): Promise; + /** * Calls ReviewDocument. * @param request ReviewDocumentRequest message or plain object @@ -19255,6 +19357,48 @@ export namespace google { */ type BatchProcessDocumentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#fetchProcessorTypes}. + * @param error Error, if any + * @param [response] FetchProcessorTypesResponse + */ + type FetchProcessorTypesCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.FetchProcessorTypesResponse) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#listProcessors}. + * @param error Error, if any + * @param [response] ListProcessorsResponse + */ + type ListProcessorsCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.ListProcessorsResponse) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#createProcessor}. + * @param error Error, if any + * @param [response] Processor + */ + type CreateProcessorCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.Processor) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#deleteProcessor}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteProcessorCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#enableProcessor}. + * @param error Error, if any + * @param [response] Operation + */ + type EnableProcessorCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#disableProcessor}. + * @param error Error, if any + * @param [response] Operation + */ + type DisableProcessorCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#reviewDocument}. * @param error Error, if any @@ -20231,361 +20375,1564 @@ export namespace google { } } - /** Properties of a ReviewDocumentRequest. */ - interface IReviewDocumentRequest { - - /** ReviewDocumentRequest inlineDocument */ - inlineDocument?: (google.cloud.documentai.v1beta3.IDocument|null); - - /** ReviewDocumentRequest humanReviewConfig */ - humanReviewConfig?: (string|null); + /** Properties of a FetchProcessorTypesRequest. */ + interface IFetchProcessorTypesRequest { - /** ReviewDocumentRequest document */ - document?: (google.cloud.documentai.v1beta3.IDocument|null); + /** FetchProcessorTypesRequest parent */ + parent?: (string|null); } - /** Represents a ReviewDocumentRequest. */ - class ReviewDocumentRequest implements IReviewDocumentRequest { + /** Represents a FetchProcessorTypesRequest. */ + class FetchProcessorTypesRequest implements IFetchProcessorTypesRequest { /** - * Constructs a new ReviewDocumentRequest. + * Constructs a new FetchProcessorTypesRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentRequest); - - /** ReviewDocumentRequest inlineDocument. */ - public inlineDocument?: (google.cloud.documentai.v1beta3.IDocument|null); - - /** ReviewDocumentRequest humanReviewConfig. */ - public humanReviewConfig: string; - - /** ReviewDocumentRequest document. */ - public document?: (google.cloud.documentai.v1beta3.IDocument|null); + constructor(properties?: google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest); - /** ReviewDocumentRequest source. */ - public source?: "inlineDocument"; + /** FetchProcessorTypesRequest parent. */ + public parent: string; /** - * Creates a new ReviewDocumentRequest instance using the specified properties. + * Creates a new FetchProcessorTypesRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ReviewDocumentRequest instance + * @returns FetchProcessorTypesRequest instance */ - public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentRequest): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + public static create(properties?: google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest): google.cloud.documentai.v1beta3.FetchProcessorTypesRequest; /** - * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. - * @param message ReviewDocumentRequest message or plain object to encode + * Encodes the specified FetchProcessorTypesRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.FetchProcessorTypesRequest.verify|verify} messages. + * @param message FetchProcessorTypesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. - * @param message ReviewDocumentRequest message or plain object to encode + * Encodes the specified FetchProcessorTypesRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.FetchProcessorTypesRequest.verify|verify} messages. + * @param message FetchProcessorTypesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * Decodes a FetchProcessorTypesRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ReviewDocumentRequest + * @returns FetchProcessorTypesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.FetchProcessorTypesRequest; /** - * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * Decodes a FetchProcessorTypesRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ReviewDocumentRequest + * @returns FetchProcessorTypesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.FetchProcessorTypesRequest; /** - * Verifies a ReviewDocumentRequest message. + * Verifies a FetchProcessorTypesRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. + * Creates a FetchProcessorTypesRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ReviewDocumentRequest + * @returns FetchProcessorTypesRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.FetchProcessorTypesRequest; /** - * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. - * @param message ReviewDocumentRequest + * Creates a plain object from a FetchProcessorTypesRequest message. Also converts values to other types if specified. + * @param message FetchProcessorTypesRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.FetchProcessorTypesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ReviewDocumentRequest to JSON. + * Converts this FetchProcessorTypesRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ReviewDocumentResponse. */ - interface IReviewDocumentResponse { + /** Properties of a FetchProcessorTypesResponse. */ + interface IFetchProcessorTypesResponse { - /** ReviewDocumentResponse gcsDestination */ - gcsDestination?: (string|null); + /** FetchProcessorTypesResponse processorTypes */ + processorTypes?: (google.cloud.documentai.v1beta3.IProcessorType[]|null); } - /** Represents a ReviewDocumentResponse. */ - class ReviewDocumentResponse implements IReviewDocumentResponse { + /** Represents a FetchProcessorTypesResponse. */ + class FetchProcessorTypesResponse implements IFetchProcessorTypesResponse { /** - * Constructs a new ReviewDocumentResponse. + * Constructs a new FetchProcessorTypesResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentResponse); + constructor(properties?: google.cloud.documentai.v1beta3.IFetchProcessorTypesResponse); - /** ReviewDocumentResponse gcsDestination. */ - public gcsDestination: string; + /** FetchProcessorTypesResponse processorTypes. */ + public processorTypes: google.cloud.documentai.v1beta3.IProcessorType[]; /** - * Creates a new ReviewDocumentResponse instance using the specified properties. + * Creates a new FetchProcessorTypesResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ReviewDocumentResponse instance + * @returns FetchProcessorTypesResponse instance */ - public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentResponse): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + public static create(properties?: google.cloud.documentai.v1beta3.IFetchProcessorTypesResponse): google.cloud.documentai.v1beta3.FetchProcessorTypesResponse; /** - * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. - * @param message ReviewDocumentResponse message or plain object to encode + * Encodes the specified FetchProcessorTypesResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.FetchProcessorTypesResponse.verify|verify} messages. + * @param message FetchProcessorTypesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.IFetchProcessorTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. - * @param message ReviewDocumentResponse message or plain object to encode + * Encodes the specified FetchProcessorTypesResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.FetchProcessorTypesResponse.verify|verify} messages. + * @param message FetchProcessorTypesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IFetchProcessorTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * Decodes a FetchProcessorTypesResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ReviewDocumentResponse + * @returns FetchProcessorTypesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.FetchProcessorTypesResponse; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * Decodes a FetchProcessorTypesResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ReviewDocumentResponse + * @returns FetchProcessorTypesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.FetchProcessorTypesResponse; /** - * Verifies a ReviewDocumentResponse message. + * Verifies a FetchProcessorTypesResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * Creates a FetchProcessorTypesResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ReviewDocumentResponse + * @returns FetchProcessorTypesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.FetchProcessorTypesResponse; /** - * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. - * @param message ReviewDocumentResponse + * Creates a plain object from a FetchProcessorTypesResponse message. Also converts values to other types if specified. + * @param message FetchProcessorTypesResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.FetchProcessorTypesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ReviewDocumentResponse to JSON. + * Converts this FetchProcessorTypesResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ReviewDocumentOperationMetadata. */ - interface IReviewDocumentOperationMetadata { - - /** ReviewDocumentOperationMetadata state */ - state?: (google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|null); - - /** ReviewDocumentOperationMetadata stateMessage */ - stateMessage?: (string|null); + /** Properties of a ListProcessorsRequest. */ + interface IListProcessorsRequest { - /** ReviewDocumentOperationMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); + /** ListProcessorsRequest parent */ + parent?: (string|null); - /** ReviewDocumentOperationMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); + /** ListProcessorsRequest pageSize */ + pageSize?: (number|null); - /** ReviewDocumentOperationMetadata commonMetadata */ - commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + /** ListProcessorsRequest pageToken */ + pageToken?: (string|null); } - /** Represents a ReviewDocumentOperationMetadata. */ - class ReviewDocumentOperationMetadata implements IReviewDocumentOperationMetadata { + /** Represents a ListProcessorsRequest. */ + class ListProcessorsRequest implements IListProcessorsRequest { /** - * Constructs a new ReviewDocumentOperationMetadata. + * Constructs a new ListProcessorsRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata); + constructor(properties?: google.cloud.documentai.v1beta3.IListProcessorsRequest); - /** ReviewDocumentOperationMetadata state. */ - public state: (google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State); - - /** ReviewDocumentOperationMetadata stateMessage. */ - public stateMessage: string; - - /** ReviewDocumentOperationMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); + /** ListProcessorsRequest parent. */ + public parent: string; - /** ReviewDocumentOperationMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); + /** ListProcessorsRequest pageSize. */ + public pageSize: number; - /** ReviewDocumentOperationMetadata commonMetadata. */ - public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + /** ListProcessorsRequest pageToken. */ + public pageToken: string; /** - * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * Creates a new ListProcessorsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ReviewDocumentOperationMetadata instance + * @returns ListProcessorsRequest instance */ - public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + public static create(properties?: google.cloud.documentai.v1beta3.IListProcessorsRequest): google.cloud.documentai.v1beta3.ListProcessorsRequest; /** - * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. - * @param message ReviewDocumentOperationMetadata message or plain object to encode + * Encodes the specified ListProcessorsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsRequest.verify|verify} messages. + * @param message ListProcessorsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.IListProcessorsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. - * @param message ReviewDocumentOperationMetadata message or plain object to encode + * Encodes the specified ListProcessorsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsRequest.verify|verify} messages. + * @param message ListProcessorsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IListProcessorsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * Decodes a ListProcessorsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ReviewDocumentOperationMetadata + * @returns ListProcessorsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ListProcessorsRequest; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * Decodes a ListProcessorsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ReviewDocumentOperationMetadata + * @returns ListProcessorsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ListProcessorsRequest; /** - * Verifies a ReviewDocumentOperationMetadata message. + * Verifies a ListProcessorsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a ListProcessorsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ReviewDocumentOperationMetadata + * @returns ListProcessorsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ListProcessorsRequest; /** - * Creates a plain object from a ReviewDocumentOperationMetadata message. Also converts values to other types if specified. - * @param message ReviewDocumentOperationMetadata + * Creates a plain object from a ListProcessorsRequest message. Also converts values to other types if specified. + * @param message ListProcessorsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.ListProcessorsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ReviewDocumentOperationMetadata to JSON. + * Converts this ListProcessorsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace ReviewDocumentOperationMetadata { - - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - RUNNING = 1, - CANCELLING = 2, - SUCCEEDED = 3, - FAILED = 4, - CANCELLED = 5 - } - } - - /** Properties of a CommonOperationMetadata. */ - interface ICommonOperationMetadata { - - /** CommonOperationMetadata state */ - state?: (google.cloud.documentai.v1beta3.CommonOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.CommonOperationMetadata.State|null); - - /** CommonOperationMetadata stateMessage */ - stateMessage?: (string|null); + /** Properties of a ListProcessorsResponse. */ + interface IListProcessorsResponse { - /** CommonOperationMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); + /** ListProcessorsResponse processors */ + processors?: (google.cloud.documentai.v1beta3.IProcessor[]|null); - /** CommonOperationMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); + /** ListProcessorsResponse nextPageToken */ + nextPageToken?: (string|null); } - /** Represents a CommonOperationMetadata. */ - class CommonOperationMetadata implements ICommonOperationMetadata { + /** Represents a ListProcessorsResponse. */ + class ListProcessorsResponse implements IListProcessorsResponse { /** - * Constructs a new CommonOperationMetadata. + * Constructs a new ListProcessorsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.ICommonOperationMetadata); - - /** CommonOperationMetadata state. */ - public state: (google.cloud.documentai.v1beta3.CommonOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.CommonOperationMetadata.State); + constructor(properties?: google.cloud.documentai.v1beta3.IListProcessorsResponse); - /** CommonOperationMetadata stateMessage. */ - public stateMessage: string; + /** ListProcessorsResponse processors. */ + public processors: google.cloud.documentai.v1beta3.IProcessor[]; - /** CommonOperationMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); + /** ListProcessorsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListProcessorsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProcessorsResponse instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IListProcessorsResponse): google.cloud.documentai.v1beta3.ListProcessorsResponse; + + /** + * Encodes the specified ListProcessorsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsResponse.verify|verify} messages. + * @param message ListProcessorsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IListProcessorsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListProcessorsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsResponse.verify|verify} messages. + * @param message ListProcessorsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IListProcessorsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListProcessorsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProcessorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ListProcessorsResponse; + + /** + * Decodes a ListProcessorsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProcessorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ListProcessorsResponse; + + /** + * Verifies a ListProcessorsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListProcessorsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProcessorsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ListProcessorsResponse; + + /** + * Creates a plain object from a ListProcessorsResponse message. Also converts values to other types if specified. + * @param message ListProcessorsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.ListProcessorsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProcessorsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateProcessorRequest. */ + interface ICreateProcessorRequest { + + /** CreateProcessorRequest parent */ + parent?: (string|null); + + /** CreateProcessorRequest processor */ + processor?: (google.cloud.documentai.v1beta3.IProcessor|null); + } + + /** Represents a CreateProcessorRequest. */ + class CreateProcessorRequest implements ICreateProcessorRequest { + + /** + * Constructs a new CreateProcessorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.ICreateProcessorRequest); + + /** CreateProcessorRequest parent. */ + public parent: string; + + /** CreateProcessorRequest processor. */ + public processor?: (google.cloud.documentai.v1beta3.IProcessor|null); + + /** + * Creates a new CreateProcessorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateProcessorRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.ICreateProcessorRequest): google.cloud.documentai.v1beta3.CreateProcessorRequest; + + /** + * Encodes the specified CreateProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.CreateProcessorRequest.verify|verify} messages. + * @param message CreateProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.ICreateProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.CreateProcessorRequest.verify|verify} messages. + * @param message CreateProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.ICreateProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateProcessorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.CreateProcessorRequest; + + /** + * Decodes a CreateProcessorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.CreateProcessorRequest; + + /** + * Verifies a CreateProcessorRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateProcessorRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.CreateProcessorRequest; + + /** + * Creates a plain object from a CreateProcessorRequest message. Also converts values to other types if specified. + * @param message CreateProcessorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.CreateProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateProcessorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteProcessorRequest. */ + interface IDeleteProcessorRequest { + + /** DeleteProcessorRequest name */ + name?: (string|null); + } + + /** Represents a DeleteProcessorRequest. */ + class DeleteProcessorRequest implements IDeleteProcessorRequest { + + /** + * Constructs a new DeleteProcessorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IDeleteProcessorRequest); + + /** DeleteProcessorRequest name. */ + public name: string; + + /** + * Creates a new DeleteProcessorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteProcessorRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IDeleteProcessorRequest): google.cloud.documentai.v1beta3.DeleteProcessorRequest; + + /** + * Encodes the specified DeleteProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorRequest.verify|verify} messages. + * @param message DeleteProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IDeleteProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorRequest.verify|verify} messages. + * @param message DeleteProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDeleteProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteProcessorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DeleteProcessorRequest; + + /** + * Decodes a DeleteProcessorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DeleteProcessorRequest; + + /** + * Verifies a DeleteProcessorRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteProcessorRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DeleteProcessorRequest; + + /** + * Creates a plain object from a DeleteProcessorRequest message. Also converts values to other types if specified. + * @param message DeleteProcessorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DeleteProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteProcessorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteProcessorMetadata. */ + interface IDeleteProcessorMetadata { + + /** DeleteProcessorMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + } + + /** Represents a DeleteProcessorMetadata. */ + class DeleteProcessorMetadata implements IDeleteProcessorMetadata { + + /** + * Constructs a new DeleteProcessorMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IDeleteProcessorMetadata); + + /** DeleteProcessorMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + + /** + * Creates a new DeleteProcessorMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteProcessorMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IDeleteProcessorMetadata): google.cloud.documentai.v1beta3.DeleteProcessorMetadata; + + /** + * Encodes the specified DeleteProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorMetadata.verify|verify} messages. + * @param message DeleteProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IDeleteProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorMetadata.verify|verify} messages. + * @param message DeleteProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDeleteProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteProcessorMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DeleteProcessorMetadata; + + /** + * Decodes a DeleteProcessorMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DeleteProcessorMetadata; + + /** + * Verifies a DeleteProcessorMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteProcessorMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DeleteProcessorMetadata; + + /** + * Creates a plain object from a DeleteProcessorMetadata message. Also converts values to other types if specified. + * @param message DeleteProcessorMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DeleteProcessorMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteProcessorMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnableProcessorRequest. */ + interface IEnableProcessorRequest { + + /** EnableProcessorRequest name */ + name?: (string|null); + } + + /** Represents an EnableProcessorRequest. */ + class EnableProcessorRequest implements IEnableProcessorRequest { + + /** + * Constructs a new EnableProcessorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IEnableProcessorRequest); + + /** EnableProcessorRequest name. */ + public name: string; + + /** + * Creates a new EnableProcessorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns EnableProcessorRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IEnableProcessorRequest): google.cloud.documentai.v1beta3.EnableProcessorRequest; + + /** + * Encodes the specified EnableProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorRequest.verify|verify} messages. + * @param message EnableProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IEnableProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnableProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorRequest.verify|verify} messages. + * @param message EnableProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IEnableProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnableProcessorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.EnableProcessorRequest; + + /** + * Decodes an EnableProcessorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.EnableProcessorRequest; + + /** + * Verifies an EnableProcessorRequest message. + * @param message Plain 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 EnableProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnableProcessorRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.EnableProcessorRequest; + + /** + * Creates a plain object from an EnableProcessorRequest message. Also converts values to other types if specified. + * @param message EnableProcessorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.EnableProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnableProcessorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnableProcessorResponse. */ + interface IEnableProcessorResponse { + } + + /** Represents an EnableProcessorResponse. */ + class EnableProcessorResponse implements IEnableProcessorResponse { + + /** + * Constructs a new EnableProcessorResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IEnableProcessorResponse); + + /** + * Creates a new EnableProcessorResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns EnableProcessorResponse instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IEnableProcessorResponse): google.cloud.documentai.v1beta3.EnableProcessorResponse; + + /** + * Encodes the specified EnableProcessorResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorResponse.verify|verify} messages. + * @param message EnableProcessorResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IEnableProcessorResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnableProcessorResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorResponse.verify|verify} messages. + * @param message EnableProcessorResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IEnableProcessorResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnableProcessorResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.EnableProcessorResponse; + + /** + * Decodes an EnableProcessorResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.EnableProcessorResponse; + + /** + * Verifies an EnableProcessorResponse message. + * @param message Plain 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 EnableProcessorResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnableProcessorResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.EnableProcessorResponse; + + /** + * Creates a plain object from an EnableProcessorResponse message. Also converts values to other types if specified. + * @param message EnableProcessorResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.EnableProcessorResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnableProcessorResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnableProcessorMetadata. */ + interface IEnableProcessorMetadata { + + /** EnableProcessorMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + } + + /** Represents an EnableProcessorMetadata. */ + class EnableProcessorMetadata implements IEnableProcessorMetadata { + + /** + * Constructs a new EnableProcessorMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IEnableProcessorMetadata); + + /** EnableProcessorMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + + /** + * Creates a new EnableProcessorMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns EnableProcessorMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IEnableProcessorMetadata): google.cloud.documentai.v1beta3.EnableProcessorMetadata; + + /** + * Encodes the specified EnableProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorMetadata.verify|verify} messages. + * @param message EnableProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IEnableProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnableProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorMetadata.verify|verify} messages. + * @param message EnableProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IEnableProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnableProcessorMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.EnableProcessorMetadata; + + /** + * Decodes an EnableProcessorMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.EnableProcessorMetadata; + + /** + * Verifies an EnableProcessorMetadata message. + * @param message Plain 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 EnableProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnableProcessorMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.EnableProcessorMetadata; + + /** + * Creates a plain object from an EnableProcessorMetadata message. Also converts values to other types if specified. + * @param message EnableProcessorMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.EnableProcessorMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnableProcessorMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DisableProcessorRequest. */ + interface IDisableProcessorRequest { + + /** DisableProcessorRequest name */ + name?: (string|null); + } + + /** Represents a DisableProcessorRequest. */ + class DisableProcessorRequest implements IDisableProcessorRequest { + + /** + * Constructs a new DisableProcessorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IDisableProcessorRequest); + + /** DisableProcessorRequest name. */ + public name: string; + + /** + * Creates a new DisableProcessorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DisableProcessorRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IDisableProcessorRequest): google.cloud.documentai.v1beta3.DisableProcessorRequest; + + /** + * Encodes the specified DisableProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorRequest.verify|verify} messages. + * @param message DisableProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IDisableProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DisableProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorRequest.verify|verify} messages. + * @param message DisableProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDisableProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DisableProcessorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DisableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DisableProcessorRequest; + + /** + * Decodes a DisableProcessorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DisableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DisableProcessorRequest; + + /** + * Verifies a DisableProcessorRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DisableProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DisableProcessorRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DisableProcessorRequest; + + /** + * Creates a plain object from a DisableProcessorRequest message. Also converts values to other types if specified. + * @param message DisableProcessorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DisableProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DisableProcessorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DisableProcessorResponse. */ + interface IDisableProcessorResponse { + } + + /** Represents a DisableProcessorResponse. */ + class DisableProcessorResponse implements IDisableProcessorResponse { + + /** + * Constructs a new DisableProcessorResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IDisableProcessorResponse); + + /** + * Creates a new DisableProcessorResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DisableProcessorResponse instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IDisableProcessorResponse): google.cloud.documentai.v1beta3.DisableProcessorResponse; + + /** + * Encodes the specified DisableProcessorResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorResponse.verify|verify} messages. + * @param message DisableProcessorResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IDisableProcessorResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DisableProcessorResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorResponse.verify|verify} messages. + * @param message DisableProcessorResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDisableProcessorResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DisableProcessorResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DisableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DisableProcessorResponse; + + /** + * Decodes a DisableProcessorResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DisableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DisableProcessorResponse; + + /** + * Verifies a DisableProcessorResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DisableProcessorResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DisableProcessorResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DisableProcessorResponse; + + /** + * Creates a plain object from a DisableProcessorResponse message. Also converts values to other types if specified. + * @param message DisableProcessorResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DisableProcessorResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DisableProcessorResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DisableProcessorMetadata. */ + interface IDisableProcessorMetadata { + + /** DisableProcessorMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + } + + /** Represents a DisableProcessorMetadata. */ + class DisableProcessorMetadata implements IDisableProcessorMetadata { + + /** + * Constructs a new DisableProcessorMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IDisableProcessorMetadata); + + /** DisableProcessorMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + + /** + * Creates a new DisableProcessorMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DisableProcessorMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IDisableProcessorMetadata): google.cloud.documentai.v1beta3.DisableProcessorMetadata; + + /** + * Encodes the specified DisableProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorMetadata.verify|verify} messages. + * @param message DisableProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IDisableProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DisableProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorMetadata.verify|verify} messages. + * @param message DisableProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDisableProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DisableProcessorMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DisableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DisableProcessorMetadata; + + /** + * Decodes a DisableProcessorMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DisableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DisableProcessorMetadata; + + /** + * Verifies a DisableProcessorMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DisableProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DisableProcessorMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DisableProcessorMetadata; + + /** + * Creates a plain object from a DisableProcessorMetadata message. Also converts values to other types if specified. + * @param message DisableProcessorMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DisableProcessorMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DisableProcessorMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ReviewDocumentRequest. */ + interface IReviewDocumentRequest { + + /** ReviewDocumentRequest inlineDocument */ + inlineDocument?: (google.cloud.documentai.v1beta3.IDocument|null); + + /** ReviewDocumentRequest humanReviewConfig */ + humanReviewConfig?: (string|null); + + /** ReviewDocumentRequest document */ + document?: (google.cloud.documentai.v1beta3.IDocument|null); + + /** ReviewDocumentRequest enableSchemaValidation */ + enableSchemaValidation?: (boolean|null); + + /** ReviewDocumentRequest priority */ + priority?: (google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority|null); + } + + /** Represents a ReviewDocumentRequest. */ + class ReviewDocumentRequest implements IReviewDocumentRequest { + + /** + * Constructs a new ReviewDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentRequest); + + /** ReviewDocumentRequest inlineDocument. */ + public inlineDocument?: (google.cloud.documentai.v1beta3.IDocument|null); + + /** ReviewDocumentRequest humanReviewConfig. */ + public humanReviewConfig: string; + + /** ReviewDocumentRequest document. */ + public document?: (google.cloud.documentai.v1beta3.IDocument|null); + + /** ReviewDocumentRequest enableSchemaValidation. */ + public enableSchemaValidation: boolean; + + /** ReviewDocumentRequest priority. */ + public priority: (google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority); + + /** ReviewDocumentRequest source. */ + public source?: "inlineDocument"; + + /** + * Creates a new ReviewDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ReviewDocumentRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentRequest): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + + /** + * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * @param message ReviewDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * @param message ReviewDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + + /** + * Verifies a ReviewDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReviewDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + + /** + * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. + * @param message ReviewDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReviewDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ReviewDocumentRequest { + + /** Priority enum. */ + enum Priority { + DEFAULT = 0, + URGENT = 1 + } + } + + /** Properties of a ReviewDocumentResponse. */ + interface IReviewDocumentResponse { + + /** ReviewDocumentResponse gcsDestination */ + gcsDestination?: (string|null); + } + + /** Represents a ReviewDocumentResponse. */ + class ReviewDocumentResponse implements IReviewDocumentResponse { + + /** + * Constructs a new ReviewDocumentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentResponse); + + /** ReviewDocumentResponse gcsDestination. */ + public gcsDestination: string; + + /** + * Creates a new ReviewDocumentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ReviewDocumentResponse instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentResponse): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + + /** + * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * @param message ReviewDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * @param message ReviewDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + + /** + * Verifies a ReviewDocumentResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReviewDocumentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + + /** + * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. + * @param message ReviewDocumentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReviewDocumentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ReviewDocumentOperationMetadata. */ + interface IReviewDocumentOperationMetadata { + + /** ReviewDocumentOperationMetadata state */ + state?: (google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|null); + + /** ReviewDocumentOperationMetadata stateMessage */ + stateMessage?: (string|null); + + /** ReviewDocumentOperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ReviewDocumentOperationMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** ReviewDocumentOperationMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + } + + /** Represents a ReviewDocumentOperationMetadata. */ + class ReviewDocumentOperationMetadata implements IReviewDocumentOperationMetadata { + + /** + * Constructs a new ReviewDocumentOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata); + + /** ReviewDocumentOperationMetadata state. */ + public state: (google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State); + + /** ReviewDocumentOperationMetadata stateMessage. */ + public stateMessage: string; + + /** ReviewDocumentOperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ReviewDocumentOperationMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** ReviewDocumentOperationMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + + /** + * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ReviewDocumentOperationMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * @param message ReviewDocumentOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * @param message ReviewDocumentOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + + /** + * Verifies a ReviewDocumentOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReviewDocumentOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + + /** + * Creates a plain object from a ReviewDocumentOperationMetadata message. Also converts values to other types if specified. + * @param message ReviewDocumentOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReviewDocumentOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ReviewDocumentOperationMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + CANCELLING = 2, + SUCCEEDED = 3, + FAILED = 4, + CANCELLED = 5 + } + } + + /** Properties of a CommonOperationMetadata. */ + interface ICommonOperationMetadata { + + /** CommonOperationMetadata state */ + state?: (google.cloud.documentai.v1beta3.CommonOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.CommonOperationMetadata.State|null); + + /** CommonOperationMetadata stateMessage */ + stateMessage?: (string|null); + + /** CommonOperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** CommonOperationMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a CommonOperationMetadata. */ + class CommonOperationMetadata implements ICommonOperationMetadata { + + /** + * Constructs a new CommonOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.ICommonOperationMetadata); + + /** CommonOperationMetadata state. */ + public state: (google.cloud.documentai.v1beta3.CommonOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.CommonOperationMetadata.State); + + /** CommonOperationMetadata stateMessage. */ + public stateMessage: string; + + /** CommonOperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); /** CommonOperationMetadata updateTime. */ public updateTime?: (google.protobuf.ITimestamp|null); @@ -20673,6 +22020,360 @@ export namespace google { CANCELLED = 5 } } + + /** Properties of a Processor. */ + interface IProcessor { + + /** Processor name */ + name?: (string|null); + + /** Processor type */ + type?: (string|null); + + /** Processor displayName */ + displayName?: (string|null); + + /** Processor state */ + state?: (google.cloud.documentai.v1beta3.Processor.State|keyof typeof google.cloud.documentai.v1beta3.Processor.State|null); + + /** Processor defaultProcessorVersion */ + defaultProcessorVersion?: (string|null); + + /** Processor processEndpoint */ + processEndpoint?: (string|null); + + /** Processor createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Processor kmsKeyName */ + kmsKeyName?: (string|null); + } + + /** Represents a Processor. */ + class Processor implements IProcessor { + + /** + * Constructs a new Processor. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IProcessor); + + /** Processor name. */ + public name: string; + + /** Processor type. */ + public type: string; + + /** Processor displayName. */ + public displayName: string; + + /** Processor state. */ + public state: (google.cloud.documentai.v1beta3.Processor.State|keyof typeof google.cloud.documentai.v1beta3.Processor.State); + + /** Processor defaultProcessorVersion. */ + public defaultProcessorVersion: string; + + /** Processor processEndpoint. */ + public processEndpoint: string; + + /** Processor createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Processor kmsKeyName. */ + public kmsKeyName: string; + + /** + * Creates a new Processor instance using the specified properties. + * @param [properties] Properties to set + * @returns Processor instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IProcessor): google.cloud.documentai.v1beta3.Processor; + + /** + * Encodes the specified Processor message. Does not implicitly {@link google.cloud.documentai.v1beta3.Processor.verify|verify} messages. + * @param message Processor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IProcessor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Processor message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Processor.verify|verify} messages. + * @param message Processor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IProcessor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Processor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Processor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Processor; + + /** + * Decodes a Processor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Processor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Processor; + + /** + * Verifies a Processor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Processor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Processor + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Processor; + + /** + * Creates a plain object from a Processor message. Also converts values to other types if specified. + * @param message Processor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Processor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Processor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Processor { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + ENABLED = 1, + DISABLED = 2, + ENABLING = 3, + DISABLING = 4, + CREATING = 5, + FAILED = 6, + DELETING = 7 + } + } + + /** Properties of a ProcessorType. */ + interface IProcessorType { + + /** ProcessorType name */ + name?: (string|null); + + /** ProcessorType type */ + type?: (string|null); + + /** ProcessorType category */ + category?: (string|null); + + /** ProcessorType availableLocations */ + availableLocations?: (google.cloud.documentai.v1beta3.ProcessorType.ILocationInfo[]|null); + + /** ProcessorType allowCreation */ + allowCreation?: (boolean|null); + } + + /** Represents a ProcessorType. */ + class ProcessorType implements IProcessorType { + + /** + * Constructs a new ProcessorType. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IProcessorType); + + /** ProcessorType name. */ + public name: string; + + /** ProcessorType type. */ + public type: string; + + /** ProcessorType category. */ + public category: string; + + /** ProcessorType availableLocations. */ + public availableLocations: google.cloud.documentai.v1beta3.ProcessorType.ILocationInfo[]; + + /** ProcessorType allowCreation. */ + public allowCreation: boolean; + + /** + * Creates a new ProcessorType instance using the specified properties. + * @param [properties] Properties to set + * @returns ProcessorType instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IProcessorType): google.cloud.documentai.v1beta3.ProcessorType; + + /** + * Encodes the specified ProcessorType message. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessorType.verify|verify} messages. + * @param message ProcessorType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IProcessorType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProcessorType message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessorType.verify|verify} messages. + * @param message ProcessorType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IProcessorType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProcessorType message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProcessorType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ProcessorType; + + /** + * Decodes a ProcessorType message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProcessorType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ProcessorType; + + /** + * Verifies a ProcessorType message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProcessorType message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProcessorType + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ProcessorType; + + /** + * Creates a plain object from a ProcessorType message. Also converts values to other types if specified. + * @param message ProcessorType + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.ProcessorType, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProcessorType to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ProcessorType { + + /** Properties of a LocationInfo. */ + interface ILocationInfo { + + /** LocationInfo locationId */ + locationId?: (string|null); + } + + /** Represents a LocationInfo. */ + class LocationInfo implements ILocationInfo { + + /** + * Constructs a new LocationInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.ProcessorType.ILocationInfo); + + /** LocationInfo locationId. */ + public locationId: string; + + /** + * Creates a new LocationInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns LocationInfo instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.ProcessorType.ILocationInfo): google.cloud.documentai.v1beta3.ProcessorType.LocationInfo; + + /** + * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessorType.LocationInfo.verify|verify} messages. + * @param message LocationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.ProcessorType.ILocationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessorType.LocationInfo.verify|verify} messages. + * @param message LocationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.ProcessorType.ILocationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LocationInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LocationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ProcessorType.LocationInfo; + + /** + * Decodes a LocationInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LocationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ProcessorType.LocationInfo; + + /** + * Verifies a LocationInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LocationInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ProcessorType.LocationInfo; + + /** + * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. + * @param message LocationInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.ProcessorType.LocationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LocationInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } } } } diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 9016528a7a5..b8d0a78350a 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -38447,6 +38447,7 @@ * @property {Array.|null} [visualElements] Page visualElements * @property {Array.|null} [tables] Page tables * @property {Array.|null} [formFields] Page formFields + * @property {google.cloud.documentai.v1beta3.Document.IProvenance|null} [provenance] Page provenance */ /** @@ -38577,6 +38578,14 @@ */ Page.prototype.formFields = $util.emptyArray; + /** + * Page provenance. + * @member {google.cloud.documentai.v1beta3.Document.IProvenance|null|undefined} provenance + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + */ + Page.prototype.provenance = null; + /** * Creates a new Page instance using the specified properties. * @function create @@ -38636,6 +38645,8 @@ if (message.transforms != null && message.transforms.length) for (var i = 0; i < message.transforms.length; ++i) $root.google.cloud.documentai.v1beta3.Document.Page.Matrix.encode(message.transforms[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) + $root.google.cloud.documentai.v1beta3.Document.Provenance.encode(message.provenance, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); return writer; }; @@ -38727,6 +38738,9 @@ message.formFields = []; message.formFields.push($root.google.cloud.documentai.v1beta3.Document.Page.FormField.decode(reader, reader.uint32())); break; + case 16: + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -38861,6 +38875,11 @@ return "formFields." + error; } } + if (message.provenance != null && message.hasOwnProperty("provenance")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Provenance.verify(message.provenance); + if (error) + return "provenance." + error; + } return null; }; @@ -38983,6 +39002,11 @@ message.formFields[i] = $root.google.cloud.documentai.v1beta3.Document.Page.FormField.fromObject(object.formFields[i]); } } + if (object.provenance != null) { + if (typeof object.provenance !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.provenance: object expected"); + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.fromObject(object.provenance); + } return message; }; @@ -39015,6 +39039,7 @@ object.dimension = null; object.layout = null; object.image = null; + object.provenance = null; } if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) object.pageNumber = message.pageNumber; @@ -39069,6 +39094,8 @@ for (var j = 0; j < message.transforms.length; ++j) object.transforms[j] = $root.google.cloud.documentai.v1beta3.Document.Page.Matrix.toObject(message.transforms[j], options); } + if (message.provenance != null && message.hasOwnProperty("provenance")) + object.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.toObject(message.provenance, options); return object; }; @@ -42546,6 +42573,7 @@ * @property {Array.|null} [nameDetectedLanguages] FormField nameDetectedLanguages * @property {Array.|null} [valueDetectedLanguages] FormField valueDetectedLanguages * @property {string|null} [valueType] FormField valueType + * @property {google.cloud.documentai.v1beta3.Document.IProvenance|null} [provenance] FormField provenance */ /** @@ -42605,6 +42633,14 @@ */ FormField.prototype.valueType = ""; + /** + * FormField provenance. + * @member {google.cloud.documentai.v1beta3.Document.IProvenance|null|undefined} provenance + * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField + * @instance + */ + FormField.prototype.provenance = null; + /** * Creates a new FormField instance using the specified properties. * @function create @@ -42641,6 +42677,8 @@ $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.encode(message.valueDetectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.valueType != null && Object.hasOwnProperty.call(message, "valueType")) writer.uint32(/* id 5, wireType 2 =*/42).string(message.valueType); + if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) + $root.google.cloud.documentai.v1beta3.Document.Provenance.encode(message.provenance, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); return writer; }; @@ -42694,6 +42732,9 @@ case 5: message.valueType = reader.string(); break; + case 8: + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -42760,6 +42801,11 @@ if (message.valueType != null && message.hasOwnProperty("valueType")) if (!$util.isString(message.valueType)) return "valueType: string expected"; + if (message.provenance != null && message.hasOwnProperty("provenance")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Provenance.verify(message.provenance); + if (error) + return "provenance." + error; + } return null; }; @@ -42807,6 +42853,11 @@ } if (object.valueType != null) message.valueType = String(object.valueType); + if (object.provenance != null) { + if (typeof object.provenance !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.FormField.provenance: object expected"); + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.fromObject(object.provenance); + } return message; }; @@ -42831,6 +42882,7 @@ object.fieldName = null; object.fieldValue = null; object.valueType = ""; + object.provenance = null; } if (message.fieldName != null && message.hasOwnProperty("fieldName")) object.fieldName = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.toObject(message.fieldName, options); @@ -42848,6 +42900,8 @@ } if (message.valueType != null && message.hasOwnProperty("valueType")) object.valueType = message.valueType; + if (message.provenance != null && message.hasOwnProperty("provenance")) + object.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.toObject(message.provenance, options); return object; }; @@ -45483,6 +45537,7 @@ * @memberof google.cloud.documentai.v1beta3.Document.Provenance * @interface IParent * @property {number|null} [revision] Parent revision + * @property {number|null} [index] Parent index * @property {number|null} [id] Parent id */ @@ -45509,6 +45564,14 @@ */ Parent.prototype.revision = 0; + /** + * Parent index. + * @member {number} index + * @memberof google.cloud.documentai.v1beta3.Document.Provenance.Parent + * @instance + */ + Parent.prototype.index = 0; + /** * Parent id. * @member {number} id @@ -45545,6 +45608,8 @@ writer.uint32(/* id 1, wireType 0 =*/8).int32(message.revision); if (message.id != null && Object.hasOwnProperty.call(message, "id")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.id); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.index); return writer; }; @@ -45582,6 +45647,9 @@ case 1: message.revision = reader.int32(); break; + case 3: + message.index = reader.int32(); + break; case 2: message.id = reader.int32(); break; @@ -45623,6 +45691,9 @@ if (message.revision != null && message.hasOwnProperty("revision")) if (!$util.isInteger(message.revision)) return "revision: integer expected"; + if (message.index != null && message.hasOwnProperty("index")) + if (!$util.isInteger(message.index)) + return "index: integer expected"; if (message.id != null && message.hasOwnProperty("id")) if (!$util.isInteger(message.id)) return "id: integer expected"; @@ -45643,6 +45714,8 @@ var message = new $root.google.cloud.documentai.v1beta3.Document.Provenance.Parent(); if (object.revision != null) message.revision = object.revision | 0; + if (object.index != null) + message.index = object.index | 0; if (object.id != null) message.id = object.id | 0; return message; @@ -45664,11 +45737,14 @@ if (options.defaults) { object.revision = 0; object.id = 0; + object.index = 0; } if (message.revision != null && message.hasOwnProperty("revision")) object.revision = message.revision; if (message.id != null && message.hasOwnProperty("id")) object.id = message.id; + if (message.index != null && message.hasOwnProperty("index")) + object.index = message.index; return object; }; @@ -48780,6 +48856,204 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#fetchProcessorTypes}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef FetchProcessorTypesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1beta3.FetchProcessorTypesResponse} [response] FetchProcessorTypesResponse + */ + + /** + * Calls FetchProcessorTypes. + * @function fetchProcessorTypes + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest} request FetchProcessorTypesRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.FetchProcessorTypesCallback} callback Node-style callback called with the error, if any, and FetchProcessorTypesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.fetchProcessorTypes = function fetchProcessorTypes(request, callback) { + return this.rpcCall(fetchProcessorTypes, $root.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest, $root.google.cloud.documentai.v1beta3.FetchProcessorTypesResponse, request, callback); + }, "name", { value: "FetchProcessorTypes" }); + + /** + * Calls FetchProcessorTypes. + * @function fetchProcessorTypes + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest} request FetchProcessorTypesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#listProcessors}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef ListProcessorsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1beta3.ListProcessorsResponse} [response] ListProcessorsResponse + */ + + /** + * Calls ListProcessors. + * @function listProcessors + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IListProcessorsRequest} request ListProcessorsRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessorsCallback} callback Node-style callback called with the error, if any, and ListProcessorsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.listProcessors = function listProcessors(request, callback) { + return this.rpcCall(listProcessors, $root.google.cloud.documentai.v1beta3.ListProcessorsRequest, $root.google.cloud.documentai.v1beta3.ListProcessorsResponse, request, callback); + }, "name", { value: "ListProcessors" }); + + /** + * Calls ListProcessors. + * @function listProcessors + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IListProcessorsRequest} request ListProcessorsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#createProcessor}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef CreateProcessorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1beta3.Processor} [response] Processor + */ + + /** + * Calls CreateProcessor. + * @function createProcessor + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.ICreateProcessorRequest} request CreateProcessorRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.CreateProcessorCallback} callback Node-style callback called with the error, if any, and Processor + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.createProcessor = function createProcessor(request, callback) { + return this.rpcCall(createProcessor, $root.google.cloud.documentai.v1beta3.CreateProcessorRequest, $root.google.cloud.documentai.v1beta3.Processor, request, callback); + }, "name", { value: "CreateProcessor" }); + + /** + * Calls CreateProcessor. + * @function createProcessor + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.ICreateProcessorRequest} request CreateProcessorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#deleteProcessor}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef DeleteProcessorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteProcessor. + * @function deleteProcessor + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorRequest} request DeleteProcessorRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.DeleteProcessorCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.deleteProcessor = function deleteProcessor(request, callback) { + return this.rpcCall(deleteProcessor, $root.google.cloud.documentai.v1beta3.DeleteProcessorRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteProcessor" }); + + /** + * Calls DeleteProcessor. + * @function deleteProcessor + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorRequest} request DeleteProcessorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#enableProcessor}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef EnableProcessorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls EnableProcessor. + * @function enableProcessor + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IEnableProcessorRequest} request EnableProcessorRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.EnableProcessorCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.enableProcessor = function enableProcessor(request, callback) { + return this.rpcCall(enableProcessor, $root.google.cloud.documentai.v1beta3.EnableProcessorRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "EnableProcessor" }); + + /** + * Calls EnableProcessor. + * @function enableProcessor + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IEnableProcessorRequest} request EnableProcessorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#disableProcessor}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef DisableProcessorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DisableProcessor. + * @function disableProcessor + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IDisableProcessorRequest} request DisableProcessorRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.DisableProcessorCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.disableProcessor = function disableProcessor(request, callback) { + return this.rpcCall(disableProcessor, $root.google.cloud.documentai.v1beta3.DisableProcessorRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DisableProcessor" }); + + /** + * Calls DisableProcessor. + * @function disableProcessor + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IDisableProcessorRequest} request DisableProcessorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#reviewDocument}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService @@ -51204,26 +51478,24 @@ return BatchProcessMetadata; })(); - v1beta3.ReviewDocumentRequest = (function() { + v1beta3.FetchProcessorTypesRequest = (function() { /** - * Properties of a ReviewDocumentRequest. + * Properties of a FetchProcessorTypesRequest. * @memberof google.cloud.documentai.v1beta3 - * @interface IReviewDocumentRequest - * @property {google.cloud.documentai.v1beta3.IDocument|null} [inlineDocument] ReviewDocumentRequest inlineDocument - * @property {string|null} [humanReviewConfig] ReviewDocumentRequest humanReviewConfig - * @property {google.cloud.documentai.v1beta3.IDocument|null} [document] ReviewDocumentRequest document + * @interface IFetchProcessorTypesRequest + * @property {string|null} [parent] FetchProcessorTypesRequest parent */ /** - * Constructs a new ReviewDocumentRequest. + * Constructs a new FetchProcessorTypesRequest. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a ReviewDocumentRequest. - * @implements IReviewDocumentRequest + * @classdesc Represents a FetchProcessorTypesRequest. + * @implements IFetchProcessorTypesRequest * @constructor - * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest=} [properties] Properties to set */ - function ReviewDocumentRequest(properties) { + function FetchProcessorTypesRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -51231,115 +51503,75 @@ } /** - * ReviewDocumentRequest inlineDocument. - * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} inlineDocument - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest - * @instance - */ - ReviewDocumentRequest.prototype.inlineDocument = null; - - /** - * ReviewDocumentRequest humanReviewConfig. - * @member {string} humanReviewConfig - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest - * @instance - */ - ReviewDocumentRequest.prototype.humanReviewConfig = ""; - - /** - * ReviewDocumentRequest document. - * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} document - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest - * @instance - */ - ReviewDocumentRequest.prototype.document = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * ReviewDocumentRequest source. - * @member {"inlineDocument"|undefined} source - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * FetchProcessorTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesRequest * @instance */ - Object.defineProperty(ReviewDocumentRequest.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["inlineDocument"]), - set: $util.oneOfSetter($oneOfFields) - }); + FetchProcessorTypesRequest.prototype.parent = ""; /** - * Creates a new ReviewDocumentRequest instance using the specified properties. + * Creates a new FetchProcessorTypesRequest instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest instance + * @param {google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.FetchProcessorTypesRequest} FetchProcessorTypesRequest instance */ - ReviewDocumentRequest.create = function create(properties) { - return new ReviewDocumentRequest(properties); + FetchProcessorTypesRequest.create = function create(properties) { + return new FetchProcessorTypesRequest(properties); }; /** - * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * Encodes the specified FetchProcessorTypesRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.FetchProcessorTypesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest} message FetchProcessorTypesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentRequest.encode = function encode(message, writer) { + FetchProcessorTypesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.humanReviewConfig != null && Object.hasOwnProperty.call(message, "humanReviewConfig")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.humanReviewConfig); - if (message.document != null && Object.hasOwnProperty.call(message, "document")) - $root.google.cloud.documentai.v1beta3.Document.encode(message.document, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.inlineDocument != null && Object.hasOwnProperty.call(message, "inlineDocument")) - $root.google.cloud.documentai.v1beta3.Document.encode(message.inlineDocument, 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); return writer; }; /** - * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * Encodes the specified FetchProcessorTypesRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.FetchProcessorTypesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest} message FetchProcessorTypesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + FetchProcessorTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * Decodes a FetchProcessorTypesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + * @returns {google.cloud.documentai.v1beta3.FetchProcessorTypesRequest} FetchProcessorTypesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentRequest.decode = function decode(reader, length) { + FetchProcessorTypesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 4: - message.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); - break; case 1: - message.humanReviewConfig = reader.string(); - break; - case 2: - message.document = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); + message.parent = reader.string(); break; default: reader.skipType(tag & 7); @@ -51350,140 +51582,108 @@ }; /** - * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * Decodes a FetchProcessorTypesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + * @returns {google.cloud.documentai.v1beta3.FetchProcessorTypesRequest} FetchProcessorTypesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + FetchProcessorTypesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReviewDocumentRequest message. + * Verifies a FetchProcessorTypesRequest message. * @function verify - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ReviewDocumentRequest.verify = function verify(message) { + FetchProcessorTypesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { - properties.source = 1; - { - var error = $root.google.cloud.documentai.v1beta3.Document.verify(message.inlineDocument); - if (error) - return "inlineDocument." + error; - } - } - if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) - if (!$util.isString(message.humanReviewConfig)) - return "humanReviewConfig: string expected"; - if (message.document != null && message.hasOwnProperty("document")) { - var error = $root.google.cloud.documentai.v1beta3.Document.verify(message.document); - if (error) - return "document." + error; - } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; return null; }; /** - * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. + * Creates a FetchProcessorTypesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + * @returns {google.cloud.documentai.v1beta3.FetchProcessorTypesRequest} FetchProcessorTypesRequest */ - ReviewDocumentRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest) + FetchProcessorTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest) return object; - var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest(); - if (object.inlineDocument != null) { - if (typeof object.inlineDocument !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentRequest.inlineDocument: object expected"); - message.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.fromObject(object.inlineDocument); - } - if (object.humanReviewConfig != null) - message.humanReviewConfig = String(object.humanReviewConfig); - if (object.document != null) { - if (typeof object.document !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentRequest.document: object expected"); - message.document = $root.google.cloud.documentai.v1beta3.Document.fromObject(object.document); - } + var message = new $root.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest(); + if (object.parent != null) + message.parent = String(object.parent); return message; }; /** - * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. + * Creates a plain object from a FetchProcessorTypesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1beta3.ReviewDocumentRequest} message ReviewDocumentRequest + * @param {google.cloud.documentai.v1beta3.FetchProcessorTypesRequest} message FetchProcessorTypesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReviewDocumentRequest.toObject = function toObject(message, options) { + FetchProcessorTypesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.humanReviewConfig = ""; - object.document = null; - } - if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) - object.humanReviewConfig = message.humanReviewConfig; - if (message.document != null && message.hasOwnProperty("document")) - object.document = $root.google.cloud.documentai.v1beta3.Document.toObject(message.document, options); - if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { - object.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.toObject(message.inlineDocument, options); - if (options.oneofs) - object.source = "inlineDocument"; - } + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; return object; }; /** - * Converts this ReviewDocumentRequest to JSON. + * Converts this FetchProcessorTypesRequest to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesRequest * @instance * @returns {Object.} JSON object */ - ReviewDocumentRequest.prototype.toJSON = function toJSON() { + FetchProcessorTypesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ReviewDocumentRequest; + return FetchProcessorTypesRequest; })(); - v1beta3.ReviewDocumentResponse = (function() { + v1beta3.FetchProcessorTypesResponse = (function() { /** - * Properties of a ReviewDocumentResponse. + * Properties of a FetchProcessorTypesResponse. * @memberof google.cloud.documentai.v1beta3 - * @interface IReviewDocumentResponse - * @property {string|null} [gcsDestination] ReviewDocumentResponse gcsDestination + * @interface IFetchProcessorTypesResponse + * @property {Array.|null} [processorTypes] FetchProcessorTypesResponse processorTypes */ /** - * Constructs a new ReviewDocumentResponse. + * Constructs a new FetchProcessorTypesResponse. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a ReviewDocumentResponse. - * @implements IReviewDocumentResponse + * @classdesc Represents a FetchProcessorTypesResponse. + * @implements IFetchProcessorTypesResponse * @constructor - * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IFetchProcessorTypesResponse=} [properties] Properties to set */ - function ReviewDocumentResponse(properties) { + function FetchProcessorTypesResponse(properties) { + this.processorTypes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -51491,75 +51691,78 @@ } /** - * ReviewDocumentResponse gcsDestination. - * @member {string} gcsDestination - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * FetchProcessorTypesResponse processorTypes. + * @member {Array.} processorTypes + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesResponse * @instance */ - ReviewDocumentResponse.prototype.gcsDestination = ""; + FetchProcessorTypesResponse.prototype.processorTypes = $util.emptyArray; /** - * Creates a new ReviewDocumentResponse instance using the specified properties. + * Creates a new FetchProcessorTypesResponse instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesResponse * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse instance + * @param {google.cloud.documentai.v1beta3.IFetchProcessorTypesResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.FetchProcessorTypesResponse} FetchProcessorTypesResponse instance */ - ReviewDocumentResponse.create = function create(properties) { - return new ReviewDocumentResponse(properties); + FetchProcessorTypesResponse.create = function create(properties) { + return new FetchProcessorTypesResponse(properties); }; /** - * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * Encodes the specified FetchProcessorTypesResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.FetchProcessorTypesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesResponse * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IFetchProcessorTypesResponse} message FetchProcessorTypesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentResponse.encode = function encode(message, writer) { + FetchProcessorTypesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsDestination); + if (message.processorTypes != null && message.processorTypes.length) + for (var i = 0; i < message.processorTypes.length; ++i) + $root.google.cloud.documentai.v1beta3.ProcessorType.encode(message.processorTypes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * Encodes the specified FetchProcessorTypesResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.FetchProcessorTypesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesResponse * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IFetchProcessorTypesResponse} message FetchProcessorTypesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { + FetchProcessorTypesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * Decodes a FetchProcessorTypesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @returns {google.cloud.documentai.v1beta3.FetchProcessorTypesResponse} FetchProcessorTypesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentResponse.decode = function decode(reader, length) { + FetchProcessorTypesResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.FetchProcessorTypesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsDestination = reader.string(); + if (!(message.processorTypes && message.processorTypes.length)) + message.processorTypes = []; + message.processorTypes.push($root.google.cloud.documentai.v1beta3.ProcessorType.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -51570,111 +51773,126 @@ }; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * Decodes a FetchProcessorTypesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @returns {google.cloud.documentai.v1beta3.FetchProcessorTypesResponse} FetchProcessorTypesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentResponse.decodeDelimited = function decodeDelimited(reader) { + FetchProcessorTypesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReviewDocumentResponse message. + * Verifies a FetchProcessorTypesResponse message. * @function verify - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ReviewDocumentResponse.verify = function verify(message) { + FetchProcessorTypesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) - if (!$util.isString(message.gcsDestination)) - return "gcsDestination: string expected"; + if (message.processorTypes != null && message.hasOwnProperty("processorTypes")) { + if (!Array.isArray(message.processorTypes)) + return "processorTypes: array expected"; + for (var i = 0; i < message.processorTypes.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.ProcessorType.verify(message.processorTypes[i]); + if (error) + return "processorTypes." + error; + } + } return null; }; /** - * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * Creates a FetchProcessorTypesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @returns {google.cloud.documentai.v1beta3.FetchProcessorTypesResponse} FetchProcessorTypesResponse */ - ReviewDocumentResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse) + FetchProcessorTypesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.FetchProcessorTypesResponse) return object; - var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse(); - if (object.gcsDestination != null) - message.gcsDestination = String(object.gcsDestination); + var message = new $root.google.cloud.documentai.v1beta3.FetchProcessorTypesResponse(); + if (object.processorTypes) { + if (!Array.isArray(object.processorTypes)) + throw TypeError(".google.cloud.documentai.v1beta3.FetchProcessorTypesResponse.processorTypes: array expected"); + message.processorTypes = []; + for (var i = 0; i < object.processorTypes.length; ++i) { + if (typeof object.processorTypes[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.FetchProcessorTypesResponse.processorTypes: object expected"); + message.processorTypes[i] = $root.google.cloud.documentai.v1beta3.ProcessorType.fromObject(object.processorTypes[i]); + } + } return message; }; /** - * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. + * Creates a plain object from a FetchProcessorTypesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesResponse * @static - * @param {google.cloud.documentai.v1beta3.ReviewDocumentResponse} message ReviewDocumentResponse + * @param {google.cloud.documentai.v1beta3.FetchProcessorTypesResponse} message FetchProcessorTypesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReviewDocumentResponse.toObject = function toObject(message, options) { + FetchProcessorTypesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.gcsDestination = ""; - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) - object.gcsDestination = message.gcsDestination; + if (options.arrays || options.defaults) + object.processorTypes = []; + if (message.processorTypes && message.processorTypes.length) { + object.processorTypes = []; + for (var j = 0; j < message.processorTypes.length; ++j) + object.processorTypes[j] = $root.google.cloud.documentai.v1beta3.ProcessorType.toObject(message.processorTypes[j], options); + } return object; }; /** - * Converts this ReviewDocumentResponse to JSON. + * Converts this FetchProcessorTypesResponse to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesResponse * @instance * @returns {Object.} JSON object */ - ReviewDocumentResponse.prototype.toJSON = function toJSON() { + FetchProcessorTypesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ReviewDocumentResponse; + return FetchProcessorTypesResponse; })(); - v1beta3.ReviewDocumentOperationMetadata = (function() { + v1beta3.ListProcessorsRequest = (function() { /** - * Properties of a ReviewDocumentOperationMetadata. + * Properties of a ListProcessorsRequest. * @memberof google.cloud.documentai.v1beta3 - * @interface IReviewDocumentOperationMetadata - * @property {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|null} [state] ReviewDocumentOperationMetadata state - * @property {string|null} [stateMessage] ReviewDocumentOperationMetadata stateMessage - * @property {google.protobuf.ITimestamp|null} [createTime] ReviewDocumentOperationMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] ReviewDocumentOperationMetadata updateTime - * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] ReviewDocumentOperationMetadata commonMetadata + * @interface IListProcessorsRequest + * @property {string|null} [parent] ListProcessorsRequest parent + * @property {number|null} [pageSize] ListProcessorsRequest pageSize + * @property {string|null} [pageToken] ListProcessorsRequest pageToken */ /** - * Constructs a new ReviewDocumentOperationMetadata. + * Constructs a new ListProcessorsRequest. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a ReviewDocumentOperationMetadata. - * @implements IReviewDocumentOperationMetadata + * @classdesc Represents a ListProcessorsRequest. + * @implements IListProcessorsRequest * @constructor - * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IListProcessorsRequest=} [properties] Properties to set */ - function ReviewDocumentOperationMetadata(properties) { + function ListProcessorsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -51682,127 +51900,101 @@ } /** - * ReviewDocumentOperationMetadata state. - * @member {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State} state - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata - * @instance - */ - ReviewDocumentOperationMetadata.prototype.state = 0; - - /** - * ReviewDocumentOperationMetadata stateMessage. - * @member {string} stateMessage - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata - * @instance - */ - ReviewDocumentOperationMetadata.prototype.stateMessage = ""; - - /** - * ReviewDocumentOperationMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * ListProcessorsRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @instance */ - ReviewDocumentOperationMetadata.prototype.createTime = null; + ListProcessorsRequest.prototype.parent = ""; /** - * ReviewDocumentOperationMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * ListProcessorsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @instance */ - ReviewDocumentOperationMetadata.prototype.updateTime = null; + ListProcessorsRequest.prototype.pageSize = 0; /** - * ReviewDocumentOperationMetadata commonMetadata. - * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * ListProcessorsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @instance */ - ReviewDocumentOperationMetadata.prototype.commonMetadata = null; + ListProcessorsRequest.prototype.pageToken = ""; /** - * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * Creates a new ListProcessorsRequest instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata instance + * @param {google.cloud.documentai.v1beta3.IListProcessorsRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ListProcessorsRequest} ListProcessorsRequest instance */ - ReviewDocumentOperationMetadata.create = function create(properties) { - return new ReviewDocumentOperationMetadata(properties); + ListProcessorsRequest.create = function create(properties) { + return new ListProcessorsRequest(properties); }; /** - * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * Encodes the specified ListProcessorsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IListProcessorsRequest} message ListProcessorsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentOperationMetadata.encode = function encode(message, writer) { + ListProcessorsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) - $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, 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.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 ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * Encodes the specified ListProcessorsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IListProcessorsRequest} message ListProcessorsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + ListProcessorsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * Decodes a ListProcessorsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @returns {google.cloud.documentai.v1beta3.ListProcessorsRequest} ListProcessorsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentOperationMetadata.decode = function decode(reader, length) { + ListProcessorsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ListProcessorsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.state = reader.int32(); + message.parent = reader.string(); break; case 2: - message.stateMessage = reader.string(); + message.pageSize = reader.int32(); break; case 3: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 5: - message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + message.pageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -51813,213 +52005,126 @@ }; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * Decodes a ListProcessorsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @returns {google.cloud.documentai.v1beta3.ListProcessorsRequest} ListProcessorsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + ListProcessorsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReviewDocumentOperationMetadata message. + * Verifies a ListProcessorsRequest message. * @function verify - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ReviewDocumentOperationMetadata.verify = function verify(message) { + ListProcessorsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) - if (!$util.isString(message.stateMessage)) - return "stateMessage: string 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.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { - var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); - if (error) - return "commonMetadata." + 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 ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a ListProcessorsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @returns {google.cloud.documentai.v1beta3.ListProcessorsRequest} ListProcessorsRequest */ - ReviewDocumentOperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata) + ListProcessorsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ListProcessorsRequest) return object; - var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata(); - switch (object.state) { - case "STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "RUNNING": - case 1: - message.state = 1; - break; - case "CANCELLING": - case 2: - message.state = 2; - break; - case "SUCCEEDED": - case 3: - message.state = 3; - break; - case "FAILED": - case 4: - message.state = 4; - break; - case "CANCELLED": - case 5: - message.state = 5; - break; - } - if (object.stateMessage != null) - message.stateMessage = String(object.stateMessage); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.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.documentai.v1beta3.ReviewDocumentOperationMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); - } - if (object.commonMetadata != null) { - if (typeof object.commonMetadata !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.commonMetadata: object expected"); - message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); - } + var message = new $root.google.cloud.documentai.v1beta3.ListProcessorsRequest(); + 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 ReviewDocumentOperationMetadata message. Also converts values to other types if specified. + * Creates a plain object from a ListProcessorsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @static - * @param {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata + * @param {google.cloud.documentai.v1beta3.ListProcessorsRequest} message ListProcessorsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReviewDocumentOperationMetadata.toObject = function toObject(message, options) { + ListProcessorsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; - object.stateMessage = ""; - object.createTime = null; - object.updateTime = null; - object.commonMetadata = null; + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State[message.state] : message.state; - if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) - object.stateMessage = message.stateMessage; - 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.commonMetadata != null && message.hasOwnProperty("commonMetadata")) - object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, 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 ReviewDocumentOperationMetadata to JSON. + * Converts this ListProcessorsRequest to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @instance * @returns {Object.} JSON object */ - ReviewDocumentOperationMetadata.prototype.toJSON = function toJSON() { + ListProcessorsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * State enum. - * @name google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State - * @enum {number} - * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} RUNNING=1 RUNNING value - * @property {number} CANCELLING=2 CANCELLING value - * @property {number} SUCCEEDED=3 SUCCEEDED value - * @property {number} FAILED=4 FAILED value - * @property {number} CANCELLED=5 CANCELLED value - */ - ReviewDocumentOperationMetadata.State = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "RUNNING"] = 1; - values[valuesById[2] = "CANCELLING"] = 2; - values[valuesById[3] = "SUCCEEDED"] = 3; - values[valuesById[4] = "FAILED"] = 4; - values[valuesById[5] = "CANCELLED"] = 5; - return values; - })(); - - return ReviewDocumentOperationMetadata; + return ListProcessorsRequest; })(); - v1beta3.CommonOperationMetadata = (function() { + v1beta3.ListProcessorsResponse = (function() { /** - * Properties of a CommonOperationMetadata. + * Properties of a ListProcessorsResponse. * @memberof google.cloud.documentai.v1beta3 - * @interface ICommonOperationMetadata - * @property {google.cloud.documentai.v1beta3.CommonOperationMetadata.State|null} [state] CommonOperationMetadata state - * @property {string|null} [stateMessage] CommonOperationMetadata stateMessage - * @property {google.protobuf.ITimestamp|null} [createTime] CommonOperationMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] CommonOperationMetadata updateTime + * @interface IListProcessorsResponse + * @property {Array.|null} [processors] ListProcessorsResponse processors + * @property {string|null} [nextPageToken] ListProcessorsResponse nextPageToken */ /** - * Constructs a new CommonOperationMetadata. + * Constructs a new ListProcessorsResponse. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a CommonOperationMetadata. - * @implements ICommonOperationMetadata + * @classdesc Represents a ListProcessorsResponse. + * @implements IListProcessorsResponse * @constructor - * @param {google.cloud.documentai.v1beta3.ICommonOperationMetadata=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IListProcessorsResponse=} [properties] Properties to set */ - function CommonOperationMetadata(properties) { + function ListProcessorsResponse(properties) { + this.processors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -52027,114 +52132,91 @@ } /** - * CommonOperationMetadata state. - * @member {google.cloud.documentai.v1beta3.CommonOperationMetadata.State} state - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata - * @instance - */ - CommonOperationMetadata.prototype.state = 0; - - /** - * CommonOperationMetadata stateMessage. - * @member {string} stateMessage - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata - * @instance - */ - CommonOperationMetadata.prototype.stateMessage = ""; - - /** - * CommonOperationMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * ListProcessorsResponse processors. + * @member {Array.} processors + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @instance */ - CommonOperationMetadata.prototype.createTime = null; + ListProcessorsResponse.prototype.processors = $util.emptyArray; /** - * CommonOperationMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * ListProcessorsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @instance */ - CommonOperationMetadata.prototype.updateTime = null; + ListProcessorsResponse.prototype.nextPageToken = ""; /** - * Creates a new CommonOperationMetadata instance using the specified properties. + * Creates a new ListProcessorsResponse instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @static - * @param {google.cloud.documentai.v1beta3.ICommonOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.CommonOperationMetadata} CommonOperationMetadata instance + * @param {google.cloud.documentai.v1beta3.IListProcessorsResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ListProcessorsResponse} ListProcessorsResponse instance */ - CommonOperationMetadata.create = function create(properties) { - return new CommonOperationMetadata(properties); + ListProcessorsResponse.create = function create(properties) { + return new ListProcessorsResponse(properties); }; /** - * Encodes the specified CommonOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.CommonOperationMetadata.verify|verify} messages. + * Encodes the specified ListProcessorsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @static - * @param {google.cloud.documentai.v1beta3.ICommonOperationMetadata} message CommonOperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IListProcessorsResponse} message ListProcessorsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CommonOperationMetadata.encode = function encode(message, writer) { + ListProcessorsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.processors != null && message.processors.length) + for (var i = 0; i < message.processors.length; ++i) + $root.google.cloud.documentai.v1beta3.Processor.encode(message.processors[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 CommonOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.CommonOperationMetadata.verify|verify} messages. + * Encodes the specified ListProcessorsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @static - * @param {google.cloud.documentai.v1beta3.ICommonOperationMetadata} message CommonOperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IListProcessorsResponse} message ListProcessorsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CommonOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + ListProcessorsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CommonOperationMetadata message from the specified reader or buffer. + * Decodes a ListProcessorsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.CommonOperationMetadata} CommonOperationMetadata + * @returns {google.cloud.documentai.v1beta3.ListProcessorsResponse} ListProcessorsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CommonOperationMetadata.decode = function decode(reader, length) { + ListProcessorsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.CommonOperationMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ListProcessorsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.state = reader.int32(); + if (!(message.processors && message.processors.length)) + message.processors = []; + message.processors.push($root.google.cloud.documentai.v1beta3.Processor.decode(reader, reader.uint32())); break; case 2: - message.stateMessage = reader.string(); - break; - case 3: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.nextPageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -52145,177 +52227,3871 @@ }; /** - * Decodes a CommonOperationMetadata message from the specified reader or buffer, length delimited. + * Decodes a ListProcessorsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.CommonOperationMetadata} CommonOperationMetadata + * @returns {google.cloud.documentai.v1beta3.ListProcessorsResponse} ListProcessorsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CommonOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + ListProcessorsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CommonOperationMetadata message. + * Verifies a ListProcessorsResponse message. * @function verify - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CommonOperationMetadata.verify = function verify(message) { + ListProcessorsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; + if (message.processors != null && message.hasOwnProperty("processors")) { + if (!Array.isArray(message.processors)) + return "processors: array expected"; + for (var i = 0; i < message.processors.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Processor.verify(message.processors[i]); + if (error) + return "processors." + error; } - if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) - if (!$util.isString(message.stateMessage)) - return "stateMessage: string 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.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; return null; }; /** - * Creates a CommonOperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a ListProcessorsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.CommonOperationMetadata} CommonOperationMetadata + * @returns {google.cloud.documentai.v1beta3.ListProcessorsResponse} ListProcessorsResponse */ - CommonOperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.CommonOperationMetadata) + ListProcessorsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ListProcessorsResponse) return object; - var message = new $root.google.cloud.documentai.v1beta3.CommonOperationMetadata(); - switch (object.state) { - case "STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "RUNNING": - case 1: - message.state = 1; - break; - case "CANCELLING": - case 2: - message.state = 2; - break; - case "SUCCEEDED": - case 3: - message.state = 3; - break; - case "FAILED": - case 4: - message.state = 4; - break; - case "CANCELLED": - case 5: - message.state = 5; - break; - } - if (object.stateMessage != null) - message.stateMessage = String(object.stateMessage); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.CommonOperationMetadata.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.documentai.v1beta3.CommonOperationMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + var message = new $root.google.cloud.documentai.v1beta3.ListProcessorsResponse(); + if (object.processors) { + if (!Array.isArray(object.processors)) + throw TypeError(".google.cloud.documentai.v1beta3.ListProcessorsResponse.processors: array expected"); + message.processors = []; + for (var i = 0; i < object.processors.length; ++i) { + if (typeof object.processors[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ListProcessorsResponse.processors: object expected"); + message.processors[i] = $root.google.cloud.documentai.v1beta3.Processor.fromObject(object.processors[i]); + } } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); return message; }; /** - * Creates a plain object from a CommonOperationMetadata message. Also converts values to other types if specified. + * Creates a plain object from a ListProcessorsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @static - * @param {google.cloud.documentai.v1beta3.CommonOperationMetadata} message CommonOperationMetadata + * @param {google.cloud.documentai.v1beta3.ListProcessorsResponse} message ListProcessorsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CommonOperationMetadata.toObject = function toObject(message, options) { + ListProcessorsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; - object.stateMessage = ""; - object.createTime = null; - object.updateTime = null; + if (options.arrays || options.defaults) + object.processors = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.processors && message.processors.length) { + object.processors = []; + for (var j = 0; j < message.processors.length; ++j) + object.processors[j] = $root.google.cloud.documentai.v1beta3.Processor.toObject(message.processors[j], options); } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.State[message.state] : message.state; - if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) - object.stateMessage = message.stateMessage; - 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.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; return object; }; /** - * Converts this CommonOperationMetadata to JSON. + * Converts this ListProcessorsResponse to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @instance * @returns {Object.} JSON object */ - CommonOperationMetadata.prototype.toJSON = function toJSON() { + ListProcessorsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + return ListProcessorsResponse; + })(); + + v1beta3.CreateProcessorRequest = (function() { + /** - * State enum. - * @name google.cloud.documentai.v1beta3.CommonOperationMetadata.State - * @enum {number} - * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} RUNNING=1 RUNNING value - * @property {number} CANCELLING=2 CANCELLING value - * @property {number} SUCCEEDED=3 SUCCEEDED value - * @property {number} FAILED=4 FAILED value - * @property {number} CANCELLED=5 CANCELLED value + * Properties of a CreateProcessorRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface ICreateProcessorRequest + * @property {string|null} [parent] CreateProcessorRequest parent + * @property {google.cloud.documentai.v1beta3.IProcessor|null} [processor] CreateProcessorRequest processor */ - CommonOperationMetadata.State = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "RUNNING"] = 1; - values[valuesById[2] = "CANCELLING"] = 2; - values[valuesById[3] = "SUCCEEDED"] = 3; - values[valuesById[4] = "FAILED"] = 4; - values[valuesById[5] = "CANCELLED"] = 5; - return values; - })(); - return CommonOperationMetadata; + /** + * Constructs a new CreateProcessorRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a CreateProcessorRequest. + * @implements ICreateProcessorRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.ICreateProcessorRequest=} [properties] Properties to set + */ + function CreateProcessorRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateProcessorRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @instance + */ + CreateProcessorRequest.prototype.parent = ""; + + /** + * CreateProcessorRequest processor. + * @member {google.cloud.documentai.v1beta3.IProcessor|null|undefined} processor + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @instance + */ + CreateProcessorRequest.prototype.processor = null; + + /** + * Creates a new CreateProcessorRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.ICreateProcessorRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.CreateProcessorRequest} CreateProcessorRequest instance + */ + CreateProcessorRequest.create = function create(properties) { + return new CreateProcessorRequest(properties); + }; + + /** + * Encodes the specified CreateProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.CreateProcessorRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.ICreateProcessorRequest} message CreateProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProcessorRequest.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.processor != null && Object.hasOwnProperty.call(message, "processor")) + $root.google.cloud.documentai.v1beta3.Processor.encode(message.processor, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.CreateProcessorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.ICreateProcessorRequest} message CreateProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateProcessorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.CreateProcessorRequest} CreateProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProcessorRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.CreateProcessorRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.processor = $root.google.cloud.documentai.v1beta3.Processor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateProcessorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.CreateProcessorRequest} CreateProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateProcessorRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateProcessorRequest.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.processor != null && message.hasOwnProperty("processor")) { + var error = $root.google.cloud.documentai.v1beta3.Processor.verify(message.processor); + if (error) + return "processor." + error; + } + return null; + }; + + /** + * Creates a CreateProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.CreateProcessorRequest} CreateProcessorRequest + */ + CreateProcessorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.CreateProcessorRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta3.CreateProcessorRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.processor != null) { + if (typeof object.processor !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.CreateProcessorRequest.processor: object expected"); + message.processor = $root.google.cloud.documentai.v1beta3.Processor.fromObject(object.processor); + } + return message; + }; + + /** + * Creates a plain object from a CreateProcessorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.CreateProcessorRequest} message CreateProcessorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateProcessorRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.processor = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.processor != null && message.hasOwnProperty("processor")) + object.processor = $root.google.cloud.documentai.v1beta3.Processor.toObject(message.processor, options); + return object; + }; + + /** + * Converts this CreateProcessorRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @instance + * @returns {Object.} JSON object + */ + CreateProcessorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateProcessorRequest; + })(); + + v1beta3.DeleteProcessorRequest = (function() { + + /** + * Properties of a DeleteProcessorRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IDeleteProcessorRequest + * @property {string|null} [name] DeleteProcessorRequest name + */ + + /** + * Constructs a new DeleteProcessorRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a DeleteProcessorRequest. + * @implements IDeleteProcessorRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorRequest=} [properties] Properties to set + */ + function DeleteProcessorRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteProcessorRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @instance + */ + DeleteProcessorRequest.prototype.name = ""; + + /** + * Creates a new DeleteProcessorRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorRequest} DeleteProcessorRequest instance + */ + DeleteProcessorRequest.create = function create(properties) { + return new DeleteProcessorRequest(properties); + }; + + /** + * Encodes the specified DeleteProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorRequest} message DeleteProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorRequest.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 DeleteProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorRequest} message DeleteProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteProcessorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorRequest} DeleteProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DeleteProcessorRequest(); + 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 DeleteProcessorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorRequest} DeleteProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteProcessorRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteProcessorRequest.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 DeleteProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorRequest} DeleteProcessorRequest + */ + DeleteProcessorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DeleteProcessorRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DeleteProcessorRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteProcessorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.DeleteProcessorRequest} message DeleteProcessorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteProcessorRequest.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 DeleteProcessorRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteProcessorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteProcessorRequest; + })(); + + v1beta3.DeleteProcessorMetadata = (function() { + + /** + * Properties of a DeleteProcessorMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @interface IDeleteProcessorMetadata + * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] DeleteProcessorMetadata commonMetadata + */ + + /** + * Constructs a new DeleteProcessorMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a DeleteProcessorMetadata. + * @implements IDeleteProcessorMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorMetadata=} [properties] Properties to set + */ + function DeleteProcessorMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteProcessorMetadata commonMetadata. + * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @instance + */ + DeleteProcessorMetadata.prototype.commonMetadata = null; + + /** + * Creates a new DeleteProcessorMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorMetadata} DeleteProcessorMetadata instance + */ + DeleteProcessorMetadata.create = function create(properties) { + return new DeleteProcessorMetadata(properties); + }; + + /** + * Encodes the specified DeleteProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorMetadata} message DeleteProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DeleteProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorMetadata} message DeleteProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteProcessorMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorMetadata} DeleteProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DeleteProcessorMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteProcessorMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorMetadata} DeleteProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteProcessorMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteProcessorMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates a DeleteProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorMetadata} DeleteProcessorMetadata + */ + DeleteProcessorMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DeleteProcessorMetadata) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DeleteProcessorMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.DeleteProcessorMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from a DeleteProcessorMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.DeleteProcessorMetadata} message DeleteProcessorMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteProcessorMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.commonMetadata = null; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this DeleteProcessorMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @instance + * @returns {Object.} JSON object + */ + DeleteProcessorMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteProcessorMetadata; + })(); + + v1beta3.EnableProcessorRequest = (function() { + + /** + * Properties of an EnableProcessorRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IEnableProcessorRequest + * @property {string|null} [name] EnableProcessorRequest name + */ + + /** + * Constructs a new EnableProcessorRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents an EnableProcessorRequest. + * @implements IEnableProcessorRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.IEnableProcessorRequest=} [properties] Properties to set + */ + function EnableProcessorRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnableProcessorRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @instance + */ + EnableProcessorRequest.prototype.name = ""; + + /** + * Creates a new EnableProcessorRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.IEnableProcessorRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.EnableProcessorRequest} EnableProcessorRequest instance + */ + EnableProcessorRequest.create = function create(properties) { + return new EnableProcessorRequest(properties); + }; + + /** + * Encodes the specified EnableProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.IEnableProcessorRequest} message EnableProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorRequest.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 EnableProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.IEnableProcessorRequest} message EnableProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnableProcessorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.EnableProcessorRequest} EnableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.EnableProcessorRequest(); + 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 an EnableProcessorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.EnableProcessorRequest} EnableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnableProcessorRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnableProcessorRequest.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 EnableProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.EnableProcessorRequest} EnableProcessorRequest + */ + EnableProcessorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.EnableProcessorRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta3.EnableProcessorRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from an EnableProcessorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.EnableProcessorRequest} message EnableProcessorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnableProcessorRequest.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 EnableProcessorRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @instance + * @returns {Object.} JSON object + */ + EnableProcessorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnableProcessorRequest; + })(); + + v1beta3.EnableProcessorResponse = (function() { + + /** + * Properties of an EnableProcessorResponse. + * @memberof google.cloud.documentai.v1beta3 + * @interface IEnableProcessorResponse + */ + + /** + * Constructs a new EnableProcessorResponse. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents an EnableProcessorResponse. + * @implements IEnableProcessorResponse + * @constructor + * @param {google.cloud.documentai.v1beta3.IEnableProcessorResponse=} [properties] Properties to set + */ + function EnableProcessorResponse(properties) { + if (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 EnableProcessorResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @static + * @param {google.cloud.documentai.v1beta3.IEnableProcessorResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.EnableProcessorResponse} EnableProcessorResponse instance + */ + EnableProcessorResponse.create = function create(properties) { + return new EnableProcessorResponse(properties); + }; + + /** + * Encodes the specified EnableProcessorResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @static + * @param {google.cloud.documentai.v1beta3.IEnableProcessorResponse} message EnableProcessorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified EnableProcessorResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @static + * @param {google.cloud.documentai.v1beta3.IEnableProcessorResponse} message EnableProcessorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnableProcessorResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.EnableProcessorResponse} EnableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.EnableProcessorResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnableProcessorResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.EnableProcessorResponse} EnableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnableProcessorResponse message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnableProcessorResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an EnableProcessorResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.EnableProcessorResponse} EnableProcessorResponse + */ + EnableProcessorResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.EnableProcessorResponse) + return object; + return new $root.google.cloud.documentai.v1beta3.EnableProcessorResponse(); + }; + + /** + * Creates a plain object from an EnableProcessorResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @static + * @param {google.cloud.documentai.v1beta3.EnableProcessorResponse} message EnableProcessorResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnableProcessorResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this EnableProcessorResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @instance + * @returns {Object.} JSON object + */ + EnableProcessorResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnableProcessorResponse; + })(); + + v1beta3.EnableProcessorMetadata = (function() { + + /** + * Properties of an EnableProcessorMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @interface IEnableProcessorMetadata + * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] EnableProcessorMetadata commonMetadata + */ + + /** + * Constructs a new EnableProcessorMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents an EnableProcessorMetadata. + * @implements IEnableProcessorMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.IEnableProcessorMetadata=} [properties] Properties to set + */ + function EnableProcessorMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnableProcessorMetadata commonMetadata. + * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @instance + */ + EnableProcessorMetadata.prototype.commonMetadata = null; + + /** + * Creates a new EnableProcessorMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IEnableProcessorMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.EnableProcessorMetadata} EnableProcessorMetadata instance + */ + EnableProcessorMetadata.create = function create(properties) { + return new EnableProcessorMetadata(properties); + }; + + /** + * Encodes the specified EnableProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IEnableProcessorMetadata} message EnableProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnableProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IEnableProcessorMetadata} message EnableProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnableProcessorMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.EnableProcessorMetadata} EnableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.EnableProcessorMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnableProcessorMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.EnableProcessorMetadata} EnableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnableProcessorMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnableProcessorMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates an EnableProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.EnableProcessorMetadata} EnableProcessorMetadata + */ + EnableProcessorMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.EnableProcessorMetadata) + return object; + var message = new $root.google.cloud.documentai.v1beta3.EnableProcessorMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.EnableProcessorMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from an EnableProcessorMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.EnableProcessorMetadata} message EnableProcessorMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnableProcessorMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.commonMetadata = null; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this EnableProcessorMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @instance + * @returns {Object.} JSON object + */ + EnableProcessorMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnableProcessorMetadata; + })(); + + v1beta3.DisableProcessorRequest = (function() { + + /** + * Properties of a DisableProcessorRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IDisableProcessorRequest + * @property {string|null} [name] DisableProcessorRequest name + */ + + /** + * Constructs a new DisableProcessorRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a DisableProcessorRequest. + * @implements IDisableProcessorRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.IDisableProcessorRequest=} [properties] Properties to set + */ + function DisableProcessorRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DisableProcessorRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @instance + */ + DisableProcessorRequest.prototype.name = ""; + + /** + * Creates a new DisableProcessorRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.IDisableProcessorRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DisableProcessorRequest} DisableProcessorRequest instance + */ + DisableProcessorRequest.create = function create(properties) { + return new DisableProcessorRequest(properties); + }; + + /** + * Encodes the specified DisableProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.IDisableProcessorRequest} message DisableProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorRequest.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 DisableProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.IDisableProcessorRequest} message DisableProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DisableProcessorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DisableProcessorRequest} DisableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DisableProcessorRequest(); + 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 DisableProcessorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DisableProcessorRequest} DisableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DisableProcessorRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DisableProcessorRequest.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 DisableProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DisableProcessorRequest} DisableProcessorRequest + */ + DisableProcessorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DisableProcessorRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DisableProcessorRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DisableProcessorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.DisableProcessorRequest} message DisableProcessorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DisableProcessorRequest.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 DisableProcessorRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @instance + * @returns {Object.} JSON object + */ + DisableProcessorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DisableProcessorRequest; + })(); + + v1beta3.DisableProcessorResponse = (function() { + + /** + * Properties of a DisableProcessorResponse. + * @memberof google.cloud.documentai.v1beta3 + * @interface IDisableProcessorResponse + */ + + /** + * Constructs a new DisableProcessorResponse. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a DisableProcessorResponse. + * @implements IDisableProcessorResponse + * @constructor + * @param {google.cloud.documentai.v1beta3.IDisableProcessorResponse=} [properties] Properties to set + */ + function DisableProcessorResponse(properties) { + if (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 DisableProcessorResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @static + * @param {google.cloud.documentai.v1beta3.IDisableProcessorResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DisableProcessorResponse} DisableProcessorResponse instance + */ + DisableProcessorResponse.create = function create(properties) { + return new DisableProcessorResponse(properties); + }; + + /** + * Encodes the specified DisableProcessorResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @static + * @param {google.cloud.documentai.v1beta3.IDisableProcessorResponse} message DisableProcessorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified DisableProcessorResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @static + * @param {google.cloud.documentai.v1beta3.IDisableProcessorResponse} message DisableProcessorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DisableProcessorResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DisableProcessorResponse} DisableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DisableProcessorResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DisableProcessorResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DisableProcessorResponse} DisableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DisableProcessorResponse message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DisableProcessorResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a DisableProcessorResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DisableProcessorResponse} DisableProcessorResponse + */ + DisableProcessorResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DisableProcessorResponse) + return object; + return new $root.google.cloud.documentai.v1beta3.DisableProcessorResponse(); + }; + + /** + * Creates a plain object from a DisableProcessorResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @static + * @param {google.cloud.documentai.v1beta3.DisableProcessorResponse} message DisableProcessorResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DisableProcessorResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this DisableProcessorResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @instance + * @returns {Object.} JSON object + */ + DisableProcessorResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DisableProcessorResponse; + })(); + + v1beta3.DisableProcessorMetadata = (function() { + + /** + * Properties of a DisableProcessorMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @interface IDisableProcessorMetadata + * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] DisableProcessorMetadata commonMetadata + */ + + /** + * Constructs a new DisableProcessorMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a DisableProcessorMetadata. + * @implements IDisableProcessorMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.IDisableProcessorMetadata=} [properties] Properties to set + */ + function DisableProcessorMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DisableProcessorMetadata commonMetadata. + * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @instance + */ + DisableProcessorMetadata.prototype.commonMetadata = null; + + /** + * Creates a new DisableProcessorMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IDisableProcessorMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DisableProcessorMetadata} DisableProcessorMetadata instance + */ + DisableProcessorMetadata.create = function create(properties) { + return new DisableProcessorMetadata(properties); + }; + + /** + * Encodes the specified DisableProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IDisableProcessorMetadata} message DisableProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DisableProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IDisableProcessorMetadata} message DisableProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DisableProcessorMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DisableProcessorMetadata} DisableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DisableProcessorMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DisableProcessorMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DisableProcessorMetadata} DisableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DisableProcessorMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DisableProcessorMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates a DisableProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DisableProcessorMetadata} DisableProcessorMetadata + */ + DisableProcessorMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DisableProcessorMetadata) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DisableProcessorMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.DisableProcessorMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from a DisableProcessorMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.DisableProcessorMetadata} message DisableProcessorMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DisableProcessorMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.commonMetadata = null; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this DisableProcessorMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @instance + * @returns {Object.} JSON object + */ + DisableProcessorMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DisableProcessorMetadata; + })(); + + v1beta3.ReviewDocumentRequest = (function() { + + /** + * Properties of a ReviewDocumentRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IReviewDocumentRequest + * @property {google.cloud.documentai.v1beta3.IDocument|null} [inlineDocument] ReviewDocumentRequest inlineDocument + * @property {string|null} [humanReviewConfig] ReviewDocumentRequest humanReviewConfig + * @property {google.cloud.documentai.v1beta3.IDocument|null} [document] ReviewDocumentRequest document + * @property {boolean|null} [enableSchemaValidation] ReviewDocumentRequest enableSchemaValidation + * @property {google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority|null} [priority] ReviewDocumentRequest priority + */ + + /** + * Constructs a new ReviewDocumentRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ReviewDocumentRequest. + * @implements IReviewDocumentRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest=} [properties] Properties to set + */ + function ReviewDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReviewDocumentRequest inlineDocument. + * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} inlineDocument + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.inlineDocument = null; + + /** + * ReviewDocumentRequest humanReviewConfig. + * @member {string} humanReviewConfig + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.humanReviewConfig = ""; + + /** + * ReviewDocumentRequest document. + * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} document + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.document = null; + + /** + * ReviewDocumentRequest enableSchemaValidation. + * @member {boolean} enableSchemaValidation + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.enableSchemaValidation = false; + + /** + * ReviewDocumentRequest priority. + * @member {google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority} priority + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.priority = 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ReviewDocumentRequest source. + * @member {"inlineDocument"|undefined} source + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + Object.defineProperty(ReviewDocumentRequest.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["inlineDocument"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ReviewDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest instance + */ + ReviewDocumentRequest.create = function create(properties) { + return new ReviewDocumentRequest(properties); + }; + + /** + * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.humanReviewConfig != null && Object.hasOwnProperty.call(message, "humanReviewConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.humanReviewConfig); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.cloud.documentai.v1beta3.Document.encode(message.document, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.enableSchemaValidation != null && Object.hasOwnProperty.call(message, "enableSchemaValidation")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableSchemaValidation); + if (message.inlineDocument != null && Object.hasOwnProperty.call(message, "inlineDocument")) + $root.google.cloud.documentai.v1beta3.Document.encode(message.inlineDocument, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.priority != null && Object.hasOwnProperty.call(message, "priority")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.priority); + return writer; + }; + + /** + * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + message.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); + break; + case 1: + message.humanReviewConfig = reader.string(); + break; + case 2: + message.document = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); + break; + case 3: + message.enableSchemaValidation = reader.bool(); + break; + case 5: + message.priority = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReviewDocumentRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReviewDocumentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { + properties.source = 1; + { + var error = $root.google.cloud.documentai.v1beta3.Document.verify(message.inlineDocument); + if (error) + return "inlineDocument." + error; + } + } + if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) + if (!$util.isString(message.humanReviewConfig)) + return "humanReviewConfig: string expected"; + if (message.document != null && message.hasOwnProperty("document")) { + var error = $root.google.cloud.documentai.v1beta3.Document.verify(message.document); + if (error) + return "document." + error; + } + if (message.enableSchemaValidation != null && message.hasOwnProperty("enableSchemaValidation")) + if (typeof message.enableSchemaValidation !== "boolean") + return "enableSchemaValidation: boolean expected"; + if (message.priority != null && message.hasOwnProperty("priority")) + switch (message.priority) { + default: + return "priority: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + */ + ReviewDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest(); + if (object.inlineDocument != null) { + if (typeof object.inlineDocument !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentRequest.inlineDocument: object expected"); + message.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.fromObject(object.inlineDocument); + } + if (object.humanReviewConfig != null) + message.humanReviewConfig = String(object.humanReviewConfig); + if (object.document != null) { + if (typeof object.document !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentRequest.document: object expected"); + message.document = $root.google.cloud.documentai.v1beta3.Document.fromObject(object.document); + } + if (object.enableSchemaValidation != null) + message.enableSchemaValidation = Boolean(object.enableSchemaValidation); + switch (object.priority) { + case "DEFAULT": + case 0: + message.priority = 0; + break; + case "URGENT": + case 1: + message.priority = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta3.ReviewDocumentRequest} message ReviewDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReviewDocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.humanReviewConfig = ""; + object.document = null; + object.enableSchemaValidation = false; + object.priority = options.enums === String ? "DEFAULT" : 0; + } + if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) + object.humanReviewConfig = message.humanReviewConfig; + if (message.document != null && message.hasOwnProperty("document")) + object.document = $root.google.cloud.documentai.v1beta3.Document.toObject(message.document, options); + if (message.enableSchemaValidation != null && message.hasOwnProperty("enableSchemaValidation")) + object.enableSchemaValidation = message.enableSchemaValidation; + if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { + object.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.toObject(message.inlineDocument, options); + if (options.oneofs) + object.source = "inlineDocument"; + } + if (message.priority != null && message.hasOwnProperty("priority")) + object.priority = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority[message.priority] : message.priority; + return object; + }; + + /** + * Converts this ReviewDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Priority enum. + * @name google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority + * @enum {number} + * @property {number} DEFAULT=0 DEFAULT value + * @property {number} URGENT=1 URGENT value + */ + ReviewDocumentRequest.Priority = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT"] = 0; + values[valuesById[1] = "URGENT"] = 1; + return values; + })(); + + return ReviewDocumentRequest; + })(); + + v1beta3.ReviewDocumentResponse = (function() { + + /** + * Properties of a ReviewDocumentResponse. + * @memberof google.cloud.documentai.v1beta3 + * @interface IReviewDocumentResponse + * @property {string|null} [gcsDestination] ReviewDocumentResponse gcsDestination + */ + + /** + * Constructs a new ReviewDocumentResponse. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ReviewDocumentResponse. + * @implements IReviewDocumentResponse + * @constructor + * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse=} [properties] Properties to set + */ + function ReviewDocumentResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReviewDocumentResponse gcsDestination. + * @member {string} gcsDestination + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @instance + */ + ReviewDocumentResponse.prototype.gcsDestination = ""; + + /** + * Creates a new ReviewDocumentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse instance + */ + ReviewDocumentResponse.create = function create(properties) { + return new ReviewDocumentResponse(properties); + }; + + /** + * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsDestination); + return writer; + }; + + /** + * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsDestination = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReviewDocumentResponse message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReviewDocumentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + if (!$util.isString(message.gcsDestination)) + return "gcsDestination: string expected"; + return null; + }; + + /** + * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + */ + ReviewDocumentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse(); + if (object.gcsDestination != null) + message.gcsDestination = String(object.gcsDestination); + return message; + }; + + /** + * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta3.ReviewDocumentResponse} message ReviewDocumentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReviewDocumentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.gcsDestination = ""; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + object.gcsDestination = message.gcsDestination; + return object; + }; + + /** + * Converts this ReviewDocumentResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ReviewDocumentResponse; + })(); + + v1beta3.ReviewDocumentOperationMetadata = (function() { + + /** + * Properties of a ReviewDocumentOperationMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @interface IReviewDocumentOperationMetadata + * @property {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|null} [state] ReviewDocumentOperationMetadata state + * @property {string|null} [stateMessage] ReviewDocumentOperationMetadata stateMessage + * @property {google.protobuf.ITimestamp|null} [createTime] ReviewDocumentOperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ReviewDocumentOperationMetadata updateTime + * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] ReviewDocumentOperationMetadata commonMetadata + */ + + /** + * Constructs a new ReviewDocumentOperationMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ReviewDocumentOperationMetadata. + * @implements IReviewDocumentOperationMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata=} [properties] Properties to set + */ + function ReviewDocumentOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReviewDocumentOperationMetadata state. + * @member {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State} state + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.state = 0; + + /** + * ReviewDocumentOperationMetadata stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.stateMessage = ""; + + /** + * ReviewDocumentOperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.createTime = null; + + /** + * ReviewDocumentOperationMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.updateTime = null; + + /** + * ReviewDocumentOperationMetadata commonMetadata. + * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.commonMetadata = null; + + /** + * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata instance + */ + ReviewDocumentOperationMetadata.create = function create(properties) { + return new ReviewDocumentOperationMetadata(properties); + }; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.int32(); + break; + case 2: + message.stateMessage = reader.string(); + break; + case 3: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReviewDocumentOperationMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReviewDocumentOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + if (!$util.isString(message.stateMessage)) + return "stateMessage: string 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.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + */ + ReviewDocumentOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "RUNNING": + case 1: + message.state = 1; + break; + case "CANCELLING": + case 2: + message.state = 2; + break; + case "SUCCEEDED": + case 3: + message.state = 3; + break; + case "FAILED": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + } + if (object.stateMessage != null) + message.stateMessage = String(object.stateMessage); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.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.documentai.v1beta3.ReviewDocumentOperationMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from a ReviewDocumentOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReviewDocumentOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.stateMessage = ""; + object.createTime = null; + object.updateTime = null; + object.commonMetadata = null; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State[message.state] : message.state; + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + object.stateMessage = message.stateMessage; + 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.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this ReviewDocumentOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} CANCELLING=2 CANCELLING value + * @property {number} SUCCEEDED=3 SUCCEEDED value + * @property {number} FAILED=4 FAILED value + * @property {number} CANCELLED=5 CANCELLED value + */ + ReviewDocumentOperationMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "CANCELLING"] = 2; + values[valuesById[3] = "SUCCEEDED"] = 3; + values[valuesById[4] = "FAILED"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return ReviewDocumentOperationMetadata; + })(); + + v1beta3.CommonOperationMetadata = (function() { + + /** + * Properties of a CommonOperationMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @interface ICommonOperationMetadata + * @property {google.cloud.documentai.v1beta3.CommonOperationMetadata.State|null} [state] CommonOperationMetadata state + * @property {string|null} [stateMessage] CommonOperationMetadata stateMessage + * @property {google.protobuf.ITimestamp|null} [createTime] CommonOperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] CommonOperationMetadata updateTime + */ + + /** + * Constructs a new CommonOperationMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a CommonOperationMetadata. + * @implements ICommonOperationMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.ICommonOperationMetadata=} [properties] Properties to set + */ + function CommonOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CommonOperationMetadata state. + * @member {google.cloud.documentai.v1beta3.CommonOperationMetadata.State} state + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.state = 0; + + /** + * CommonOperationMetadata stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.stateMessage = ""; + + /** + * CommonOperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.createTime = null; + + /** + * CommonOperationMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.updateTime = null; + + /** + * Creates a new CommonOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.ICommonOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.CommonOperationMetadata} CommonOperationMetadata instance + */ + CommonOperationMetadata.create = function create(properties) { + return new CommonOperationMetadata(properties); + }; + + /** + * Encodes the specified CommonOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.CommonOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.ICommonOperationMetadata} message CommonOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommonOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CommonOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.CommonOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.ICommonOperationMetadata} message CommonOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommonOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CommonOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.CommonOperationMetadata} CommonOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommonOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.CommonOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.int32(); + break; + case 2: + message.stateMessage = reader.string(); + break; + case 3: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CommonOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.CommonOperationMetadata} CommonOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommonOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CommonOperationMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CommonOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + if (!$util.isString(message.stateMessage)) + return "stateMessage: string 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 a CommonOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.CommonOperationMetadata} CommonOperationMetadata + */ + CommonOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.CommonOperationMetadata) + return object; + var message = new $root.google.cloud.documentai.v1beta3.CommonOperationMetadata(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "RUNNING": + case 1: + message.state = 1; + break; + case "CANCELLING": + case 2: + message.state = 2; + break; + case "SUCCEEDED": + case 3: + message.state = 3; + break; + case "FAILED": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + } + if (object.stateMessage != null) + message.stateMessage = String(object.stateMessage); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.CommonOperationMetadata.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.documentai.v1beta3.CommonOperationMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + return message; + }; + + /** + * Creates a plain object from a CommonOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.CommonOperationMetadata} message CommonOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CommonOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.stateMessage = ""; + object.createTime = null; + object.updateTime = null; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.State[message.state] : message.state; + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + object.stateMessage = message.stateMessage; + 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 CommonOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + CommonOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.documentai.v1beta3.CommonOperationMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} CANCELLING=2 CANCELLING value + * @property {number} SUCCEEDED=3 SUCCEEDED value + * @property {number} FAILED=4 FAILED value + * @property {number} CANCELLED=5 CANCELLED value + */ + CommonOperationMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "CANCELLING"] = 2; + values[valuesById[3] = "SUCCEEDED"] = 3; + values[valuesById[4] = "FAILED"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return CommonOperationMetadata; + })(); + + v1beta3.Processor = (function() { + + /** + * Properties of a Processor. + * @memberof google.cloud.documentai.v1beta3 + * @interface IProcessor + * @property {string|null} [name] Processor name + * @property {string|null} [type] Processor type + * @property {string|null} [displayName] Processor displayName + * @property {google.cloud.documentai.v1beta3.Processor.State|null} [state] Processor state + * @property {string|null} [defaultProcessorVersion] Processor defaultProcessorVersion + * @property {string|null} [processEndpoint] Processor processEndpoint + * @property {google.protobuf.ITimestamp|null} [createTime] Processor createTime + * @property {string|null} [kmsKeyName] Processor kmsKeyName + */ + + /** + * Constructs a new Processor. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a Processor. + * @implements IProcessor + * @constructor + * @param {google.cloud.documentai.v1beta3.IProcessor=} [properties] Properties to set + */ + function Processor(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Processor name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.Processor + * @instance + */ + Processor.prototype.name = ""; + + /** + * Processor type. + * @member {string} type + * @memberof google.cloud.documentai.v1beta3.Processor + * @instance + */ + Processor.prototype.type = ""; + + /** + * Processor displayName. + * @member {string} displayName + * @memberof google.cloud.documentai.v1beta3.Processor + * @instance + */ + Processor.prototype.displayName = ""; + + /** + * Processor state. + * @member {google.cloud.documentai.v1beta3.Processor.State} state + * @memberof google.cloud.documentai.v1beta3.Processor + * @instance + */ + Processor.prototype.state = 0; + + /** + * Processor defaultProcessorVersion. + * @member {string} defaultProcessorVersion + * @memberof google.cloud.documentai.v1beta3.Processor + * @instance + */ + Processor.prototype.defaultProcessorVersion = ""; + + /** + * Processor processEndpoint. + * @member {string} processEndpoint + * @memberof google.cloud.documentai.v1beta3.Processor + * @instance + */ + Processor.prototype.processEndpoint = ""; + + /** + * Processor createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1beta3.Processor + * @instance + */ + Processor.prototype.createTime = null; + + /** + * Processor kmsKeyName. + * @member {string} kmsKeyName + * @memberof google.cloud.documentai.v1beta3.Processor + * @instance + */ + Processor.prototype.kmsKeyName = ""; + + /** + * Creates a new Processor instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Processor + * @static + * @param {google.cloud.documentai.v1beta3.IProcessor=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Processor} Processor instance + */ + Processor.create = function create(properties) { + return new Processor(properties); + }; + + /** + * Encodes the specified Processor message. Does not implicitly {@link google.cloud.documentai.v1beta3.Processor.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Processor + * @static + * @param {google.cloud.documentai.v1beta3.IProcessor} message Processor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Processor.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 2, wireType 2 =*/18).string(message.type); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.displayName); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.state); + if (message.processEndpoint != null && Object.hasOwnProperty.call(message, "processEndpoint")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.processEndpoint); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.kmsKeyName); + if (message.defaultProcessorVersion != null && Object.hasOwnProperty.call(message, "defaultProcessorVersion")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.defaultProcessorVersion); + return writer; + }; + + /** + * Encodes the specified Processor message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Processor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Processor + * @static + * @param {google.cloud.documentai.v1beta3.IProcessor} message Processor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Processor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Processor message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Processor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Processor} Processor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Processor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Processor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.type = reader.string(); + break; + case 3: + message.displayName = reader.string(); + break; + case 4: + message.state = reader.int32(); + break; + case 9: + message.defaultProcessorVersion = reader.string(); + break; + case 6: + message.processEndpoint = reader.string(); + break; + case 7: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 8: + message.kmsKeyName = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Processor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Processor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Processor} Processor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Processor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Processor message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Processor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Processor.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.defaultProcessorVersion != null && message.hasOwnProperty("defaultProcessorVersion")) + if (!$util.isString(message.defaultProcessorVersion)) + return "defaultProcessorVersion: string expected"; + if (message.processEndpoint != null && message.hasOwnProperty("processEndpoint")) + if (!$util.isString(message.processEndpoint)) + return "processEndpoint: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + if (!$util.isString(message.kmsKeyName)) + return "kmsKeyName: string expected"; + return null; + }; + + /** + * Creates a Processor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Processor + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Processor} Processor + */ + Processor.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Processor) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Processor(); + if (object.name != null) + message.name = String(object.name); + if (object.type != null) + message.type = String(object.type); + if (object.displayName != null) + message.displayName = String(object.displayName); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "ENABLED": + case 1: + message.state = 1; + break; + case "DISABLED": + case 2: + message.state = 2; + break; + case "ENABLING": + case 3: + message.state = 3; + break; + case "DISABLING": + case 4: + message.state = 4; + break; + case "CREATING": + case 5: + message.state = 5; + break; + case "FAILED": + case 6: + message.state = 6; + break; + case "DELETING": + case 7: + message.state = 7; + break; + } + if (object.defaultProcessorVersion != null) + message.defaultProcessorVersion = String(object.defaultProcessorVersion); + if (object.processEndpoint != null) + message.processEndpoint = String(object.processEndpoint); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Processor.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.kmsKeyName != null) + message.kmsKeyName = String(object.kmsKeyName); + return message; + }; + + /** + * Creates a plain object from a Processor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Processor + * @static + * @param {google.cloud.documentai.v1beta3.Processor} message Processor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Processor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.type = ""; + object.displayName = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.processEndpoint = ""; + object.createTime = null; + object.kmsKeyName = ""; + object.defaultProcessorVersion = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.Processor.State[message.state] : message.state; + if (message.processEndpoint != null && message.hasOwnProperty("processEndpoint")) + object.processEndpoint = message.processEndpoint; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + object.kmsKeyName = message.kmsKeyName; + if (message.defaultProcessorVersion != null && message.hasOwnProperty("defaultProcessorVersion")) + object.defaultProcessorVersion = message.defaultProcessorVersion; + return object; + }; + + /** + * Converts this Processor to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Processor + * @instance + * @returns {Object.} JSON object + */ + Processor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.documentai.v1beta3.Processor.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} ENABLED=1 ENABLED value + * @property {number} DISABLED=2 DISABLED value + * @property {number} ENABLING=3 ENABLING value + * @property {number} DISABLING=4 DISABLING value + * @property {number} CREATING=5 CREATING value + * @property {number} FAILED=6 FAILED value + * @property {number} DELETING=7 DELETING value + */ + Processor.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ENABLED"] = 1; + values[valuesById[2] = "DISABLED"] = 2; + values[valuesById[3] = "ENABLING"] = 3; + values[valuesById[4] = "DISABLING"] = 4; + values[valuesById[5] = "CREATING"] = 5; + values[valuesById[6] = "FAILED"] = 6; + values[valuesById[7] = "DELETING"] = 7; + return values; + })(); + + return Processor; + })(); + + v1beta3.ProcessorType = (function() { + + /** + * Properties of a ProcessorType. + * @memberof google.cloud.documentai.v1beta3 + * @interface IProcessorType + * @property {string|null} [name] ProcessorType name + * @property {string|null} [type] ProcessorType type + * @property {string|null} [category] ProcessorType category + * @property {Array.|null} [availableLocations] ProcessorType availableLocations + * @property {boolean|null} [allowCreation] ProcessorType allowCreation + */ + + /** + * Constructs a new ProcessorType. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ProcessorType. + * @implements IProcessorType + * @constructor + * @param {google.cloud.documentai.v1beta3.IProcessorType=} [properties] Properties to set + */ + function ProcessorType(properties) { + this.availableLocations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProcessorType name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.ProcessorType + * @instance + */ + ProcessorType.prototype.name = ""; + + /** + * ProcessorType type. + * @member {string} type + * @memberof google.cloud.documentai.v1beta3.ProcessorType + * @instance + */ + ProcessorType.prototype.type = ""; + + /** + * ProcessorType category. + * @member {string} category + * @memberof google.cloud.documentai.v1beta3.ProcessorType + * @instance + */ + ProcessorType.prototype.category = ""; + + /** + * ProcessorType availableLocations. + * @member {Array.} availableLocations + * @memberof google.cloud.documentai.v1beta3.ProcessorType + * @instance + */ + ProcessorType.prototype.availableLocations = $util.emptyArray; + + /** + * ProcessorType allowCreation. + * @member {boolean} allowCreation + * @memberof google.cloud.documentai.v1beta3.ProcessorType + * @instance + */ + ProcessorType.prototype.allowCreation = false; + + /** + * Creates a new ProcessorType instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ProcessorType + * @static + * @param {google.cloud.documentai.v1beta3.IProcessorType=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ProcessorType} ProcessorType instance + */ + ProcessorType.create = function create(properties) { + return new ProcessorType(properties); + }; + + /** + * Encodes the specified ProcessorType message. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessorType.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ProcessorType + * @static + * @param {google.cloud.documentai.v1beta3.IProcessorType} message ProcessorType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessorType.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 2, wireType 2 =*/18).string(message.type); + if (message.category != null && Object.hasOwnProperty.call(message, "category")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.category); + if (message.availableLocations != null && message.availableLocations.length) + for (var i = 0; i < message.availableLocations.length; ++i) + $root.google.cloud.documentai.v1beta3.ProcessorType.LocationInfo.encode(message.availableLocations[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allowCreation != null && Object.hasOwnProperty.call(message, "allowCreation")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.allowCreation); + return writer; + }; + + /** + * Encodes the specified ProcessorType message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessorType.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ProcessorType + * @static + * @param {google.cloud.documentai.v1beta3.IProcessorType} message ProcessorType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessorType.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProcessorType message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ProcessorType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ProcessorType} ProcessorType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessorType.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ProcessorType(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.type = reader.string(); + break; + case 3: + message.category = reader.string(); + break; + case 4: + if (!(message.availableLocations && message.availableLocations.length)) + message.availableLocations = []; + message.availableLocations.push($root.google.cloud.documentai.v1beta3.ProcessorType.LocationInfo.decode(reader, reader.uint32())); + break; + case 6: + message.allowCreation = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProcessorType message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ProcessorType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ProcessorType} ProcessorType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessorType.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProcessorType message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ProcessorType + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProcessorType.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.category != null && message.hasOwnProperty("category")) + if (!$util.isString(message.category)) + return "category: string expected"; + if (message.availableLocations != null && message.hasOwnProperty("availableLocations")) { + if (!Array.isArray(message.availableLocations)) + return "availableLocations: array expected"; + for (var i = 0; i < message.availableLocations.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.ProcessorType.LocationInfo.verify(message.availableLocations[i]); + if (error) + return "availableLocations." + error; + } + } + if (message.allowCreation != null && message.hasOwnProperty("allowCreation")) + if (typeof message.allowCreation !== "boolean") + return "allowCreation: boolean expected"; + return null; + }; + + /** + * Creates a ProcessorType message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ProcessorType + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ProcessorType} ProcessorType + */ + ProcessorType.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ProcessorType) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ProcessorType(); + if (object.name != null) + message.name = String(object.name); + if (object.type != null) + message.type = String(object.type); + if (object.category != null) + message.category = String(object.category); + if (object.availableLocations) { + if (!Array.isArray(object.availableLocations)) + throw TypeError(".google.cloud.documentai.v1beta3.ProcessorType.availableLocations: array expected"); + message.availableLocations = []; + for (var i = 0; i < object.availableLocations.length; ++i) { + if (typeof object.availableLocations[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ProcessorType.availableLocations: object expected"); + message.availableLocations[i] = $root.google.cloud.documentai.v1beta3.ProcessorType.LocationInfo.fromObject(object.availableLocations[i]); + } + } + if (object.allowCreation != null) + message.allowCreation = Boolean(object.allowCreation); + return message; + }; + + /** + * Creates a plain object from a ProcessorType message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ProcessorType + * @static + * @param {google.cloud.documentai.v1beta3.ProcessorType} message ProcessorType + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProcessorType.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.availableLocations = []; + if (options.defaults) { + object.name = ""; + object.type = ""; + object.category = ""; + object.allowCreation = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.category != null && message.hasOwnProperty("category")) + object.category = message.category; + if (message.availableLocations && message.availableLocations.length) { + object.availableLocations = []; + for (var j = 0; j < message.availableLocations.length; ++j) + object.availableLocations[j] = $root.google.cloud.documentai.v1beta3.ProcessorType.LocationInfo.toObject(message.availableLocations[j], options); + } + if (message.allowCreation != null && message.hasOwnProperty("allowCreation")) + object.allowCreation = message.allowCreation; + return object; + }; + + /** + * Converts this ProcessorType to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ProcessorType + * @instance + * @returns {Object.} JSON object + */ + ProcessorType.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + ProcessorType.LocationInfo = (function() { + + /** + * Properties of a LocationInfo. + * @memberof google.cloud.documentai.v1beta3.ProcessorType + * @interface ILocationInfo + * @property {string|null} [locationId] LocationInfo locationId + */ + + /** + * Constructs a new LocationInfo. + * @memberof google.cloud.documentai.v1beta3.ProcessorType + * @classdesc Represents a LocationInfo. + * @implements ILocationInfo + * @constructor + * @param {google.cloud.documentai.v1beta3.ProcessorType.ILocationInfo=} [properties] Properties to set + */ + function LocationInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LocationInfo locationId. + * @member {string} locationId + * @memberof google.cloud.documentai.v1beta3.ProcessorType.LocationInfo + * @instance + */ + LocationInfo.prototype.locationId = ""; + + /** + * Creates a new LocationInfo instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ProcessorType.LocationInfo + * @static + * @param {google.cloud.documentai.v1beta3.ProcessorType.ILocationInfo=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ProcessorType.LocationInfo} LocationInfo instance + */ + LocationInfo.create = function create(properties) { + return new LocationInfo(properties); + }; + + /** + * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessorType.LocationInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ProcessorType.LocationInfo + * @static + * @param {google.cloud.documentai.v1beta3.ProcessorType.ILocationInfo} message LocationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocationInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.locationId != null && Object.hasOwnProperty.call(message, "locationId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.locationId); + return writer; + }; + + /** + * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessorType.LocationInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ProcessorType.LocationInfo + * @static + * @param {google.cloud.documentai.v1beta3.ProcessorType.ILocationInfo} message LocationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocationInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LocationInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ProcessorType.LocationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ProcessorType.LocationInfo} LocationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ProcessorType.LocationInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.locationId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LocationInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ProcessorType.LocationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ProcessorType.LocationInfo} LocationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LocationInfo message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ProcessorType.LocationInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LocationInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.locationId != null && message.hasOwnProperty("locationId")) + if (!$util.isString(message.locationId)) + return "locationId: string expected"; + return null; + }; + + /** + * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ProcessorType.LocationInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ProcessorType.LocationInfo} LocationInfo + */ + LocationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ProcessorType.LocationInfo) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ProcessorType.LocationInfo(); + if (object.locationId != null) + message.locationId = String(object.locationId); + return message; + }; + + /** + * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ProcessorType.LocationInfo + * @static + * @param {google.cloud.documentai.v1beta3.ProcessorType.LocationInfo} message LocationInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LocationInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.locationId = ""; + if (message.locationId != null && message.hasOwnProperty("locationId")) + object.locationId = message.locationId; + return object; + }; + + /** + * Converts this LocationInfo to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ProcessorType.LocationInfo + * @instance + * @returns {Object.} JSON object + */ + LocationInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LocationInfo; + })(); + + return ProcessorType; })(); return v1beta3; diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index d21a9a1d180..0210786328c 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -3117,7 +3117,7 @@ "csharp_namespace": "Google.Cloud.DocumentAI.V1Beta3", "go_package": "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai", "java_multiple_files": true, - "java_outer_classname": "OperationMetadataProto", + "java_outer_classname": "DocumentAiProcessorType", "java_package": "com.google.cloud.documentai.v1beta3", "php_namespace": "Google\\Cloud\\DocumentAI\\V1beta3", "ruby_package": "Google::Cloud::DocumentAI::V1beta3", @@ -3324,6 +3324,10 @@ "rule": "repeated", "type": "FormField", "id": 11 + }, + "provenance": { + "type": "Provenance", + "id": 16 } }, "nested": { @@ -3601,6 +3605,10 @@ "valueType": { "type": "string", "id": 5 + }, + "provenance": { + "type": "Provenance", + "id": 8 } } }, @@ -3857,7 +3865,10 @@ }, "id": { "type": "int32", - "id": 2 + "id": 2, + "options": { + "deprecated": true + } }, "parents": { "rule": "repeated", @@ -3876,9 +3887,16 @@ "type": "int32", "id": 1 }, + "index": { + "type": "int32", + "id": 3 + }, "id": { "type": "int32", - "id": 2 + "id": 2, + "options": { + "deprecated": true + } } } }, @@ -4143,6 +4161,136 @@ } ] }, + "FetchProcessorTypes": { + "requestType": "FetchProcessorTypesRequest", + "responseType": "FetchProcessorTypesResponse", + "options": { + "(google.api.http).get": "/v1beta3/{parent=projects/*/locations/*}:fetchProcessorTypes", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta3/{parent=projects/*/locations/*}:fetchProcessorTypes" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "ListProcessors": { + "requestType": "ListProcessorsRequest", + "responseType": "ListProcessorsResponse", + "options": { + "(google.api.http).get": "/v1beta3/{parent=projects/*/locations/*}/processors", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta3/{parent=projects/*/locations/*}/processors" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "CreateProcessor": { + "requestType": "CreateProcessorRequest", + "responseType": "Processor", + "options": { + "(google.api.http).post": "/v1beta3/{parent=projects/*/locations/*}/processors", + "(google.api.http).body": "processor", + "(google.api.method_signature)": "parent,processor" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta3/{parent=projects/*/locations/*}/processors", + "body": "processor" + } + }, + { + "(google.api.method_signature)": "parent,processor" + } + ] + }, + "DeleteProcessor": { + "requestType": "DeleteProcessorRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v1beta3/{name=projects/*/locations/*/processors/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "DeleteProcessorMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1beta3/{name=projects/*/locations/*/processors/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "DeleteProcessorMetadata" + } + } + ] + }, + "EnableProcessor": { + "requestType": "EnableProcessorRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1beta3/{name=projects/*/locations/*/processors/*}:enable", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "EnableProcessorResponse", + "(google.longrunning.operation_info).metadata_type": "EnableProcessorMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta3/{name=projects/*/locations/*/processors/*}:enable", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "EnableProcessorResponse", + "metadata_type": "EnableProcessorMetadata" + } + } + ] + }, + "DisableProcessor": { + "requestType": "DisableProcessorRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1beta3/{name=projects/*/locations/*/processors/*}:disable", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "DisableProcessorResponse", + "(google.longrunning.operation_info).metadata_type": "DisableProcessorMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta3/{name=projects/*/locations/*/processors/*}:disable", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "DisableProcessorResponse", + "metadata_type": "DisableProcessorMetadata" + } + } + ] + }, "ReviewDocument": { "requestType": "ReviewDocumentRequest", "responseType": "google.longrunning.Operation", @@ -4393,6 +4541,145 @@ } } }, + "FetchProcessorTypesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "documentai.googleapis.com/ProcessorType" + } + } + } + }, + "FetchProcessorTypesResponse": { + "fields": { + "processorTypes": { + "rule": "repeated", + "type": "ProcessorType", + "id": 1 + } + } + }, + "ListProcessorsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "documentai.googleapis.com/Processor" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListProcessorsResponse": { + "fields": { + "processors": { + "rule": "repeated", + "type": "Processor", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "CreateProcessorRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "documentai.googleapis.com/Processor" + } + }, + "processor": { + "type": "Processor", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteProcessorRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + } + } + } + }, + "DeleteProcessorMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 5 + } + } + }, + "EnableProcessorRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + } + } + } + }, + "EnableProcessorResponse": { + "fields": {} + }, + "EnableProcessorMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 5 + } + } + }, + "DisableProcessorRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + } + } + } + }, + "DisableProcessorResponse": { + "fields": {} + }, + "DisableProcessorMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 5 + } + } + }, "ReviewDocumentRequest": { "oneofs": { "source": { @@ -4420,6 +4707,22 @@ "options": { "deprecated": true } + }, + "enableSchemaValidation": { + "type": "bool", + "id": 3 + }, + "priority": { + "type": "Priority", + "id": 5 + } + }, + "nested": { + "Priority": { + "values": { + "DEFAULT": 0, + "URGENT": 1 + } } } }, @@ -4498,6 +4801,108 @@ } } } + }, + "Processor": { + "options": { + "(google.api.resource).type": "documentai.googleapis.com/Processor", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/processors/{processor}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "type": { + "type": "string", + "id": 2 + }, + "displayName": { + "type": "string", + "id": 3 + }, + "state": { + "type": "State", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "defaultProcessorVersion": { + "type": "string", + "id": 9 + }, + "processEndpoint": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 7 + }, + "kmsKeyName": { + "type": "string", + "id": 8 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "ENABLED": 1, + "DISABLED": 2, + "ENABLING": 3, + "DISABLING": 4, + "CREATING": 5, + "FAILED": 6, + "DELETING": 7 + } + } + } + }, + "ProcessorType": { + "options": { + "(google.api.resource).type": "documentai.googleapis.com/ProcessorType", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/processorTypes/{processor_type}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "type": { + "type": "string", + "id": 2 + }, + "category": { + "type": "string", + "id": 3 + }, + "availableLocations": { + "rule": "repeated", + "type": "LocationInfo", + "id": 4 + }, + "allowCreation": { + "type": "bool", + "id": 6 + } + }, + "nested": { + "LocationInfo": { + "fields": { + "locationId": { + "type": "string", + "id": 1 + } + } + } + } } } } diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index 877a98aae0d..54b644d3a77 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_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'); /** @@ -153,9 +157,29 @@ export class DocumentProcessorServiceClient { humanReviewConfigPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig' ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), processorPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/processors/{processor}' ), + processorTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/processorTypes/{processor_type}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + }; + + // 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 = { + listProcessors: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'processors' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -176,6 +200,24 @@ export class DocumentProcessorServiceClient { const batchProcessDocumentsMetadata = protoFilesRoot.lookup( '.google.cloud.documentai.v1beta3.BatchProcessMetadata' ) as gax.protobuf.Type; + const deleteProcessorResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const deleteProcessorMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta3.DeleteProcessorMetadata' + ) as gax.protobuf.Type; + const enableProcessorResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta3.EnableProcessorResponse' + ) as gax.protobuf.Type; + const enableProcessorMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta3.EnableProcessorMetadata' + ) as gax.protobuf.Type; + const disableProcessorResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta3.DisableProcessorResponse' + ) as gax.protobuf.Type; + const disableProcessorMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta3.DisableProcessorMetadata' + ) as gax.protobuf.Type; const reviewDocumentResponse = protoFilesRoot.lookup( '.google.cloud.documentai.v1beta3.ReviewDocumentResponse' ) as gax.protobuf.Type; @@ -191,6 +233,21 @@ export class DocumentProcessorServiceClient { ), batchProcessDocumentsMetadata.decode.bind(batchProcessDocumentsMetadata) ), + deleteProcessor: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteProcessorResponse.decode.bind(deleteProcessorResponse), + deleteProcessorMetadata.decode.bind(deleteProcessorMetadata) + ), + enableProcessor: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + enableProcessorResponse.decode.bind(enableProcessorResponse), + enableProcessorMetadata.decode.bind(enableProcessorMetadata) + ), + disableProcessor: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + disableProcessorResponse.decode.bind(disableProcessorResponse), + disableProcessorMetadata.decode.bind(disableProcessorMetadata) + ), reviewDocument: new this._gaxModule.LongrunningDescriptor( this.operationsClient, reviewDocumentResponse.decode.bind(reviewDocumentResponse), @@ -247,6 +304,12 @@ export class DocumentProcessorServiceClient { const documentProcessorServiceStubMethods = [ 'processDocument', 'batchProcessDocuments', + 'fetchProcessorTypes', + 'listProcessors', + 'createProcessor', + 'deleteProcessor', + 'enableProcessor', + 'disableProcessor', 'reviewDocument', ]; for (const methodName of documentProcessorServiceStubMethods) { @@ -264,7 +327,10 @@ export class DocumentProcessorServiceClient { } ); - 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], @@ -424,6 +490,206 @@ export class DocumentProcessorServiceClient { this.initialize(); return this.innerApiCalls.processDocument(request, options, callback); } + fetchProcessorTypes( + request: protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesResponse, + ( + | protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest + | undefined + ), + {} | undefined + ] + >; + fetchProcessorTypes( + request: protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesResponse, + | protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + fetchProcessorTypes( + request: protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest, + callback: Callback< + protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesResponse, + | protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Fetches processor types. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project of processor type to list. + * Format: projects/{project}/locations/{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 [FetchProcessorTypesResponse]{@link google.cloud.documentai.v1beta3.FetchProcessorTypesResponse}. + * 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.fetchProcessorTypes(request); + */ + fetchProcessorTypes( + request: protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesResponse, + | protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesResponse, + | protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesResponse, + ( + | protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest + | 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.fetchProcessorTypes(request, options, callback); + } + createProcessor( + request: protos.google.cloud.documentai.v1beta3.ICreateProcessorRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IProcessor, + ( + | protos.google.cloud.documentai.v1beta3.ICreateProcessorRequest + | undefined + ), + {} | undefined + ] + >; + createProcessor( + request: protos.google.cloud.documentai.v1beta3.ICreateProcessorRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.documentai.v1beta3.IProcessor, + | protos.google.cloud.documentai.v1beta3.ICreateProcessorRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createProcessor( + request: protos.google.cloud.documentai.v1beta3.ICreateProcessorRequest, + callback: Callback< + protos.google.cloud.documentai.v1beta3.IProcessor, + | protos.google.cloud.documentai.v1beta3.ICreateProcessorRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Creates a processor from the type processor that the user chose. + * The processor will be at "ENABLED" state by default after its creation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) under which to create the processor. + * Format: projects/{project}/locations/{location} + * @param {google.cloud.documentai.v1beta3.Processor} request.processor + * Required. The processor to be created, requires [processor_type] and [display_name] + * to be set. Also, the processor is under CMEK if CMEK fields are set. + * @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 [Processor]{@link google.cloud.documentai.v1beta3.Processor}. + * 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.createProcessor(request); + */ + createProcessor( + request: protos.google.cloud.documentai.v1beta3.ICreateProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.documentai.v1beta3.IProcessor, + | protos.google.cloud.documentai.v1beta3.ICreateProcessorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.documentai.v1beta3.IProcessor, + | protos.google.cloud.documentai.v1beta3.ICreateProcessorRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IProcessor, + ( + | protos.google.cloud.documentai.v1beta3.ICreateProcessorRequest + | 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.createProcessor(request, options, callback); + } batchProcessDocuments( request: protos.google.cloud.documentai.v1beta3.IBatchProcessRequest, @@ -578,55 +844,50 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1beta3.BatchProcessMetadata >; } - reviewDocument( - request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + deleteProcessor( + request: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, options?: CallOptions ): Promise< [ LROperation< - protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, - protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] >; - reviewDocument( - request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + deleteProcessor( + request: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, options: CallOptions, callback: Callback< LROperation< - protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, - protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; - reviewDocument( - request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + deleteProcessor( + request: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, callback: Callback< LROperation< - protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, - protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; /** - * Send a document for Human Review. The input document should be processed by - * the specified processor. + * Deletes the processor, unloads all deployed model artifacts if it was + * enabled and then deletes all artifacts associated with this processor. * * @param {Object} request * The request object that will be sent. - * @param {google.cloud.documentai.v1beta3.Document} request.inlineDocument - * An inline document proto. - * @param {string} request.humanReviewConfig - * Required. The resource name of the HumanReviewConfig that the document will be - * reviewed with. - * @param {google.cloud.documentai.v1beta3.Document} request.document - * The document that needs human review. + * @param {string} request.name + * Required. The processor resource name to 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. @@ -637,25 +898,25 @@ export class DocumentProcessorServiceClient { * [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.reviewDocument(request); + * const [operation] = await client.deleteProcessor(request); * const [response] = await operation.promise(); */ - reviewDocument( - request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + deleteProcessor( + request: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, optionsOrCallback?: | CallOptions | Callback< LROperation< - protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, - protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined >, callback?: Callback< LROperation< - protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, - protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined @@ -663,8 +924,8 @@ export class DocumentProcessorServiceClient { ): Promise< [ LROperation< - protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, - protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined @@ -683,13 +944,13 @@ export class DocumentProcessorServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ - human_review_config: request.humanReviewConfig || '', + name: request.name || '', }); this.initialize(); - return this.innerApiCalls.reviewDocument(request, options, callback); + return this.innerApiCalls.deleteProcessor(request, options, callback); } /** - * Check the status of the long running operation returned by `reviewDocument()`. + * Check the status of the long running operation returned by `deleteProcessor()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. @@ -698,17 +959,17 @@ export class DocumentProcessorServiceClient { * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example - * const decodedOperation = await checkReviewDocumentProgress(name); + * const decodedOperation = await checkDeleteProcessorProgress(name); * console.log(decodedOperation.result); * console.log(decodedOperation.done); * console.log(decodedOperation.metadata); */ - async checkReviewDocumentProgress( + async checkDeleteProcessorProgress( name: string ): Promise< LROperation< - protos.google.cloud.documentai.v1beta3.ReviewDocumentResponse, - protos.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + protos.google.protobuf.Empty, + protos.google.cloud.documentai.v1beta3.DeleteProcessorMetadata > > { const request = new operationsProtos.google.longrunning.GetOperationRequest( @@ -717,55 +978,691 @@ export class DocumentProcessorServiceClient { const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new gax.Operation( operation, - this.descriptors.longrunning.reviewDocument, + this.descriptors.longrunning.deleteProcessor, gax.createDefaultBackoffSettings() ); return decodeOperation as LROperation< - protos.google.cloud.documentai.v1beta3.ReviewDocumentResponse, - protos.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + protos.google.protobuf.Empty, + protos.google.cloud.documentai.v1beta3.DeleteProcessorMetadata >; } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified humanReviewConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} processor - * @returns {string} Resource name string. - */ - humanReviewConfigPath(project: string, location: string, processor: string) { - return this.pathTemplates.humanReviewConfigPathTemplate.render({ - project: project, - location: location, - processor: processor, - }); - } - - /** - * Parse the project from HumanReviewConfig resource. - * - * @param {string} humanReviewConfigName - * A fully-qualified path representing HumanReviewConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromHumanReviewConfigName(humanReviewConfigName: string) { - return this.pathTemplates.humanReviewConfigPathTemplate.match( - humanReviewConfigName - ).project; - } - + enableProcessor( + request: protos.google.cloud.documentai.v1beta3.IEnableProcessorRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + enableProcessor( + request: protos.google.cloud.documentai.v1beta3.IEnableProcessorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + enableProcessor( + request: protos.google.cloud.documentai.v1beta3.IEnableProcessorRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; /** - * Parse the location from HumanReviewConfig resource. + * Enables a processor * - * @param {string} humanReviewConfigName - * A fully-qualified path representing HumanReviewConfig resource. - * @returns {string} A string representing the location. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name to be enabled. + * @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.enableProcessor(request); + * const [response] = await operation.promise(); */ - matchLocationFromHumanReviewConfigName(humanReviewConfigName: string) { + enableProcessor( + request: protos.google.cloud.documentai.v1beta3.IEnableProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + >, + 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.enableProcessor(request, options, callback); + } + /** + * Check the status of the long running operation returned by `enableProcessor()`. + * @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 checkEnableProcessorProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkEnableProcessorProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1beta3.EnableProcessorResponse, + protos.google.cloud.documentai.v1beta3.EnableProcessorMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.enableProcessor, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1beta3.EnableProcessorResponse, + protos.google.cloud.documentai.v1beta3.EnableProcessorMetadata + >; + } + disableProcessor( + request: protos.google.cloud.documentai.v1beta3.IDisableProcessorRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + disableProcessor( + request: protos.google.cloud.documentai.v1beta3.IDisableProcessorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + disableProcessor( + request: protos.google.cloud.documentai.v1beta3.IDisableProcessorRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Disables a processor + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name to be disabled. + * @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.disableProcessor(request); + * const [response] = await operation.promise(); + */ + disableProcessor( + request: protos.google.cloud.documentai.v1beta3.IDisableProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + >, + 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.disableProcessor(request, options, callback); + } + /** + * Check the status of the long running operation returned by `disableProcessor()`. + * @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 checkDisableProcessorProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkDisableProcessorProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1beta3.DisableProcessorResponse, + protos.google.cloud.documentai.v1beta3.DisableProcessorMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.disableProcessor, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1beta3.DisableProcessorResponse, + protos.google.cloud.documentai.v1beta3.DisableProcessorMetadata + >; + } + reviewDocument( + request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + reviewDocument( + request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + reviewDocument( + request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Send a document for Human Review. The input document should be processed by + * the specified processor. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.documentai.v1beta3.Document} request.inlineDocument + * An inline document proto. + * @param {string} request.humanReviewConfig + * Required. The resource name of the HumanReviewConfig that the document will be + * reviewed with. + * @param {google.cloud.documentai.v1beta3.Document} request.document + * The document that needs human review. + * @param {boolean} request.enableSchemaValidation + * Whether the validation should be performed on the ad-hoc review request. + * @param {google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority} request.priority + * The priority of the human review task. + * @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.reviewDocument(request); + * const [response] = await operation.promise(); + */ + reviewDocument( + request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >, + 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({ + human_review_config: request.humanReviewConfig || '', + }); + this.initialize(); + return this.innerApiCalls.reviewDocument(request, options, callback); + } + /** + * Check the status of the long running operation returned by `reviewDocument()`. + * @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 checkReviewDocumentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkReviewDocumentProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1beta3.ReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.reviewDocument, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1beta3.ReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + >; + } + listProcessors( + request: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IProcessor[], + protos.google.cloud.documentai.v1beta3.IListProcessorsRequest | null, + protos.google.cloud.documentai.v1beta3.IListProcessorsResponse + ] + >; + listProcessors( + request: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + | protos.google.cloud.documentai.v1beta3.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.documentai.v1beta3.IProcessor + > + ): void; + listProcessors( + request: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + callback: PaginationCallback< + protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + | protos.google.cloud.documentai.v1beta3.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.documentai.v1beta3.IProcessor + > + ): void; + /** + * Lists all processors which belong to this project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) which owns this collection of Processors. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * The maximum number of processors to return. + * If unspecified, at most 50 processors will be returned. + * The maximum value is 100; values above 100 will be coerced to 100. + * @param {string} request.pageToken + * We will return the processors sorted by creation time. The page token + * will point to the next processor. + * @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 [Processor]{@link google.cloud.documentai.v1beta3.Processor}. + * 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 `listProcessorsAsync()` + * 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. + */ + listProcessors( + request: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + | protos.google.cloud.documentai.v1beta3.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.documentai.v1beta3.IProcessor + >, + callback?: PaginationCallback< + protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + | protos.google.cloud.documentai.v1beta3.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.documentai.v1beta3.IProcessor + > + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IProcessor[], + protos.google.cloud.documentai.v1beta3.IListProcessorsRequest | null, + protos.google.cloud.documentai.v1beta3.IListProcessorsResponse + ] + > | 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.listProcessors(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 (project and location) which owns this collection of Processors. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * The maximum number of processors to return. + * If unspecified, at most 50 processors will be returned. + * The maximum value is 100; values above 100 will be coerced to 100. + * @param {string} request.pageToken + * We will return the processors sorted by creation time. The page token + * will point to the next processor. + * @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 [Processor]{@link google.cloud.documentai.v1beta3.Processor} 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 `listProcessorsAsync()` + * 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. + */ + listProcessorsStream( + request?: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + 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.listProcessors.createStream( + this.innerApiCalls.listProcessors as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listProcessors`, 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 (project and location) which owns this collection of Processors. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * The maximum number of processors to return. + * If unspecified, at most 50 processors will be returned. + * The maximum value is 100; values above 100 will be coerced to 100. + * @param {string} request.pageToken + * We will return the processors sorted by creation time. The page token + * will point to the next processor. + * @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 + * [Processor]{@link google.cloud.documentai.v1beta3.Processor}. 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.listProcessorsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listProcessorsAsync( + request?: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + 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.listProcessors.asyncIterate( + this.innerApiCalls['listProcessors'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified humanReviewConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} processor + * @returns {string} Resource name string. + */ + humanReviewConfigPath(project: string, location: string, processor: string) { + return this.pathTemplates.humanReviewConfigPathTemplate.render({ + project: project, + location: location, + processor: processor, + }); + } + + /** + * Parse the project from HumanReviewConfig resource. + * + * @param {string} humanReviewConfigName + * A fully-qualified path representing HumanReviewConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromHumanReviewConfigName(humanReviewConfigName: string) { + return this.pathTemplates.humanReviewConfigPathTemplate.match( + humanReviewConfigName + ).project; + } + + /** + * Parse the location from HumanReviewConfig resource. + * + * @param {string} humanReviewConfigName + * A fully-qualified path representing HumanReviewConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromHumanReviewConfigName(humanReviewConfigName: string) { return this.pathTemplates.humanReviewConfigPathTemplate.match( humanReviewConfigName ).location; @@ -784,6 +1681,42 @@ export class DocumentProcessorServiceClient { ).processor; } + /** + * 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 processor resource name string. * @@ -836,6 +1769,81 @@ export class DocumentProcessorServiceClient { .processor; } + /** + * Return a fully-qualified processorType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} processor_type + * @returns {string} Resource name string. + */ + processorTypePath(project: string, location: string, processorType: string) { + return this.pathTemplates.processorTypePathTemplate.render({ + project: project, + location: location, + processor_type: processorType, + }); + } + + /** + * Parse the project from ProcessorType resource. + * + * @param {string} processorTypeName + * A fully-qualified path representing ProcessorType resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProcessorTypeName(processorTypeName: string) { + return this.pathTemplates.processorTypePathTemplate.match(processorTypeName) + .project; + } + + /** + * Parse the location from ProcessorType resource. + * + * @param {string} processorTypeName + * A fully-qualified path representing ProcessorType resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProcessorTypeName(processorTypeName: string) { + return this.pathTemplates.processorTypePathTemplate.match(processorTypeName) + .location; + } + + /** + * Parse the processor_type from ProcessorType resource. + * + * @param {string} processorTypeName + * A fully-qualified path representing ProcessorType resource. + * @returns {string} A string representing the processor_type. + */ + matchProcessorTypeFromProcessorTypeName(processorTypeName: string) { + return this.pathTemplates.processorTypePathTemplate.match(processorTypeName) + .processor_type; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client_config.json b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client_config.json index 1aac4003ded..8fde58b8d7f 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client_config.json +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client_config.json @@ -30,6 +30,30 @@ "retry_codes_name": "idempotent", "retry_params_name": "default" }, + "FetchProcessorTypes": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListProcessors": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateProcessor": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteProcessor": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "EnableProcessor": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DisableProcessor": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "ReviewDocument": { "timeout_millis": 120000, "retry_codes_name": "idempotent", diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json index 3f71a31868d..e6cd8590089 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json @@ -3,5 +3,7 @@ "../../protos/google/cloud/documentai/v1beta3/document_io.proto", "../../protos/google/cloud/documentai/v1beta3/document_processor_service.proto", "../../protos/google/cloud/documentai/v1beta3/geometry.proto", - "../../protos/google/cloud/documentai/v1beta3/operation_metadata.proto" + "../../protos/google/cloud/documentai/v1beta3/operation_metadata.proto", + "../../protos/google/cloud/documentai/v1beta3/processor.proto", + "../../protos/google/cloud/documentai/v1beta3/processor_type.proto" ] diff --git a/packages/google-cloud-documentai/src/v1beta3/gapic_metadata.json b/packages/google-cloud-documentai/src/v1beta3/gapic_metadata.json index ce8f20a97ae..791a44e4dd5 100644 --- a/packages/google-cloud-documentai/src/v1beta3/gapic_metadata.json +++ b/packages/google-cloud-documentai/src/v1beta3/gapic_metadata.json @@ -15,15 +15,47 @@ "processDocument" ] }, + "FetchProcessorTypes": { + "methods": [ + "fetchProcessorTypes" + ] + }, + "CreateProcessor": { + "methods": [ + "createProcessor" + ] + }, "BatchProcessDocuments": { "methods": [ "batchProcessDocuments" ] }, + "DeleteProcessor": { + "methods": [ + "deleteProcessor" + ] + }, + "EnableProcessor": { + "methods": [ + "enableProcessor" + ] + }, + "DisableProcessor": { + "methods": [ + "disableProcessor" + ] + }, "ReviewDocument": { "methods": [ "reviewDocument" ] + }, + "ListProcessors": { + "methods": [ + "listProcessors", + "listProcessorsStream", + "listProcessorsAsync" + ] } } }, @@ -35,15 +67,47 @@ "processDocument" ] }, + "FetchProcessorTypes": { + "methods": [ + "fetchProcessorTypes" + ] + }, + "CreateProcessor": { + "methods": [ + "createProcessor" + ] + }, "BatchProcessDocuments": { "methods": [ "batchProcessDocuments" ] }, + "DeleteProcessor": { + "methods": [ + "deleteProcessor" + ] + }, + "EnableProcessor": { + "methods": [ + "enableProcessor" + ] + }, + "DisableProcessor": { + "methods": [ + "disableProcessor" + ] + }, "ReviewDocument": { "methods": [ "reviewDocument" ] + }, + "ListProcessors": { + "methods": [ + "listProcessors", + "listProcessorsStream", + "listProcessorsAsync" + ] } } } diff --git a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts index 0380c49a53a..a450f720901 100644 --- a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts @@ -23,6 +23,8 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as documentprocessorserviceModule 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('v1beta3.DocumentProcessorServiceClient', () => { it('has servicePath', () => { const servicePath = @@ -304,6 +367,247 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); }); + describe('fetchProcessorTypes', () => { + it('invokes fetchProcessorTypes without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.FetchProcessorTypesResponse() + ); + client.innerApiCalls.fetchProcessorTypes = + stubSimpleCall(expectedResponse); + const [response] = await client.fetchProcessorTypes(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.fetchProcessorTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes fetchProcessorTypes without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.FetchProcessorTypesResponse() + ); + client.innerApiCalls.fetchProcessorTypes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.fetchProcessorTypes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.fetchProcessorTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes fetchProcessorTypes with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.fetchProcessorTypes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.fetchProcessorTypes(request), expectedError); + assert( + (client.innerApiCalls.fetchProcessorTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createProcessor', () => { + it('invokes createProcessor without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.CreateProcessorRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ); + client.innerApiCalls.createProcessor = stubSimpleCall(expectedResponse); + const [response] = await client.createProcessor(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createProcessor without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.CreateProcessorRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ); + client.innerApiCalls.createProcessor = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createProcessor( + request, + ( + err?: Error | null, + result?: protos.google.cloud.documentai.v1beta3.IProcessor | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createProcessor with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.CreateProcessorRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createProcessor = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createProcessor(request), expectedError); + assert( + (client.innerApiCalls.createProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('batchProcessDocuments', () => { it('invokes batchProcessDocuments without error', async () => { const client = @@ -519,8 +823,8 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); }); - describe('reviewDocument', () => { - it('invokes reviewDocument without error', async () => { + describe('deleteProcessor', () => { + it('invokes deleteProcessor without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -530,10 +834,10 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() + new protos.google.cloud.documentai.v1beta3.DeleteProcessorRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; + request.name = ''; + const expectedHeaderRequestParams = 'name='; const expectedOptions = { otherArgs: { headers: { @@ -544,19 +848,19 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.reviewDocument = + client.innerApiCalls.deleteProcessor = stubLongRunningCall(expectedResponse); - const [operation] = await client.reviewDocument(request); + const [operation] = await client.deleteProcessor(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.reviewDocument as SinonStub) + (client.innerApiCalls.deleteProcessor as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes reviewDocument without error using callback', async () => { + it('invokes deleteProcessor without error using callback', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -566,10 +870,10 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() + new protos.google.cloud.documentai.v1beta3.DeleteProcessorRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; + request.name = ''; + const expectedHeaderRequestParams = 'name='; const expectedOptions = { otherArgs: { headers: { @@ -580,16 +884,16 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.reviewDocument = + client.innerApiCalls.deleteProcessor = stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.reviewDocument( + client.deleteProcessor( request, ( err?: Error | null, result?: LROperation< - protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, - protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata > | null ) => { if (err) { @@ -601,19 +905,19 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); }); const operation = (await promise) as LROperation< - protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, - protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.reviewDocument as SinonStub) + (client.innerApiCalls.deleteProcessor as SinonStub) .getCall(0) .calledWith(request, expectedOptions /*, callback defined above */) ); }); - it('invokes reviewDocument with call error', async () => { + it('invokes deleteProcessor with call error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -623,10 +927,10 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() + new protos.google.cloud.documentai.v1beta3.DeleteProcessorRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; + request.name = ''; + const expectedHeaderRequestParams = 'name='; const expectedOptions = { otherArgs: { headers: { @@ -635,19 +939,19 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }, }; const expectedError = new Error('expected'); - client.innerApiCalls.reviewDocument = stubLongRunningCall( + client.innerApiCalls.deleteProcessor = stubLongRunningCall( undefined, expectedError ); - await assert.rejects(client.reviewDocument(request), expectedError); + await assert.rejects(client.deleteProcessor(request), expectedError); assert( - (client.innerApiCalls.reviewDocument as SinonStub) + (client.innerApiCalls.deleteProcessor as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes reviewDocument with LRO error', async () => { + it('invokes deleteProcessor with LRO error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -657,10 +961,10 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() + new protos.google.cloud.documentai.v1beta3.DeleteProcessorRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; + request.name = ''; + const expectedHeaderRequestParams = 'name='; const expectedOptions = { otherArgs: { headers: { @@ -669,21 +973,21 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }, }; const expectedError = new Error('expected'); - client.innerApiCalls.reviewDocument = stubLongRunningCall( + client.innerApiCalls.deleteProcessor = stubLongRunningCall( undefined, undefined, expectedError ); - const [operation] = await client.reviewDocument(request); + const [operation] = await client.deleteProcessor(request); await assert.rejects(operation.promise(), expectedError); assert( - (client.innerApiCalls.reviewDocument as SinonStub) + (client.innerApiCalls.deleteProcessor as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes checkReviewDocumentProgress without error', async () => { + it('invokes checkDeleteProcessorProgress without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -700,7 +1004,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkReviewDocumentProgress( + const decodedOperation = await client.checkDeleteProcessorProgress( expectedResponse.name ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); @@ -708,7 +1012,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - it('invokes checkReviewDocumentProgress with error', async () => { + it('invokes checkDeleteProcessorProgress with error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -724,14 +1028,979 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { expectedError ); await assert.rejects( - client.checkReviewDocumentProgress(''), + client.checkDeleteProcessorProgress(''), expectedError ); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); - describe('Path templates', () => { + describe('enableProcessor', () => { + it('invokes enableProcessor without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.EnableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.enableProcessor = + stubLongRunningCall(expectedResponse); + const [operation] = await client.enableProcessor(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.enableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes enableProcessor without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.EnableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.enableProcessor = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.enableProcessor( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.enableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes enableProcessor with call error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.EnableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.enableProcessor = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.enableProcessor(request), expectedError); + assert( + (client.innerApiCalls.enableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes enableProcessor with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.EnableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.enableProcessor = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.enableProcessor(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.enableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkEnableProcessorProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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.checkEnableProcessorProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkEnableProcessorProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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.checkEnableProcessorProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('disableProcessor', () => { + it('invokes disableProcessor without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.DisableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.disableProcessor = + stubLongRunningCall(expectedResponse); + const [operation] = await client.disableProcessor(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.disableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes disableProcessor without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.DisableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.disableProcessor = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.disableProcessor( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.disableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes disableProcessor with call error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.DisableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.disableProcessor = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.disableProcessor(request), expectedError); + assert( + (client.innerApiCalls.disableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes disableProcessor with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.DisableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.disableProcessor = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.disableProcessor(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.disableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkDisableProcessorProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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.checkDisableProcessorProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDisableProcessorProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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.checkDisableProcessorProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('reviewDocument', () => { + it('invokes reviewDocument without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reviewDocument = + stubLongRunningCall(expectedResponse); + const [operation] = await client.reviewDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes reviewDocument without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reviewDocument = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.reviewDocument( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes reviewDocument with call error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.reviewDocument = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.reviewDocument(request), expectedError); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes reviewDocument with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.reviewDocument = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.reviewDocument(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkReviewDocumentProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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.checkReviewDocumentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkReviewDocumentProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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.checkReviewDocumentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listProcessors', () => { + it('invokes listProcessors without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + ]; + client.innerApiCalls.listProcessors = stubSimpleCall(expectedResponse); + const [response] = await client.listProcessors(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProcessors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProcessors without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + ]; + client.innerApiCalls.listProcessors = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listProcessors( + request, + ( + err?: Error | null, + result?: protos.google.cloud.documentai.v1beta3.IProcessor[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProcessors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listProcessors with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listProcessors = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listProcessors(request), expectedError); + assert( + (client.innerApiCalls.listProcessors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProcessorsStream without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + ]; + client.descriptors.page.listProcessors.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listProcessorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.documentai.v1beta3.Processor[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.documentai.v1beta3.Processor) => { + 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.listProcessors.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessors, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessors.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listProcessorsStream with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessors.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listProcessorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.documentai.v1beta3.Processor[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.documentai.v1beta3.Processor) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listProcessors.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessors, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessors.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProcessors without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + ]; + client.descriptors.page.listProcessors.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.documentai.v1beta3.IProcessor[] = []; + const iterable = client.listProcessorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessors.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessors.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProcessors with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessors.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listProcessorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.documentai.v1beta3.IProcessor[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessors.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessors.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { describe('humanReviewConfig', () => { const fakePath = '/rendered/path/humanReviewConfig'; const expectedParameters = { @@ -811,6 +2080,58 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); }); + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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('processor', () => { const fakePath = '/rendered/path/processor'; const expectedParameters = { @@ -877,5 +2198,113 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); }); }); + + describe('processorType', () => { + const fakePath = '/rendered/path/processorType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + processor_type: 'processorTypeValue', + }; + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.processorTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.processorTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('processorTypePath', () => { + const result = client.processorTypePath( + 'projectValue', + 'locationValue', + 'processorTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.processorTypePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProcessorTypeName', () => { + const result = client.matchProjectFromProcessorTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.processorTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProcessorTypeName', () => { + const result = client.matchLocationFromProcessorTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.processorTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProcessorTypeFromProcessorTypeName', () => { + const result = client.matchProcessorTypeFromProcessorTypeName(fakePath); + assert.strictEqual(result, 'processorTypeValue'); + assert( + (client.pathTemplates.processorTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); From b88562add7b09f9ba1e335ae657f9e2919ba4b19 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:22:21 +0000 Subject: [PATCH 140/213] fix: make request optional in all cases (#237) ... 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 --- .../v1/document_processor_service_client.ts | 12 +++---- .../document_understanding_service_client.ts | 4 +-- .../document_understanding_service_client.ts | 8 ++--- .../document_processor_service_client.ts | 36 +++++++++---------- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts index 91947a35a5f..8f7d6e99eff 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts @@ -331,7 +331,7 @@ export class DocumentProcessorServiceClient { // -- Service calls -- // ------------------- processDocument( - request: protos.google.cloud.documentai.v1.IProcessRequest, + request?: protos.google.cloud.documentai.v1.IProcessRequest, options?: CallOptions ): Promise< [ @@ -382,7 +382,7 @@ export class DocumentProcessorServiceClient { * const [response] = await client.processDocument(request); */ processDocument( - request: protos.google.cloud.documentai.v1.IProcessRequest, + request?: protos.google.cloud.documentai.v1.IProcessRequest, optionsOrCallback?: | CallOptions | Callback< @@ -422,7 +422,7 @@ export class DocumentProcessorServiceClient { } batchProcessDocuments( - request: protos.google.cloud.documentai.v1.IBatchProcessRequest, + request?: protos.google.cloud.documentai.v1.IBatchProcessRequest, options?: CallOptions ): Promise< [ @@ -486,7 +486,7 @@ export class DocumentProcessorServiceClient { * const [response] = await operation.promise(); */ batchProcessDocuments( - request: protos.google.cloud.documentai.v1.IBatchProcessRequest, + request?: protos.google.cloud.documentai.v1.IBatchProcessRequest, optionsOrCallback?: | CallOptions | Callback< @@ -571,7 +571,7 @@ export class DocumentProcessorServiceClient { >; } reviewDocument( - request: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + request?: protos.google.cloud.documentai.v1.IReviewDocumentRequest, options?: CallOptions ): Promise< [ @@ -631,7 +631,7 @@ export class DocumentProcessorServiceClient { * const [response] = await operation.promise(); */ reviewDocument( - request: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + request?: protos.google.cloud.documentai.v1.IReviewDocumentRequest, optionsOrCallback?: | CallOptions | Callback< diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts index 4e03441018e..f7308e952c3 100644 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts @@ -303,7 +303,7 @@ export class DocumentUnderstandingServiceClient { // ------------------- batchProcessDocuments( - request: protos.google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest, + request?: protos.google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest, options?: CallOptions ): Promise< [ @@ -365,7 +365,7 @@ export class DocumentUnderstandingServiceClient { * const [response] = await operation.promise(); */ batchProcessDocuments( - request: protos.google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest, + request?: protos.google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest, optionsOrCallback?: | CallOptions | Callback< diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index e291f3059af..663ae582931 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -305,7 +305,7 @@ export class DocumentUnderstandingServiceClient { // -- Service calls -- // ------------------- processDocument( - request: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest, + request?: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest, options?: CallOptions ): Promise< [ @@ -385,7 +385,7 @@ export class DocumentUnderstandingServiceClient { * const [response] = await client.processDocument(request); */ processDocument( - request: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest, + request?: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest, optionsOrCallback?: | CallOptions | Callback< @@ -432,7 +432,7 @@ export class DocumentUnderstandingServiceClient { } batchProcessDocuments( - request: protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, + request?: protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, options?: CallOptions ): Promise< [ @@ -495,7 +495,7 @@ export class DocumentUnderstandingServiceClient { * const [response] = await operation.promise(); */ batchProcessDocuments( - request: protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, + request?: protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, optionsOrCallback?: | CallOptions | Callback< diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index 54b644d3a77..60feb96b46a 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts @@ -397,7 +397,7 @@ export class DocumentProcessorServiceClient { // -- Service calls -- // ------------------- processDocument( - request: protos.google.cloud.documentai.v1beta3.IProcessRequest, + request?: protos.google.cloud.documentai.v1beta3.IProcessRequest, options?: CallOptions ): Promise< [ @@ -450,7 +450,7 @@ export class DocumentProcessorServiceClient { * const [response] = await client.processDocument(request); */ processDocument( - request: protos.google.cloud.documentai.v1beta3.IProcessRequest, + request?: protos.google.cloud.documentai.v1beta3.IProcessRequest, optionsOrCallback?: | CallOptions | Callback< @@ -491,7 +491,7 @@ export class DocumentProcessorServiceClient { return this.innerApiCalls.processDocument(request, options, callback); } fetchProcessorTypes( - request: protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest, + request?: protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest, options?: CallOptions ): Promise< [ @@ -543,7 +543,7 @@ export class DocumentProcessorServiceClient { * const [response] = await client.fetchProcessorTypes(request); */ fetchProcessorTypes( - request: protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest, + request?: protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest, optionsOrCallback?: | CallOptions | Callback< @@ -589,7 +589,7 @@ export class DocumentProcessorServiceClient { return this.innerApiCalls.fetchProcessorTypes(request, options, callback); } createProcessor( - request: protos.google.cloud.documentai.v1beta3.ICreateProcessorRequest, + request?: protos.google.cloud.documentai.v1beta3.ICreateProcessorRequest, options?: CallOptions ): Promise< [ @@ -645,7 +645,7 @@ export class DocumentProcessorServiceClient { * const [response] = await client.createProcessor(request); */ createProcessor( - request: protos.google.cloud.documentai.v1beta3.ICreateProcessorRequest, + request?: protos.google.cloud.documentai.v1beta3.ICreateProcessorRequest, optionsOrCallback?: | CallOptions | Callback< @@ -692,7 +692,7 @@ export class DocumentProcessorServiceClient { } batchProcessDocuments( - request: protos.google.cloud.documentai.v1beta3.IBatchProcessRequest, + request?: protos.google.cloud.documentai.v1beta3.IBatchProcessRequest, options?: CallOptions ): Promise< [ @@ -760,7 +760,7 @@ export class DocumentProcessorServiceClient { * const [response] = await operation.promise(); */ batchProcessDocuments( - request: protos.google.cloud.documentai.v1beta3.IBatchProcessRequest, + request?: protos.google.cloud.documentai.v1beta3.IBatchProcessRequest, optionsOrCallback?: | CallOptions | Callback< @@ -845,7 +845,7 @@ export class DocumentProcessorServiceClient { >; } deleteProcessor( - request: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, + request?: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, options?: CallOptions ): Promise< [ @@ -902,7 +902,7 @@ export class DocumentProcessorServiceClient { * const [response] = await operation.promise(); */ deleteProcessor( - request: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, + request?: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, optionsOrCallback?: | CallOptions | Callback< @@ -987,7 +987,7 @@ export class DocumentProcessorServiceClient { >; } enableProcessor( - request: protos.google.cloud.documentai.v1beta3.IEnableProcessorRequest, + request?: protos.google.cloud.documentai.v1beta3.IEnableProcessorRequest, options?: CallOptions ): Promise< [ @@ -1043,7 +1043,7 @@ export class DocumentProcessorServiceClient { * const [response] = await operation.promise(); */ enableProcessor( - request: protos.google.cloud.documentai.v1beta3.IEnableProcessorRequest, + request?: protos.google.cloud.documentai.v1beta3.IEnableProcessorRequest, optionsOrCallback?: | CallOptions | Callback< @@ -1128,7 +1128,7 @@ export class DocumentProcessorServiceClient { >; } disableProcessor( - request: protos.google.cloud.documentai.v1beta3.IDisableProcessorRequest, + request?: protos.google.cloud.documentai.v1beta3.IDisableProcessorRequest, options?: CallOptions ): Promise< [ @@ -1184,7 +1184,7 @@ export class DocumentProcessorServiceClient { * const [response] = await operation.promise(); */ disableProcessor( - request: protos.google.cloud.documentai.v1beta3.IDisableProcessorRequest, + request?: protos.google.cloud.documentai.v1beta3.IDisableProcessorRequest, optionsOrCallback?: | CallOptions | Callback< @@ -1269,7 +1269,7 @@ export class DocumentProcessorServiceClient { >; } reviewDocument( - request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + request?: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, options?: CallOptions ): Promise< [ @@ -1335,7 +1335,7 @@ export class DocumentProcessorServiceClient { * const [response] = await operation.promise(); */ reviewDocument( - request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + request?: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, optionsOrCallback?: | CallOptions | Callback< @@ -1420,7 +1420,7 @@ export class DocumentProcessorServiceClient { >; } listProcessors( - request: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + request?: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, options?: CallOptions ): Promise< [ @@ -1479,7 +1479,7 @@ export class DocumentProcessorServiceClient { * for more details and examples. */ listProcessors( - request: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + request?: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, optionsOrCallback?: | CallOptions | PaginationCallback< From 6cc2664edb8f8eb4200653ac40dc4fb6b2df5446 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 23 Jun 2021 09:15:49 -0700 Subject: [PATCH 141/213] feat: update ReviewDocumentRequest to allow set priority and enable validation (#238) PiperOrigin-RevId: 380732771 --- .../google/cloud/documentai/v1/document.proto | 16 +- .../v1/document_processor_service.proto | 18 +++ .../protos/protos.d.ts | 39 +++++ .../google-cloud-documentai/protos/protos.js | 150 +++++++++++++++++- .../protos/protos.json | 44 ++++- .../v1/document_processor_service_client.ts | 4 + 6 files changed, 266 insertions(+), 5 deletions(-) diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto index eb4615c1845..467a44921a6 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto @@ -324,6 +324,9 @@ message Document { // - "unfilled_checkbox" // - "filled_checkbox" string value_type = 5; + + // The history of this annotation. + Provenance provenance = 8; } // Detected language for a structural component. @@ -385,6 +388,9 @@ message Document { // A list of visually detected form fields on the page. repeated FormField form_fields = 11; + + // The history of this page. + Provenance provenance = 16; } // A phrase in the text that is a known entity type, such as a person, an @@ -536,6 +542,8 @@ message Document { // Required. Index into the [Document.pages][google.cloud.documentai.v1.Document.pages] element, for example using // [Document.pages][page_refs.page] to locate the related page element. + // This field is skipped when its value is the default 0. See + // https://developers.google.com/protocol-buffers/docs/proto3#json. int64 page = 1 [(google.api.field_behavior) = REQUIRED]; // Optional. The type of the layout element that is being referenced if any. @@ -568,8 +576,12 @@ message Document { // The index of the [Document.revisions] identifying the parent revision. int32 revision = 1; + // The index of the parent revisions corresponding collection of items + // (eg. list of entities, properties within entities, etc.) + int32 index = 3; + // The id of the parent provenance. - int32 id = 2; + int32 id = 2 [deprecated = true]; } // If a processor or agent does an explicit operation on existing elements. @@ -602,7 +614,7 @@ message Document { // The Id of this operation. Needs to be unique within the scope of the // revision. - int32 id = 2; + int32 id = 2 [deprecated = true]; // References to the original elements that are replaced. repeated Parent parents = 3; diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto index 9f0b11a74de..65f0e6d967c 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto @@ -254,6 +254,18 @@ message BatchProcessMetadata { // Request message for review document method. message ReviewDocumentRequest { + reserved 2; + + // The priority level of the human review task. + enum Priority { + // The default priority level. + DEFAULT = 0; + + // The urgent priority level. The labeling manager should allocate labeler + // resource to the urgent task queue to respect this priority level. + URGENT = 1; + } + // The document payload. oneof source { // An inline document proto. @@ -268,6 +280,12 @@ message ReviewDocumentRequest { type: "documentai.googleapis.com/HumanReviewConfig" } ]; + + // Whether the validation should be performed on the ad-hoc review request. + bool enable_schema_validation = 3; + + // The priority of the human review task. + Priority priority = 5; } // Response message for review document method. diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 9c5d7578c3f..5504882a531 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -555,6 +555,9 @@ export namespace google { /** Page formFields */ formFields?: (google.cloud.documentai.v1.Document.Page.IFormField[]|null); + + /** Page provenance */ + provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); } /** Represents a Page. */ @@ -605,6 +608,9 @@ export namespace google { /** Page formFields. */ public formFields: google.cloud.documentai.v1.Document.Page.IFormField[]; + /** Page provenance. */ + public provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); + /** * Creates a new Page instance using the specified properties. * @param [properties] Properties to set @@ -2062,6 +2068,9 @@ export namespace google { /** FormField valueType */ valueType?: (string|null); + + /** FormField provenance */ + provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); } /** Represents a FormField. */ @@ -2088,6 +2097,9 @@ export namespace google { /** FormField valueType. */ public valueType: string; + /** FormField provenance. */ + public provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); + /** * Creates a new FormField instance using the specified properties. * @param [properties] Properties to set @@ -3167,6 +3179,9 @@ export namespace google { /** Parent revision */ revision?: (number|null); + /** Parent index */ + index?: (number|null); + /** Parent id */ id?: (number|null); } @@ -3183,6 +3198,9 @@ export namespace google { /** Parent revision. */ public revision: number; + /** Parent index. */ + public index: number; + /** Parent id. */ public id: number; @@ -5383,6 +5401,12 @@ export namespace google { /** ReviewDocumentRequest humanReviewConfig */ humanReviewConfig?: (string|null); + + /** ReviewDocumentRequest enableSchemaValidation */ + enableSchemaValidation?: (boolean|null); + + /** ReviewDocumentRequest priority */ + priority?: (google.cloud.documentai.v1.ReviewDocumentRequest.Priority|keyof typeof google.cloud.documentai.v1.ReviewDocumentRequest.Priority|null); } /** Represents a ReviewDocumentRequest. */ @@ -5400,6 +5424,12 @@ export namespace google { /** ReviewDocumentRequest humanReviewConfig. */ public humanReviewConfig: string; + /** ReviewDocumentRequest enableSchemaValidation. */ + public enableSchemaValidation: boolean; + + /** ReviewDocumentRequest priority. */ + public priority: (google.cloud.documentai.v1.ReviewDocumentRequest.Priority|keyof typeof google.cloud.documentai.v1.ReviewDocumentRequest.Priority); + /** ReviewDocumentRequest source. */ public source?: "inlineDocument"; @@ -5474,6 +5504,15 @@ export namespace google { public toJSON(): { [k: string]: any }; } + namespace ReviewDocumentRequest { + + /** Priority enum. */ + enum Priority { + DEFAULT = 0, + URGENT = 1 + } + } + /** Properties of a ReviewDocumentResponse. */ interface IReviewDocumentResponse { diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index b8d0a78350a..3bdbfbb41e9 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -1502,6 +1502,7 @@ * @property {Array.|null} [visualElements] Page visualElements * @property {Array.|null} [tables] Page tables * @property {Array.|null} [formFields] Page formFields + * @property {google.cloud.documentai.v1.Document.IProvenance|null} [provenance] Page provenance */ /** @@ -1632,6 +1633,14 @@ */ Page.prototype.formFields = $util.emptyArray; + /** + * Page provenance. + * @member {google.cloud.documentai.v1.Document.IProvenance|null|undefined} provenance + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.provenance = null; + /** * Creates a new Page instance using the specified properties. * @function create @@ -1691,6 +1700,8 @@ if (message.transforms != null && message.transforms.length) for (var i = 0; i < message.transforms.length; ++i) $root.google.cloud.documentai.v1.Document.Page.Matrix.encode(message.transforms[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) + $root.google.cloud.documentai.v1.Document.Provenance.encode(message.provenance, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); return writer; }; @@ -1782,6 +1793,9 @@ message.formFields = []; message.formFields.push($root.google.cloud.documentai.v1.Document.Page.FormField.decode(reader, reader.uint32())); break; + case 16: + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -1916,6 +1930,11 @@ return "formFields." + error; } } + if (message.provenance != null && message.hasOwnProperty("provenance")) { + var error = $root.google.cloud.documentai.v1.Document.Provenance.verify(message.provenance); + if (error) + return "provenance." + error; + } return null; }; @@ -2038,6 +2057,11 @@ message.formFields[i] = $root.google.cloud.documentai.v1.Document.Page.FormField.fromObject(object.formFields[i]); } } + if (object.provenance != null) { + if (typeof object.provenance !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.provenance: object expected"); + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.fromObject(object.provenance); + } return message; }; @@ -2070,6 +2094,7 @@ object.dimension = null; object.layout = null; object.image = null; + object.provenance = null; } if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) object.pageNumber = message.pageNumber; @@ -2124,6 +2149,8 @@ for (var j = 0; j < message.transforms.length; ++j) object.transforms[j] = $root.google.cloud.documentai.v1.Document.Page.Matrix.toObject(message.transforms[j], options); } + if (message.provenance != null && message.hasOwnProperty("provenance")) + object.provenance = $root.google.cloud.documentai.v1.Document.Provenance.toObject(message.provenance, options); return object; }; @@ -5601,6 +5628,7 @@ * @property {Array.|null} [nameDetectedLanguages] FormField nameDetectedLanguages * @property {Array.|null} [valueDetectedLanguages] FormField valueDetectedLanguages * @property {string|null} [valueType] FormField valueType + * @property {google.cloud.documentai.v1.Document.IProvenance|null} [provenance] FormField provenance */ /** @@ -5660,6 +5688,14 @@ */ FormField.prototype.valueType = ""; + /** + * FormField provenance. + * @member {google.cloud.documentai.v1.Document.IProvenance|null|undefined} provenance + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @instance + */ + FormField.prototype.provenance = null; + /** * Creates a new FormField instance using the specified properties. * @function create @@ -5696,6 +5732,8 @@ $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.encode(message.valueDetectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.valueType != null && Object.hasOwnProperty.call(message, "valueType")) writer.uint32(/* id 5, wireType 2 =*/42).string(message.valueType); + if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) + $root.google.cloud.documentai.v1.Document.Provenance.encode(message.provenance, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); return writer; }; @@ -5749,6 +5787,9 @@ case 5: message.valueType = reader.string(); break; + case 8: + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -5815,6 +5856,11 @@ if (message.valueType != null && message.hasOwnProperty("valueType")) if (!$util.isString(message.valueType)) return "valueType: string expected"; + if (message.provenance != null && message.hasOwnProperty("provenance")) { + var error = $root.google.cloud.documentai.v1.Document.Provenance.verify(message.provenance); + if (error) + return "provenance." + error; + } return null; }; @@ -5862,6 +5908,11 @@ } if (object.valueType != null) message.valueType = String(object.valueType); + if (object.provenance != null) { + if (typeof object.provenance !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.FormField.provenance: object expected"); + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.fromObject(object.provenance); + } return message; }; @@ -5886,6 +5937,7 @@ object.fieldName = null; object.fieldValue = null; object.valueType = ""; + object.provenance = null; } if (message.fieldName != null && message.hasOwnProperty("fieldName")) object.fieldName = $root.google.cloud.documentai.v1.Document.Page.Layout.toObject(message.fieldName, options); @@ -5903,6 +5955,8 @@ } if (message.valueType != null && message.hasOwnProperty("valueType")) object.valueType = message.valueType; + if (message.provenance != null && message.hasOwnProperty("provenance")) + object.provenance = $root.google.cloud.documentai.v1.Document.Provenance.toObject(message.provenance, options); return object; }; @@ -8538,6 +8592,7 @@ * @memberof google.cloud.documentai.v1.Document.Provenance * @interface IParent * @property {number|null} [revision] Parent revision + * @property {number|null} [index] Parent index * @property {number|null} [id] Parent id */ @@ -8564,6 +8619,14 @@ */ Parent.prototype.revision = 0; + /** + * Parent index. + * @member {number} index + * @memberof google.cloud.documentai.v1.Document.Provenance.Parent + * @instance + */ + Parent.prototype.index = 0; + /** * Parent id. * @member {number} id @@ -8600,6 +8663,8 @@ writer.uint32(/* id 1, wireType 0 =*/8).int32(message.revision); if (message.id != null && Object.hasOwnProperty.call(message, "id")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.id); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.index); return writer; }; @@ -8637,6 +8702,9 @@ case 1: message.revision = reader.int32(); break; + case 3: + message.index = reader.int32(); + break; case 2: message.id = reader.int32(); break; @@ -8678,6 +8746,9 @@ if (message.revision != null && message.hasOwnProperty("revision")) if (!$util.isInteger(message.revision)) return "revision: integer expected"; + if (message.index != null && message.hasOwnProperty("index")) + if (!$util.isInteger(message.index)) + return "index: integer expected"; if (message.id != null && message.hasOwnProperty("id")) if (!$util.isInteger(message.id)) return "id: integer expected"; @@ -8698,6 +8769,8 @@ var message = new $root.google.cloud.documentai.v1.Document.Provenance.Parent(); if (object.revision != null) message.revision = object.revision | 0; + if (object.index != null) + message.index = object.index | 0; if (object.id != null) message.id = object.id | 0; return message; @@ -8719,11 +8792,14 @@ if (options.defaults) { object.revision = 0; object.id = 0; + object.index = 0; } if (message.revision != null && message.hasOwnProperty("revision")) object.revision = message.revision; if (message.id != null && message.hasOwnProperty("id")) object.id = message.id; + if (message.index != null && message.hasOwnProperty("index")) + object.index = message.index; return object; }; @@ -13728,6 +13804,8 @@ * @interface IReviewDocumentRequest * @property {google.cloud.documentai.v1.IDocument|null} [inlineDocument] ReviewDocumentRequest inlineDocument * @property {string|null} [humanReviewConfig] ReviewDocumentRequest humanReviewConfig + * @property {boolean|null} [enableSchemaValidation] ReviewDocumentRequest enableSchemaValidation + * @property {google.cloud.documentai.v1.ReviewDocumentRequest.Priority|null} [priority] ReviewDocumentRequest priority */ /** @@ -13761,6 +13839,22 @@ */ ReviewDocumentRequest.prototype.humanReviewConfig = ""; + /** + * ReviewDocumentRequest enableSchemaValidation. + * @member {boolean} enableSchemaValidation + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.enableSchemaValidation = false; + + /** + * ReviewDocumentRequest priority. + * @member {google.cloud.documentai.v1.ReviewDocumentRequest.Priority} priority + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.priority = 0; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -13801,8 +13895,12 @@ writer = $Writer.create(); if (message.humanReviewConfig != null && Object.hasOwnProperty.call(message, "humanReviewConfig")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.humanReviewConfig); + if (message.enableSchemaValidation != null && Object.hasOwnProperty.call(message, "enableSchemaValidation")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableSchemaValidation); if (message.inlineDocument != null && Object.hasOwnProperty.call(message, "inlineDocument")) $root.google.cloud.documentai.v1.Document.encode(message.inlineDocument, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.priority != null && Object.hasOwnProperty.call(message, "priority")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.priority); return writer; }; @@ -13843,6 +13941,12 @@ case 1: message.humanReviewConfig = reader.string(); break; + case 3: + message.enableSchemaValidation = reader.bool(); + break; + case 5: + message.priority = reader.int32(); + break; default: reader.skipType(tag & 7); break; @@ -13890,6 +13994,17 @@ if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) if (!$util.isString(message.humanReviewConfig)) return "humanReviewConfig: string expected"; + if (message.enableSchemaValidation != null && message.hasOwnProperty("enableSchemaValidation")) + if (typeof message.enableSchemaValidation !== "boolean") + return "enableSchemaValidation: boolean expected"; + if (message.priority != null && message.hasOwnProperty("priority")) + switch (message.priority) { + default: + return "priority: enum value expected"; + case 0: + case 1: + break; + } return null; }; @@ -13912,6 +14027,18 @@ } if (object.humanReviewConfig != null) message.humanReviewConfig = String(object.humanReviewConfig); + if (object.enableSchemaValidation != null) + message.enableSchemaValidation = Boolean(object.enableSchemaValidation); + switch (object.priority) { + case "DEFAULT": + case 0: + message.priority = 0; + break; + case "URGENT": + case 1: + message.priority = 1; + break; + } return message; }; @@ -13928,15 +14055,22 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.humanReviewConfig = ""; + object.enableSchemaValidation = false; + object.priority = options.enums === String ? "DEFAULT" : 0; + } if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) object.humanReviewConfig = message.humanReviewConfig; + if (message.enableSchemaValidation != null && message.hasOwnProperty("enableSchemaValidation")) + object.enableSchemaValidation = message.enableSchemaValidation; if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { object.inlineDocument = $root.google.cloud.documentai.v1.Document.toObject(message.inlineDocument, options); if (options.oneofs) object.source = "inlineDocument"; } + if (message.priority != null && message.hasOwnProperty("priority")) + object.priority = options.enums === String ? $root.google.cloud.documentai.v1.ReviewDocumentRequest.Priority[message.priority] : message.priority; return object; }; @@ -13951,6 +14085,20 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Priority enum. + * @name google.cloud.documentai.v1.ReviewDocumentRequest.Priority + * @enum {number} + * @property {number} DEFAULT=0 DEFAULT value + * @property {number} URGENT=1 URGENT value + */ + ReviewDocumentRequest.Priority = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT"] = 0; + values[valuesById[1] = "URGENT"] = 1; + return values; + })(); + return ReviewDocumentRequest; })(); diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 0210786328c..b7abceda7ac 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -218,6 +218,10 @@ "rule": "repeated", "type": "FormField", "id": 11 + }, + "provenance": { + "type": "Provenance", + "id": 16 } }, "nested": { @@ -495,6 +499,10 @@ "valueType": { "type": "string", "id": 5 + }, + "provenance": { + "type": "Provenance", + "id": 8 } } }, @@ -751,7 +759,10 @@ }, "id": { "type": "int32", - "id": 2 + "id": 2, + "options": { + "deprecated": true + } }, "parents": { "rule": "repeated", @@ -770,9 +781,16 @@ "type": "int32", "id": 1 }, + "index": { + "type": "int32", + "id": 3 + }, "id": { "type": "int32", - "id": 2 + "id": 2, + "options": { + "deprecated": true + } } } }, @@ -1243,6 +1261,28 @@ "(google.api.field_behavior)": "REQUIRED", "(google.api.resource_reference).type": "documentai.googleapis.com/HumanReviewConfig" } + }, + "enableSchemaValidation": { + "type": "bool", + "id": 3 + }, + "priority": { + "type": "Priority", + "id": 5 + } + }, + "reserved": [ + [ + 2, + 2 + ] + ], + "nested": { + "Priority": { + "values": { + "DEFAULT": 0, + "URGENT": 1 + } } } }, diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts index 8f7d6e99eff..dff16ac1453 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts @@ -617,6 +617,10 @@ export class DocumentProcessorServiceClient { * @param {string} request.humanReviewConfig * Required. The resource name of the HumanReviewConfig that the document will be * reviewed with. + * @param {boolean} request.enableSchemaValidation + * Whether the validation should be performed on the ad-hoc review request. + * @param {google.cloud.documentai.v1.ReviewDocumentRequest.Priority} request.priority + * The priority of the human review task. * @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. From 5dc66a8f527532dcd5a29043ff77b00fe76cfddf Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Wed, 30 Jun 2021 12:18:26 -0400 Subject: [PATCH 142/213] fix(deps): google-gax v2.17.0 with mTLS (#241) --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 5e45ac77010..95ff8b3678f 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -27,7 +27,7 @@ "precompile": "gts clean" }, "dependencies": { - "google-gax": "^2.12.0" + "google-gax": "^2.17.0" }, "devDependencies": { "@types/mocha": "^8.0.0", From f97ac38a1e6e520a8f164462df96688d7bffbe75 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 1 Jul 2021 08:44:27 -0700 Subject: [PATCH 143/213] chore: release 3.0.0 (#221) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-documentai/CHANGELOG.md | 21 +++++++++++++++++++ packages/google-cloud-documentai/package.json | 2 +- .../samples/package.json | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index ac36a7944b3..256d6fe48f3 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## [3.0.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.10.0...v3.0.0) (2021-07-01) + + +### ⚠ BREAKING CHANGES + +* The default version of the API has changed from `v1beta3` to `v1`. + +### Features + +* default to v1 of the API ([#220](https://www.github.com/googleapis/nodejs-document-ai/issues/220)) ([5b370d0](https://www.github.com/googleapis/nodejs-document-ai/commit/5b370d06dd0edeefc05d70d99e2ae25890c8546d)) +* update document.proto, add the processor management methods. ([#236](https://www.github.com/googleapis/nodejs-document-ai/issues/236)) ([ddc147f](https://www.github.com/googleapis/nodejs-document-ai/commit/ddc147f4ca253e52eb1d419219b5124ba00c93cd)) +* update ReviewDocumentRequest to allow set priority and enable validation ([#238](https://www.github.com/googleapis/nodejs-document-ai/issues/238)) ([a39d9d5](https://www.github.com/googleapis/nodejs-document-ai/commit/a39d9d53fc9c25f0ba0f7046704ef9807116120b)) + + +### Bug Fixes + +* **deps:** google-gax v2.17.0 with mTLS ([#241](https://www.github.com/googleapis/nodejs-document-ai/issues/241)) ([2576761](https://www.github.com/googleapis/nodejs-document-ai/commit/25767610bc0161ff98c984e6f08a29ff401ff6e4)) +* GoogleAdsError missing using generator version after 1.3.0 ([#224](https://www.github.com/googleapis/nodejs-document-ai/issues/224)) ([087b081](https://www.github.com/googleapis/nodejs-document-ai/commit/087b0814467e340e8a1c5e2f860ebe8c083be734)) +* make request optional in all cases ([#237](https://www.github.com/googleapis/nodejs-document-ai/issues/237)) ([10e12bb](https://www.github.com/googleapis/nodejs-document-ai/commit/10e12bbcd85818040cf85d9b70fbbaa63bde14e3)) +* update default host to documentai.googleapis.com ([#217](https://www.github.com/googleapis/nodejs-document-ai/issues/217)) ([2d30ad0](https://www.github.com/googleapis/nodejs-document-ai/commit/2d30ad0f29e06d3fc83abba7e46f8d53c24762e7)) + ## [2.10.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.9.0...v2.10.0) (2021-05-12) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 95ff8b3678f..83235520e93 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "2.10.0", + "version": "3.0.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index a6ac3ef4e79..5160009f2f8 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^2.10.0", + "@google-cloud/documentai": "^3.0.0", "@google-cloud/storage": "^5.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" From a4e414a364c06d02abf3433082856dc7f160da9c Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Mon, 12 Jul 2021 17:44:32 -0400 Subject: [PATCH 144/213] fix(deps): google-gax v2.17.1 (#243) --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 83235520e93..ed341125578 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -27,7 +27,7 @@ "precompile": "gts clean" }, "dependencies": { - "google-gax": "^2.17.0" + "google-gax": "^2.17.1" }, "devDependencies": { "@types/mocha": "^8.0.0", From 9f245f0e1dd834d87e9819931506b3a37451479a 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:08:27 +0000 Subject: [PATCH 145/213] fix: Updating WORKSPACE files to use the newest version of the Typescript generator. (#245) 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/v1/document_processor_service_client.ts | 11 ++++++++++- .../v1beta1/document_understanding_service_client.ts | 11 ++++++++++- .../v1beta2/document_understanding_service_client.ts | 11 ++++++++++- .../src/v1beta3/document_processor_service_client.ts | 11 ++++++++++- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts index dff16ac1453..32e602d352d 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts @@ -48,6 +48,7 @@ const version = require('../../../package.json').version; export class DocumentProcessorServiceClient { 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 DocumentProcessorServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -104,6 +106,9 @@ export class DocumentProcessorServiceClient { .constructor as typeof DocumentProcessorServiceClient; 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 = @@ -210,6 +215,9 @@ export class DocumentProcessorServiceClient { // 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; } /** @@ -239,7 +247,8 @@ export class DocumentProcessorServiceClient { : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.documentai.v1 .DocumentProcessorService, - 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-documentai/src/v1beta1/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts index f7308e952c3..8a006d5e807 100644 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts @@ -47,6 +47,7 @@ const version = require('../../../package.json').version; export class DocumentUnderstandingServiceClient { 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: {}; @@ -58,6 +59,7 @@ export class DocumentUnderstandingServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; operationsClient: gax.OperationsClient; documentUnderstandingServiceStub?: Promise<{[name: string]: Function}>; @@ -102,6 +104,9 @@ export class DocumentUnderstandingServiceClient { .constructor as typeof DocumentUnderstandingServiceClient; 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 = @@ -185,6 +190,9 @@ export class DocumentUnderstandingServiceClient { // 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; } /** @@ -214,7 +222,8 @@ export class DocumentUnderstandingServiceClient { : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.documentai.v1beta1 .DocumentUnderstandingService, - 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-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index 663ae582931..ca4fb252d79 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -47,6 +47,7 @@ const version = require('../../../package.json').version; export class DocumentUnderstandingServiceClient { 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: {}; @@ -58,6 +59,7 @@ export class DocumentUnderstandingServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; operationsClient: gax.OperationsClient; documentUnderstandingServiceStub?: Promise<{[name: string]: Function}>; @@ -102,6 +104,9 @@ export class DocumentUnderstandingServiceClient { .constructor as typeof DocumentUnderstandingServiceClient; 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 = @@ -185,6 +190,9 @@ export class DocumentUnderstandingServiceClient { // 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; } /** @@ -214,7 +222,8 @@ export class DocumentUnderstandingServiceClient { : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.documentai.v1beta2 .DocumentUnderstandingService, - 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-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index 60feb96b46a..44cb40c5e48 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts @@ -52,6 +52,7 @@ const version = require('../../../package.json').version; export class DocumentProcessorServiceClient { 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: {}; @@ -63,6 +64,7 @@ export class DocumentProcessorServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -108,6 +110,9 @@ export class DocumentProcessorServiceClient { .constructor as typeof DocumentProcessorServiceClient; 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 = @@ -267,6 +272,9 @@ export class DocumentProcessorServiceClient { // 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; } /** @@ -296,7 +304,8 @@ export class DocumentProcessorServiceClient { : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.documentai.v1beta3 .DocumentProcessorService, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides From f04b66183ec6789bfe5f4cb511bc5f777d3024c1 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 21 Jul 2021 00:38:26 +0000 Subject: [PATCH 146/213] chore: release 3.0.1 (#244) :robot: I have created a release \*beep\* \*boop\* --- ### [3.0.1](https://www.github.com/googleapis/nodejs-document-ai/compare/v3.0.0...v3.0.1) (2021-07-21) ### Bug Fixes * **deps:** google-gax v2.17.1 ([#243](https://www.github.com/googleapis/nodejs-document-ai/issues/243)) ([a9e4efd](https://www.github.com/googleapis/nodejs-document-ai/commit/a9e4efd2478def845376a951c40b76e3384a8b29)) * Updating WORKSPACE files to use the newest version of the Typescript generator. ([#245](https://www.github.com/googleapis/nodejs-document-ai/issues/245)) ([06bf319](https://www.github.com/googleapis/nodejs-document-ai/commit/06bf3190cad3c9ce98e13aff718bb11db85dd4e5)) --- 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-documentai/CHANGELOG.md | 8 ++++++++ packages/google-cloud-documentai/package.json | 2 +- packages/google-cloud-documentai/samples/package.json | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index 256d6fe48f3..bfdde6731bd 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +### [3.0.1](https://www.github.com/googleapis/nodejs-document-ai/compare/v3.0.0...v3.0.1) (2021-07-21) + + +### Bug Fixes + +* **deps:** google-gax v2.17.1 ([#243](https://www.github.com/googleapis/nodejs-document-ai/issues/243)) ([a9e4efd](https://www.github.com/googleapis/nodejs-document-ai/commit/a9e4efd2478def845376a951c40b76e3384a8b29)) +* Updating WORKSPACE files to use the newest version of the Typescript generator. ([#245](https://www.github.com/googleapis/nodejs-document-ai/issues/245)) ([06bf319](https://www.github.com/googleapis/nodejs-document-ai/commit/06bf3190cad3c9ce98e13aff718bb11db85dd4e5)) + ## [3.0.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v2.10.0...v3.0.0) (2021-07-01) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index ed341125578..c4888216763 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "3.0.0", + "version": "3.0.1", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 5160009f2f8..bdf900a70d1 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^3.0.0", + "@google-cloud/documentai": "^3.0.1", "@google-cloud/storage": "^5.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" From c00f1061a06355a35ffe858c6f0142b8e3bf4653 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 12 Aug 2021 15:53:50 -0700 Subject: [PATCH 147/213] fix: Update DocumentUnderstandingService default_host in v1beta2 from a regional endpoint, to non-regional (#252) Committer: @nicain PiperOrigin-RevId: 390219495 --- .../cloud/documentai/v1beta2/document_understanding.proto | 2 +- packages/google-cloud-documentai/protos/protos.json | 2 +- .../src/v1beta2/document_understanding_service_client.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document_understanding.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document_understanding.proto index cf336f014cc..137ba5e3116 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document_understanding.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document_understanding.proto @@ -36,7 +36,7 @@ option ruby_package = "Google::Cloud::DocumentAI::V1beta2"; // documents using state-of-the-art Google AI such as natural language, // computer vision, and translation. service DocumentUnderstandingService { - option (google.api.default_host) = "us-documentai.googleapis.com"; + option (google.api.default_host) = "documentai.googleapis.com"; option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; // LRO endpoint to batch process many documents. The output is written diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index b7abceda7ac..04a286de08b 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -2802,7 +2802,7 @@ }, "DocumentUnderstandingService": { "options": { - "(google.api.default_host)": "us-documentai.googleapis.com", + "(google.api.default_host)": "documentai.googleapis.com", "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" }, "methods": { diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index ca4fb252d79..62ce5d4ca44 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -265,7 +265,7 @@ export class DocumentUnderstandingServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - return 'us-documentai.googleapis.com'; + return 'documentai.googleapis.com'; } /** @@ -274,7 +274,7 @@ export class DocumentUnderstandingServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - return 'us-documentai.googleapis.com'; + return 'documentai.googleapis.com'; } /** From 5ee11f4c3bbd280a243bcfc3609be32e81df5e71 Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Fri, 13 Aug 2021 12:04:10 -0700 Subject: [PATCH 148/213] build: replaces old link with current product doc location (#256) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: replaces old with current product doc location * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../.repo-metadata.json | 2 +- packages/google-cloud-documentai/README.md | 28 +++++++++---------- .../google-cloud-documentai/samples/README.md | 20 ++++++------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/packages/google-cloud-documentai/.repo-metadata.json b/packages/google-cloud-documentai/.repo-metadata.json index aa01608f573..c08666a41e8 100644 --- a/packages/google-cloud-documentai/.repo-metadata.json +++ b/packages/google-cloud-documentai/.repo-metadata.json @@ -1,7 +1,7 @@ { "name": "documentai", "name_pretty": "Document AI", - "product_documentation": "https://cloud.google.com/document-understanding/docs/", + "product_documentation": "https://cloud.google.com/document-ai/docs/", "client_documentation": "https://googleapis.dev/nodejs/documentai/latest/index.html", "issue_tracker": "", "release_level": "beta", diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index 8070b8f51c8..d30216a19f9 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -15,7 +15,7 @@ Document AI client for Node.js A comprehensive list of changes in each version may be found in -[the CHANGELOG](https://github.com/googleapis/nodejs-document-ai/blob/master/CHANGELOG.md). +[the CHANGELOG](https://github.com/googleapis/nodejs-document-ai/blob/main/CHANGELOG.md). * [Document AI Node.js Client API Reference][client-docs] * [Document AI Documentation][product-docs] @@ -132,19 +132,19 @@ async function quickstart() { ## Samples -Samples are in the [`samples/`](https://github.com/googleapis/nodejs-document-ai/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-document-ai/tree/main/samples) directory. Each sample's `README.md` has instructions for running its sample. | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | -| Batch-parse-form.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch-parse-form.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-parse-form.v1beta2.js,samples/README.md) | -| Batch-parse-table.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch-parse-table.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-parse-table.v1beta2.js,samples/README.md) | -| Batch-process-document | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch-process-document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-process-document.js,samples/README.md) | -| Parse-form.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse-form.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-form.v1beta2.js,samples/README.md) | -| Parse-table.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse-table.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-table.v1beta2.js,samples/README.md) | -| Parse-with-model.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse-with-model.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-with-model.v1beta2.js,samples/README.md) | -| Process-document | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/process-document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document.js,samples/README.md) | -| Quickstart | [source code](https://github.com/googleapis/nodejs-document-ai/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-document-ai&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | -| Set-endpoint.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/set-endpoint.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/set-endpoint.v1beta2.js,samples/README.md) | +| Batch-parse-form.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/batch-parse-form.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-parse-form.v1beta2.js,samples/README.md) | +| Batch-parse-table.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/batch-parse-table.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-parse-table.v1beta2.js,samples/README.md) | +| Batch-process-document | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/batch-process-document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-process-document.js,samples/README.md) | +| Parse-form.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/parse-form.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-form.v1beta2.js,samples/README.md) | +| Parse-table.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/parse-table.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-table.v1beta2.js,samples/README.md) | +| Parse-with-model.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/parse-with-model.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-with-model.v1beta2.js,samples/README.md) | +| Process-document | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document.js,samples/README.md) | +| Quickstart | [source code](https://github.com/googleapis/nodejs-document-ai/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-document-ai&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | +| Set-endpoint.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/set-endpoint.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/set-endpoint.v1beta2.js,samples/README.md) | @@ -192,7 +192,7 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] ## Contributing -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-document-ai/blob/master/CONTRIBUTING.md). +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-document-ai/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`) @@ -204,10 +204,10 @@ to its template in this Apache Version 2.0 -See [LICENSE](https://github.com/googleapis/nodejs-document-ai/blob/master/LICENSE) +See [LICENSE](https://github.com/googleapis/nodejs-document-ai/blob/main/LICENSE) [client-docs]: https://googleapis.dev/nodejs/documentai/latest/index.html -[product-docs]: https://cloud.google.com/document-understanding/docs/ +[product-docs]: https://cloud.google.com/document-ai/docs/ [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 diff --git a/packages/google-cloud-documentai/samples/README.md b/packages/google-cloud-documentai/samples/README.md index 6ac37ff71ea..97939601fff 100644 --- a/packages/google-cloud-documentai/samples/README.md +++ b/packages/google-cloud-documentai/samples/README.md @@ -39,7 +39,7 @@ Before running the samples, make sure you've followed the steps outlined in ### Batch-parse-form.v1beta2 -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch-parse-form.v1beta2.js). +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/batch-parse-form.v1beta2.js). [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-parse-form.v1beta2.js,samples/README.md) @@ -56,7 +56,7 @@ __Usage:__ ### Batch-parse-table.v1beta2 -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch-parse-table.v1beta2.js). +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/batch-parse-table.v1beta2.js). [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-parse-table.v1beta2.js,samples/README.md) @@ -73,7 +73,7 @@ __Usage:__ ### Batch-process-document -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/batch-process-document.js). +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/batch-process-document.js). [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-process-document.js,samples/README.md) @@ -90,7 +90,7 @@ __Usage:__ ### Parse-form.v1beta2 -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse-form.v1beta2.js). +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/parse-form.v1beta2.js). [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-form.v1beta2.js,samples/README.md) @@ -107,7 +107,7 @@ __Usage:__ ### Parse-table.v1beta2 -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse-table.v1beta2.js). +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/parse-table.v1beta2.js). [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-table.v1beta2.js,samples/README.md) @@ -124,7 +124,7 @@ __Usage:__ ### Parse-with-model.v1beta2 -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/parse-with-model.v1beta2.js). +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/parse-with-model.v1beta2.js). [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-with-model.v1beta2.js,samples/README.md) @@ -141,7 +141,7 @@ __Usage:__ ### Process-document -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/process-document.js). +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document.js). [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document.js,samples/README.md) @@ -158,7 +158,7 @@ __Usage:__ ### Quickstart -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/quickstart.js). +View the [source code](https://github.com/googleapis/nodejs-document-ai/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-document-ai&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) @@ -175,7 +175,7 @@ __Usage:__ ### Set-endpoint.v1beta2 -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/master/samples/set-endpoint.v1beta2.js). +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/set-endpoint.v1beta2.js). [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/set-endpoint.v1beta2.js,samples/README.md) @@ -191,4 +191,4 @@ __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-document-ai&page=editor&open_in_editor=samples/README.md -[product-docs]: https://cloud.google.com/document-understanding/docs/ +[product-docs]: https://cloud.google.com/document-ai/docs/ From 21643105aa9d25ba870911be712a7daba55814ab Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Fri, 13 Aug 2021 12:14:29 -0700 Subject: [PATCH 149/213] fix(build): migrate to using main branch (#253) --- packages/google-cloud-documentai/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index d30216a19f9..eaeb6fc82fb 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -6,7 +6,7 @@ [![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/documentai.svg)](https://www.npmjs.org/package/@google-cloud/documentai) -[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-document-ai/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-document-ai) +[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-document-ai/main.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-document-ai) @@ -197,8 +197,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 0dcf2b3556b8eace944ad9c3afce1027b6cb418d Mon Sep 17 00:00:00 2001 From: "F. Hinkelmann" Date: Fri, 13 Aug 2021 18:04:36 -0400 Subject: [PATCH 150/213] chore(nodejs): update client ref docs link in metadata (#250) --- packages/google-cloud-documentai/.repo-metadata.json | 2 +- packages/google-cloud-documentai/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/.repo-metadata.json b/packages/google-cloud-documentai/.repo-metadata.json index c08666a41e8..176f8808132 100644 --- a/packages/google-cloud-documentai/.repo-metadata.json +++ b/packages/google-cloud-documentai/.repo-metadata.json @@ -2,7 +2,7 @@ "name": "documentai", "name_pretty": "Document AI", "product_documentation": "https://cloud.google.com/document-ai/docs/", - "client_documentation": "https://googleapis.dev/nodejs/documentai/latest/index.html", + "client_documentation": "https://cloud.google.com/nodejs/docs/reference/documentai/latest", "issue_tracker": "", "release_level": "beta", "language": "nodejs", diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index eaeb6fc82fb..9ee1de83769 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -206,7 +206,7 @@ Apache Version 2.0 See [LICENSE](https://github.com/googleapis/nodejs-document-ai/blob/main/LICENSE) -[client-docs]: https://googleapis.dev/nodejs/documentai/latest/index.html +[client-docs]: https://cloud.google.com/nodejs/docs/reference/documentai/latest [product-docs]: https://cloud.google.com/document-ai/docs/ [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project From acc29312a6cf7c0729ad9f11e8db809e682ce2d3 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Mon, 16 Aug 2021 22:44:34 -0400 Subject: [PATCH 151/213] fix(deps): google-gax v2.24.1 (#257) --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index c4888216763..6e8914450e7 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -27,7 +27,7 @@ "precompile": "gts clean" }, "dependencies": { - "google-gax": "^2.17.1" + "google-gax": "^2.24.1" }, "devDependencies": { "@types/mocha": "^8.0.0", From eea1e03b9834ee67a68cb511eac1297112433fb2 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 17 Aug 2021 17:18:42 +0000 Subject: [PATCH 152/213] chore: release 3.0.2 (#254) :robot: I have created a release \*beep\* \*boop\* --- ### [3.0.2](https://www.github.com/googleapis/nodejs-document-ai/compare/v3.0.1...v3.0.2) (2021-08-17) ### Bug Fixes * **build:** migrate to using main branch ([#253](https://www.github.com/googleapis/nodejs-document-ai/issues/253)) ([ac879c4](https://www.github.com/googleapis/nodejs-document-ai/commit/ac879c425cb75862508527b2cf7cbd34e958684e)) * **deps:** google-gax v2.24.1 ([#257](https://www.github.com/googleapis/nodejs-document-ai/issues/257)) ([4ff6b2d](https://www.github.com/googleapis/nodejs-document-ai/commit/4ff6b2dfa2a5cee97f5dee0690c54f606902a38a)) * Update DocumentUnderstandingService default_host in v1beta2 from a regional endpoint, to non-regional ([#252](https://www.github.com/googleapis/nodejs-document-ai/issues/252)) ([79b8d82](https://www.github.com/googleapis/nodejs-document-ai/commit/79b8d825244748473efcee1d75653aa2b5077055)) --- 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-documentai/CHANGELOG.md | 9 +++++++++ packages/google-cloud-documentai/package.json | 2 +- packages/google-cloud-documentai/samples/package.json | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index bfdde6731bd..10941a9dcdd 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +### [3.0.2](https://www.github.com/googleapis/nodejs-document-ai/compare/v3.0.1...v3.0.2) (2021-08-17) + + +### Bug Fixes + +* **build:** migrate to using main branch ([#253](https://www.github.com/googleapis/nodejs-document-ai/issues/253)) ([ac879c4](https://www.github.com/googleapis/nodejs-document-ai/commit/ac879c425cb75862508527b2cf7cbd34e958684e)) +* **deps:** google-gax v2.24.1 ([#257](https://www.github.com/googleapis/nodejs-document-ai/issues/257)) ([4ff6b2d](https://www.github.com/googleapis/nodejs-document-ai/commit/4ff6b2dfa2a5cee97f5dee0690c54f606902a38a)) +* Update DocumentUnderstandingService default_host in v1beta2 from a regional endpoint, to non-regional ([#252](https://www.github.com/googleapis/nodejs-document-ai/issues/252)) ([79b8d82](https://www.github.com/googleapis/nodejs-document-ai/commit/79b8d825244748473efcee1d75653aa2b5077055)) + ### [3.0.1](https://www.github.com/googleapis/nodejs-document-ai/compare/v3.0.0...v3.0.1) (2021-07-21) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 6e8914450e7..2a625fa2c40 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "3.0.1", + "version": "3.0.2", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index bdf900a70d1..003217f3de0 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^3.0.1", + "@google-cloud/documentai": "^3.0.2", "@google-cloud/storage": "^5.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" From aa60ef65b3f0d37666bce8ef9ce5045893944f74 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 23 Aug 2021 18:30:19 +0000 Subject: [PATCH 153/213] feat: turns on self-signed JWT feature flag (#258) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 392067151 Source-Link: https://github.com/googleapis/googleapis/commit/06345f7b95c4b4a3ffe4303f1f2984ccc304b2e0 Source-Link: https://github.com/googleapis/googleapis-gen/commit/95882b37970e41e4cd51b22fa507cfd46dc7c4b6 --- .../src/v1/document_processor_service_client.ts | 7 +++++++ .../src/v1beta1/document_understanding_service_client.ts | 7 +++++++ .../src/v1beta2/document_understanding_service_client.ts | 7 +++++++ .../src/v1beta3/document_processor_service_client.ts | 7 +++++++ 4 files changed, 28 insertions(+) diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts index 32e602d352d..b58bd2cdd98 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts @@ -133,6 +133,12 @@ export class DocumentProcessorServiceClient { // 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; + // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { @@ -851,6 +857,7 @@ export class DocumentProcessorServiceClient { return this.documentProcessorServiceStub!.then(stub => { this._terminated = true; stub.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts index 8a006d5e807..2b8d70e5efc 100644 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts @@ -131,6 +131,12 @@ export class DocumentUnderstandingServiceClient { // 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; + // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { @@ -471,6 +477,7 @@ export class DocumentUnderstandingServiceClient { return this.documentUnderstandingServiceStub!.then(stub => { this._terminated = true; stub.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index 62ce5d4ca44..1c0adfcca40 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -131,6 +131,12 @@ export class DocumentUnderstandingServiceClient { // 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; + // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { @@ -601,6 +607,7 @@ export class DocumentUnderstandingServiceClient { return this.documentUnderstandingServiceStub!.then(stub => { this._terminated = true; stub.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index 44cb40c5e48..581a008412b 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts @@ -137,6 +137,12 @@ export class DocumentProcessorServiceClient { // 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; + // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { @@ -1865,6 +1871,7 @@ export class DocumentProcessorServiceClient { return this.documentProcessorServiceStub!.then(stub => { this._terminated = true; stub.close(); + this.operationsClient.close(); }); } return Promise.resolve(); From 5727e02da039c47c22ac24503032f082b5c80374 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Wed, 25 Aug 2021 11:13:27 -0700 Subject: [PATCH 154/213] fix: flag module as GA (#260) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: flag module as GA * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Update .repo-metadata.json * 🦉 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-documentai/.repo-metadata.json | 2 +- packages/google-cloud-documentai/README.md | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-documentai/.repo-metadata.json b/packages/google-cloud-documentai/.repo-metadata.json index 176f8808132..127fc5cd4a9 100644 --- a/packages/google-cloud-documentai/.repo-metadata.json +++ b/packages/google-cloud-documentai/.repo-metadata.json @@ -4,7 +4,7 @@ "product_documentation": "https://cloud.google.com/document-ai/docs/", "client_documentation": "https://cloud.google.com/nodejs/docs/reference/documentai/latest", "issue_tracker": "", - "release_level": "beta", + "release_level": "ga", "language": "nodejs", "repo": "googleapis/nodejs-document-ai", "distribution_name": "@google-cloud/documentai", diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index 9ee1de83769..18cc6781834 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -4,7 +4,7 @@ # [Document AI: Node.js Client](https://github.com/googleapis/nodejs-document-ai) -[![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/documentai.svg)](https://www.npmjs.org/package/@google-cloud/documentai) [![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-document-ai/main.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-document-ai) @@ -177,11 +177,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. From efecba2d45d240b61d41fba6f890f43bf367da7b Mon Sep 17 00:00:00 2001 From: Jeffrey Rennie Date: Tue, 21 Sep 2021 14:42:34 -0700 Subject: [PATCH 155/213] chore: relocate owl bot post processor (#270) chore: relocate owl bot post processor --- packages/google-cloud-documentai/.github/.OwlBot.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/.github/.OwlBot.yaml b/packages/google-cloud-documentai/.github/.OwlBot.yaml index f316b1c8a07..7c4d3838232 100644 --- a/packages/google-cloud-documentai/.github/.OwlBot.yaml +++ b/packages/google-cloud-documentai/.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 456ff2d84df376040a9ee6c4aeb4ad66d57318c4 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 27 Sep 2021 09:07:18 -0700 Subject: [PATCH 156/213] chore: release 3.1.0 (#259) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-documentai/CHANGELOG.md | 12 ++++++++++++ packages/google-cloud-documentai/package.json | 2 +- .../google-cloud-documentai/samples/package.json | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index 10941a9dcdd..c8ed3cce3e6 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [3.1.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v3.0.2...v3.1.0) (2021-09-21) + + +### Features + +* turns on self-signed JWT feature flag ([#258](https://www.github.com/googleapis/nodejs-document-ai/issues/258)) ([e39c909](https://www.github.com/googleapis/nodejs-document-ai/commit/e39c909422e03b6ba48ea1163d80bc8a2504d172)) + + +### Bug Fixes + +* flag module as GA ([#260](https://www.github.com/googleapis/nodejs-document-ai/issues/260)) ([ecc541c](https://www.github.com/googleapis/nodejs-document-ai/commit/ecc541ce928a0b69a4541d8df941d47b71374938)) + ### [3.0.2](https://www.github.com/googleapis/nodejs-document-ai/compare/v3.0.1...v3.0.2) (2021-08-17) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 2a625fa2c40..529a47a3ada 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "3.0.2", + "version": "3.1.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 003217f3de0..140933d1f8b 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^3.0.2", + "@google-cloud/documentai": "^3.1.0", "@google-cloud/storage": "^5.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" From 36e18997c6ed13ded90661f4fc29364cf527545e 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:40 +0000 Subject: [PATCH 157/213] build(node): update deps used during postprocessing (#1243) (#278) --- .../google-cloud-documentai/protos/protos.d.ts | 3 ++- packages/google-cloud-documentai/protos/protos.js | 7 +++++++ .../google-cloud-documentai/protos/protos.json | 15 ++++++++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 5504882a531..4060d264e41 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -22428,7 +22428,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 Http. */ diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 3bdbfbb41e9..ac7893e6f00 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -56271,6 +56271,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); @@ -56281,6 +56282,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; })(); @@ -63353,6 +63355,7 @@ case 4: case 5: case 6: + case 7: break; } } @@ -63457,6 +63460,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-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 04a286de08b..935b4e3a15d 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -4974,7 +4974,8 @@ "OUTPUT_ONLY": 3, "INPUT_ONLY": 4, "IMMUTABLE": 5, - "UNORDERED_LIST": 6 + "UNORDERED_LIST": 6, + "NON_EMPTY_DEFAULT": 7 } }, "http": { @@ -5720,6 +5721,18 @@ ] ], "reserved": [ + [ + 4, + 4 + ], + [ + 5, + 5 + ], + [ + 6, + 6 + ], [ 8, 8 From c6762d35fe40794ee8f4ce96e28003510bf90a99 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 26 Oct 2021 23:19:06 +0200 Subject: [PATCH 158/213] chore(deps): update dependency @types/node to v16 (#279) 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.0.0` -> `^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-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 529a47a3ada..3ba83453b6c 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -31,7 +31,7 @@ }, "devDependencies": { "@types/mocha": "^8.0.0", - "@types/node": "^14.0.0", + "@types/node": "^16.0.0", "@types/sinon": "^10.0.0", "c8": "^7.1.0", "chai": "^4.2.0", From b180384a1a4c5f5cffff1c21a6d5672a212696c1 Mon Sep 17 00:00:00 2001 From: "F. Hinkelmann" Date: Wed, 3 Nov 2021 11:54:17 -0400 Subject: [PATCH 159/213] chore(cloud-rad): delete api-extractor config (#280) --- .../api-extractor.json | 369 ------------------ 1 file changed, 369 deletions(-) delete mode 100644 packages/google-cloud-documentai/api-extractor.json diff --git a/packages/google-cloud-documentai/api-extractor.json b/packages/google-cloud-documentai/api-extractor.json deleted file mode 100644 index de228294b23..00000000000 --- a/packages/google-cloud-documentai/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 d841bb6e9754cd563caf11816cf722ebbb3f9427 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 4 Nov 2021 20:44:18 +0100 Subject: [PATCH 160/213] chore(deps): update dependency sinon to v12 (#281) 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-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 3ba83453b6c..b7cc811abdc 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -43,7 +43,7 @@ "mocha": "^8.0.0", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", - "sinon": "^11.0.0", + "sinon": "^12.0.0", "ts-loader": "^9.0.0", "typescript": "^3.8.3", "webpack": "^5.0.0", From 4072dff45cefd3937a841da7786fbe8963264f51 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Fri, 12 Nov 2021 14:29:02 -0800 Subject: [PATCH 161/213] docs(samples): add OCR, form, quality, splitter and specialized processing samples (#283) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs(samples): add OCR, form, quality, splitter and specialized processing samples * 🦉 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-documentai/README.md | 5 ++ .../google-cloud-documentai/samples/README.md | 90 +++++++++++++++++++ 2 files changed, 95 insertions(+) diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index 18cc6781834..4f1a4ca397a 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -142,6 +142,11 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-document-ai | Parse-form.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/parse-form.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-form.v1beta2.js,samples/README.md) | | Parse-table.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/parse-table.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-table.v1beta2.js,samples/README.md) | | Parse-with-model.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/parse-with-model.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-with-model.v1beta2.js,samples/README.md) | +| Process-document-form | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-form.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-form.js,samples/README.md) | +| Process-document-ocr | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-ocr.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-ocr.js,samples/README.md) | +| Process-document-quality | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-quality.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-quality.js,samples/README.md) | +| Process-document-specialized | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-specialized.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-specialized.js,samples/README.md) | +| Process-document-splitter | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-splitter.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-splitter.js,samples/README.md) | | Process-document | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document.js,samples/README.md) | | Quickstart | [source code](https://github.com/googleapis/nodejs-document-ai/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-document-ai&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | | Set-endpoint.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/set-endpoint.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/set-endpoint.v1beta2.js,samples/README.md) | diff --git a/packages/google-cloud-documentai/samples/README.md b/packages/google-cloud-documentai/samples/README.md index 97939601fff..d8910e35f35 100644 --- a/packages/google-cloud-documentai/samples/README.md +++ b/packages/google-cloud-documentai/samples/README.md @@ -18,6 +18,11 @@ * [Parse-form.v1beta2](#parse-form.v1beta2) * [Parse-table.v1beta2](#parse-table.v1beta2) * [Parse-with-model.v1beta2](#parse-with-model.v1beta2) + * [Process-document-form](#process-document-form) + * [Process-document-ocr](#process-document-ocr) + * [Process-document-quality](#process-document-quality) + * [Process-document-specialized](#process-document-specialized) + * [Process-document-splitter](#process-document-splitter) * [Process-document](#process-document) * [Quickstart](#quickstart) * [Set-endpoint.v1beta2](#set-endpoint.v1beta2) @@ -139,6 +144,91 @@ __Usage:__ +### Process-document-form + +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-form.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-form.js,samples/README.md) + +__Usage:__ + + +`node samples/process-document-form.js` + + +----- + + + + +### Process-document-ocr + +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-ocr.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-ocr.js,samples/README.md) + +__Usage:__ + + +`node samples/process-document-ocr.js` + + +----- + + + + +### Process-document-quality + +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-quality.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-quality.js,samples/README.md) + +__Usage:__ + + +`node samples/process-document-quality.js` + + +----- + + + + +### Process-document-specialized + +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-specialized.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-specialized.js,samples/README.md) + +__Usage:__ + + +`node samples/process-document-specialized.js` + + +----- + + + + +### Process-document-splitter + +View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-splitter.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-splitter.js,samples/README.md) + +__Usage:__ + + +`node samples/process-document-splitter.js` + + +----- + + + + ### Process-document View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document.js). From 6582ece64d4c60fb3369a9e2593a4c1fc2a4d162 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 16:40:25 +0000 Subject: [PATCH 162/213] build(npm): add artifact name for npm (#284) docs: adds generated samples PiperOrigin-RevId: 408439482 PiperOrigin-RevId: 411579858 Source-Link: https://github.com/googleapis/googleapis/commit/4bd5f4b45f5e6e4c0d6383a84e461556d35c549f Source-Link: https://github.com/googleapis/googleapis-gen/commit/c7653e1728d1a926bfeffca4de4ae204ff17cf54 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzc2NTNlMTcyOGQxYTkyNmJmZWZmY2E0ZGU0YWUyMDRmZjE3Y2Y1NCJ9 Co-authored-by: Owl Bot --- .../linkinator.config.json | 2 +- ...ocessor_service.batch_process_documents.js | 67 +++ ...ment_processor_service.process_document.js | 66 +++ ...ument_processor_service.review_document.js | 67 +++ ...tanding_service.batch_process_documents.js | 60 +++ ...tanding_service.batch_process_documents.js | 60 +++ ..._understanding_service.process_document.js | 96 ++++ ...ocessor_service.batch_process_documents.js | 75 +++ ...ment_processor_service.create_processor.js | 60 +++ ...ment_processor_service.delete_processor.js | 54 ++ ...ent_processor_service.disable_processor.js | 54 ++ ...ment_processor_service.enable_processor.js | 54 ++ ...processor_service.fetch_processor_types.js | 54 ++ ...ument_processor_service.list_processors.js | 67 +++ ...ment_processor_service.process_document.js | 70 +++ ...ument_processor_service.review_document.js | 71 +++ .../v1/document_processor_service_client.ts | 172 +++---- .../document_understanding_service_client.ts | 58 +-- .../src/v1beta1/gapic_metadata.json | 2 +- .../document_understanding_service_client.ts | 132 +++-- .../document_processor_service_client.ts | 478 +++++++++--------- 21 files changed, 1378 insertions(+), 441 deletions(-) create mode 100644 packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js diff --git a/packages/google-cloud-documentai/linkinator.config.json b/packages/google-cloud-documentai/linkinator.config.json index 29a223b6db6..0121dfa684f 100644 --- a/packages/google-cloud-documentai/linkinator.config.json +++ b/packages/google-cloud-documentai/linkinator.config.json @@ -6,5 +6,5 @@ "img.shields.io" ], "silent": true, - "concurrency": 10 + "concurrency": 5 } diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js new file mode 100644 index 00000000000..cdf98d1b454 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.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(name) { + // [START documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor resource name. + */ + // const name = 'abc123' + /** + * The input documents for batch process. + */ + // const inputDocuments = {} + /** + * The overall output config for batch process. + */ + // const documentOutputConfig = {} + /** + * Whether Human Review feature should be skipped for this request. Default to + * false. + */ + // const skipHumanReview = true + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = + require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callBatchProcessDocuments() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await documentaiClient.batchProcessDocuments(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchProcessDocuments(); + // [END documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js new file mode 100644 index 00000000000..9c22048acda --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js @@ -0,0 +1,66 @@ +// 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 documentai_v1_generated_DocumentProcessorService_ProcessDocument_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * An inline document proto. + */ + // const inlineDocument = {} + /** + * A raw document content (bytes). + */ + // const rawDocument = {} + /** + * Required. The processor resource name. + */ + // const name = 'abc123' + /** + * Whether Human Review feature should be skipped for this request. Default to + * false. + */ + // const skipHumanReview = true + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = + require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callProcessDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await documentaiClient.processDocument(request); + console.log(response); + } + + callProcessDocument(); + // [END documentai_v1_generated_DocumentProcessorService_ProcessDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js new file mode 100644 index 00000000000..2dc162fe458 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.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(humanReviewConfig) { + // [START documentai_v1_generated_DocumentProcessorService_ReviewDocument_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * An inline document proto. + */ + // const inlineDocument = {} + /** + * Required. The resource name of the HumanReviewConfig that the document will be + * reviewed with. + */ + // const humanReviewConfig = 'abc123' + /** + * Whether the validation should be performed on the ad-hoc review request. + */ + // const enableSchemaValidation = true + /** + * The priority of the human review task. + */ + // const priority = {} + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = + require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callReviewDocument() { + // Construct request + const request = { + humanReviewConfig, + }; + + // Run request + const [operation] = await documentaiClient.reviewDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callReviewDocument(); + // [END documentai_v1_generated_DocumentProcessorService_ReviewDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js new file mode 100644 index 00000000000..56d524f4ba6 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js @@ -0,0 +1,60 @@ +// 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(requests) { + // [START documentai_v1beta1_generated_DocumentUnderstandingService_BatchProcessDocuments_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Individual requests for each document. + */ + // const requests = 1234 + /** + * Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no location is specified, a region will be chosen automatically. + */ + // const parent = 'abc123' + + // Imports the Documentai library + const {DocumentUnderstandingServiceClient} = + require('@google-cloud/documentai').v1beta1; + + // Instantiates a client + const documentaiClient = new DocumentUnderstandingServiceClient(); + + async function callBatchProcessDocuments() { + // Construct request + const request = { + requests, + }; + + // Run request + const [operation] = await documentaiClient.batchProcessDocuments(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchProcessDocuments(); + // [END documentai_v1beta1_generated_DocumentUnderstandingService_BatchProcessDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js new file mode 100644 index 00000000000..9f4e352679b --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js @@ -0,0 +1,60 @@ +// 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(requests) { + // [START documentai_v1beta2_generated_DocumentUnderstandingService_BatchProcessDocuments_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Individual requests for each document. + */ + // const requests = 1234 + /** + * Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no location is specified, a region will be chosen automatically. + */ + // const parent = 'abc123' + + // Imports the Documentai library + const {DocumentUnderstandingServiceClient} = + require('@google-cloud/documentai').v1beta2; + + // Instantiates a client + const documentaiClient = new DocumentUnderstandingServiceClient(); + + async function callBatchProcessDocuments() { + // Construct request + const request = { + requests, + }; + + // Run request + const [operation] = await documentaiClient.batchProcessDocuments(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchProcessDocuments(); + // [END documentai_v1beta2_generated_DocumentUnderstandingService_BatchProcessDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js new file mode 100644 index 00000000000..679aad5de80 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js @@ -0,0 +1,96 @@ +// 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(inputConfig) { + // [START documentai_v1beta2_generated_DocumentUnderstandingService_ProcessDocument_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no location is specified, a region will be chosen automatically. + * This field is only populated when used in ProcessDocument method. + */ + // const parent = 'abc123' + /** + * Required. Information about the input file. + */ + // const inputConfig = {} + /** + * Optional. The desired output location. This field is only needed in + * BatchProcessDocumentsRequest. + */ + // const outputConfig = {} + /** + * Specifies a known document type for deeper structure detection. Valid + * values are currently "general" and "invoice". If not provided, "general"\ + * is used as default. If any other value is given, the request is rejected. + */ + // const documentType = 'abc123' + /** + * Controls table extraction behavior. If not specified, the system will + * decide reasonable defaults. + */ + // const tableExtractionParams = {} + /** + * Controls form extraction behavior. If not specified, the system will + * decide reasonable defaults. + */ + // const formExtractionParams = {} + /** + * Controls entity extraction behavior. If not specified, the system will + * decide reasonable defaults. + */ + // const entityExtractionParams = {} + /** + * Controls OCR behavior. If not specified, the system will decide reasonable + * defaults. + */ + // const ocrParams = {} + /** + * Controls AutoML model prediction behavior. AutoMlParams cannot be used + * together with other Params. + */ + // const automlParams = {} + + // Imports the Documentai library + const {DocumentUnderstandingServiceClient} = + require('@google-cloud/documentai').v1beta2; + + // Instantiates a client + const documentaiClient = new DocumentUnderstandingServiceClient(); + + async function callProcessDocument() { + // Construct request + const request = { + inputConfig, + }; + + // Run request + const response = await documentaiClient.processDocument(request); + console.log(response); + } + + callProcessDocument(); + // [END documentai_v1beta2_generated_DocumentUnderstandingService_ProcessDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js new file mode 100644 index 00000000000..06105529398 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js @@ -0,0 +1,75 @@ +// 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 documentai_v1beta3_generated_DocumentProcessorService_BatchProcessDocuments_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor resource name. + */ + // const name = 'abc123' + /** + * The input config for each single document in the batch process. + */ + // const inputConfigs = 1234 + /** + * The overall output config for batch process. + */ + // const outputConfig = {} + /** + * The input documents for batch process. + */ + // const inputDocuments = {} + /** + * The overall output config for batch process. + */ + // const documentOutputConfig = {} + /** + * Whether Human Review feature should be skipped for this request. Default to + * false. + */ + // const skipHumanReview = true + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = + require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callBatchProcessDocuments() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await documentaiClient.batchProcessDocuments(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchProcessDocuments(); + // [END documentai_v1beta3_generated_DocumentProcessorService_BatchProcessDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js new file mode 100644 index 00000000000..4ed3a3e8ad6 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js @@ -0,0 +1,60 @@ +// 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, processor) { + // [START documentai_v1beta3_generated_DocumentProcessorService_CreateProcessor_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent (project and location) under which to create the processor. + * Format: projects/{project}/locations/{location} + */ + // const parent = 'abc123' + /** + * Required. The processor to be created, requires processor_type and display_name + * to be set. Also, the processor is under CMEK if CMEK fields are set. + */ + // const processor = {} + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = + require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callCreateProcessor() { + // Construct request + const request = { + parent, + processor, + }; + + // Run request + const response = await documentaiClient.createProcessor(request); + console.log(response); + } + + callCreateProcessor(); + // [END documentai_v1beta3_generated_DocumentProcessorService_CreateProcessor_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js new file mode 100644 index 00000000000..5cbd9f196ee --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js @@ -0,0 +1,54 @@ +// 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 documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessor_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor resource name to be deleted. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = + require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callDeleteProcessor() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await documentaiClient.deleteProcessor(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteProcessor(); + // [END documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessor_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js new file mode 100644 index 00000000000..f55d16d1916 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js @@ -0,0 +1,54 @@ +// 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 documentai_v1beta3_generated_DocumentProcessorService_DisableProcessor_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor resource name to be disabled. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = + require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callDisableProcessor() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await documentaiClient.disableProcessor(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDisableProcessor(); + // [END documentai_v1beta3_generated_DocumentProcessorService_DisableProcessor_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js new file mode 100644 index 00000000000..9581b40ce87 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js @@ -0,0 +1,54 @@ +// 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 documentai_v1beta3_generated_DocumentProcessorService_EnableProcessor_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor resource name to be enabled. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = + require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callEnableProcessor() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await documentaiClient.enableProcessor(request); + const [response] = await operation.promise(); + console.log(response); + } + + callEnableProcessor(); + // [END documentai_v1beta3_generated_DocumentProcessorService_EnableProcessor_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js new file mode 100644 index 00000000000..95cf1157f7a --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js @@ -0,0 +1,54 @@ +// 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 documentai_v1beta3_generated_DocumentProcessorService_FetchProcessorTypes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project of processor type to list. + * Format: projects/{project}/locations/{location} + */ + // const parent = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = + require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callFetchProcessorTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await documentaiClient.fetchProcessorTypes(request); + console.log(response); + } + + callFetchProcessorTypes(); + // [END documentai_v1beta3_generated_DocumentProcessorService_FetchProcessorTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js new file mode 100644 index 00000000000..ec0e270b9b2 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.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) { + // [START documentai_v1beta3_generated_DocumentProcessorService_ListProcessors_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent (project and location) which owns this collection of Processors. + * Format: projects/{project}/locations/{location} + */ + // const parent = 'abc123' + /** + * The maximum number of processors to return. + * If unspecified, at most 50 processors will be returned. + * The maximum value is 100; values above 100 will be coerced to 100. + */ + // const pageSize = 1234 + /** + * We will return the processors sorted by creation time. The page token + * will point to the next processor. + */ + // const pageToken = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = + require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callListProcessors() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await documentaiClient.listProcessorsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListProcessors(); + // [END documentai_v1beta3_generated_DocumentProcessorService_ListProcessors_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js new file mode 100644 index 00000000000..37018bc1171 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js @@ -0,0 +1,70 @@ +// 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 documentai_v1beta3_generated_DocumentProcessorService_ProcessDocument_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * An inline document proto. + */ + // const inlineDocument = {} + /** + * A raw document content (bytes). + */ + // const rawDocument = {} + /** + * Required. The processor resource name. + */ + // const name = 'abc123' + /** + * The document payload, the content and mime_type fields must be set. + */ + // const document = {} + /** + * Whether Human Review feature should be skipped for this request. Default to + * false. + */ + // const skipHumanReview = true + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = + require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callProcessDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await documentaiClient.processDocument(request); + console.log(response); + } + + callProcessDocument(); + // [END documentai_v1beta3_generated_DocumentProcessorService_ProcessDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js new file mode 100644 index 00000000000..3f952d125c2 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js @@ -0,0 +1,71 @@ +// 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(humanReviewConfig) { + // [START documentai_v1beta3_generated_DocumentProcessorService_ReviewDocument_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * An inline document proto. + */ + // const inlineDocument = {} + /** + * Required. The resource name of the HumanReviewConfig that the document will be + * reviewed with. + */ + // const humanReviewConfig = 'abc123' + /** + * The document that needs human review. + */ + // const document = {} + /** + * Whether the validation should be performed on the ad-hoc review request. + */ + // const enableSchemaValidation = true + /** + * The priority of the human review task. + */ + // const priority = {} + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = + require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callReviewDocument() { + // Construct request + const request = { + humanReviewConfig, + }; + + // Run request + const [operation] = await documentaiClient.reviewDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callReviewDocument(); + // [END documentai_v1beta3_generated_DocumentProcessorService_ReviewDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts index b58bd2cdd98..bf664e515c4 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts @@ -345,6 +345,30 @@ export class DocumentProcessorServiceClient { // ------------------- // -- Service calls -- // ------------------- + /** + * Processes a single document. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.documentai.v1.Document} request.inlineDocument + * An inline document proto. + * @param {google.cloud.documentai.v1.RawDocument} request.rawDocument + * A raw document content (bytes). + * @param {string} request.name + * Required. The processor resource name. + * @param {boolean} request.skipHumanReview + * Whether Human Review feature should be skipped for this request. Default to + * false. + * @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 [ProcessResponse]{@link google.cloud.documentai.v1.ProcessResponse}. + * 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/v1/document_processor_service.process_document.js + * region_tag:documentai_v1_generated_DocumentProcessorService_ProcessDocument_async + */ processDocument( request?: protos.google.cloud.documentai.v1.IProcessRequest, options?: CallOptions @@ -372,30 +396,6 @@ export class DocumentProcessorServiceClient { {} | null | undefined > ): void; - /** - * Processes a single document. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.documentai.v1.Document} request.inlineDocument - * An inline document proto. - * @param {google.cloud.documentai.v1.RawDocument} request.rawDocument - * A raw document content (bytes). - * @param {string} request.name - * Required. The processor resource name. - * @param {boolean} request.skipHumanReview - * Whether Human Review feature should be skipped for this request. Default to - * false. - * @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 [ProcessResponse]{@link google.cloud.documentai.v1.ProcessResponse}. - * 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.processDocument(request); - */ processDocument( request?: protos.google.cloud.documentai.v1.IProcessRequest, optionsOrCallback?: @@ -436,6 +436,33 @@ export class DocumentProcessorServiceClient { return this.innerApiCalls.processDocument(request, options, callback); } + /** + * LRO endpoint to batch process many documents. The output is written + * to Cloud Storage as JSON in the [Document] format. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name. + * @param {google.cloud.documentai.v1.BatchDocumentsInputConfig} request.inputDocuments + * The input documents for batch process. + * @param {google.cloud.documentai.v1.DocumentOutputConfig} request.documentOutputConfig + * The overall output config for batch process. + * @param {boolean} request.skipHumanReview + * Whether Human Review feature should be skipped for this request. Default to + * false. + * @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/v1/document_processor_service.batch_process_documents.js + * region_tag:documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_async + */ batchProcessDocuments( request?: protos.google.cloud.documentai.v1.IBatchProcessRequest, options?: CallOptions @@ -472,34 +499,6 @@ export class DocumentProcessorServiceClient { {} | null | undefined > ): void; - /** - * LRO endpoint to batch process many documents. The output is written - * to Cloud Storage as JSON in the [Document] format. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The processor resource name. - * @param {google.cloud.documentai.v1.BatchDocumentsInputConfig} request.inputDocuments - * The input documents for batch process. - * @param {google.cloud.documentai.v1.DocumentOutputConfig} request.documentOutputConfig - * The overall output config for batch process. - * @param {boolean} request.skipHumanReview - * Whether Human Review feature should be skipped for this request. Default to - * false. - * @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.batchProcessDocuments(request); - * const [response] = await operation.promise(); - */ batchProcessDocuments( request?: protos.google.cloud.documentai.v1.IBatchProcessRequest, optionsOrCallback?: @@ -557,11 +556,8 @@ export class DocumentProcessorServiceClient { * 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 checkBatchProcessDocumentsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v1/document_processor_service.batch_process_documents.js + * region_tag:documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_async */ async checkBatchProcessDocumentsProgress( name: string @@ -585,6 +581,33 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1.BatchProcessMetadata >; } + /** + * Send a document for Human Review. The input document should be processed by + * the specified processor. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.documentai.v1.Document} request.inlineDocument + * An inline document proto. + * @param {string} request.humanReviewConfig + * Required. The resource name of the HumanReviewConfig that the document will be + * reviewed with. + * @param {boolean} request.enableSchemaValidation + * Whether the validation should be performed on the ad-hoc review request. + * @param {google.cloud.documentai.v1.ReviewDocumentRequest.Priority} request.priority + * The priority of the human review task. + * @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/v1/document_processor_service.review_document.js + * region_tag:documentai_v1_generated_DocumentProcessorService_ReviewDocument_async + */ reviewDocument( request?: protos.google.cloud.documentai.v1.IReviewDocumentRequest, options?: CallOptions @@ -621,34 +644,6 @@ export class DocumentProcessorServiceClient { {} | null | undefined > ): void; - /** - * Send a document for Human Review. The input document should be processed by - * the specified processor. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.documentai.v1.Document} request.inlineDocument - * An inline document proto. - * @param {string} request.humanReviewConfig - * Required. The resource name of the HumanReviewConfig that the document will be - * reviewed with. - * @param {boolean} request.enableSchemaValidation - * Whether the validation should be performed on the ad-hoc review request. - * @param {google.cloud.documentai.v1.ReviewDocumentRequest.Priority} request.priority - * The priority of the human review task. - * @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.reviewDocument(request); - * const [response] = await operation.promise(); - */ reviewDocument( request?: protos.google.cloud.documentai.v1.IReviewDocumentRequest, optionsOrCallback?: @@ -706,11 +701,8 @@ export class DocumentProcessorServiceClient { * 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 checkReviewDocumentProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v1/document_processor_service.review_document.js + * region_tag:documentai_v1_generated_DocumentProcessorService_ReviewDocument_async */ async checkReviewDocumentProgress( name: string diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts index 2b8d70e5efc..d38d1c7999a 100644 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts @@ -317,6 +317,31 @@ export class DocumentUnderstandingServiceClient { // -- Service calls -- // ------------------- + /** + * LRO endpoint to batch process many documents. + * + * @param {Object} request + * The request object that will be sent. + * @param {number[]} request.requests + * Required. Individual requests for each document. + * @param {string} request.parent + * Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no location is specified, a region will be chosen automatically. + * @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/v1beta1/document_understanding_service.batch_process_documents.js + * region_tag:documentai_v1beta1_generated_DocumentUnderstandingService_BatchProcessDocuments_async + */ batchProcessDocuments( request?: protos.google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest, options?: CallOptions @@ -353,32 +378,6 @@ export class DocumentUnderstandingServiceClient { {} | null | undefined > ): void; - /** - * LRO endpoint to batch process many documents. - * - * @param {Object} request - * The request object that will be sent. - * @param {number[]} request.requests - * Required. Individual requests for each document. - * @param {string} request.parent - * Target project and location to make a call. - * - * Format: `projects/{project-id}/locations/{location-id}`. - * - * If no location is specified, a region will be chosen automatically. - * @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.batchProcessDocuments(request); - * const [response] = await operation.promise(); - */ batchProcessDocuments( request?: protos.google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest, optionsOrCallback?: @@ -436,11 +435,8 @@ export class DocumentUnderstandingServiceClient { * 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 checkBatchProcessDocumentsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v1beta1/document_understanding_service.batch_process_documents.js + * region_tag:documentai_v1beta1_generated_DocumentUnderstandingService_BatchProcessDocuments_async */ async checkBatchProcessDocumentsProgress( name: string diff --git a/packages/google-cloud-documentai/src/v1beta1/gapic_metadata.json b/packages/google-cloud-documentai/src/v1beta1/gapic_metadata.json index ec68421d538..a283d1de127 100644 --- a/packages/google-cloud-documentai/src/v1beta1/gapic_metadata.json +++ b/packages/google-cloud-documentai/src/v1beta1/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.documentai.v1beta1", - "libraryPackage": "documentai", + "libraryPackage": "@google-cloud/documentai", "services": { "DocumentUnderstandingService": { "clients": { diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index 1c0adfcca40..552b1045653 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -319,40 +319,6 @@ export class DocumentUnderstandingServiceClient { // ------------------- // -- Service calls -- // ------------------- - processDocument( - request?: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.documentai.v1beta2.IDocument, - ( - | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest - | undefined - ), - {} | undefined - ] - >; - processDocument( - request: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.documentai.v1beta2.IDocument, - | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest - | null - | undefined, - {} | null | undefined - > - ): void; - processDocument( - request: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest, - callback: Callback< - protos.google.cloud.documentai.v1beta2.IDocument, - | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest - | null - | undefined, - {} | null | undefined - > - ): void; /** * Processes a single document. * @@ -396,9 +362,43 @@ export class DocumentUnderstandingServiceClient { * 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.processDocument(request); + * @example include:samples/generated/v1beta2/document_understanding_service.process_document.js + * region_tag:documentai_v1beta2_generated_DocumentUnderstandingService_ProcessDocument_async */ + processDocument( + request?: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1beta2.IDocument, + ( + | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest + | undefined + ), + {} | undefined + ] + >; + processDocument( + request: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.documentai.v1beta2.IDocument, + | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + processDocument( + request: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest, + callback: Callback< + protos.google.cloud.documentai.v1beta2.IDocument, + | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest + | null + | undefined, + {} | null | undefined + > + ): void; processDocument( request?: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest, optionsOrCallback?: @@ -446,6 +446,32 @@ export class DocumentUnderstandingServiceClient { return this.innerApiCalls.processDocument(request, options, callback); } + /** + * LRO endpoint to batch process many documents. The output is written + * to Cloud Storage as JSON in the [Document] format. + * + * @param {Object} request + * The request object that will be sent. + * @param {number[]} request.requests + * Required. Individual requests for each document. + * @param {string} request.parent + * Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no location is specified, a region will be chosen automatically. + * @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/v1beta2/document_understanding_service.batch_process_documents.js + * region_tag:documentai_v1beta2_generated_DocumentUnderstandingService_BatchProcessDocuments_async + */ batchProcessDocuments( request?: protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, options?: CallOptions @@ -482,33 +508,6 @@ export class DocumentUnderstandingServiceClient { {} | null | undefined > ): void; - /** - * LRO endpoint to batch process many documents. The output is written - * to Cloud Storage as JSON in the [Document] format. - * - * @param {Object} request - * The request object that will be sent. - * @param {number[]} request.requests - * Required. Individual requests for each document. - * @param {string} request.parent - * Target project and location to make a call. - * - * Format: `projects/{project-id}/locations/{location-id}`. - * - * If no location is specified, a region will be chosen automatically. - * @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.batchProcessDocuments(request); - * const [response] = await operation.promise(); - */ batchProcessDocuments( request?: protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, optionsOrCallback?: @@ -566,11 +565,8 @@ export class DocumentUnderstandingServiceClient { * 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 checkBatchProcessDocumentsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v1beta2/document_understanding_service.batch_process_documents.js + * region_tag:documentai_v1beta2_generated_DocumentUnderstandingService_BatchProcessDocuments_async */ async checkBatchProcessDocumentsProgress( name: string diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index 581a008412b..827328391fa 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts @@ -411,6 +411,32 @@ export class DocumentProcessorServiceClient { // ------------------- // -- Service calls -- // ------------------- + /** + * Processes a single document. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.documentai.v1beta3.Document} request.inlineDocument + * An inline document proto. + * @param {google.cloud.documentai.v1beta3.RawDocument} request.rawDocument + * A raw document content (bytes). + * @param {string} request.name + * Required. The processor resource name. + * @param {google.cloud.documentai.v1beta3.Document} request.document + * The document payload, the [content] and [mime_type] fields must be set. + * @param {boolean} request.skipHumanReview + * Whether Human Review feature should be skipped for this request. Default to + * false. + * @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 [ProcessResponse]{@link google.cloud.documentai.v1beta3.ProcessResponse}. + * 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/v1beta3/document_processor_service.process_document.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_ProcessDocument_async + */ processDocument( request?: protos.google.cloud.documentai.v1beta3.IProcessRequest, options?: CallOptions @@ -438,32 +464,6 @@ export class DocumentProcessorServiceClient { {} | null | undefined > ): void; - /** - * Processes a single document. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.documentai.v1beta3.Document} request.inlineDocument - * An inline document proto. - * @param {google.cloud.documentai.v1beta3.RawDocument} request.rawDocument - * A raw document content (bytes). - * @param {string} request.name - * Required. The processor resource name. - * @param {google.cloud.documentai.v1beta3.Document} request.document - * The document payload, the [content] and [mime_type] fields must be set. - * @param {boolean} request.skipHumanReview - * Whether Human Review feature should be skipped for this request. Default to - * false. - * @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 [ProcessResponse]{@link google.cloud.documentai.v1beta3.ProcessResponse}. - * 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.processDocument(request); - */ processDocument( request?: protos.google.cloud.documentai.v1beta3.IProcessRequest, optionsOrCallback?: @@ -505,6 +505,24 @@ export class DocumentProcessorServiceClient { this.initialize(); return this.innerApiCalls.processDocument(request, options, callback); } + /** + * Fetches processor types. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project of processor type to list. + * Format: projects/{project}/locations/{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 [FetchProcessorTypesResponse]{@link google.cloud.documentai.v1beta3.FetchProcessorTypesResponse}. + * 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/v1beta3/document_processor_service.fetch_processor_types.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_FetchProcessorTypes_async + */ fetchProcessorTypes( request?: protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest, options?: CallOptions @@ -539,24 +557,6 @@ export class DocumentProcessorServiceClient { {} | null | undefined > ): void; - /** - * Fetches processor types. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project of processor type to list. - * Format: projects/{project}/locations/{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 [FetchProcessorTypesResponse]{@link google.cloud.documentai.v1beta3.FetchProcessorTypesResponse}. - * 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.fetchProcessorTypes(request); - */ fetchProcessorTypes( request?: protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest, optionsOrCallback?: @@ -603,6 +603,28 @@ export class DocumentProcessorServiceClient { this.initialize(); return this.innerApiCalls.fetchProcessorTypes(request, options, callback); } + /** + * Creates a processor from the type processor that the user chose. + * The processor will be at "ENABLED" state by default after its creation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) under which to create the processor. + * Format: projects/{project}/locations/{location} + * @param {google.cloud.documentai.v1beta3.Processor} request.processor + * Required. The processor to be created, requires [processor_type] and [display_name] + * to be set. Also, the processor is under CMEK if CMEK fields are set. + * @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 [Processor]{@link google.cloud.documentai.v1beta3.Processor}. + * 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/v1beta3/document_processor_service.create_processor.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_CreateProcessor_async + */ createProcessor( request?: protos.google.cloud.documentai.v1beta3.ICreateProcessorRequest, options?: CallOptions @@ -637,28 +659,6 @@ export class DocumentProcessorServiceClient { {} | null | undefined > ): void; - /** - * Creates a processor from the type processor that the user chose. - * The processor will be at "ENABLED" state by default after its creation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent (project and location) under which to create the processor. - * Format: projects/{project}/locations/{location} - * @param {google.cloud.documentai.v1beta3.Processor} request.processor - * Required. The processor to be created, requires [processor_type] and [display_name] - * to be set. Also, the processor is under CMEK if CMEK fields are set. - * @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 [Processor]{@link google.cloud.documentai.v1beta3.Processor}. - * 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.createProcessor(request); - */ createProcessor( request?: protos.google.cloud.documentai.v1beta3.ICreateProcessorRequest, optionsOrCallback?: @@ -706,6 +706,37 @@ export class DocumentProcessorServiceClient { return this.innerApiCalls.createProcessor(request, options, callback); } + /** + * LRO endpoint to batch process many documents. The output is written + * to Cloud Storage as JSON in the [Document] format. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name. + * @param {number[]} request.inputConfigs + * The input config for each single document in the batch process. + * @param {google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig} request.outputConfig + * The overall output config for batch process. + * @param {google.cloud.documentai.v1beta3.BatchDocumentsInputConfig} request.inputDocuments + * The input documents for batch process. + * @param {google.cloud.documentai.v1beta3.DocumentOutputConfig} request.documentOutputConfig + * The overall output config for batch process. + * @param {boolean} request.skipHumanReview + * Whether Human Review feature should be skipped for this request. Default to + * false. + * @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/v1beta3/document_processor_service.batch_process_documents.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_BatchProcessDocuments_async + */ batchProcessDocuments( request?: protos.google.cloud.documentai.v1beta3.IBatchProcessRequest, options?: CallOptions @@ -742,38 +773,6 @@ export class DocumentProcessorServiceClient { {} | null | undefined > ): void; - /** - * LRO endpoint to batch process many documents. The output is written - * to Cloud Storage as JSON in the [Document] format. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The processor resource name. - * @param {number[]} request.inputConfigs - * The input config for each single document in the batch process. - * @param {google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig} request.outputConfig - * The overall output config for batch process. - * @param {google.cloud.documentai.v1beta3.BatchDocumentsInputConfig} request.inputDocuments - * The input documents for batch process. - * @param {google.cloud.documentai.v1beta3.DocumentOutputConfig} request.documentOutputConfig - * The overall output config for batch process. - * @param {boolean} request.skipHumanReview - * Whether Human Review feature should be skipped for this request. Default to - * false. - * @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.batchProcessDocuments(request); - * const [response] = await operation.promise(); - */ batchProcessDocuments( request?: protos.google.cloud.documentai.v1beta3.IBatchProcessRequest, optionsOrCallback?: @@ -831,11 +830,8 @@ export class DocumentProcessorServiceClient { * 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 checkBatchProcessDocumentsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v1beta3/document_processor_service.batch_process_documents.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_BatchProcessDocuments_async */ async checkBatchProcessDocumentsProgress( name: string @@ -859,6 +855,26 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1beta3.BatchProcessMetadata >; } + /** + * Deletes the processor, unloads all deployed model artifacts if it was + * enabled and then deletes all artifacts associated with this processor. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name to 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. + * 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/v1beta3/document_processor_service.delete_processor.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessor_async + */ deleteProcessor( request?: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, options?: CallOptions @@ -895,27 +911,6 @@ export class DocumentProcessorServiceClient { {} | null | undefined > ): void; - /** - * Deletes the processor, unloads all deployed model artifacts if it was - * enabled and then deletes all artifacts associated with this processor. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The processor resource name to 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. - * 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.deleteProcessor(request); - * const [response] = await operation.promise(); - */ deleteProcessor( request?: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, optionsOrCallback?: @@ -973,11 +968,8 @@ export class DocumentProcessorServiceClient { * 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 checkDeleteProcessorProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v1beta3/document_processor_service.delete_processor.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessor_async */ async checkDeleteProcessorProgress( name: string @@ -1001,6 +993,25 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1beta3.DeleteProcessorMetadata >; } + /** + * Enables a processor + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name to be enabled. + * @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/v1beta3/document_processor_service.enable_processor.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_EnableProcessor_async + */ enableProcessor( request?: protos.google.cloud.documentai.v1beta3.IEnableProcessorRequest, options?: CallOptions @@ -1037,26 +1048,6 @@ export class DocumentProcessorServiceClient { {} | null | undefined > ): void; - /** - * Enables a processor - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The processor resource name to be enabled. - * @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.enableProcessor(request); - * const [response] = await operation.promise(); - */ enableProcessor( request?: protos.google.cloud.documentai.v1beta3.IEnableProcessorRequest, optionsOrCallback?: @@ -1114,11 +1105,8 @@ export class DocumentProcessorServiceClient { * 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 checkEnableProcessorProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v1beta3/document_processor_service.enable_processor.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_EnableProcessor_async */ async checkEnableProcessorProgress( name: string @@ -1142,6 +1130,25 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1beta3.EnableProcessorMetadata >; } + /** + * Disables a processor + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name to be disabled. + * @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/v1beta3/document_processor_service.disable_processor.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DisableProcessor_async + */ disableProcessor( request?: protos.google.cloud.documentai.v1beta3.IDisableProcessorRequest, options?: CallOptions @@ -1178,26 +1185,6 @@ export class DocumentProcessorServiceClient { {} | null | undefined > ): void; - /** - * Disables a processor - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The processor resource name to be disabled. - * @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.disableProcessor(request); - * const [response] = await operation.promise(); - */ disableProcessor( request?: protos.google.cloud.documentai.v1beta3.IDisableProcessorRequest, optionsOrCallback?: @@ -1255,11 +1242,8 @@ export class DocumentProcessorServiceClient { * 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 checkDisableProcessorProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v1beta3/document_processor_service.disable_processor.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DisableProcessor_async */ async checkDisableProcessorProgress( name: string @@ -1283,6 +1267,35 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1beta3.DisableProcessorMetadata >; } + /** + * Send a document for Human Review. The input document should be processed by + * the specified processor. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.documentai.v1beta3.Document} request.inlineDocument + * An inline document proto. + * @param {string} request.humanReviewConfig + * Required. The resource name of the HumanReviewConfig that the document will be + * reviewed with. + * @param {google.cloud.documentai.v1beta3.Document} request.document + * The document that needs human review. + * @param {boolean} request.enableSchemaValidation + * Whether the validation should be performed on the ad-hoc review request. + * @param {google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority} request.priority + * The priority of the human review task. + * @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/v1beta3/document_processor_service.review_document.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_ReviewDocument_async + */ reviewDocument( request?: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, options?: CallOptions @@ -1319,36 +1332,6 @@ export class DocumentProcessorServiceClient { {} | null | undefined > ): void; - /** - * Send a document for Human Review. The input document should be processed by - * the specified processor. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.documentai.v1beta3.Document} request.inlineDocument - * An inline document proto. - * @param {string} request.humanReviewConfig - * Required. The resource name of the HumanReviewConfig that the document will be - * reviewed with. - * @param {google.cloud.documentai.v1beta3.Document} request.document - * The document that needs human review. - * @param {boolean} request.enableSchemaValidation - * Whether the validation should be performed on the ad-hoc review request. - * @param {google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority} request.priority - * The priority of the human review task. - * @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.reviewDocument(request); - * const [response] = await operation.promise(); - */ reviewDocument( request?: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, optionsOrCallback?: @@ -1406,11 +1389,8 @@ export class DocumentProcessorServiceClient { * 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 checkReviewDocumentProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v1beta3/document_processor_service.review_document.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_ReviewDocument_async */ async checkReviewDocumentProgress( name: string @@ -1434,6 +1414,34 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata >; } + /** + * Lists all processors which belong to this project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) which owns this collection of Processors. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * The maximum number of processors to return. + * If unspecified, at most 50 processors will be returned. + * The maximum value is 100; values above 100 will be coerced to 100. + * @param {string} request.pageToken + * We will return the processors sorted by creation time. The page token + * will point to the next processor. + * @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 [Processor]{@link google.cloud.documentai.v1beta3.Processor}. + * 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 `listProcessorsAsync()` + * 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. + */ listProcessors( request?: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, options?: CallOptions @@ -1465,34 +1473,6 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1beta3.IProcessor > ): void; - /** - * Lists all processors which belong to this project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent (project and location) which owns this collection of Processors. - * Format: projects/{project}/locations/{location} - * @param {number} request.pageSize - * The maximum number of processors to return. - * If unspecified, at most 50 processors will be returned. - * The maximum value is 100; values above 100 will be coerced to 100. - * @param {string} request.pageToken - * We will return the processors sorted by creation time. The page token - * will point to the next processor. - * @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 [Processor]{@link google.cloud.documentai.v1beta3.Processor}. - * 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 `listProcessorsAsync()` - * 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. - */ listProcessors( request?: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, optionsOrCallback?: @@ -1575,7 +1555,8 @@ export class DocumentProcessorServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listProcessors']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listProcessors.createStream( this.innerApiCalls.listProcessors as gax.GaxCall, @@ -1610,11 +1591,8 @@ export class DocumentProcessorServiceClient { * 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.listProcessorsAsync(request); - * for await (const response of iterable) { - * // process response - * } + * @example include:samples/generated/v1beta3/document_processor_service.list_processors.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_ListProcessors_async */ listProcessorsAsync( request?: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, @@ -1628,8 +1606,8 @@ export class DocumentProcessorServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listProcessors']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listProcessors.asyncIterate( this.innerApiCalls['listProcessors'] as GaxCall, From febdd2ffafc2a061b6a3d8f25c279606568d920b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 14 Dec 2021 15:29:50 -0800 Subject: [PATCH 163/213] feat: add eslintignore for sameple generated code (#1302) (#286) Source-Link: https://github.com/googleapis/synthtool/commit/b80127683923d61d471bf957cf19ae7ba131ff8b Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:ba3f2990fefe465f89834e4c46f847ddb141afa54daa6a1d462928fa679ed143 Co-authored-by: Owl Bot Co-authored-by: nicain --- packages/google-cloud-documentai/.eslintignore | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/google-cloud-documentai/.eslintignore b/packages/google-cloud-documentai/.eslintignore index 9340ad9b86d..ea5b04aebe6 100644 --- a/packages/google-cloud-documentai/.eslintignore +++ b/packages/google-cloud-documentai/.eslintignore @@ -4,3 +4,4 @@ test/fixtures build/ docs/ protos/ +samples/generated/ From 0ae5d9975a9e4d4608c2b9cb541d8b35392fc047 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 14 Dec 2021 23:44:14 +0000 Subject: [PATCH 164/213] chore: release 3.2.0 (#288) :robot: I have created a release \*beep\* \*boop\* --- ## [3.2.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v3.1.0...v3.2.0) (2021-12-14) ### Features * add eslintignore for sameple generated code ([#1302](https://www.github.com/googleapis/nodejs-document-ai/issues/1302)) ([#286](https://www.github.com/googleapis/nodejs-document-ai/issues/286)) ([2baf637](https://www.github.com/googleapis/nodejs-document-ai/commit/2baf63798501748096b8e17500789e067ec66edd)) --- 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-documentai/CHANGELOG.md | 7 +++++++ packages/google-cloud-documentai/package.json | 2 +- packages/google-cloud-documentai/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index c8ed3cce3e6..6e8294796d3 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [3.2.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v3.1.0...v3.2.0) (2021-12-14) + + +### Features + +* add eslintignore for sameple generated code ([#1302](https://www.github.com/googleapis/nodejs-document-ai/issues/1302)) ([#286](https://www.github.com/googleapis/nodejs-document-ai/issues/286)) ([2baf637](https://www.github.com/googleapis/nodejs-document-ai/commit/2baf63798501748096b8e17500789e067ec66edd)) + ## [3.1.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v3.0.2...v3.1.0) (2021-09-21) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index b7cc811abdc..8162d0e6258 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "3.1.0", + "version": "3.2.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 140933d1f8b..fb6c4cf3ed9 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^3.1.0", + "@google-cloud/documentai": "^3.2.0", "@google-cloud/storage": "^5.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" From f7655fea64879642f77605be9f596aabb14361e4 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 20:06:20 +0000 Subject: [PATCH 165/213] docs(node): support "stable"/"preview" release level (#1312) (#291) --- packages/google-cloud-documentai/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index 4f1a4ca397a..c1a1c4bebd3 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -192,6 +192,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 69b3d5b53a62e8e20dcd565b4e19cdeb87ee7e5d Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 30 Dec 2021 18:48:17 -0500 Subject: [PATCH 166/213] chore: add api_shortname and library_type to repo metadata (#290) Update .repo-metadata.json as required by go/library-data-integrity --- packages/google-cloud-documentai/.repo-metadata.json | 6 ++++-- packages/google-cloud-documentai/README.md | 9 ++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/google-cloud-documentai/.repo-metadata.json b/packages/google-cloud-documentai/.repo-metadata.json index 127fc5cd4a9..a4985047d99 100644 --- a/packages/google-cloud-documentai/.repo-metadata.json +++ b/packages/google-cloud-documentai/.repo-metadata.json @@ -4,12 +4,14 @@ "product_documentation": "https://cloud.google.com/document-ai/docs/", "client_documentation": "https://cloud.google.com/nodejs/docs/reference/documentai/latest", "issue_tracker": "", - "release_level": "ga", + "release_level": "stable", "language": "nodejs", "repo": "googleapis/nodejs-document-ai", "distribution_name": "@google-cloud/documentai", "api_id": "documentai.googleapis.com", "requires_billing": true, "codeowner_team": "@googleapis/ml-apis", - "default_version": "v1" + "default_version": "v1", + "api_shortname": "documentai", + "library_type": "GAPIC_AUTO" } diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index c1a1c4bebd3..b22f02683d5 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -4,7 +4,7 @@ # [Document AI: Node.js Client](https://github.com/googleapis/nodejs-document-ai) -[![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/documentai.svg)](https://www.npmjs.org/package/@google-cloud/documentai) [![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-document-ai/main.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-document-ai) @@ -182,10 +182,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. @@ -193,7 +193,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 e54a19df2638560ed9736e85255738994fd8a1a3 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 17:02:12 +0000 Subject: [PATCH 167/213] test(nodejs): remove 15 add 16 (#1322) (#294) --- packages/google-cloud-documentai/README.md | 3 +-- packages/google-cloud-documentai/protos/protos.d.ts | 2 +- packages/google-cloud-documentai/protos/protos.js | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index b22f02683d5..d6f4146ef2d 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -4,9 +4,8 @@ # [Document AI: Node.js Client](https://github.com/googleapis/nodejs-document-ai) - +[![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/documentai.svg)](https://www.npmjs.org/package/@google-cloud/documentai) -[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-document-ai/main.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-document-ai) diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 4060d264e41..bce47fd3259 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/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-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index ac7893e6f00..6b96278a97c 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/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 ce4fe16652952a9c476de3d1cae850159ee20f71 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 12 Jan 2022 17:20:31 +0000 Subject: [PATCH 168/213] fix(documentai): add ancillary service bindings to service_yaml (#296) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 421098374 Source-Link: https://github.com/googleapis/googleapis/commit/706ac2b021bb8aef168b584f76dd8efe25e6349d Source-Link: https://github.com/googleapis/googleapis-gen/commit/d469765bf2194780a933e15b4ce6c5d1c4742489 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDQ2OTc2NWJmMjE5NDc4MGE5MzNlMTViNGNlNmM1ZDFjNDc0MjQ4OSJ9 --- packages/google-cloud-documentai/.jsdoc.js | 4 ++-- .../document_processor_service.batch_process_documents.js | 4 ++-- .../v1/document_processor_service.process_document.js | 4 ++-- .../v1/document_processor_service.review_document.js | 4 ++-- ...ocument_understanding_service.batch_process_documents.js | 4 ++-- ...ocument_understanding_service.batch_process_documents.js | 4 ++-- .../document_understanding_service.process_document.js | 4 ++-- .../document_processor_service.batch_process_documents.js | 4 ++-- .../v1beta3/document_processor_service.create_processor.js | 6 +++--- .../v1beta3/document_processor_service.delete_processor.js | 4 ++-- .../v1beta3/document_processor_service.disable_processor.js | 4 ++-- .../v1beta3/document_processor_service.enable_processor.js | 4 ++-- .../document_processor_service.fetch_processor_types.js | 4 ++-- .../v1beta3/document_processor_service.list_processors.js | 6 +++--- .../v1beta3/document_processor_service.process_document.js | 4 ++-- .../v1beta3/document_processor_service.review_document.js | 4 ++-- .../src/v1/document_processor_service_client.ts | 2 +- packages/google-cloud-documentai/src/v1/index.ts | 2 +- .../system-test/fixtures/sample/src/index.js | 2 +- .../system-test/fixtures/sample/src/index.ts | 2 +- packages/google-cloud-documentai/system-test/install.ts | 2 +- .../test/gapic_document_processor_service_v1.ts | 2 +- 22 files changed, 40 insertions(+), 40 deletions(-) diff --git a/packages/google-cloud-documentai/.jsdoc.js b/packages/google-cloud-documentai/.jsdoc.js index a00b08ce270..75c76e52a54 100644 --- a/packages/google-cloud-documentai/.jsdoc.js +++ b/packages/google-cloud-documentai/.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/documentai', diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js index cdf98d1b454..6651cd4d885 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name) { @@ -38,8 +39,7 @@ function main(name) { // const skipHumanReview = true // Imports the Documentai library - const {DocumentProcessorServiceClient} = - require('@google-cloud/documentai').v1; + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; // Instantiates a client const documentaiClient = new DocumentProcessorServiceClient(); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js index 9c22048acda..849d86196e5 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name) { @@ -38,8 +39,7 @@ function main(name) { // const skipHumanReview = true // Imports the Documentai library - const {DocumentProcessorServiceClient} = - require('@google-cloud/documentai').v1; + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; // Instantiates a client const documentaiClient = new DocumentProcessorServiceClient(); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js index 2dc162fe458..3ced0143291 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(humanReviewConfig) { @@ -38,8 +39,7 @@ function main(humanReviewConfig) { // const priority = {} // Imports the Documentai library - const {DocumentProcessorServiceClient} = - require('@google-cloud/documentai').v1; + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; // Instantiates a client const documentaiClient = new DocumentProcessorServiceClient(); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js index 56d524f4ba6..4e9d54da93e 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(requests) { @@ -31,8 +32,7 @@ function main(requests) { // const parent = 'abc123' // Imports the Documentai library - const {DocumentUnderstandingServiceClient} = - require('@google-cloud/documentai').v1beta1; + const {DocumentUnderstandingServiceClient} = require('@google-cloud/documentai').v1beta1; // Instantiates a client const documentaiClient = new DocumentUnderstandingServiceClient(); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js index 9f4e352679b..ad7d7d1e1f5 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(requests) { @@ -31,8 +32,7 @@ function main(requests) { // const parent = 'abc123' // Imports the Documentai library - const {DocumentUnderstandingServiceClient} = - require('@google-cloud/documentai').v1beta2; + const {DocumentUnderstandingServiceClient} = require('@google-cloud/documentai').v1beta2; // Instantiates a client const documentaiClient = new DocumentUnderstandingServiceClient(); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js index 679aad5de80..5864d9937e9 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(inputConfig) { @@ -68,8 +69,7 @@ function main(inputConfig) { // const automlParams = {} // Imports the Documentai library - const {DocumentUnderstandingServiceClient} = - require('@google-cloud/documentai').v1beta2; + const {DocumentUnderstandingServiceClient} = require('@google-cloud/documentai').v1beta2; // Instantiates a client const documentaiClient = new DocumentUnderstandingServiceClient(); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js index 06105529398..596ffb8e78b 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name) { @@ -46,8 +47,7 @@ function main(name) { // const skipHumanReview = true // Imports the Documentai library - const {DocumentProcessorServiceClient} = - require('@google-cloud/documentai').v1beta3; + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; // Instantiates a client const documentaiClient = new DocumentProcessorServiceClient(); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js index 4ed3a3e8ad6..cedc57901d1 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, processor) { @@ -25,14 +26,13 @@ function main(parent, processor) { */ // const parent = 'abc123' /** - * Required. The processor to be created, requires processor_type and display_name + * Required. The processor to be created, requires processor_type and display_name * to be set. Also, the processor is under CMEK if CMEK fields are set. */ // const processor = {} // Imports the Documentai library - const {DocumentProcessorServiceClient} = - require('@google-cloud/documentai').v1beta3; + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; // Instantiates a client const documentaiClient = new DocumentProcessorServiceClient(); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js index 5cbd9f196ee..3b20ac69a29 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name) { @@ -25,8 +26,7 @@ function main(name) { // const name = 'abc123' // Imports the Documentai library - const {DocumentProcessorServiceClient} = - require('@google-cloud/documentai').v1beta3; + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; // Instantiates a client const documentaiClient = new DocumentProcessorServiceClient(); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js index f55d16d1916..b6bbe5af056 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name) { @@ -25,8 +26,7 @@ function main(name) { // const name = 'abc123' // Imports the Documentai library - const {DocumentProcessorServiceClient} = - require('@google-cloud/documentai').v1beta3; + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; // Instantiates a client const documentaiClient = new DocumentProcessorServiceClient(); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js index 9581b40ce87..32f84b4dad7 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name) { @@ -25,8 +26,7 @@ function main(name) { // const name = 'abc123' // Imports the Documentai library - const {DocumentProcessorServiceClient} = - require('@google-cloud/documentai').v1beta3; + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; // Instantiates a client const documentaiClient = new DocumentProcessorServiceClient(); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js index 95cf1157f7a..ad17c02adbf 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent) { @@ -26,8 +27,7 @@ function main(parent) { // const parent = 'abc123' // Imports the Documentai library - const {DocumentProcessorServiceClient} = - require('@google-cloud/documentai').v1beta3; + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; // Instantiates a client const documentaiClient = new DocumentProcessorServiceClient(); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js index ec0e270b9b2..0e7a5e8d194 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent) { @@ -37,8 +38,7 @@ function main(parent) { // const pageToken = 'abc123' // Imports the Documentai library - const {DocumentProcessorServiceClient} = - require('@google-cloud/documentai').v1beta3; + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; // Instantiates a client const documentaiClient = new DocumentProcessorServiceClient(); @@ -52,7 +52,7 @@ function main(parent) { // Run request const iterable = await documentaiClient.listProcessorsAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js index 37018bc1171..112ef1e6ba9 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name) { @@ -42,8 +43,7 @@ function main(name) { // const skipHumanReview = true // Imports the Documentai library - const {DocumentProcessorServiceClient} = - require('@google-cloud/documentai').v1beta3; + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; // Instantiates a client const documentaiClient = new DocumentProcessorServiceClient(); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js index 3f952d125c2..fc4ee452881 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(humanReviewConfig) { @@ -42,8 +43,7 @@ function main(humanReviewConfig) { // const priority = {} // Imports the Documentai library - const {DocumentProcessorServiceClient} = - require('@google-cloud/documentai').v1beta3; + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; // Instantiates a client const documentaiClient = new DocumentProcessorServiceClient(); diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts index bf664e515c4..794cc921c6c 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1/document_processor_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-documentai/src/v1/index.ts b/packages/google-cloud-documentai/src/v1/index.ts index 2f6c91a4251..db3b76d115a 100644 --- a/packages/google-cloud-documentai/src/v1/index.ts +++ b/packages/google-cloud-documentai/src/v1/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-documentai/system-test/fixtures/sample/src/index.js b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js index 2a311c0623f..68ef68b55fd 100644 --- a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-documentai/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-documentai/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts index d5d3a39fcdf..c92c9a088ce 100644 --- a/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-documentai/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-documentai/system-test/install.ts b/packages/google-cloud-documentai/system-test/install.ts index d2d61c0396f..6dd1eaadafa 100644 --- a/packages/google-cloud-documentai/system-test/install.ts +++ b/packages/google-cloud-documentai/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-documentai/test/gapic_document_processor_service_v1.ts b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts index 9b9c1289884..4c9a793a3d4 100644 --- a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.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 4acc84fc3461018926e4ad09882261ea47cb4f36 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 17 Jan 2022 14:38:09 -0500 Subject: [PATCH 169/213] chore(main): release 3.2.1 (#297) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-documentai/CHANGELOG.md | 7 +++++++ packages/google-cloud-documentai/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index 6e8294796d3..f61d769450b 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [3.2.1](https://github.com/googleapis/nodejs-document-ai/compare/v3.2.0...v3.2.1) (2022-01-13) + + +### Bug Fixes + +* **documentai:** add ancillary service bindings to service_yaml ([#296](https://github.com/googleapis/nodejs-document-ai/issues/296)) ([14d1b31](https://github.com/googleapis/nodejs-document-ai/commit/14d1b3195a3288f436a1445372cc3d66438bc544)) + ## [3.2.0](https://www.github.com/googleapis/nodejs-document-ai/compare/v3.1.0...v3.2.0) (2021-12-14) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 8162d0e6258..8e0f02c2a09 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "3.2.0", + "version": "3.2.1", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", From f1a7f34f1e015dc239f315a75500091504fea09c 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:53:07 +0000 Subject: [PATCH 170/213] chore: update v2.12.0 gapic-generator-typescript (#302) - [ ] 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 --- .../google-cloud-documentai/linkinator.config.json | 10 ++++++++-- .../v1beta1/document_understanding_service_client.ts | 2 +- packages/google-cloud-documentai/src/v1beta1/index.ts | 2 +- .../v1beta2/document_understanding_service_client.ts | 2 +- packages/google-cloud-documentai/src/v1beta2/index.ts | 2 +- .../src/v1beta3/document_processor_service_client.ts | 2 +- packages/google-cloud-documentai/src/v1beta3/index.ts | 2 +- .../test/gapic_document_processor_service_v1beta3.ts | 2 +- .../gapic_document_understanding_service_v1beta1.ts | 2 +- .../gapic_document_understanding_service_v1beta2.ts | 2 +- 10 files changed, 17 insertions(+), 11 deletions(-) diff --git a/packages/google-cloud-documentai/linkinator.config.json b/packages/google-cloud-documentai/linkinator.config.json index 0121dfa684f..befd23c8633 100644 --- a/packages/google-cloud-documentai/linkinator.config.json +++ b/packages/google-cloud-documentai/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 } diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts index d38d1c7999a..4135b22014b 100644 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_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-documentai/src/v1beta1/index.ts b/packages/google-cloud-documentai/src/v1beta1/index.ts index 1a00861f815..c274d629b37 100644 --- a/packages/google-cloud-documentai/src/v1beta1/index.ts +++ b/packages/google-cloud-documentai/src/v1beta1/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-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index 552b1045653..8d24e78da41 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_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-documentai/src/v1beta2/index.ts b/packages/google-cloud-documentai/src/v1beta2/index.ts index 1a00861f815..c274d629b37 100644 --- a/packages/google-cloud-documentai/src/v1beta2/index.ts +++ b/packages/google-cloud-documentai/src/v1beta2/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-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index 827328391fa..d9f6bcf37b4 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_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-documentai/src/v1beta3/index.ts b/packages/google-cloud-documentai/src/v1beta3/index.ts index 2f6c91a4251..db3b76d115a 100644 --- a/packages/google-cloud-documentai/src/v1beta3/index.ts +++ b/packages/google-cloud-documentai/src/v1beta3/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-documentai/test/gapic_document_processor_service_v1beta3.ts b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts index a450f720901..377013c94f6 100644 --- a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.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-documentai/test/gapic_document_understanding_service_v1beta1.ts b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts index d5f75fdf143..90b5ea5dd5e 100644 --- a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts +++ b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.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-documentai/test/gapic_document_understanding_service_v1beta2.ts b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts index ba8e872054a..c277620b853 100644 --- a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts +++ b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.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 d44127da7b113144cecd9f6a369aba17efc0fc8a Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 31 Jan 2022 23:28:46 +0100 Subject: [PATCH 171/213] chore(deps): update dependency sinon to v13 (#305) 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.0) | [![age](https://badges.renovateapi.com/packages/npm/sinon/13.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/sinon/13.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/sinon/13.0.0/compatibility-slim/12.0.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/sinon/13.0.0/confidence-slim/12.0.1)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
sinonjs/sinon ### [`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-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 8e0f02c2a09..e12650c4084 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -43,7 +43,7 @@ "mocha": "^8.0.0", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", - "sinon": "^12.0.0", + "sinon": "^13.0.0", "ts-loader": "^9.0.0", "typescript": "^3.8.3", "webpack": "^5.0.0", From 4ceb0ef87f7fead4363762bcd520ee77cd2c7116 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:22:50 +0000 Subject: [PATCH 172/213] feat: add question_id field in ReviewDocumentOperationMetadata (#304) PiperOrigin-RevId: 424949086 Source-Link: https://github.com/googleapis/googleapis/commit/087bceb20b8f938e5167e1272c1b7fba50feae19 Source-Link: https://github.com/googleapis/googleapis-gen/commit/af347930b66df50d30cd079e282776d08eb7f2aa Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWYzNDc5MzBiNjZkZjUwZDMwY2QwNzllMjgyNzc2ZDA4ZWI3ZjJhYSJ9 --- .../v1/document_processor_service.proto | 3 +++ .../protos/protos.d.ts | 6 +++++ .../google-cloud-documentai/protos/protos.js | 25 ++++++++++++++++++- .../protos/protos.json | 4 +++ 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto index 65f0e6d967c..314a51d9ac0 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto @@ -298,4 +298,7 @@ message ReviewDocumentResponse { message ReviewDocumentOperationMetadata { // The basic metadata of the long running operation. CommonOperationMetadata common_metadata = 5; + + // The question ID. + string question_id = 6; } diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index bce47fd3259..df591e898bb 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -5608,6 +5608,9 @@ export namespace google { /** ReviewDocumentOperationMetadata commonMetadata */ commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + + /** ReviewDocumentOperationMetadata questionId */ + questionId?: (string|null); } /** Represents a ReviewDocumentOperationMetadata. */ @@ -5622,6 +5625,9 @@ export namespace google { /** ReviewDocumentOperationMetadata commonMetadata. */ public commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + /** ReviewDocumentOperationMetadata questionId. */ + public questionId: string; + /** * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 6b96278a97c..f9dff874b4c 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -14296,6 +14296,7 @@ * @memberof google.cloud.documentai.v1 * @interface IReviewDocumentOperationMetadata * @property {google.cloud.documentai.v1.ICommonOperationMetadata|null} [commonMetadata] ReviewDocumentOperationMetadata commonMetadata + * @property {string|null} [questionId] ReviewDocumentOperationMetadata questionId */ /** @@ -14321,6 +14322,14 @@ */ ReviewDocumentOperationMetadata.prototype.commonMetadata = null; + /** + * ReviewDocumentOperationMetadata questionId. + * @member {string} questionId + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.questionId = ""; + /** * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. * @function create @@ -14347,6 +14356,8 @@ writer = $Writer.create(); if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) $root.google.cloud.documentai.v1.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.questionId != null && Object.hasOwnProperty.call(message, "questionId")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.questionId); return writer; }; @@ -14384,6 +14395,9 @@ case 5: message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); break; + case 6: + message.questionId = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -14424,6 +14438,9 @@ if (error) return "commonMetadata." + error; } + if (message.questionId != null && message.hasOwnProperty("questionId")) + if (!$util.isString(message.questionId)) + return "questionId: string expected"; return null; }; @@ -14444,6 +14461,8 @@ throw TypeError(".google.cloud.documentai.v1.ReviewDocumentOperationMetadata.commonMetadata: object expected"); message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.fromObject(object.commonMetadata); } + if (object.questionId != null) + message.questionId = String(object.questionId); return message; }; @@ -14460,10 +14479,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.commonMetadata = null; + object.questionId = ""; + } if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) object.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.toObject(message.commonMetadata, options); + if (message.questionId != null && message.hasOwnProperty("questionId")) + object.questionId = message.questionId; return object; }; diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 935b4e3a15d..79bf712a099 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -1299,6 +1299,10 @@ "commonMetadata": { "type": "CommonOperationMetadata", "id": 5 + }, + "questionId": { + "type": "string", + "id": 6 } } }, From 50610af9e8d19233bf8e9321948f96eef1fb5374 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 3 Feb 2022 23:56:12 +0000 Subject: [PATCH 173/213] feat: add question_id field in ReviewDocumentOperationMetadata (#308) PiperOrigin-RevId: 426180523 Source-Link: https://github.com/googleapis/googleapis/commit/38a8eb97e2b3d0f0cceefc8190c12bdcefff7214 Source-Link: https://github.com/googleapis/googleapis-gen/commit/9a1a88b211e2e94bc8e35855378e0523cb8a6683 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOWExYTg4YjIxMWUyZTk0YmM4ZTM1ODU1Mzc4ZTA1MjNjYjhhNjY4MyJ9 See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../v1beta3/document_processor_service.proto | 3 +++ .../protos/protos.d.ts | 6 +++++ .../google-cloud-documentai/protos/protos.js | 22 +++++++++++++++++++ .../protos/protos.json | 4 ++++ 4 files changed, 35 insertions(+) diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto index e76a0316463..ae589642dc4 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto @@ -569,4 +569,7 @@ message ReviewDocumentOperationMetadata { // The basic metadata of the long running operation. CommonOperationMetadata common_metadata = 5; + + // The question ID. + string question_id = 6; } diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index df591e898bb..6e5f5789d1b 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -21835,6 +21835,9 @@ export namespace google { /** ReviewDocumentOperationMetadata commonMetadata */ commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + + /** ReviewDocumentOperationMetadata questionId */ + questionId?: (string|null); } /** Represents a ReviewDocumentOperationMetadata. */ @@ -21861,6 +21864,9 @@ export namespace google { /** ReviewDocumentOperationMetadata commonMetadata. */ public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + /** ReviewDocumentOperationMetadata questionId. */ + public questionId: string; + /** * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index f9dff874b4c..e2761b092fa 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -54710,6 +54710,7 @@ * @property {google.protobuf.ITimestamp|null} [createTime] ReviewDocumentOperationMetadata createTime * @property {google.protobuf.ITimestamp|null} [updateTime] ReviewDocumentOperationMetadata updateTime * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] ReviewDocumentOperationMetadata commonMetadata + * @property {string|null} [questionId] ReviewDocumentOperationMetadata questionId */ /** @@ -54767,6 +54768,14 @@ */ ReviewDocumentOperationMetadata.prototype.commonMetadata = null; + /** + * ReviewDocumentOperationMetadata questionId. + * @member {string} questionId + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.questionId = ""; + /** * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. * @function create @@ -54801,6 +54810,8 @@ $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.questionId != null && Object.hasOwnProperty.call(message, "questionId")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.questionId); return writer; }; @@ -54850,6 +54861,9 @@ case 5: message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); break; + case 6: + message.questionId = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -54915,6 +54929,9 @@ if (error) return "commonMetadata." + error; } + if (message.questionId != null && message.hasOwnProperty("questionId")) + if (!$util.isString(message.questionId)) + return "questionId: string expected"; return null; }; @@ -54973,6 +54990,8 @@ throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.commonMetadata: object expected"); message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); } + if (object.questionId != null) + message.questionId = String(object.questionId); return message; }; @@ -54995,6 +55014,7 @@ object.createTime = null; object.updateTime = null; object.commonMetadata = null; + object.questionId = ""; } if (message.state != null && message.hasOwnProperty("state")) object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State[message.state] : message.state; @@ -55006,6 +55026,8 @@ object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); + if (message.questionId != null && message.hasOwnProperty("questionId")) + object.questionId = message.questionId; return object; }; diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 79bf712a099..9ccf231fb45 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -4799,6 +4799,10 @@ "commonMetadata": { "type": "CommonOperationMetadata", "id": 5 + }, + "questionId": { + "type": "string", + "id": 6 } }, "nested": { From eb17148dbd6046aa59fc7c71923c615c3726b3bb 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:22:48 +0000 Subject: [PATCH 174/213] docs(nodejs): version support policy edits (#1346) (#309) --- packages/google-cloud-documentai/README.md | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index d6f4146ef2d..f432a138efc 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -160,21 +160,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/documentai@legacy-8` installs client libraries +for versions compatible with Node.js 8. ## Versioning From 4531bd99841e6321de38623c70d141fc839c62a2 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 22 Feb 2022 18:20:47 +0000 Subject: [PATCH 175/213] docs(samples): include metadata file, add exclusions for samples to handwritten libraries (#310) - [ ] 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 feat: add `symbols` field, and auto-format comments PiperOrigin-RevId: 428800506 Source-Link: https://github.com/googleapis/googleapis/commit/ea203800672c46605968b78138eb84d871c125c5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/8b9ece508c132516f4bf79e462f08253acc85935 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOGI5ZWNlNTA4YzEzMjUxNmY0YmY3OWU0NjJmMDgyNTNhY2M4NTkzNSJ9 feat: add `symbols` field, and auto-format comments PiperOrigin-RevId: 428799963 Source-Link: https://github.com/googleapis/googleapis/commit/8b6181f5ba0b45f07403ac801f6914045d464da2 Source-Link: https://github.com/googleapis/googleapis-gen/commit/2c320a956160ee86cb8d7923e37a1a3a451d1042 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmMzMjBhOTU2MTYwZWU4NmNiOGQ3OTIzZTM3YTFhM2E0NTFkMTA0MiJ9 --- .../google/cloud/documentai/v1/document.proto | 257 +++++--- .../cloud/documentai/v1beta3/document.proto | 283 +++++--- .../protos/protos.d.ts | 228 ++++++- .../google-cloud-documentai/protos/protos.js | 610 +++++++++++++++++- .../protos/protos.json | 76 ++- ...ocessor_service.batch_process_documents.js | 9 +- ...ment_processor_service.process_document.js | 9 +- ...ument_processor_service.review_document.js | 9 +- ...t_metadata.google.cloud.documentai.v1.json | 171 +++++ ...tanding_service.batch_process_documents.js | 9 +- ...adata.google.cloud.documentai.v1beta1.json | 59 ++ ...tanding_service.batch_process_documents.js | 9 +- ..._understanding_service.process_document.js | 9 +- ...adata.google.cloud.documentai.v1beta2.json | 131 ++++ ...ocessor_service.batch_process_documents.js | 9 +- ...ment_processor_service.create_processor.js | 9 +- ...ment_processor_service.delete_processor.js | 9 +- ...ent_processor_service.disable_processor.js | 9 +- ...ment_processor_service.enable_processor.js | 9 +- ...processor_service.fetch_processor_types.js | 9 +- ...ument_processor_service.list_processors.js | 9 +- ...ment_processor_service.process_document.js | 9 +- ...ument_processor_service.review_document.js | 9 +- ...adata.google.cloud.documentai.v1beta3.json | 439 +++++++++++++ .../v1/document_processor_service_client.ts | 5 +- .../document_understanding_service_client.ts | 5 +- .../document_understanding_service_client.ts | 5 +- .../document_processor_service_client.ts | 5 +- .../gapic_document_processor_service_v1.ts | 37 +- ...apic_document_processor_service_v1beta3.ts | 79 ++- ..._document_understanding_service_v1beta1.ts | 22 +- ..._document_understanding_service_v1beta2.ts | 41 +- 32 files changed, 2288 insertions(+), 300 deletions(-) create mode 100644 packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto index 467a44921a6..e6368bad543 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto @@ -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. @@ -16,6 +16,7 @@ syntax = "proto3"; package google.cloud.documentai.v1; +import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/cloud/documentai/v1/geometry.proto"; import "google/protobuf/timestamp.proto"; @@ -25,7 +26,6 @@ import "google/type/date.proto"; import "google/type/datetime.proto"; import "google/type/money.proto"; import "google/type/postal_address.proto"; -import "google/api/annotations.proto"; option csharp_namespace = "Google.Cloud.DocumentAI.V1"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai"; @@ -51,7 +51,8 @@ message Document { // Total number of shards. int64 shard_count = 2; - // The index of the first character in [Document.text][google.cloud.documentai.v1.Document.text] in the overall + // The index of the first character in + // [Document.text][google.cloud.documentai.v1.Document.text] in the overall // document global text. int64 text_offset = 3; } @@ -68,7 +69,8 @@ message Document { string unit = 2; } - // Text anchor indexing into the [Document.text][google.cloud.documentai.v1.Document.text]. + // Text anchor indexing into the + // [Document.text][google.cloud.documentai.v1.Document.text]. TextAnchor text_anchor = 1; // Text color. @@ -165,25 +167,31 @@ message Document { PAGE_LEFT = 4; } - // Text anchor indexing into the [Document.text][google.cloud.documentai.v1.Document.text]. + // Text anchor indexing into the + // [Document.text][google.cloud.documentai.v1.Document.text]. TextAnchor text_anchor = 1; - // Confidence of the current [Layout][google.cloud.documentai.v1.Document.Page.Layout] within context of the object this - // layout is for. e.g. confidence can be for a single token, a table, - // a visual element, etc. depending on context. Range [0, 1]. + // Confidence of the current + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] within + // context of the object this layout is for. e.g. confidence can be for a + // single token, a table, a visual element, etc. depending on context. + // Range [0, 1]. float confidence = 2; - // The bounding polygon for the [Layout][google.cloud.documentai.v1.Document.Page.Layout]. + // The bounding polygon for the + // [Layout][google.cloud.documentai.v1.Document.Page.Layout]. BoundingPoly bounding_poly = 3; - // Detected orientation for the [Layout][google.cloud.documentai.v1.Document.Page.Layout]. + // Detected orientation for the + // [Layout][google.cloud.documentai.v1.Document.Page.Layout]. Orientation orientation = 4; } // A block has a set of lines (collected into paragraphs) that have a // common line-spacing and orientation. message Block { - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Block][google.cloud.documentai.v1.Document.Page.Block]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + // [Block][google.cloud.documentai.v1.Document.Page.Block]. Layout layout = 1; // A list of detected languages together with confidence. @@ -195,7 +203,8 @@ message Document { // A collection of lines that a human would perceive as a paragraph. message Paragraph { - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Paragraph][google.cloud.documentai.v1.Document.Page.Paragraph]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + // [Paragraph][google.cloud.documentai.v1.Document.Page.Paragraph]. Layout layout = 1; // A list of detected languages together with confidence. @@ -208,7 +217,8 @@ message Document { // A collection of tokens that a human would perceive as a line. // Does not cross column boundaries, can be horizontal, vertical, etc. message Line { - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Line][google.cloud.documentai.v1.Document.Page.Line]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + // [Line][google.cloud.documentai.v1.Document.Page.Line]. Layout layout = 1; // A list of detected languages together with confidence. @@ -220,7 +230,8 @@ message Document { // A detected token. message Token { - // Detected break at the end of a [Token][google.cloud.documentai.v1.Document.Page.Token]. + // Detected break at the end of a + // [Token][google.cloud.documentai.v1.Document.Page.Token]. message DetectedBreak { // Enum to denote the type of break found. enum Type { @@ -241,10 +252,12 @@ message Document { Type type = 1; } - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Token][google.cloud.documentai.v1.Document.Page.Token]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + // [Token][google.cloud.documentai.v1.Document.Page.Token]. Layout layout = 1; - // Detected break at the end of a [Token][google.cloud.documentai.v1.Document.Page.Token]. + // Detected break at the end of a + // [Token][google.cloud.documentai.v1.Document.Page.Token]. DetectedBreak detected_break = 2; // A list of detected languages together with confidence. @@ -254,13 +267,25 @@ message Document { Provenance provenance = 4; } + // A detected symbol. + message Symbol { + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + // [Symbol][google.cloud.documentai.v1.Document.Page.Symbol]. + Layout layout = 1; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 2; + } + // Detected non-text visual elements e.g. checkbox, signature etc. on the // page. message VisualElement { - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + // [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. Layout layout = 1; - // Type of the [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. + // Type of the + // [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. string type = 2; // A list of detected languages together with confidence. @@ -277,7 +302,8 @@ message Document { // A cell representation inside the table. message TableCell { - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [TableCell][google.cloud.documentai.v1.Document.Page.Table.TableCell]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + // [TableCell][google.cloud.documentai.v1.Document.Page.Table.TableCell]. Layout layout = 1; // How many rows this cell spans. @@ -290,7 +316,8 @@ message Document { repeated DetectedLanguage detected_languages = 4; } - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Table][google.cloud.documentai.v1.Document.Page.Table]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + // [Table][google.cloud.documentai.v1.Document.Page.Table]. Layout layout = 1; // Header rows of the table. @@ -305,11 +332,13 @@ message Document { // A form field detected on the page. message FormField { - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the [FormField][google.cloud.documentai.v1.Document.Page.FormField] name. e.g. `Address`, `Email`, - // `Grand total`, `Phone number`, etc. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the + // [FormField][google.cloud.documentai.v1.Document.Page.FormField] name. + // e.g. `Address`, `Email`, `Grand total`, `Phone number`, etc. Layout field_name = 1; - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the [FormField][google.cloud.documentai.v1.Document.Page.FormField] value. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the + // [FormField][google.cloud.documentai.v1.Document.Page.FormField] value. Layout field_value = 2; // A list of detected languages for name together with confidence. @@ -333,16 +362,18 @@ message Document { message DetectedLanguage { // The BCP-47 language code, such as "en-US" or "sr-Latn". For more // information, see - // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + // https://www.unicode.org/reports/tr35/#Unicode_locale_identifier. string language_code = 1; // Confidence of detected language. Range [0, 1]. float confidence = 2; } - // 1-based index for current [Page][google.cloud.documentai.v1.Document.Page] in a parent [Document][google.cloud.documentai.v1.Document]. - // Useful when a page is taken out of a [Document][google.cloud.documentai.v1.Document] for individual - // processing. + // 1-based index for current + // [Page][google.cloud.documentai.v1.Document.Page] in a parent + // [Document][google.cloud.documentai.v1.Document]. Useful when a page is + // taken out of a [Document][google.cloud.documentai.v1.Document] for + // individual processing. int32 page_number = 1; // Rendered image for this page. This image is preprocessed to remove any @@ -389,17 +420,23 @@ message Document { // A list of visually detected form fields on the page. repeated FormField form_fields = 11; + // A list of visually detected symbols on the page. + repeated Symbol symbols = 12; + // The history of this page. Provenance provenance = 16; } - // A phrase in the text that is a known entity type, such as a person, an - // organization, or location. + // An entity that could be a phrase in the text or a property that belongs to + // the document. It is a known entity type, such as a person, an organization, + // or location. message Entity { // Parsed and normalized entity value. message NormalizedValue { - // Structured entity value. Must match entity type defined in schema if - // known. If this field is present, the 'text' field is still populated. + // An optional structured entity value. + // Must match entity type defined in schema if + // known. If this field is present, the `text` field could also be + // populated. oneof structured_value { // Money value. See also: // https://github.com/googleapis/googleapis/blob/master/google/type/money.proto @@ -422,24 +459,29 @@ message Document { bool boolean_value = 6; } - // Required. Normalized entity value stored as a string. This field is populated for - // supported document type (e.g. Invoice). For some entity types, one of - // respective 'structured_value' fields may also be populated. + // Optional. An optional field to store a normalized string. + // For some entity types, one of respective `structured_value` fields may + // also be populated. Also not all the types of `structured_value` will be + // normalized. For example, some processors may not generate float + // or int normalized text by default. // + // Below are sample formats mapped to structured values. // - Money/Currency type (`money_value`) is in the ISO 4217 text format. // - Date type (`date_value`) is in the ISO 8601 text format. // - Datetime type (`datetime_value`) is in the ISO 8601 text format. - string text = 1 [(google.api.field_behavior) = REQUIRED]; + string text = 1 [(google.api.field_behavior) = OPTIONAL]; } // Optional. Provenance of the entity. - // Text anchor indexing into the [Document.text][google.cloud.documentai.v1.Document.text]. + // Text anchor indexing into the + // [Document.text][google.cloud.documentai.v1.Document.text]. TextAnchor text_anchor = 1 [(google.api.field_behavior) = OPTIONAL]; // Entity type from a schema e.g. `Address`. string type = 2; - // Optional. Text value in the document e.g. `1600 Amphitheatre Pkwy`. + // Optional. Text value in the document e.g. `1600 Amphitheatre Pkwy`. If + // the entity is not present in the document, this field will be empty. string mention_text = 3 [(google.api.field_behavior) = OPTIONAL]; // Optional. Deprecated. Use `id` field instead. @@ -448,32 +490,35 @@ message Document { // Optional. Confidence of detected Schema entity. Range [0, 1]. float confidence = 5 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Represents the provenance of this entity wrt. the location on the - // page where it was found. + // Optional. Represents the provenance of this entity wrt. the location on + // the page where it was found. PageAnchor page_anchor = 6 [(google.api.field_behavior) = OPTIONAL]; // Optional. Canonical id. This will be a unique value in the entity list // for this document. string id = 7 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Normalized entity value. Absent if the extracted value could not be - // converted or the type (e.g. address) is not supported for certain + // Optional. Normalized entity value. Absent if the extracted value could + // not be converted or the type (e.g. address) is not supported for certain // parsers. This field is also only populated for certain supported document // types. - NormalizedValue normalized_value = 9 [(google.api.field_behavior) = OPTIONAL]; + NormalizedValue normalized_value = 9 + [(google.api.field_behavior) = OPTIONAL]; - // Optional. Entities can be nested to form a hierarchical data structure representing - // the content in the document. + // Optional. Entities can be nested to form a hierarchical data structure + // representing the content in the document. repeated Entity properties = 10 [(google.api.field_behavior) = OPTIONAL]; // Optional. The history of this annotation. Provenance provenance = 11 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Whether the entity will be redacted for de-identification purposes. + // Optional. Whether the entity will be redacted for de-identification + // purposes. bool redacted = 12 [(google.api.field_behavior) = OPTIONAL]; } - // Relationship between [Entities][google.cloud.documentai.v1.Document.Entity]. + // Relationship between + // [Entities][google.cloud.documentai.v1.Document.Entity]. message EntityRelation { // Subject entity id. string subject_id = 1; @@ -485,31 +530,40 @@ message Document { string relation = 3; } - // Text reference indexing into the [Document.text][google.cloud.documentai.v1.Document.text]. + // Text reference indexing into the + // [Document.text][google.cloud.documentai.v1.Document.text]. message TextAnchor { - // A text segment in the [Document.text][google.cloud.documentai.v1.Document.text]. The indices may be out of bounds - // which indicate that the text extends into another document shard for - // large sharded documents. See [ShardInfo.text_offset][google.cloud.documentai.v1.Document.ShardInfo.text_offset] + // A text segment in the + // [Document.text][google.cloud.documentai.v1.Document.text]. The indices + // may be out of bounds which indicate that the text extends into another + // document shard for large sharded documents. See + // [ShardInfo.text_offset][google.cloud.documentai.v1.Document.ShardInfo.text_offset] message TextSegment { - // [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] start UTF-8 char index in the [Document.text][google.cloud.documentai.v1.Document.text]. + // [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] + // start UTF-8 char index in the + // [Document.text][google.cloud.documentai.v1.Document.text]. int64 start_index = 1; - // [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] half open end UTF-8 char index in the + // [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] + // half open end UTF-8 char index in the // [Document.text][google.cloud.documentai.v1.Document.text]. int64 end_index = 2; } - // The text segments from the [Document.text][google.cloud.documentai.v1.Document.text]. + // The text segments from the + // [Document.text][google.cloud.documentai.v1.Document.text]. repeated TextSegment text_segments = 1; // Contains the content of the text span so that users do - // not have to look it up in the text_segments. + // not have to look it up in the text_segments. It is always + // populated for formFields. string content = 2; } - // Referencing the visual context of the entity in the [Document.pages][google.cloud.documentai.v1.Document.pages]. - // Page anchors can be cross-page, consist of multiple bounding polygons and - // optionally reference specific layout element types. + // Referencing the visual context of the entity in the + // [Document.pages][google.cloud.documentai.v1.Document.pages]. Page anchors + // can be cross-page, consist of multiple bounding polygons and optionally + // reference specific layout element types. message PageAnchor { // Represents a weak reference to a page element within a document. message PageRef { @@ -518,47 +572,65 @@ message Document { // Layout Unspecified. LAYOUT_TYPE_UNSPECIFIED = 0; - // References a [Page.blocks][google.cloud.documentai.v1.Document.Page.blocks] element. + // References a + // [Page.blocks][google.cloud.documentai.v1.Document.Page.blocks] + // element. BLOCK = 1; - // References a [Page.paragraphs][google.cloud.documentai.v1.Document.Page.paragraphs] element. + // References a + // [Page.paragraphs][google.cloud.documentai.v1.Document.Page.paragraphs] + // element. PARAGRAPH = 2; - // References a [Page.lines][google.cloud.documentai.v1.Document.Page.lines] element. + // References a + // [Page.lines][google.cloud.documentai.v1.Document.Page.lines] element. LINE = 3; - // References a [Page.tokens][google.cloud.documentai.v1.Document.Page.tokens] element. + // References a + // [Page.tokens][google.cloud.documentai.v1.Document.Page.tokens] + // element. TOKEN = 4; - // References a [Page.visual_elements][google.cloud.documentai.v1.Document.Page.visual_elements] element. + // References a + // [Page.visual_elements][google.cloud.documentai.v1.Document.Page.visual_elements] + // element. VISUAL_ELEMENT = 5; - // Refrrences a [Page.tables][google.cloud.documentai.v1.Document.Page.tables] element. + // Refrrences a + // [Page.tables][google.cloud.documentai.v1.Document.Page.tables] + // element. TABLE = 6; - // References a [Page.form_fields][google.cloud.documentai.v1.Document.Page.form_fields] element. + // References a + // [Page.form_fields][google.cloud.documentai.v1.Document.Page.form_fields] + // element. FORM_FIELD = 7; } - // Required. Index into the [Document.pages][google.cloud.documentai.v1.Document.pages] element, for example using - // [Document.pages][page_refs.page] to locate the related page element. - // This field is skipped when its value is the default 0. See + // Required. Index into the + // [Document.pages][google.cloud.documentai.v1.Document.pages] element, + // for example using [Document.pages][page_refs.page] to locate the + // related page element. This field is skipped when its value is the + // default 0. See // https://developers.google.com/protocol-buffers/docs/proto3#json. int64 page = 1 [(google.api.field_behavior) = REQUIRED]; - // Optional. The type of the layout element that is being referenced if any. + // Optional. The type of the layout element that is being referenced if + // any. LayoutType layout_type = 2 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Deprecated. Use [PageRef.bounding_poly][google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly] instead. - string layout_id = 3 [ - deprecated = true, - (google.api.field_behavior) = OPTIONAL - ]; + // Optional. Deprecated. Use + // [PageRef.bounding_poly][google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly] + // instead. + string layout_id = 3 + [deprecated = true, (google.api.field_behavior) = OPTIONAL]; - // Optional. Identifies the bounding polygon of a layout element on the page. + // Optional. Identifies the bounding polygon of a layout element on the + // page. BoundingPoly bounding_poly = 4 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Confidence of detected page element, if applicable. Range [0, 1]. + // Optional. Confidence of detected page element, if applicable. Range [0, + // 1]. float confidence = 5 [(google.api.field_behavior) = OPTIONAL]; } @@ -569,15 +641,14 @@ message Document { // Structure to identify provenance relationships between annotations in // different revisions. message Provenance { - // Structure for referencing parent provenances. When an element replaces - // one of more other elements parent references identify the elements that - // are replaced. + // The parent element the current element is based on. Used for + // referencing/aligning, removal and replacement operations. message Parent { - // The index of the [Document.revisions] identifying the parent revision. + // The index of the index into current revision's parent_ids list. int32 revision = 1; - // The index of the parent revisions corresponding collection of items - // (eg. list of entities, properties within entities, etc.) + // The index of the parent item in the corresponding item list (eg. list + // of entities, properties within entities, etc.) in the parent revision. int32 index = 3; // The id of the parent provenance. @@ -586,19 +657,20 @@ message Document { // If a processor or agent does an explicit operation on existing elements. enum OperationType { - // Operation type unspecified. + // Operation type unspecified. If no operation is specified a provenance + // entry is simply used to match against a `parent`. OPERATION_TYPE_UNSPECIFIED = 0; - // Add an element. Implicit if no `parents` are set for the provenance. + // Add an element. ADD = 1; - // The element is removed. No `parents` should be set. + // Remove an element identified by `parent`. REMOVE = 2; - // Explicitly replaces the element(s) identified by `parents`. + // Replace an element identified by `parent`. REPLACE = 3; - // Element is requested for human review. + // Request human review for the element identified by `parent`. EVAL_REQUESTED = 4; // Element is reviewed and approved at human review, confidence will be @@ -664,8 +736,9 @@ message Document { // This message is used for text changes aka. OCR corrections. message TextChange { // Provenance of the correction. - // Text anchor indexing into the [Document.text][google.cloud.documentai.v1.Document.text]. There can only be a - // single `TextAnchor.text_segments` element. If the start and + // Text anchor indexing into the + // [Document.text][google.cloud.documentai.v1.Document.text]. There can + // only be a single `TextAnchor.text_segments` element. If the start and // end index of the text segment are the same, the text change is inserted // before that index. TextAnchor text_anchor = 1; @@ -706,11 +779,13 @@ message Document { // Visual page layout for the [Document][google.cloud.documentai.v1.Document]. repeated Page pages = 6; - // A list of entities detected on [Document.text][google.cloud.documentai.v1.Document.text]. For document shards, - // entities in this list may cross shard boundaries. + // A list of entities detected on + // [Document.text][google.cloud.documentai.v1.Document.text]. For document + // shards, entities in this list may cross shard boundaries. repeated Entity entities = 7; - // Relationship among [Document.entities][google.cloud.documentai.v1.Document.entities]. + // Relationship among + // [Document.entities][google.cloud.documentai.v1.Document.entities]. repeated EntityRelation entity_relations = 8; // A list of text corrections made to [Document.text]. This is usually diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto index abba3ae1923..760cd511530 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto @@ -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. @@ -16,6 +16,7 @@ syntax = "proto3"; package google.cloud.documentai.v1beta3; +import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/cloud/documentai/v1beta3/geometry.proto"; import "google/protobuf/timestamp.proto"; @@ -25,7 +26,6 @@ import "google/type/date.proto"; import "google/type/datetime.proto"; import "google/type/money.proto"; import "google/type/postal_address.proto"; -import "google/api/annotations.proto"; option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; @@ -51,8 +51,9 @@ message Document { // Total number of shards. int64 shard_count = 2; - // The index of the first character in [Document.text][google.cloud.documentai.v1beta3.Document.text] in the overall - // document global text. + // The index of the first character in + // [Document.text][google.cloud.documentai.v1beta3.Document.text] in the + // overall document global text. int64 text_offset = 3; } @@ -68,7 +69,8 @@ message Document { string unit = 2; } - // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. + // Text anchor indexing into the + // [Document.text][google.cloud.documentai.v1beta3.Document.text]. TextAnchor text_anchor = 1; // Text color. @@ -165,25 +167,31 @@ message Document { PAGE_LEFT = 4; } - // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. + // Text anchor indexing into the + // [Document.text][google.cloud.documentai.v1beta3.Document.text]. TextAnchor text_anchor = 1; - // Confidence of the current [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] within context of the object this - // layout is for. e.g. confidence can be for a single token, a table, - // a visual element, etc. depending on context. Range [0, 1]. + // Confidence of the current + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] within + // context of the object this layout is for. e.g. confidence can be for a + // single token, a table, a visual element, etc. depending on context. + // Range [0, 1]. float confidence = 2; - // The bounding polygon for the [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout]. + // The bounding polygon for the + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout]. BoundingPoly bounding_poly = 3; - // Detected orientation for the [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout]. + // Detected orientation for the + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout]. Orientation orientation = 4; } // A block has a set of lines (collected into paragraphs) that have a // common line-spacing and orientation. message Block { - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Block][google.cloud.documentai.v1beta3.Document.Page.Block]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for + // [Block][google.cloud.documentai.v1beta3.Document.Page.Block]. Layout layout = 1; // A list of detected languages together with confidence. @@ -195,7 +203,8 @@ message Document { // A collection of lines that a human would perceive as a paragraph. message Paragraph { - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Paragraph][google.cloud.documentai.v1beta3.Document.Page.Paragraph]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for + // [Paragraph][google.cloud.documentai.v1beta3.Document.Page.Paragraph]. Layout layout = 1; // A list of detected languages together with confidence. @@ -208,7 +217,8 @@ message Document { // A collection of tokens that a human would perceive as a line. // Does not cross column boundaries, can be horizontal, vertical, etc. message Line { - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Line][google.cloud.documentai.v1beta3.Document.Page.Line]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for + // [Line][google.cloud.documentai.v1beta3.Document.Page.Line]. Layout layout = 1; // A list of detected languages together with confidence. @@ -220,7 +230,8 @@ message Document { // A detected token. message Token { - // Detected break at the end of a [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. + // Detected break at the end of a + // [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. message DetectedBreak { // Enum to denote the type of break found. enum Type { @@ -241,10 +252,12 @@ message Document { Type type = 1; } - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for + // [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. Layout layout = 1; - // Detected break at the end of a [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. + // Detected break at the end of a + // [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. DetectedBreak detected_break = 2; // A list of detected languages together with confidence. @@ -254,13 +267,25 @@ message Document { Provenance provenance = 4; } + // A detected symbol. + message Symbol { + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for + // [Symbol][google.cloud.documentai.v1beta3.Document.Page.Symbol]. + Layout layout = 1; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 2; + } + // Detected non-text visual elements e.g. checkbox, signature etc. on the // page. message VisualElement { - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [VisualElement][google.cloud.documentai.v1beta3.Document.Page.VisualElement]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for + // [VisualElement][google.cloud.documentai.v1beta3.Document.Page.VisualElement]. Layout layout = 1; - // Type of the [VisualElement][google.cloud.documentai.v1beta3.Document.Page.VisualElement]. + // Type of the + // [VisualElement][google.cloud.documentai.v1beta3.Document.Page.VisualElement]. string type = 2; // A list of detected languages together with confidence. @@ -277,7 +302,8 @@ message Document { // A cell representation inside the table. message TableCell { - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [TableCell][google.cloud.documentai.v1beta3.Document.Page.Table.TableCell]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for + // [TableCell][google.cloud.documentai.v1beta3.Document.Page.Table.TableCell]. Layout layout = 1; // How many rows this cell spans. @@ -290,7 +316,8 @@ message Document { repeated DetectedLanguage detected_languages = 4; } - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Table][google.cloud.documentai.v1beta3.Document.Page.Table]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for + // [Table][google.cloud.documentai.v1beta3.Document.Page.Table]. Layout layout = 1; // Header rows of the table. @@ -305,11 +332,14 @@ message Document { // A form field detected on the page. message FormField { - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the [FormField][google.cloud.documentai.v1beta3.Document.Page.FormField] name. e.g. `Address`, `Email`, - // `Grand total`, `Phone number`, etc. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the + // [FormField][google.cloud.documentai.v1beta3.Document.Page.FormField] + // name. e.g. `Address`, `Email`, `Grand total`, `Phone number`, etc. Layout field_name = 1; - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the [FormField][google.cloud.documentai.v1beta3.Document.Page.FormField] value. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the + // [FormField][google.cloud.documentai.v1beta3.Document.Page.FormField] + // value. Layout field_value = 2; // A list of detected languages for name together with confidence. @@ -333,16 +363,18 @@ message Document { message DetectedLanguage { // The BCP-47 language code, such as "en-US" or "sr-Latn". For more // information, see - // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + // https://www.unicode.org/reports/tr35/#Unicode_locale_identifier. string language_code = 1; // Confidence of detected language. Range [0, 1]. float confidence = 2; } - // 1-based index for current [Page][google.cloud.documentai.v1beta3.Document.Page] in a parent [Document][google.cloud.documentai.v1beta3.Document]. - // Useful when a page is taken out of a [Document][google.cloud.documentai.v1beta3.Document] for individual - // processing. + // 1-based index for current + // [Page][google.cloud.documentai.v1beta3.Document.Page] in a parent + // [Document][google.cloud.documentai.v1beta3.Document]. Useful when a page + // is taken out of a [Document][google.cloud.documentai.v1beta3.Document] + // for individual processing. int32 page_number = 1; // Rendered image for this page. This image is preprocessed to remove any @@ -351,13 +383,15 @@ message Document { Image image = 13; // Transformation matrices that were applied to the original document image - // to produce [Page.image][google.cloud.documentai.v1beta3.Document.Page.image]. + // to produce + // [Page.image][google.cloud.documentai.v1beta3.Document.Page.image]. repeated Matrix transforms = 14; // Physical dimension of the page. Dimension dimension = 2; - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the page. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the + // page. Layout layout = 3; // A list of detected languages together with confidence. @@ -389,17 +423,23 @@ message Document { // A list of visually detected form fields on the page. repeated FormField form_fields = 11; + // A list of visually detected symbols on the page. + repeated Symbol symbols = 12; + // The history of this page. Provenance provenance = 16; } - // A phrase in the text that is a known entity type, such as a person, an - // organization, or location. + // An entity that could be a phrase in the text or a property that belongs to + // the document. It is a known entity type, such as a person, an organization, + // or location. message Entity { // Parsed and normalized entity value. message NormalizedValue { - // Structured entity value. Must match entity type defined in schema if - // known. If this field is present, the 'text' field is still populated. + // An optional structured entity value. + // Must match entity type defined in schema if + // known. If this field is present, the `text` field could also be + // populated. oneof structured_value { // Money value. See also: // https://github.com/googleapis/googleapis/blob/master/google/type/money.proto @@ -422,24 +462,29 @@ message Document { bool boolean_value = 6; } - // Required. Normalized entity value stored as a string. This field is populated for - // supported document type (e.g. Invoice). For some entity types, one of - // respective 'structured_value' fields may also be populated. + // Optional. An optional field to store a normalized string. + // For some entity types, one of respective `structured_value` fields may + // also be populated. Also not all the types of `structured_value` will be + // normalized. For example, some processors may not generate float + // or int normalized text by default. // + // Below are sample formats mapped to structured values. // - Money/Currency type (`money_value`) is in the ISO 4217 text format. // - Date type (`date_value`) is in the ISO 8601 text format. // - Datetime type (`datetime_value`) is in the ISO 8601 text format. - string text = 1 [(google.api.field_behavior) = REQUIRED]; + string text = 1 [(google.api.field_behavior) = OPTIONAL]; } // Optional. Provenance of the entity. - // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. + // Text anchor indexing into the + // [Document.text][google.cloud.documentai.v1beta3.Document.text]. TextAnchor text_anchor = 1 [(google.api.field_behavior) = OPTIONAL]; // Entity type from a schema e.g. `Address`. string type = 2; - // Optional. Text value in the document e.g. `1600 Amphitheatre Pkwy`. + // Optional. Text value in the document e.g. `1600 Amphitheatre Pkwy`. If + // the entity is not present in the document, this field will be empty. string mention_text = 3 [(google.api.field_behavior) = OPTIONAL]; // Optional. Deprecated. Use `id` field instead. @@ -448,32 +493,35 @@ message Document { // Optional. Confidence of detected Schema entity. Range [0, 1]. float confidence = 5 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Represents the provenance of this entity wrt. the location on the - // page where it was found. + // Optional. Represents the provenance of this entity wrt. the location on + // the page where it was found. PageAnchor page_anchor = 6 [(google.api.field_behavior) = OPTIONAL]; // Optional. Canonical id. This will be a unique value in the entity list // for this document. string id = 7 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Normalized entity value. Absent if the extracted value could not be - // converted or the type (e.g. address) is not supported for certain + // Optional. Normalized entity value. Absent if the extracted value could + // not be converted or the type (e.g. address) is not supported for certain // parsers. This field is also only populated for certain supported document // types. - NormalizedValue normalized_value = 9 [(google.api.field_behavior) = OPTIONAL]; + NormalizedValue normalized_value = 9 + [(google.api.field_behavior) = OPTIONAL]; - // Optional. Entities can be nested to form a hierarchical data structure representing - // the content in the document. + // Optional. Entities can be nested to form a hierarchical data structure + // representing the content in the document. repeated Entity properties = 10 [(google.api.field_behavior) = OPTIONAL]; // Optional. The history of this annotation. Provenance provenance = 11 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Whether the entity will be redacted for de-identification purposes. + // Optional. Whether the entity will be redacted for de-identification + // purposes. bool redacted = 12 [(google.api.field_behavior) = OPTIONAL]; } - // Relationship between [Entities][google.cloud.documentai.v1beta3.Document.Entity]. + // Relationship between + // [Entities][google.cloud.documentai.v1beta3.Document.Entity]. message EntityRelation { // Subject entity id. string subject_id = 1; @@ -485,30 +533,39 @@ message Document { string relation = 3; } - // Text reference indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. + // Text reference indexing into the + // [Document.text][google.cloud.documentai.v1beta3.Document.text]. message TextAnchor { - // A text segment in the [Document.text][google.cloud.documentai.v1beta3.Document.text]. The indices may be out of bounds - // which indicate that the text extends into another document shard for - // large sharded documents. See [ShardInfo.text_offset][google.cloud.documentai.v1beta3.Document.ShardInfo.text_offset] + // A text segment in the + // [Document.text][google.cloud.documentai.v1beta3.Document.text]. The + // indices may be out of bounds which indicate that the text extends into + // another document shard for large sharded documents. See + // [ShardInfo.text_offset][google.cloud.documentai.v1beta3.Document.ShardInfo.text_offset] message TextSegment { - // [TextSegment][google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment] start UTF-8 char index in the [Document.text][google.cloud.documentai.v1beta3.Document.text]. + // [TextSegment][google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment] + // start UTF-8 char index in the + // [Document.text][google.cloud.documentai.v1beta3.Document.text]. int64 start_index = 1; - // [TextSegment][google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment] half open end UTF-8 char index in the + // [TextSegment][google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment] + // half open end UTF-8 char index in the // [Document.text][google.cloud.documentai.v1beta3.Document.text]. int64 end_index = 2; } - // The text segments from the [Document.text][google.cloud.documentai.v1beta3.Document.text]. + // The text segments from the + // [Document.text][google.cloud.documentai.v1beta3.Document.text]. repeated TextSegment text_segments = 1; // Contains the content of the text span so that users do - // not have to look it up in the text_segments. + // not have to look it up in the text_segments. It is always + // populated for formFields. string content = 2; } - // Referencing the visual context of the entity in the [Document.pages][google.cloud.documentai.v1beta3.Document.pages]. - // Page anchors can be cross-page, consist of multiple bounding polygons and + // Referencing the visual context of the entity in the + // [Document.pages][google.cloud.documentai.v1beta3.Document.pages]. Page + // anchors can be cross-page, consist of multiple bounding polygons and // optionally reference specific layout element types. message PageAnchor { // Represents a weak reference to a page element within a document. @@ -518,47 +575,66 @@ message Document { // Layout Unspecified. LAYOUT_TYPE_UNSPECIFIED = 0; - // References a [Page.blocks][google.cloud.documentai.v1beta3.Document.Page.blocks] element. + // References a + // [Page.blocks][google.cloud.documentai.v1beta3.Document.Page.blocks] + // element. BLOCK = 1; - // References a [Page.paragraphs][google.cloud.documentai.v1beta3.Document.Page.paragraphs] element. + // References a + // [Page.paragraphs][google.cloud.documentai.v1beta3.Document.Page.paragraphs] + // element. PARAGRAPH = 2; - // References a [Page.lines][google.cloud.documentai.v1beta3.Document.Page.lines] element. + // References a + // [Page.lines][google.cloud.documentai.v1beta3.Document.Page.lines] + // element. LINE = 3; - // References a [Page.tokens][google.cloud.documentai.v1beta3.Document.Page.tokens] element. + // References a + // [Page.tokens][google.cloud.documentai.v1beta3.Document.Page.tokens] + // element. TOKEN = 4; - // References a [Page.visual_elements][google.cloud.documentai.v1beta3.Document.Page.visual_elements] element. + // References a + // [Page.visual_elements][google.cloud.documentai.v1beta3.Document.Page.visual_elements] + // element. VISUAL_ELEMENT = 5; - // Refrrences a [Page.tables][google.cloud.documentai.v1beta3.Document.Page.tables] element. + // Refrrences a + // [Page.tables][google.cloud.documentai.v1beta3.Document.Page.tables] + // element. TABLE = 6; - // References a [Page.form_fields][google.cloud.documentai.v1beta3.Document.Page.form_fields] element. + // References a + // [Page.form_fields][google.cloud.documentai.v1beta3.Document.Page.form_fields] + // element. FORM_FIELD = 7; } - // Required. Index into the [Document.pages][google.cloud.documentai.v1beta3.Document.pages] element, for example using - // [Document.pages][page_refs.page] to locate the related page element. - // This field is skipped when its value is the default 0. See + // Required. Index into the + // [Document.pages][google.cloud.documentai.v1beta3.Document.pages] + // element, for example using [Document.pages][page_refs.page] to locate + // the related page element. This field is skipped when its value is the + // default 0. See // https://developers.google.com/protocol-buffers/docs/proto3#json. int64 page = 1 [(google.api.field_behavior) = REQUIRED]; - // Optional. The type of the layout element that is being referenced if any. + // Optional. The type of the layout element that is being referenced if + // any. LayoutType layout_type = 2 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Deprecated. Use [PageRef.bounding_poly][google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.bounding_poly] instead. - string layout_id = 3 [ - deprecated = true, - (google.api.field_behavior) = OPTIONAL - ]; + // Optional. Deprecated. Use + // [PageRef.bounding_poly][google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.bounding_poly] + // instead. + string layout_id = 3 + [deprecated = true, (google.api.field_behavior) = OPTIONAL]; - // Optional. Identifies the bounding polygon of a layout element on the page. + // Optional. Identifies the bounding polygon of a layout element on the + // page. BoundingPoly bounding_poly = 4 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Confidence of detected page element, if applicable. Range [0, 1]. + // Optional. Confidence of detected page element, if applicable. Range [0, + // 1]. float confidence = 5 [(google.api.field_behavior) = OPTIONAL]; } @@ -569,15 +645,14 @@ message Document { // Structure to identify provenance relationships between annotations in // different revisions. message Provenance { - // Structure for referencing parent provenances. When an element replaces - // one of more other elements parent references identify the elements that - // are replaced. + // The parent element the current element is based on. Used for + // referencing/aligning, removal and replacement operations. message Parent { - // The index of the [Document.revisions] identifying the parent revision. + // The index of the index into current revision's parent_ids list. int32 revision = 1; - // The index of the parent revisions corresponding collection of items - // (eg. list of entities, properties within entities, etc.) + // The index of the parent item in the corresponding item list (eg. list + // of entities, properties within entities, etc.) in the parent revision. int32 index = 3; // The id of the parent provenance. @@ -586,19 +661,20 @@ message Document { // If a processor or agent does an explicit operation on existing elements. enum OperationType { - // Operation type unspecified. + // Operation type unspecified. If no operation is specified a provenance + // entry is simply used to match against a `parent`. OPERATION_TYPE_UNSPECIFIED = 0; - // Add an element. Implicit if no `parents` are set for the provenance. + // Add an element. ADD = 1; - // The element is removed. No `parents` should be set. + // Remove an element identified by `parent`. REMOVE = 2; - // Explicitly replaces the element(s) identified by `parents`. + // Replace an element identified by `parent`. REPLACE = 3; - // Element is requested for human review. + // Request human review for the element identified by `parent`. EVAL_REQUESTED = 4; // Element is reviewed and approved at human review, confidence will be @@ -664,10 +740,11 @@ message Document { // This message is used for text changes aka. OCR corrections. message TextChange { // Provenance of the correction. - // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. There can only be a - // single `TextAnchor.text_segments` element. If the start and - // end index of the text segment are the same, the text change is inserted - // before that index. + // Text anchor indexing into the + // [Document.text][google.cloud.documentai.v1beta3.Document.text]. There + // can only be a single `TextAnchor.text_segments` element. If the start + // and end index of the text segment are the same, the text change is + // inserted before that index. TextAnchor text_anchor = 1; // The text that replaces the text identified in the `text_anchor`. @@ -700,22 +777,26 @@ message Document { // Optional. UTF-8 encoded text in reading order from the document. string text = 4 [(google.api.field_behavior) = OPTIONAL]; - // Styles for the [Document.text][google.cloud.documentai.v1beta3.Document.text]. + // Placeholder. Styles for the + // [Document.text][google.cloud.documentai.v1beta3.Document.text]. repeated Style text_styles = 5; - // Visual page layout for the [Document][google.cloud.documentai.v1beta3.Document]. + // Visual page layout for the + // [Document][google.cloud.documentai.v1beta3.Document]. repeated Page pages = 6; - // A list of entities detected on [Document.text][google.cloud.documentai.v1beta3.Document.text]. For document shards, - // entities in this list may cross shard boundaries. + // A list of entities detected on + // [Document.text][google.cloud.documentai.v1beta3.Document.text]. For + // document shards, entities in this list may cross shard boundaries. repeated Entity entities = 7; - // Relationship among [Document.entities][google.cloud.documentai.v1beta3.Document.entities]. + // Placeholder. Relationship among + // [Document.entities][google.cloud.documentai.v1beta3.Document.entities]. repeated EntityRelation entity_relations = 8; - // A list of text corrections made to [Document.text]. This is usually - // used for annotating corrections to OCR mistakes. Text changes for a given - // revision may not overlap with each other. + // Placeholder. A list of text corrections made to [Document.text]. This is + // usually used for annotating corrections to OCR mistakes. Text changes for + // a given revision may not overlap with each other. repeated TextChange text_changes = 14; // Information about the sharding if this document is sharded part of a larger @@ -725,6 +806,6 @@ message Document { // Any error that occurred while processing this document. google.rpc.Status error = 10; - // Revision history of this document. + // Placeholder. Revision history of this document. repeated Revision revisions = 13; } diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 6e5f5789d1b..acb31c79a8e 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -556,6 +556,9 @@ export namespace google { /** Page formFields */ formFields?: (google.cloud.documentai.v1.Document.Page.IFormField[]|null); + /** Page symbols */ + symbols?: (google.cloud.documentai.v1.Document.Page.ISymbol[]|null); + /** Page provenance */ provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); } @@ -608,6 +611,9 @@ export namespace google { /** Page formFields. */ public formFields: google.cloud.documentai.v1.Document.Page.IFormField[]; + /** Page symbols. */ + public symbols: google.cloud.documentai.v1.Document.Page.ISymbol[]; + /** Page provenance. */ public provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); @@ -1640,6 +1646,102 @@ export namespace google { } } + /** Properties of a Symbol. */ + interface ISymbol { + + /** Symbol layout */ + layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** Symbol detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a Symbol. */ + class Symbol implements ISymbol { + + /** + * Constructs a new Symbol. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.ISymbol); + + /** Symbol layout. */ + public layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** Symbol detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new Symbol instance using the specified properties. + * @param [properties] Properties to set + * @returns Symbol instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.ISymbol): google.cloud.documentai.v1.Document.Page.Symbol; + + /** + * Encodes the specified Symbol message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Symbol.verify|verify} messages. + * @param message Symbol message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Page.ISymbol, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Symbol message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Symbol.verify|verify} messages. + * @param message Symbol message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Page.ISymbol, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Symbol message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Symbol + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Page.Symbol; + + /** + * Decodes a Symbol message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Symbol + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Page.Symbol; + + /** + * Verifies a Symbol message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Symbol message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Symbol + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page.Symbol; + + /** + * Creates a plain object from a Symbol message. Also converts values to other types if specified. + * @param message Symbol + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page.Symbol, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Symbol to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a VisualElement. */ interface IVisualElement { @@ -15238,6 +15340,9 @@ export namespace google { /** Page formFields */ formFields?: (google.cloud.documentai.v1beta3.Document.Page.IFormField[]|null); + /** Page symbols */ + symbols?: (google.cloud.documentai.v1beta3.Document.Page.ISymbol[]|null); + /** Page provenance */ provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); } @@ -15290,6 +15395,9 @@ export namespace google { /** Page formFields. */ public formFields: google.cloud.documentai.v1beta3.Document.Page.IFormField[]; + /** Page symbols. */ + public symbols: google.cloud.documentai.v1beta3.Document.Page.ISymbol[]; + /** Page provenance. */ public provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); @@ -16322,6 +16430,102 @@ export namespace google { } } + /** Properties of a Symbol. */ + interface ISymbol { + + /** Symbol layout */ + layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** Symbol detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a Symbol. */ + class Symbol implements ISymbol { + + /** + * Constructs a new Symbol. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Page.ISymbol); + + /** Symbol layout. */ + public layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** Symbol detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new Symbol instance using the specified properties. + * @param [properties] Properties to set + * @returns Symbol instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Page.ISymbol): google.cloud.documentai.v1beta3.Document.Page.Symbol; + + /** + * Encodes the specified Symbol message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Symbol.verify|verify} messages. + * @param message Symbol message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Page.ISymbol, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Symbol message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Symbol.verify|verify} messages. + * @param message Symbol message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Page.ISymbol, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Symbol message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Symbol + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Page.Symbol; + + /** + * Decodes a Symbol message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Symbol + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Page.Symbol; + + /** + * Verifies a Symbol message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Symbol message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Symbol + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Page.Symbol; + + /** + * Creates a plain object from a Symbol message. Also converts values to other types if specified. + * @param message Symbol + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Page.Symbol, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Symbol to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a VisualElement. */ interface IVisualElement { @@ -22432,18 +22636,6 @@ 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 Http. */ interface IHttp { @@ -22783,6 +22975,18 @@ 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 { diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index e2761b092fa..cfa1f8eac5b 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -1502,6 +1502,7 @@ * @property {Array.|null} [visualElements] Page visualElements * @property {Array.|null} [tables] Page tables * @property {Array.|null} [formFields] Page formFields + * @property {Array.|null} [symbols] Page symbols * @property {google.cloud.documentai.v1.Document.IProvenance|null} [provenance] Page provenance */ @@ -1523,6 +1524,7 @@ this.visualElements = []; this.tables = []; this.formFields = []; + this.symbols = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1633,6 +1635,14 @@ */ Page.prototype.formFields = $util.emptyArray; + /** + * Page symbols. + * @member {Array.} symbols + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.symbols = $util.emptyArray; + /** * Page provenance. * @member {google.cloud.documentai.v1.Document.IProvenance|null|undefined} provenance @@ -1695,6 +1705,9 @@ if (message.formFields != null && message.formFields.length) for (var i = 0; i < message.formFields.length; ++i) $root.google.cloud.documentai.v1.Document.Page.FormField.encode(message.formFields[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.symbols != null && message.symbols.length) + for (var i = 0; i < message.symbols.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.Symbol.encode(message.symbols[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); if (message.image != null && Object.hasOwnProperty.call(message, "image")) $root.google.cloud.documentai.v1.Document.Page.Image.encode(message.image, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); if (message.transforms != null && message.transforms.length) @@ -1793,6 +1806,11 @@ message.formFields = []; message.formFields.push($root.google.cloud.documentai.v1.Document.Page.FormField.decode(reader, reader.uint32())); break; + case 12: + if (!(message.symbols && message.symbols.length)) + message.symbols = []; + message.symbols.push($root.google.cloud.documentai.v1.Document.Page.Symbol.decode(reader, reader.uint32())); + break; case 16: message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); break; @@ -1930,6 +1948,15 @@ return "formFields." + error; } } + if (message.symbols != null && message.hasOwnProperty("symbols")) { + if (!Array.isArray(message.symbols)) + return "symbols: array expected"; + for (var i = 0; i < message.symbols.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.Symbol.verify(message.symbols[i]); + if (error) + return "symbols." + error; + } + } if (message.provenance != null && message.hasOwnProperty("provenance")) { var error = $root.google.cloud.documentai.v1.Document.Provenance.verify(message.provenance); if (error) @@ -2057,6 +2084,16 @@ message.formFields[i] = $root.google.cloud.documentai.v1.Document.Page.FormField.fromObject(object.formFields[i]); } } + if (object.symbols) { + if (!Array.isArray(object.symbols)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.symbols: array expected"); + message.symbols = []; + for (var i = 0; i < object.symbols.length; ++i) { + if (typeof object.symbols[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.symbols: object expected"); + message.symbols[i] = $root.google.cloud.documentai.v1.Document.Page.Symbol.fromObject(object.symbols[i]); + } + } if (object.provenance != null) { if (typeof object.provenance !== "object") throw TypeError(".google.cloud.documentai.v1.Document.Page.provenance: object expected"); @@ -2087,6 +2124,7 @@ object.visualElements = []; object.tables = []; object.formFields = []; + object.symbols = []; object.transforms = []; } if (options.defaults) { @@ -2142,6 +2180,11 @@ for (var j = 0; j < message.formFields.length; ++j) object.formFields[j] = $root.google.cloud.documentai.v1.Document.Page.FormField.toObject(message.formFields[j], options); } + if (message.symbols && message.symbols.length) { + object.symbols = []; + for (var j = 0; j < message.symbols.length; ++j) + object.symbols[j] = $root.google.cloud.documentai.v1.Document.Page.Symbol.toObject(message.symbols[j], options); + } if (message.image != null && message.hasOwnProperty("image")) object.image = $root.google.cloud.documentai.v1.Document.Page.Image.toObject(message.image, options); if (message.transforms && message.transforms.length) { @@ -4546,6 +4589,242 @@ return Token; })(); + Page.Symbol = (function() { + + /** + * Properties of a Symbol. + * @memberof google.cloud.documentai.v1.Document.Page + * @interface ISymbol + * @property {google.cloud.documentai.v1.Document.Page.ILayout|null} [layout] Symbol layout + * @property {Array.|null} [detectedLanguages] Symbol detectedLanguages + */ + + /** + * Constructs a new Symbol. + * @memberof google.cloud.documentai.v1.Document.Page + * @classdesc Represents a Symbol. + * @implements ISymbol + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.ISymbol=} [properties] Properties to set + */ + function Symbol(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Symbol layout. + * @member {google.cloud.documentai.v1.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @instance + */ + Symbol.prototype.layout = null; + + /** + * Symbol detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @instance + */ + Symbol.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new Symbol instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @static + * @param {google.cloud.documentai.v1.Document.Page.ISymbol=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.Symbol} Symbol instance + */ + Symbol.create = function create(properties) { + return new Symbol(properties); + }; + + /** + * Encodes the specified Symbol message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Symbol.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @static + * @param {google.cloud.documentai.v1.Document.Page.ISymbol} message Symbol message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Symbol.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Symbol message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Symbol.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @static + * @param {google.cloud.documentai.v1.Document.Page.ISymbol} message Symbol message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Symbol.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Symbol message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page.Symbol} Symbol + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Symbol.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Page.Symbol(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Symbol message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.Symbol} Symbol + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Symbol.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Symbol message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Symbol.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a Symbol message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.Symbol} Symbol + */ + Symbol.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.Symbol) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.Symbol(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Symbol.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.Symbol.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Symbol.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Symbol message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @static + * @param {google.cloud.documentai.v1.Document.Page.Symbol} message Symbol + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Symbol.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) + object.layout = null; + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this Symbol to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @instance + * @returns {Object.} JSON object + */ + Symbol.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Symbol; + })(); + Page.VisualElement = (function() { /** @@ -38618,6 +38897,7 @@ * @property {Array.|null} [visualElements] Page visualElements * @property {Array.|null} [tables] Page tables * @property {Array.|null} [formFields] Page formFields + * @property {Array.|null} [symbols] Page symbols * @property {google.cloud.documentai.v1beta3.Document.IProvenance|null} [provenance] Page provenance */ @@ -38639,6 +38919,7 @@ this.visualElements = []; this.tables = []; this.formFields = []; + this.symbols = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -38749,6 +39030,14 @@ */ Page.prototype.formFields = $util.emptyArray; + /** + * Page symbols. + * @member {Array.} symbols + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + */ + Page.prototype.symbols = $util.emptyArray; + /** * Page provenance. * @member {google.cloud.documentai.v1beta3.Document.IProvenance|null|undefined} provenance @@ -38811,6 +39100,9 @@ if (message.formFields != null && message.formFields.length) for (var i = 0; i < message.formFields.length; ++i) $root.google.cloud.documentai.v1beta3.Document.Page.FormField.encode(message.formFields[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.symbols != null && message.symbols.length) + for (var i = 0; i < message.symbols.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.Symbol.encode(message.symbols[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); if (message.image != null && Object.hasOwnProperty.call(message, "image")) $root.google.cloud.documentai.v1beta3.Document.Page.Image.encode(message.image, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); if (message.transforms != null && message.transforms.length) @@ -38909,6 +39201,11 @@ message.formFields = []; message.formFields.push($root.google.cloud.documentai.v1beta3.Document.Page.FormField.decode(reader, reader.uint32())); break; + case 12: + if (!(message.symbols && message.symbols.length)) + message.symbols = []; + message.symbols.push($root.google.cloud.documentai.v1beta3.Document.Page.Symbol.decode(reader, reader.uint32())); + break; case 16: message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); break; @@ -39046,6 +39343,15 @@ return "formFields." + error; } } + if (message.symbols != null && message.hasOwnProperty("symbols")) { + if (!Array.isArray(message.symbols)) + return "symbols: array expected"; + for (var i = 0; i < message.symbols.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Symbol.verify(message.symbols[i]); + if (error) + return "symbols." + error; + } + } if (message.provenance != null && message.hasOwnProperty("provenance")) { var error = $root.google.cloud.documentai.v1beta3.Document.Provenance.verify(message.provenance); if (error) @@ -39173,6 +39479,16 @@ message.formFields[i] = $root.google.cloud.documentai.v1beta3.Document.Page.FormField.fromObject(object.formFields[i]); } } + if (object.symbols) { + if (!Array.isArray(object.symbols)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.symbols: array expected"); + message.symbols = []; + for (var i = 0; i < object.symbols.length; ++i) { + if (typeof object.symbols[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.symbols: object expected"); + message.symbols[i] = $root.google.cloud.documentai.v1beta3.Document.Page.Symbol.fromObject(object.symbols[i]); + } + } if (object.provenance != null) { if (typeof object.provenance !== "object") throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.provenance: object expected"); @@ -39203,6 +39519,7 @@ object.visualElements = []; object.tables = []; object.formFields = []; + object.symbols = []; object.transforms = []; } if (options.defaults) { @@ -39258,6 +39575,11 @@ for (var j = 0; j < message.formFields.length; ++j) object.formFields[j] = $root.google.cloud.documentai.v1beta3.Document.Page.FormField.toObject(message.formFields[j], options); } + if (message.symbols && message.symbols.length) { + object.symbols = []; + for (var j = 0; j < message.symbols.length; ++j) + object.symbols[j] = $root.google.cloud.documentai.v1beta3.Document.Page.Symbol.toObject(message.symbols[j], options); + } if (message.image != null && message.hasOwnProperty("image")) object.image = $root.google.cloud.documentai.v1beta3.Document.Page.Image.toObject(message.image, options); if (message.transforms && message.transforms.length) { @@ -41662,6 +41984,242 @@ return Token; })(); + Page.Symbol = (function() { + + /** + * Properties of a Symbol. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @interface ISymbol + * @property {google.cloud.documentai.v1beta3.Document.Page.ILayout|null} [layout] Symbol layout + * @property {Array.|null} [detectedLanguages] Symbol detectedLanguages + */ + + /** + * Constructs a new Symbol. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @classdesc Represents a Symbol. + * @implements ISymbol + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Page.ISymbol=} [properties] Properties to set + */ + function Symbol(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Symbol layout. + * @member {google.cloud.documentai.v1beta3.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @instance + */ + Symbol.prototype.layout = null; + + /** + * Symbol detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @instance + */ + Symbol.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new Symbol instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.ISymbol=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.Symbol} Symbol instance + */ + Symbol.create = function create(properties) { + return new Symbol(properties); + }; + + /** + * Encodes the specified Symbol message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Symbol.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.ISymbol} message Symbol message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Symbol.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1beta3.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Symbol message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Symbol.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.ISymbol} message Symbol message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Symbol.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Symbol message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page.Symbol} Symbol + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Symbol.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Page.Symbol(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Symbol message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page.Symbol} Symbol + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Symbol.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Symbol message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Symbol.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a Symbol message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page.Symbol} Symbol + */ + Symbol.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page.Symbol) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page.Symbol(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Symbol.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Symbol.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Symbol.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Symbol message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Symbol} message Symbol + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Symbol.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) + object.layout = null; + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this Symbol to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @instance + * @returns {Object.} JSON object + */ + Symbol.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Symbol; + })(); + Page.VisualElement = (function() { /** @@ -56305,32 +56863,6 @@ */ var api = {}; - /** - * 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.Http = (function() { /** @@ -57235,6 +57767,32 @@ 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; + })(); + api.ResourceDescriptor = (function() { /** diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 9ccf231fb45..d24ee7e24dd 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -219,6 +219,11 @@ "type": "FormField", "id": 11 }, + "symbols": { + "rule": "repeated", + "type": "Symbol", + "id": 12 + }, "provenance": { "type": "Provenance", "id": 16 @@ -404,6 +409,19 @@ } } }, + "Symbol": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 2 + } + } + }, "VisualElement": { "fields": { "layout": { @@ -636,7 +654,7 @@ "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "OPTIONAL" } } } @@ -3369,6 +3387,11 @@ "type": "FormField", "id": 11 }, + "symbols": { + "rule": "repeated", + "type": "Symbol", + "id": 12 + }, "provenance": { "type": "Provenance", "id": 16 @@ -3554,6 +3577,19 @@ } } }, + "Symbol": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 2 + } + } + }, "VisualElement": { "fields": { "layout": { @@ -3786,7 +3822,7 @@ "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "OPTIONAL" } } } @@ -4968,24 +5004,6 @@ "cc_enable_arenas": true }, "nested": { - "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, - "UNORDERED_LIST": 6, - "NON_EMPTY_DEFAULT": 7 - } - }, "http": { "type": "HttpRule", "id": 72295728, @@ -5073,6 +5091,24 @@ } } }, + "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, + "UNORDERED_LIST": 6, + "NON_EMPTY_DEFAULT": 7 + } + }, "methodSignature": { "rule": "repeated", "type": "string", diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js index 6651cd4d885..33e8eef0fc0 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.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-documentai/samples/generated/v1/document_processor_service.process_document.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js index 849d86196e5..1ff38d5a965 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.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-documentai/samples/generated/v1/document_processor_service.review_document.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js index 3ced0143291..d78861aaedb 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.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-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json new file mode 100644 index 00000000000..1d4eabaf9c6 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json @@ -0,0 +1,171 @@ +{ + "clientLibrary": { + "name": "nodejs-documentai", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.documentai.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_ProcessDocument_async", + "title": "DocumentProcessorService processDocument Sample", + "origin": "API_DEFINITION", + "description": " Processes a single document.", + "canonical": true, + "file": "document_processor_service.process_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ProcessDocument", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument", + "async": true, + "parameters": [ + { + "name": "inline_document", + "type": ".google.cloud.documentai.v1.Document" + }, + { + "name": "raw_document", + "type": ".google.cloud.documentai.v1.RawDocument" + }, + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "skip_human_review", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.documentai.v1.ProcessResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ProcessDocument", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_async", + "title": "DocumentProcessorService batchProcessDocuments Sample", + "origin": "API_DEFINITION", + "description": " LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.", + "canonical": true, + "file": "document_processor_service.batch_process_documents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "input_documents", + "type": ".google.cloud.documentai.v1.BatchDocumentsInputConfig" + }, + { + "name": "document_output_config", + "type": ".google.cloud.documentai.v1.DocumentOutputConfig" + }, + { + "name": "skip_human_review", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_ReviewDocument_async", + "title": "DocumentProcessorService reviewDocument Sample", + "origin": "API_DEFINITION", + "description": " Send a document for Human Review. The input document should be processed by the specified processor.", + "canonical": true, + "file": "document_processor_service.review_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReviewDocument", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument", + "async": true, + "parameters": [ + { + "name": "inline_document", + "type": ".google.cloud.documentai.v1.Document" + }, + { + "name": "human_review_config", + "type": "TYPE_STRING" + }, + { + "name": "enable_schema_validation", + "type": "TYPE_BOOL" + }, + { + "name": "priority", + "type": ".google.cloud.documentai.v1.ReviewDocumentRequest.Priority" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ReviewDocument", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + } + ] +} diff --git a/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js index 4e9d54da93e..b521d8f8f14 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.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-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json b/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json new file mode 100644 index 00000000000..6fb76dcd077 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json @@ -0,0 +1,59 @@ +{ + "clientLibrary": { + "name": "nodejs-documentai", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.documentai.v1beta1", + "version": "v1beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "documentai_v1beta1_generated_DocumentUnderstandingService_BatchProcessDocuments_async", + "title": "DocumentUnderstandingService batchProcessDocuments Sample", + "origin": "API_DEFINITION", + "description": " LRO endpoint to batch process many documents.", + "canonical": true, + "file": "document_understanding_service.batch_process_documents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1beta1.DocumentUnderstandingService.BatchProcessDocuments", + "async": true, + "parameters": [ + { + "name": "requests", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentUnderstandingServiceClient", + "fullName": "google.cloud.documentai.v1beta1.DocumentUnderstandingServiceClient" + }, + "method": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1beta1.DocumentUnderstandingService.BatchProcessDocuments", + "service": { + "shortName": "DocumentUnderstandingService", + "fullName": "google.cloud.documentai.v1beta1.DocumentUnderstandingService" + } + } + } + } + ] +} diff --git a/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js index ad7d7d1e1f5..8b2ab19f553 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.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-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js index 5864d9937e9..f689731c7ea 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.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-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json b/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json new file mode 100644 index 00000000000..ad18521496c --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json @@ -0,0 +1,131 @@ +{ + "clientLibrary": { + "name": "nodejs-documentai", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.documentai.v1beta2", + "version": "v1beta2" + } + ] + }, + "snippets": [ + { + "regionTag": "documentai_v1beta2_generated_DocumentUnderstandingService_BatchProcessDocuments_async", + "title": "DocumentUnderstandingService batchProcessDocuments Sample", + "origin": "API_DEFINITION", + "description": " LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.", + "canonical": true, + "file": "document_understanding_service.batch_process_documents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService.BatchProcessDocuments", + "async": true, + "parameters": [ + { + "name": "requests", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentUnderstandingServiceClient", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingServiceClient" + }, + "method": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService.BatchProcessDocuments", + "service": { + "shortName": "DocumentUnderstandingService", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService" + } + } + } + }, + { + "regionTag": "documentai_v1beta2_generated_DocumentUnderstandingService_ProcessDocument_async", + "title": "DocumentUnderstandingService processDocument Sample", + "origin": "API_DEFINITION", + "description": " Processes a single document.", + "canonical": true, + "file": "document_understanding_service.process_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 93, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ProcessDocument", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService.ProcessDocument", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.documentai.v1beta2.InputConfig" + }, + { + "name": "output_config", + "type": ".google.cloud.documentai.v1beta2.OutputConfig" + }, + { + "name": "document_type", + "type": "TYPE_STRING" + }, + { + "name": "table_extraction_params", + "type": ".google.cloud.documentai.v1beta2.TableExtractionParams" + }, + { + "name": "form_extraction_params", + "type": ".google.cloud.documentai.v1beta2.FormExtractionParams" + }, + { + "name": "entity_extraction_params", + "type": ".google.cloud.documentai.v1beta2.EntityExtractionParams" + }, + { + "name": "ocr_params", + "type": ".google.cloud.documentai.v1beta2.OcrParams" + }, + { + "name": "automl_params", + "type": ".google.cloud.documentai.v1beta2.AutoMlParams" + } + ], + "resultType": ".google.cloud.documentai.v1beta2.Document", + "client": { + "shortName": "DocumentUnderstandingServiceClient", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingServiceClient" + }, + "method": { + "shortName": "ProcessDocument", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService.ProcessDocument", + "service": { + "shortName": "DocumentUnderstandingService", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService" + } + } + } + } + ] +} diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js index 596ffb8e78b..65ed20475d7 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.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-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js index cedc57901d1..6fa2b2766f3 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.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-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js index 3b20ac69a29..23228e13926 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.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-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js index b6bbe5af056..219f687ea5a 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.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-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js index 32f84b4dad7..88e78e8d95e 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.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-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js index ad17c02adbf..c0c9b717ee4 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.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-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js index 0e7a5e8d194..cfea7fd672e 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.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-documentai/samples/generated/v1beta3/document_processor_service.process_document.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js index 112ef1e6ba9..2c0d6e90f6f 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.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-documentai/samples/generated/v1beta3/document_processor_service.review_document.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js index fc4ee452881..fd35938f62d 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.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-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json new file mode 100644 index 00000000000..fc76128abe7 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json @@ -0,0 +1,439 @@ +{ + "clientLibrary": { + "name": "nodejs-documentai", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.documentai.v1beta3", + "version": "v1beta3" + } + ] + }, + "snippets": [ + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_ProcessDocument_async", + "title": "DocumentProcessorService processDocument Sample", + "origin": "API_DEFINITION", + "description": " Processes a single document.", + "canonical": true, + "file": "document_processor_service.process_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ProcessDocument", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ProcessDocument", + "async": true, + "parameters": [ + { + "name": "inline_document", + "type": ".google.cloud.documentai.v1beta3.Document" + }, + { + "name": "raw_document", + "type": ".google.cloud.documentai.v1beta3.RawDocument" + }, + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "document", + "type": ".google.cloud.documentai.v1beta3.Document" + }, + { + "name": "skip_human_review", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.documentai.v1beta3.ProcessResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ProcessDocument", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ProcessDocument", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_BatchProcessDocuments_async", + "title": "DocumentProcessorService batchProcessDocuments Sample", + "origin": "API_DEFINITION", + "description": " LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.", + "canonical": true, + "file": "document_processor_service.batch_process_documents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.BatchProcessDocuments", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "input_configs", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "output_config", + "type": ".google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig" + }, + { + "name": "input_documents", + "type": ".google.cloud.documentai.v1beta3.BatchDocumentsInputConfig" + }, + { + "name": "document_output_config", + "type": ".google.cloud.documentai.v1beta3.DocumentOutputConfig" + }, + { + "name": "skip_human_review", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.BatchProcessDocuments", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_FetchProcessorTypes_async", + "title": "DocumentProcessorService fetchProcessorTypes Sample", + "origin": "API_DEFINITION", + "description": " Fetches processor types.", + "canonical": true, + "file": "document_processor_service.fetch_processor_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchProcessorTypes", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.FetchProcessorTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1beta3.FetchProcessorTypesResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "FetchProcessorTypes", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.FetchProcessorTypes", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_ListProcessors_async", + "title": "DocumentProcessorService listProcessors Sample", + "origin": "API_DEFINITION", + "description": " Lists all processors which belong to this project.", + "canonical": true, + "file": "document_processor_service.list_processors.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListProcessors", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessors", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1beta3.ListProcessorsResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ListProcessors", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessors", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_CreateProcessor_async", + "title": "DocumentProcessorService createProcessor Sample", + "origin": "API_DEFINITION", + "description": " Creates a processor from the type processor that the user chose. The processor will be at \"ENABLED\" state by default after its creation.", + "canonical": true, + "file": "document_processor_service.create_processor.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.CreateProcessor", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "processor", + "type": ".google.cloud.documentai.v1beta3.Processor" + } + ], + "resultType": ".google.cloud.documentai.v1beta3.Processor", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "CreateProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.CreateProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessor_async", + "title": "DocumentProcessorService deleteProcessor Sample", + "origin": "API_DEFINITION", + "description": " Deletes the processor, unloads all deployed model artifacts if it was enabled and then deletes all artifacts associated with this processor.", + "canonical": true, + "file": "document_processor_service.delete_processor.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.DeleteProcessor", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "DeleteProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.DeleteProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_EnableProcessor_async", + "title": "DocumentProcessorService enableProcessor Sample", + "origin": "API_DEFINITION", + "description": " Enables a processor", + "canonical": true, + "file": "document_processor_service.enable_processor.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "EnableProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.EnableProcessor", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "EnableProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.EnableProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_DisableProcessor_async", + "title": "DocumentProcessorService disableProcessor Sample", + "origin": "API_DEFINITION", + "description": " Disables a processor", + "canonical": true, + "file": "document_processor_service.disable_processor.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DisableProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.DisableProcessor", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "DisableProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.DisableProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_ReviewDocument_async", + "title": "DocumentProcessorService reviewDocument Sample", + "origin": "API_DEFINITION", + "description": " Send a document for Human Review. The input document should be processed by the specified processor.", + "canonical": true, + "file": "document_processor_service.review_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReviewDocument", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ReviewDocument", + "async": true, + "parameters": [ + { + "name": "inline_document", + "type": ".google.cloud.documentai.v1beta3.Document" + }, + { + "name": "human_review_config", + "type": "TYPE_STRING" + }, + { + "name": "document", + "type": ".google.cloud.documentai.v1beta3.Document" + }, + { + "name": "enable_schema_validation", + "type": "TYPE_BOOL" + }, + { + "name": "priority", + "type": ".google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ReviewDocument", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ReviewDocument", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + } + ] +} diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts index 794cc921c6c..038d6c11d62 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts @@ -844,9 +844,8 @@ export class DocumentProcessorServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.documentProcessorServiceStub!.then(stub => { + if (this.documentProcessorServiceStub && !this._terminated) { + return this.documentProcessorServiceStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts index 4135b22014b..238a9b91361 100644 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts @@ -468,9 +468,8 @@ export class DocumentUnderstandingServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.documentUnderstandingServiceStub!.then(stub => { + if (this.documentUnderstandingServiceStub && !this._terminated) { + return this.documentUnderstandingServiceStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index 8d24e78da41..24c3cd2fa1f 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -598,9 +598,8 @@ export class DocumentUnderstandingServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.documentUnderstandingServiceStub!.then(stub => { + if (this.documentUnderstandingServiceStub && !this._terminated) { + return this.documentUnderstandingServiceStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index d9f6bcf37b4..0d5704520e9 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts @@ -1844,9 +1844,8 @@ export class DocumentProcessorServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.documentProcessorServiceStub!.then(stub => { + if (this.documentProcessorServiceStub && !this._terminated) { + return this.documentProcessorServiceStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts index 4c9a793a3d4..79ba37f220a 100644 --- a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts @@ -128,13 +128,29 @@ describe('v1.DocumentProcessorServiceClient', () => { assert(client.documentProcessorServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.documentProcessorServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.documentProcessorServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -285,6 +301,23 @@ describe('v1.DocumentProcessorServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes processDocument with closed client', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.processDocument(request), expectedError); + }); }); describe('batchProcessDocuments', () => { diff --git a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts index 377013c94f6..4384156325d 100644 --- a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts @@ -196,7 +196,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { assert(client.documentProcessorServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -204,7 +204,25 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { projectId: 'bogus', } ); - client.close(); + client.initialize(); + assert(client.documentProcessorServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.documentProcessorServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -365,6 +383,25 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes processDocument with closed client', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.processDocument(request), expectedError); + }); }); describe('fetchProcessorTypes', () => { @@ -486,6 +523,25 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes fetchProcessorTypes with closed client', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.fetchProcessorTypes(request), expectedError); + }); }); describe('createProcessor', () => { @@ -606,6 +662,25 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes createProcessor with closed client', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.CreateProcessorRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createProcessor(request), expectedError); + }); }); describe('batchProcessDocuments', () => { diff --git a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts index 90b5ea5dd5e..521250e72a7 100644 --- a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts +++ b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts @@ -124,7 +124,7 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { assert(client.documentUnderstandingServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( { @@ -132,7 +132,25 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { projectId: 'bogus', } ); - client.close(); + client.initialize(); + assert(client.documentUnderstandingServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.documentUnderstandingServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { diff --git a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts index c277620b853..e92cfd7d3a6 100644 --- a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts +++ b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts @@ -133,7 +133,7 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { assert(client.documentUnderstandingServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( { @@ -141,7 +141,25 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { projectId: 'bogus', } ); - client.close(); + client.initialize(); + assert(client.documentUnderstandingServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.documentUnderstandingServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -302,6 +320,25 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes processDocument with closed client', async () => { + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta2.ProcessDocumentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.processDocument(request), expectedError); + }); }); describe('batchProcessDocuments', () => { From d5dea410c26f4b5a4228ffd744c6a210bb6f606c Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 22 Feb 2022 18:30:50 +0000 Subject: [PATCH 176/213] chore(main): release 3.3.0 (#306) :robot: I have created a release *beep* *boop* --- ## [3.3.0](https://github.com/googleapis/nodejs-document-ai/compare/v3.2.1...v3.3.0) (2022-02-22) ### Features * add `symbols` field, and auto-format comments ([ec5edb7](https://github.com/googleapis/nodejs-document-ai/commit/ec5edb79f3efc5bef40a55dc30e342ce8ffa0cb8)) * add `symbols` field, and auto-format comments ([ec5edb7](https://github.com/googleapis/nodejs-document-ai/commit/ec5edb79f3efc5bef40a55dc30e342ce8ffa0cb8)) * add question_id field in ReviewDocumentOperationMetadata ([#304](https://github.com/googleapis/nodejs-document-ai/issues/304)) ([e10cd03](https://github.com/googleapis/nodejs-document-ai/commit/e10cd0349295483ca2628af661a3ce18c75382ac)) * add question_id field in ReviewDocumentOperationMetadata ([#308](https://github.com/googleapis/nodejs-document-ai/issues/308)) ([675aff9](https://github.com/googleapis/nodejs-document-ai/commit/675aff978cf6d0b685816a76f75d0562af9bef0b)) --- 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-documentai/CHANGELOG.md | 10 ++++++++++ packages/google-cloud-documentai/package.json | 2 +- packages/google-cloud-documentai/samples/package.json | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index f61d769450b..5b75d045093 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## [3.3.0](https://github.com/googleapis/nodejs-document-ai/compare/v3.2.1...v3.3.0) (2022-02-22) + + +### Features + +* add `symbols` field, and auto-format comments ([ec5edb7](https://github.com/googleapis/nodejs-document-ai/commit/ec5edb79f3efc5bef40a55dc30e342ce8ffa0cb8)) +* add `symbols` field, and auto-format comments ([ec5edb7](https://github.com/googleapis/nodejs-document-ai/commit/ec5edb79f3efc5bef40a55dc30e342ce8ffa0cb8)) +* add question_id field in ReviewDocumentOperationMetadata ([#304](https://github.com/googleapis/nodejs-document-ai/issues/304)) ([e10cd03](https://github.com/googleapis/nodejs-document-ai/commit/e10cd0349295483ca2628af661a3ce18c75382ac)) +* add question_id field in ReviewDocumentOperationMetadata ([#308](https://github.com/googleapis/nodejs-document-ai/issues/308)) ([675aff9](https://github.com/googleapis/nodejs-document-ai/commit/675aff978cf6d0b685816a76f75d0562af9bef0b)) + ### [3.2.1](https://github.com/googleapis/nodejs-document-ai/compare/v3.2.0...v3.2.1) (2022-01-13) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index e12650c4084..610d1c7c0ea 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "3.2.1", + "version": "3.3.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index fb6c4cf3ed9..7ccfa2d1d60 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^3.2.0", + "@google-cloud/documentai": "^3.3.0", "@google-cloud/storage": "^5.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" From b13e567c13eb11af525fbc5bf3a893c61098a699 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 22 Feb 2022 20:01:07 +0100 Subject: [PATCH 177/213] chore(deps): update dependency gts to v3 (#295) 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 | |---|---|---|---|---|---| | [gts](https://togithub.com/google/gts) | [`^2.0.0` -> `^3.0.0`](https://renovatebot.com/diffs/npm/gts/2.0.2/3.1.0) | [![age](https://badges.renovateapi.com/packages/npm/gts/3.1.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/gts/3.1.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/gts/3.1.0/compatibility-slim/2.0.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/gts/3.1.0/confidence-slim/2.0.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
google/gts ### [`v3.1.0`](https://togithub.com/google/gts/blob/HEAD/CHANGELOG.md#​310-httpswwwgithubcomgooglegtscomparev303v310-2021-01-11) [Compare Source](https://togithub.com/google/gts/compare/v3.0.3...v3.1.0) ##### Features - support comments in JSON ([#​571](https://www.togithub.com/google/gts/issues/571)) ([cb6d2ca](https://www.github.com/google/gts/commit/cb6d2cacb5de7bcc9c8e82dd47e14fc5bf9596a3)) ##### Bug Fixes - **deps:** update dependency eslint-config-prettier to v7 ([#​601](https://www.togithub.com/google/gts/issues/601)) ([6e26681](https://www.github.com/google/gts/commit/6e266812da4b90b18e2abead9b2b5a1ca0c6654b)) - **deps:** upgrade to latest version of meow ([#​616](https://www.togithub.com/google/gts/issues/616)) ([634bad9](https://www.github.com/google/gts/commit/634bad9bbbdb4d397bba101dc38ab14881172a30)) ##### [3.0.3](https://www.github.com/google/gts/compare/v3.0.2...v3.0.3) (2020-12-03) ##### Bug Fixes - **deps:** update dependency execa to v5 ([#​600](https://www.togithub.com/google/gts/issues/600)) ([4e5f1e5](https://www.github.com/google/gts/commit/4e5f1e54facf53588bbb3b025b5240edbd7f3c8a)) - **deps:** update dependency meow to v8 ([#​591](https://www.togithub.com/google/gts/issues/591)) ([c7e223e](https://www.github.com/google/gts/commit/c7e223e6a2ff605fabad2f8359a0385033f8de66)) ##### [3.0.2](https://www.github.com/google/gts/compare/v3.0.1...v3.0.2) (2020-10-26) ##### Bug Fixes - **deps:** loosen ts peer dependency ([#​589](https://www.togithub.com/google/gts/issues/589)) ([8f1d381](https://www.github.com/google/gts/commit/8f1d381d7b166a510c42786c4a337e81b7222c84)) ##### [3.0.1](https://www.github.com/google/gts/compare/v3.0.0...v3.0.1) (2020-10-12) ##### Bug Fixes - **rule:** turn off [@​typescript-eslint/no-var-requires](https://togithub.com/typescript-eslint/no-var-requires) ([#​578](https://www.togithub.com/google/gts/issues/578)) ([3b37229](https://www.github.com/google/gts/commit/3b37229c45969a3c53af123c69bb749578ee6b0b)) ### [`v3.0.3`](https://togithub.com/google/gts/blob/HEAD/CHANGELOG.md#​303-httpswwwgithubcomgooglegtscomparev302v303-2020-12-03) [Compare Source](https://togithub.com/google/gts/compare/v3.0.2...v3.0.3) ### [`v3.0.2`](https://togithub.com/google/gts/blob/HEAD/CHANGELOG.md#​302-httpswwwgithubcomgooglegtscomparev301v302-2020-10-26) [Compare Source](https://togithub.com/google/gts/compare/v3.0.1...v3.0.2) ### [`v3.0.1`](https://togithub.com/google/gts/blob/HEAD/CHANGELOG.md#​301-httpswwwgithubcomgooglegtscomparev300v301-2020-10-12) [Compare Source](https://togithub.com/google/gts/compare/v3.0.0...v3.0.1) ### [`v3.0.0`](https://togithub.com/google/gts/blob/HEAD/CHANGELOG.md#​300-httpswwwgithubcomgooglegtscomparev202v300-2020-10-08) [Compare Source](https://togithub.com/google/gts/compare/v2.0.2...v3.0.0) ##### ⚠ BREAKING CHANGES - change default `check` to `lint` ([#​570](https://togithub.com/google/gts/issues/570)) - **deps:** require TypeScript 4.x ([#​565](https://togithub.com/google/gts/issues/565)) ##### Features - Add TypeScript v4 support ([#​551](https://www.togithub.com/google/gts/issues/551)) ([0883956](https://www.github.com/google/gts/commit/08839565a1d2b4b39d532c9b0b596f01b18856fe)) - change default `check` to `lint` ([#​570](https://www.togithub.com/google/gts/issues/570)) ([c527b66](https://www.github.com/google/gts/commit/c527b66be1ef6a78ea14b3d29225a8d7fb7097bd)) - generate .eslintignore when running init ([#​521](https://www.togithub.com/google/gts/issues/521)) ([8bce036](https://www.github.com/google/gts/commit/8bce0368767f0c2ad7d0700deb839962bc928d16)) ##### Bug Fixes - add build/.eslintrc.json to files field ([#​553](https://www.togithub.com/google/gts/issues/553)) ([3b516ad](https://www.github.com/google/gts/commit/3b516ad5e9f0d58201dde469461db7c6ed1c1b78)) - **deps:** require TypeScript 4.x ([#​565](https://www.togithub.com/google/gts/issues/565)) ([cbc5267](https://www.github.com/google/gts/commit/cbc5267579ef24e8c8ceaa2ef794df3ef54ea56a)) - **deps:** update dependency update-notifier to v5 ([#​574](https://www.togithub.com/google/gts/issues/574)) ([9a882bf](https://www.github.com/google/gts/commit/9a882bf4ac30ad06e7b91a65ad5721d8e8b41c4b)) - **deps:** update typescript-eslint monorepo to v2.34.0 ([#​509](https://www.togithub.com/google/gts/issues/509)) ([998a4ac](https://www.github.com/google/gts/commit/998a4ac9b75c97f04d8e5db37563f32d31652f23)) - **deps:** update typescript-eslint monorepo to v3 (major) ([#​528](https://www.togithub.com/google/gts/issues/528)) ([e22e173](https://www.github.com/google/gts/commit/e22e17338db2ddb7eb829c821037c2f4e77ff869)) - **deps:** update typescript-eslint monorepo to v4 ([#​556](https://www.togithub.com/google/gts/issues/556)) ([54148df](https://www.github.com/google/gts/commit/54148dfbd8b5f8b36a0f44f901c5db933393a661)) - better error message for broken tsconfig.json ([#​501](https://www.togithub.com/google/gts/issues/501)) ([0c17a76](https://www.github.com/google/gts/commit/0c17a76c6650eee1d8abaff11a897a432eeaa65f)) - prohibit calls for it.only and describe.only ([#​499](https://www.togithub.com/google/gts/issues/499)) ([071c33c](https://www.github.com/google/gts/commit/071c33ceef0e3765166aaebf6ed4698167ac0f98)) ##### [2.0.2](https://www.github.com/google/gts/compare/v2.0.1...v2.0.2) (2020-05-11) ##### Bug Fixes - Revert 'update dependency eslint to v7'" ([#​507](https://www.togithub.com/google/gts/issues/507)) ([0f9950b](https://www.github.com/google/gts/commit/0f9950b273329dbcce5f3cc20864c3dcd076f08c)) - **deps:** pin release of eslint-typescript ([#​508](https://www.togithub.com/google/gts/issues/508)) ([bd86b42](https://www.github.com/google/gts/commit/bd86b42e2bb904d3765dee82262e4691a11b9958)) - **deps:** update dependency eslint to v7 ([#​504](https://www.togithub.com/google/gts/issues/504)) ([6aee159](https://www.github.com/google/gts/commit/6aee1595d0486ae2c7fd68d16b1b59c4c4015753)) ##### [2.0.1](https://www.github.com/google/gts/compare/v2.0.0...v2.0.1) (2020-05-07) ##### Bug Fixes - throw an error if running with an unsupported version of nodejs ([#​493](https://www.togithub.com/google/gts/issues/493)) ([94fdf1e](https://www.github.com/google/gts/commit/94fdf1eaed634aa73c3e44c7a3d9f1325f773b07)) - **deps:** update dependency meow to v7 ([#​502](https://www.togithub.com/google/gts/issues/502)) ([cf91cda](https://www.github.com/google/gts/commit/cf91cda1afab25759427511d3c97d0037d61c649))
--- ### Configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found. 🔕 **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-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 610d1c7c0ea..94429523898 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -35,7 +35,7 @@ "@types/sinon": "^10.0.0", "c8": "^7.1.0", "chai": "^4.2.0", - "gts": "^2.0.0", + "gts": "^3.0.0", "jsdoc": "^3.6.3", "jsdoc-fresh": "^1.0.2", "jsdoc-region-tag": "^1.0.4", From 36ca7ffe846fdc99e996949cddd3aa2834894d39 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 16 Mar 2022 21:32:29 +0000 Subject: [PATCH 178/213] chore: update v2.14.2 gapic-generator-typescript (#314) - [ ] Regenerate this pull request now. Committer: @summer-ji-eng PiperOrigin-RevId: 434859890 Source-Link: https://github.com/googleapis/googleapis/commit/bc2432d50cba657e95212122e3fa112591b5bec2 Source-Link: https://github.com/googleapis/googleapis-gen/commit/930b673103e92523f8cfed38decd7d3afae8ebe7 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTMwYjY3MzEwM2U5MjUyM2Y4Y2ZlZDM4ZGVjZDdkM2FmYWU4ZWJlNyJ9 --- .../test/gapic_document_processor_service_v1.ts | 1 - .../test/gapic_document_processor_service_v1beta3.ts | 3 --- .../test/gapic_document_understanding_service_v1beta2.ts | 1 - 3 files changed, 5 deletions(-) diff --git a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts index 79ba37f220a..de45bc4c5cc 100644 --- a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts @@ -313,7 +313,6 @@ describe('v1.DocumentProcessorServiceClient', () => { new protos.google.cloud.documentai.v1.ProcessRequest() ); request.name = ''; - const expectedHeaderRequestParams = 'name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.processDocument(request), expectedError); diff --git a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts index 4384156325d..24d778aea4d 100644 --- a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts @@ -397,7 +397,6 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { new protos.google.cloud.documentai.v1beta3.ProcessRequest() ); request.name = ''; - const expectedHeaderRequestParams = 'name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.processDocument(request), expectedError); @@ -537,7 +536,6 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { new protos.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest() ); request.parent = ''; - const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.fetchProcessorTypes(request), expectedError); @@ -676,7 +674,6 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { new protos.google.cloud.documentai.v1beta3.CreateProcessorRequest() ); request.parent = ''; - const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createProcessor(request), expectedError); diff --git a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts index e92cfd7d3a6..6feb89ff20a 100644 --- a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts +++ b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts @@ -334,7 +334,6 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { new protos.google.cloud.documentai.v1beta2.ProcessDocumentRequest() ); request.parent = ''; - const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.processDocument(request), expectedError); From c30721df5bfeda8566d75f2fa029d3ba7c3a4dcd Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 17 Mar 2022 02:00:19 +0000 Subject: [PATCH 179/213] feat: add `content` field in TextAnchor (#315) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 435142243 Source-Link: https://github.com/googleapis/googleapis/commit/721b367f4b3e7a98f6f57c31409b281379a2e39e Source-Link: https://github.com/googleapis/googleapis-gen/commit/b627aaeb3afafe7d94d6099a2d1945aa9b4dadad Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjYyN2FhZWIzYWZhZmU3ZDk0ZDYwOTlhMmQxOTQ1YWE5YjRkYWRhZCJ9 --- .../cloud/documentai/v1beta2/document.proto | 4 ++++ .../protos/protos.d.ts | 6 +++++ .../google-cloud-documentai/protos/protos.js | 23 +++++++++++++++++++ .../protos/protos.json | 4 ++++ 4 files changed, 37 insertions(+) diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto index bb3b58bade9..b8af15b5225 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto @@ -421,6 +421,10 @@ message Document { // The text segments from the [Document.text][google.cloud.documentai.v1beta2.Document.text]. repeated TextSegment text_segments = 1; + + // Contains the content of the text span so that users do + // not have to look it up in the text_segments. + string content = 2; } // Referencing elements in [Document.pages][google.cloud.documentai.v1beta2.Document.pages]. diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index acb31c79a8e..79e133a2632 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -12453,6 +12453,9 @@ export namespace google { /** TextAnchor textSegments */ textSegments?: (google.cloud.documentai.v1beta2.Document.TextAnchor.ITextSegment[]|null); + + /** TextAnchor content */ + content?: (string|null); } /** Represents a TextAnchor. */ @@ -12467,6 +12470,9 @@ export namespace google { /** TextAnchor textSegments. */ public textSegments: google.cloud.documentai.v1beta2.Document.TextAnchor.ITextSegment[]; + /** TextAnchor content. */ + public content: string; + /** * Creates a new TextAnchor instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index cfa1f8eac5b..4f9ea7245b2 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -31866,6 +31866,7 @@ * @memberof google.cloud.documentai.v1beta2.Document * @interface ITextAnchor * @property {Array.|null} [textSegments] TextAnchor textSegments + * @property {string|null} [content] TextAnchor content */ /** @@ -31892,6 +31893,14 @@ */ TextAnchor.prototype.textSegments = $util.emptyArray; + /** + * TextAnchor content. + * @member {string} content + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor + * @instance + */ + TextAnchor.prototype.content = ""; + /** * Creates a new TextAnchor instance using the specified properties. * @function create @@ -31919,6 +31928,8 @@ if (message.textSegments != null && message.textSegments.length) for (var i = 0; i < message.textSegments.length; ++i) $root.google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment.encode(message.textSegments[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.content != null && Object.hasOwnProperty.call(message, "content")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.content); return writer; }; @@ -31958,6 +31969,9 @@ message.textSegments = []; message.textSegments.push($root.google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment.decode(reader, reader.uint32())); break; + case 2: + message.content = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -32002,6 +32016,9 @@ return "textSegments." + error; } } + if (message.content != null && message.hasOwnProperty("content")) + if (!$util.isString(message.content)) + return "content: string expected"; return null; }; @@ -32027,6 +32044,8 @@ message.textSegments[i] = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment.fromObject(object.textSegments[i]); } } + if (object.content != null) + message.content = String(object.content); return message; }; @@ -32045,11 +32064,15 @@ var object = {}; if (options.arrays || options.defaults) object.textSegments = []; + if (options.defaults) + object.content = ""; if (message.textSegments && message.textSegments.length) { object.textSegments = []; for (var j = 0; j < message.textSegments.length; ++j) object.textSegments[j] = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment.toObject(message.textSegments[j], options); } + if (message.content != null && message.hasOwnProperty("content")) + object.content = message.content; return object; }; diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index d24ee7e24dd..d7e308e6c06 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -2715,6 +2715,10 @@ "rule": "repeated", "type": "TextSegment", "id": 1 + }, + "content": { + "type": "string", + "id": 2 } }, "nested": { From 1257994ec8cf95417065c5ef3a9c719cd8f7cd7e Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 23 Mar 2022 17:22:17 +0000 Subject: [PATCH 180/213] chore: remove unused imports (#317) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 436716640 Source-Link: https://github.com/googleapis/googleapis/commit/ab8c7d2054227e02e9a897f8058543bc9380be0c Source-Link: https://github.com/googleapis/googleapis-gen/commit/05c806948faa4efd7f83e6f375cac941aef40811 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDVjODA2OTQ4ZmFhNGVmZDdmODNlNmYzNzVjYWM5NDFhZWY0MDgxMSJ9 --- .../google/cloud/documentai/v1/document.proto | 1 - .../cloud/documentai/v1/document_io.proto | 2 - .../v1/document_processor_service.proto | 1 - .../google/cloud/documentai/v1/geometry.proto | 2 - .../documentai/v1/operation_metadata.proto | 1 - .../protos/protos.d.ts | 24 ++++----- .../google-cloud-documentai/protos/protos.js | 52 +++++++++---------- .../protos/protos.json | 36 ++++++------- 8 files changed, 56 insertions(+), 63 deletions(-) diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto index e6368bad543..aed16a998e3 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto @@ -16,7 +16,6 @@ syntax = "proto3"; package google.cloud.documentai.v1; -import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/cloud/documentai/v1/geometry.proto"; import "google/protobuf/timestamp.proto"; diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto index 1bd020eefdb..281a379fab6 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto @@ -16,8 +16,6 @@ syntax = "proto3"; package google.cloud.documentai.v1; -import "google/api/annotations.proto"; - option csharp_namespace = "Google.Cloud.DocumentAI.V1"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai"; option java_multiple_files = true; diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto index 314a51d9ac0..d0c21feb2a3 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto @@ -24,7 +24,6 @@ import "google/cloud/documentai/v1/document.proto"; import "google/cloud/documentai/v1/document_io.proto"; import "google/cloud/documentai/v1/operation_metadata.proto"; import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/status.proto"; diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto index 19ced5073bc..6f83ee7beb0 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto @@ -16,8 +16,6 @@ syntax = "proto3"; package google.cloud.documentai.v1; -import "google/api/annotations.proto"; - option csharp_namespace = "Google.Cloud.DocumentAI.V1"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai"; option java_multiple_files = true; diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/operation_metadata.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/operation_metadata.proto index 503451bf272..773222439ed 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/operation_metadata.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/operation_metadata.proto @@ -17,7 +17,6 @@ syntax = "proto3"; package google.cloud.documentai.v1; import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; option csharp_namespace = "Google.Cloud.DocumentAI.V1"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai"; diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 79e133a2632..0d6b8928276 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -22642,6 +22642,18 @@ 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 Http. */ interface IHttp { @@ -22981,18 +22993,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 { diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 4f9ea7245b2..7e024ef519b 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -56886,6 +56886,32 @@ */ var api = {}; + /** + * 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.Http = (function() { /** @@ -57790,32 +57816,6 @@ 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; - })(); - api.ResourceDescriptor = (function() { /** diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index d7e308e6c06..d293c9d9a80 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -5008,6 +5008,24 @@ "cc_enable_arenas": true }, "nested": { + "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, + "UNORDERED_LIST": 6, + "NON_EMPTY_DEFAULT": 7 + } + }, "http": { "type": "HttpRule", "id": 72295728, @@ -5095,24 +5113,6 @@ } } }, - "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, - "UNORDERED_LIST": 6, - "NON_EMPTY_DEFAULT": 7 - } - }, "methodSignature": { "rule": "repeated", "type": "string", From ca5d054500e6d4ef1e3208afcd2faef8bc90a696 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 21 Apr 2022 02:34:30 +0000 Subject: [PATCH 181/213] build(node): update client library version in samples metadata (#1356) (#324) * 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 --- ...t_metadata.google.cloud.documentai.v1.json | 328 +++---- ...adata.google.cloud.documentai.v1beta1.json | 112 +-- ...adata.google.cloud.documentai.v1beta2.json | 252 +++--- ...adata.google.cloud.documentai.v1beta3.json | 840 +++++++++--------- 4 files changed, 766 insertions(+), 766 deletions(-) diff --git a/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json index 1d4eabaf9c6..79b7584d87e 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json +++ b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json @@ -1,171 +1,171 @@ { - "clientLibrary": { - "name": "nodejs-documentai", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.documentai.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "documentai_v1_generated_DocumentProcessorService_ProcessDocument_async", - "title": "DocumentProcessorService processDocument Sample", - "origin": "API_DEFINITION", - "description": " Processes a single document.", - "canonical": true, - "file": "document_processor_service.process_document.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ProcessDocument", - "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument", - "async": true, - "parameters": [ - { - "name": "inline_document", - "type": ".google.cloud.documentai.v1.Document" - }, - { - "name": "raw_document", - "type": ".google.cloud.documentai.v1.RawDocument" - }, - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "skip_human_review", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.documentai.v1.ProcessResponse", - "client": { - "shortName": "DocumentProcessorServiceClient", - "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" - }, - "method": { - "shortName": "ProcessDocument", - "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument", - "service": { - "shortName": "DocumentProcessorService", - "fullName": "google.cloud.documentai.v1.DocumentProcessorService" - } - } - } + "clientLibrary": { + "name": "nodejs-documentai", + "version": "3.3.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.documentai.v1", + "version": "v1" + } + ] }, - { - "regionTag": "documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_async", - "title": "DocumentProcessorService batchProcessDocuments Sample", - "origin": "API_DEFINITION", - "description": " LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.", - "canonical": true, - "file": "document_processor_service.batch_process_documents.js", - "language": "JAVASCRIPT", - "segments": [ + "snippets": [ { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchProcessDocuments", - "fullName": "google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "input_documents", - "type": ".google.cloud.documentai.v1.BatchDocumentsInputConfig" - }, - { - "name": "document_output_config", - "type": ".google.cloud.documentai.v1.DocumentOutputConfig" - }, - { - "name": "skip_human_review", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DocumentProcessorServiceClient", - "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + "regionTag": "documentai_v1_generated_DocumentProcessorService_ProcessDocument_async", + "title": "DocumentProcessorService processDocument Sample", + "origin": "API_DEFINITION", + "description": " Processes a single document.", + "canonical": true, + "file": "document_processor_service.process_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ProcessDocument", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument", + "async": true, + "parameters": [ + { + "name": "inline_document", + "type": ".google.cloud.documentai.v1.Document" + }, + { + "name": "raw_document", + "type": ".google.cloud.documentai.v1.RawDocument" + }, + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "skip_human_review", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.documentai.v1.ProcessResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ProcessDocument", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } }, - "method": { - "shortName": "BatchProcessDocuments", - "fullName": "google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments", - "service": { - "shortName": "DocumentProcessorService", - "fullName": "google.cloud.documentai.v1.DocumentProcessorService" - } - } - } - }, - { - "regionTag": "documentai_v1_generated_DocumentProcessorService_ReviewDocument_async", - "title": "DocumentProcessorService reviewDocument Sample", - "origin": "API_DEFINITION", - "description": " Send a document for Human Review. The input document should be processed by the specified processor.", - "canonical": true, - "file": "document_processor_service.review_document.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReviewDocument", - "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument", - "async": true, - "parameters": [ - { - "name": "inline_document", - "type": ".google.cloud.documentai.v1.Document" - }, - { - "name": "human_review_config", - "type": "TYPE_STRING" - }, - { - "name": "enable_schema_validation", - "type": "TYPE_BOOL" - }, - { - "name": "priority", - "type": ".google.cloud.documentai.v1.ReviewDocumentRequest.Priority" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DocumentProcessorServiceClient", - "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + "regionTag": "documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_async", + "title": "DocumentProcessorService batchProcessDocuments Sample", + "origin": "API_DEFINITION", + "description": " LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.", + "canonical": true, + "file": "document_processor_service.batch_process_documents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "input_documents", + "type": ".google.cloud.documentai.v1.BatchDocumentsInputConfig" + }, + { + "name": "document_output_config", + "type": ".google.cloud.documentai.v1.DocumentOutputConfig" + }, + { + "name": "skip_human_review", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } }, - "method": { - "shortName": "ReviewDocument", - "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument", - "service": { - "shortName": "DocumentProcessorService", - "fullName": "google.cloud.documentai.v1.DocumentProcessorService" - } + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_ReviewDocument_async", + "title": "DocumentProcessorService reviewDocument Sample", + "origin": "API_DEFINITION", + "description": " Send a document for Human Review. The input document should be processed by the specified processor.", + "canonical": true, + "file": "document_processor_service.review_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReviewDocument", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument", + "async": true, + "parameters": [ + { + "name": "inline_document", + "type": ".google.cloud.documentai.v1.Document" + }, + { + "name": "human_review_config", + "type": "TYPE_STRING" + }, + { + "name": "enable_schema_validation", + "type": "TYPE_BOOL" + }, + { + "name": "priority", + "type": ".google.cloud.documentai.v1.ReviewDocumentRequest.Priority" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ReviewDocument", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } } - } - } - ] -} + ] +} \ No newline at end of file diff --git a/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json b/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json index 6fb76dcd077..74b43f46584 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json @@ -1,59 +1,59 @@ { - "clientLibrary": { - "name": "nodejs-documentai", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.documentai.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "documentai_v1beta1_generated_DocumentUnderstandingService_BatchProcessDocuments_async", - "title": "DocumentUnderstandingService batchProcessDocuments Sample", - "origin": "API_DEFINITION", - "description": " LRO endpoint to batch process many documents.", - "canonical": true, - "file": "document_understanding_service.batch_process_documents.js", - "language": "JAVASCRIPT", - "segments": [ + "clientLibrary": { + "name": "nodejs-documentai", + "version": "3.3.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.documentai.v1beta1", + "version": "v1beta1" + } + ] + }, + "snippets": [ { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchProcessDocuments", - "fullName": "google.cloud.documentai.v1beta1.DocumentUnderstandingService.BatchProcessDocuments", - "async": true, - "parameters": [ - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DocumentUnderstandingServiceClient", - "fullName": "google.cloud.documentai.v1beta1.DocumentUnderstandingServiceClient" - }, - "method": { - "shortName": "BatchProcessDocuments", - "fullName": "google.cloud.documentai.v1beta1.DocumentUnderstandingService.BatchProcessDocuments", - "service": { - "shortName": "DocumentUnderstandingService", - "fullName": "google.cloud.documentai.v1beta1.DocumentUnderstandingService" - } + "regionTag": "documentai_v1beta1_generated_DocumentUnderstandingService_BatchProcessDocuments_async", + "title": "DocumentUnderstandingService batchProcessDocuments Sample", + "origin": "API_DEFINITION", + "description": " LRO endpoint to batch process many documents.", + "canonical": true, + "file": "document_understanding_service.batch_process_documents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1beta1.DocumentUnderstandingService.BatchProcessDocuments", + "async": true, + "parameters": [ + { + "name": "requests", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentUnderstandingServiceClient", + "fullName": "google.cloud.documentai.v1beta1.DocumentUnderstandingServiceClient" + }, + "method": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1beta1.DocumentUnderstandingService.BatchProcessDocuments", + "service": { + "shortName": "DocumentUnderstandingService", + "fullName": "google.cloud.documentai.v1beta1.DocumentUnderstandingService" + } + } + } } - } - } - ] -} + ] +} \ No newline at end of file diff --git a/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json b/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json index ad18521496c..d35bfc1233b 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json @@ -1,131 +1,131 @@ { - "clientLibrary": { - "name": "nodejs-documentai", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.documentai.v1beta2", - "version": "v1beta2" - } - ] - }, - "snippets": [ - { - "regionTag": "documentai_v1beta2_generated_DocumentUnderstandingService_BatchProcessDocuments_async", - "title": "DocumentUnderstandingService batchProcessDocuments Sample", - "origin": "API_DEFINITION", - "description": " LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.", - "canonical": true, - "file": "document_understanding_service.batch_process_documents.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchProcessDocuments", - "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService.BatchProcessDocuments", - "async": true, - "parameters": [ - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DocumentUnderstandingServiceClient", - "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingServiceClient" - }, - "method": { - "shortName": "BatchProcessDocuments", - "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService.BatchProcessDocuments", - "service": { - "shortName": "DocumentUnderstandingService", - "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService" - } - } - } + "clientLibrary": { + "name": "nodejs-documentai", + "version": "3.3.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.documentai.v1beta2", + "version": "v1beta2" + } + ] }, - { - "regionTag": "documentai_v1beta2_generated_DocumentUnderstandingService_ProcessDocument_async", - "title": "DocumentUnderstandingService processDocument Sample", - "origin": "API_DEFINITION", - "description": " Processes a single document.", - "canonical": true, - "file": "document_understanding_service.process_document.js", - "language": "JAVASCRIPT", - "segments": [ + "snippets": [ { - "start": 25, - "end": 93, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ProcessDocument", - "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService.ProcessDocument", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.documentai.v1beta2.InputConfig" - }, - { - "name": "output_config", - "type": ".google.cloud.documentai.v1beta2.OutputConfig" - }, - { - "name": "document_type", - "type": "TYPE_STRING" - }, - { - "name": "table_extraction_params", - "type": ".google.cloud.documentai.v1beta2.TableExtractionParams" - }, - { - "name": "form_extraction_params", - "type": ".google.cloud.documentai.v1beta2.FormExtractionParams" - }, - { - "name": "entity_extraction_params", - "type": ".google.cloud.documentai.v1beta2.EntityExtractionParams" - }, - { - "name": "ocr_params", - "type": ".google.cloud.documentai.v1beta2.OcrParams" - }, - { - "name": "automl_params", - "type": ".google.cloud.documentai.v1beta2.AutoMlParams" - } - ], - "resultType": ".google.cloud.documentai.v1beta2.Document", - "client": { - "shortName": "DocumentUnderstandingServiceClient", - "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingServiceClient" + "regionTag": "documentai_v1beta2_generated_DocumentUnderstandingService_BatchProcessDocuments_async", + "title": "DocumentUnderstandingService batchProcessDocuments Sample", + "origin": "API_DEFINITION", + "description": " LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.", + "canonical": true, + "file": "document_understanding_service.batch_process_documents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService.BatchProcessDocuments", + "async": true, + "parameters": [ + { + "name": "requests", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentUnderstandingServiceClient", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingServiceClient" + }, + "method": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService.BatchProcessDocuments", + "service": { + "shortName": "DocumentUnderstandingService", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService" + } + } + } }, - "method": { - "shortName": "ProcessDocument", - "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService.ProcessDocument", - "service": { - "shortName": "DocumentUnderstandingService", - "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService" - } + { + "regionTag": "documentai_v1beta2_generated_DocumentUnderstandingService_ProcessDocument_async", + "title": "DocumentUnderstandingService processDocument Sample", + "origin": "API_DEFINITION", + "description": " Processes a single document.", + "canonical": true, + "file": "document_understanding_service.process_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 93, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ProcessDocument", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService.ProcessDocument", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.documentai.v1beta2.InputConfig" + }, + { + "name": "output_config", + "type": ".google.cloud.documentai.v1beta2.OutputConfig" + }, + { + "name": "document_type", + "type": "TYPE_STRING" + }, + { + "name": "table_extraction_params", + "type": ".google.cloud.documentai.v1beta2.TableExtractionParams" + }, + { + "name": "form_extraction_params", + "type": ".google.cloud.documentai.v1beta2.FormExtractionParams" + }, + { + "name": "entity_extraction_params", + "type": ".google.cloud.documentai.v1beta2.EntityExtractionParams" + }, + { + "name": "ocr_params", + "type": ".google.cloud.documentai.v1beta2.OcrParams" + }, + { + "name": "automl_params", + "type": ".google.cloud.documentai.v1beta2.AutoMlParams" + } + ], + "resultType": ".google.cloud.documentai.v1beta2.Document", + "client": { + "shortName": "DocumentUnderstandingServiceClient", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingServiceClient" + }, + "method": { + "shortName": "ProcessDocument", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService.ProcessDocument", + "service": { + "shortName": "DocumentUnderstandingService", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService" + } + } + } } - } - } - ] -} + ] +} \ No newline at end of file diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json index fc76128abe7..d7b945733cf 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json @@ -1,439 +1,439 @@ { - "clientLibrary": { - "name": "nodejs-documentai", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.documentai.v1beta3", - "version": "v1beta3" - } - ] - }, - "snippets": [ - { - "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_ProcessDocument_async", - "title": "DocumentProcessorService processDocument Sample", - "origin": "API_DEFINITION", - "description": " Processes a single document.", - "canonical": true, - "file": "document_processor_service.process_document.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ProcessDocument", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ProcessDocument", - "async": true, - "parameters": [ - { - "name": "inline_document", - "type": ".google.cloud.documentai.v1beta3.Document" - }, - { - "name": "raw_document", - "type": ".google.cloud.documentai.v1beta3.RawDocument" - }, - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "document", - "type": ".google.cloud.documentai.v1beta3.Document" - }, - { - "name": "skip_human_review", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.documentai.v1beta3.ProcessResponse", - "client": { - "shortName": "DocumentProcessorServiceClient", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" - }, - "method": { - "shortName": "ProcessDocument", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ProcessDocument", - "service": { - "shortName": "DocumentProcessorService", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" - } - } - } + "clientLibrary": { + "name": "nodejs-documentai", + "version": "3.3.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.documentai.v1beta3", + "version": "v1beta3" + } + ] }, - { - "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_BatchProcessDocuments_async", - "title": "DocumentProcessorService batchProcessDocuments Sample", - "origin": "API_DEFINITION", - "description": " LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.", - "canonical": true, - "file": "document_processor_service.batch_process_documents.js", - "language": "JAVASCRIPT", - "segments": [ + "snippets": [ { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchProcessDocuments", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.BatchProcessDocuments", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "input_configs", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "output_config", - "type": ".google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig" - }, - { - "name": "input_documents", - "type": ".google.cloud.documentai.v1beta3.BatchDocumentsInputConfig" - }, - { - "name": "document_output_config", - "type": ".google.cloud.documentai.v1beta3.DocumentOutputConfig" - }, - { - "name": "skip_human_review", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DocumentProcessorServiceClient", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_ProcessDocument_async", + "title": "DocumentProcessorService processDocument Sample", + "origin": "API_DEFINITION", + "description": " Processes a single document.", + "canonical": true, + "file": "document_processor_service.process_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ProcessDocument", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ProcessDocument", + "async": true, + "parameters": [ + { + "name": "inline_document", + "type": ".google.cloud.documentai.v1beta3.Document" + }, + { + "name": "raw_document", + "type": ".google.cloud.documentai.v1beta3.RawDocument" + }, + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "document", + "type": ".google.cloud.documentai.v1beta3.Document" + }, + { + "name": "skip_human_review", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.documentai.v1beta3.ProcessResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ProcessDocument", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ProcessDocument", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } }, - "method": { - "shortName": "BatchProcessDocuments", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.BatchProcessDocuments", - "service": { - "shortName": "DocumentProcessorService", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" - } - } - } - }, - { - "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_FetchProcessorTypes_async", - "title": "DocumentProcessorService fetchProcessorTypes Sample", - "origin": "API_DEFINITION", - "description": " Fetches processor types.", - "canonical": true, - "file": "document_processor_service.fetch_processor_types.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FetchProcessorTypes", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.FetchProcessorTypes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.documentai.v1beta3.FetchProcessorTypesResponse", - "client": { - "shortName": "DocumentProcessorServiceClient", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_BatchProcessDocuments_async", + "title": "DocumentProcessorService batchProcessDocuments Sample", + "origin": "API_DEFINITION", + "description": " LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.", + "canonical": true, + "file": "document_processor_service.batch_process_documents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.BatchProcessDocuments", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "input_configs", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "output_config", + "type": ".google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig" + }, + { + "name": "input_documents", + "type": ".google.cloud.documentai.v1beta3.BatchDocumentsInputConfig" + }, + { + "name": "document_output_config", + "type": ".google.cloud.documentai.v1beta3.DocumentOutputConfig" + }, + { + "name": "skip_human_review", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.BatchProcessDocuments", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } }, - "method": { - "shortName": "FetchProcessorTypes", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.FetchProcessorTypes", - "service": { - "shortName": "DocumentProcessorService", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" - } - } - } - }, - { - "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_ListProcessors_async", - "title": "DocumentProcessorService listProcessors Sample", - "origin": "API_DEFINITION", - "description": " Lists all processors which belong to this project.", - "canonical": true, - "file": "document_processor_service.list_processors.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListProcessors", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessors", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.documentai.v1beta3.ListProcessorsResponse", - "client": { - "shortName": "DocumentProcessorServiceClient", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_FetchProcessorTypes_async", + "title": "DocumentProcessorService fetchProcessorTypes Sample", + "origin": "API_DEFINITION", + "description": " Fetches processor types.", + "canonical": true, + "file": "document_processor_service.fetch_processor_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchProcessorTypes", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.FetchProcessorTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1beta3.FetchProcessorTypesResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "FetchProcessorTypes", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.FetchProcessorTypes", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } }, - "method": { - "shortName": "ListProcessors", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessors", - "service": { - "shortName": "DocumentProcessorService", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" - } - } - } - }, - { - "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_CreateProcessor_async", - "title": "DocumentProcessorService createProcessor Sample", - "origin": "API_DEFINITION", - "description": " Creates a processor from the type processor that the user chose. The processor will be at \"ENABLED\" state by default after its creation.", - "canonical": true, - "file": "document_processor_service.create_processor.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateProcessor", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.CreateProcessor", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "processor", - "type": ".google.cloud.documentai.v1beta3.Processor" - } - ], - "resultType": ".google.cloud.documentai.v1beta3.Processor", - "client": { - "shortName": "DocumentProcessorServiceClient", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_ListProcessors_async", + "title": "DocumentProcessorService listProcessors Sample", + "origin": "API_DEFINITION", + "description": " Lists all processors which belong to this project.", + "canonical": true, + "file": "document_processor_service.list_processors.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListProcessors", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessors", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1beta3.ListProcessorsResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ListProcessors", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessors", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } }, - "method": { - "shortName": "CreateProcessor", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.CreateProcessor", - "service": { - "shortName": "DocumentProcessorService", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" - } - } - } - }, - { - "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessor_async", - "title": "DocumentProcessorService deleteProcessor Sample", - "origin": "API_DEFINITION", - "description": " Deletes the processor, unloads all deployed model artifacts if it was enabled and then deletes all artifacts associated with this processor.", - "canonical": true, - "file": "document_processor_service.delete_processor.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteProcessor", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.DeleteProcessor", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DocumentProcessorServiceClient", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_CreateProcessor_async", + "title": "DocumentProcessorService createProcessor Sample", + "origin": "API_DEFINITION", + "description": " Creates a processor from the type processor that the user chose. The processor will be at \"ENABLED\" state by default after its creation.", + "canonical": true, + "file": "document_processor_service.create_processor.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.CreateProcessor", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "processor", + "type": ".google.cloud.documentai.v1beta3.Processor" + } + ], + "resultType": ".google.cloud.documentai.v1beta3.Processor", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "CreateProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.CreateProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } }, - "method": { - "shortName": "DeleteProcessor", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.DeleteProcessor", - "service": { - "shortName": "DocumentProcessorService", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" - } - } - } - }, - { - "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_EnableProcessor_async", - "title": "DocumentProcessorService enableProcessor Sample", - "origin": "API_DEFINITION", - "description": " Enables a processor", - "canonical": true, - "file": "document_processor_service.enable_processor.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "EnableProcessor", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.EnableProcessor", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DocumentProcessorServiceClient", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessor_async", + "title": "DocumentProcessorService deleteProcessor Sample", + "origin": "API_DEFINITION", + "description": " Deletes the processor, unloads all deployed model artifacts if it was enabled and then deletes all artifacts associated with this processor.", + "canonical": true, + "file": "document_processor_service.delete_processor.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.DeleteProcessor", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "DeleteProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.DeleteProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } }, - "method": { - "shortName": "EnableProcessor", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.EnableProcessor", - "service": { - "shortName": "DocumentProcessorService", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" - } - } - } - }, - { - "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_DisableProcessor_async", - "title": "DocumentProcessorService disableProcessor Sample", - "origin": "API_DEFINITION", - "description": " Disables a processor", - "canonical": true, - "file": "document_processor_service.disable_processor.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DisableProcessor", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.DisableProcessor", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DocumentProcessorServiceClient", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_EnableProcessor_async", + "title": "DocumentProcessorService enableProcessor Sample", + "origin": "API_DEFINITION", + "description": " Enables a processor", + "canonical": true, + "file": "document_processor_service.enable_processor.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "EnableProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.EnableProcessor", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "EnableProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.EnableProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } }, - "method": { - "shortName": "DisableProcessor", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.DisableProcessor", - "service": { - "shortName": "DocumentProcessorService", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" - } - } - } - }, - { - "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_ReviewDocument_async", - "title": "DocumentProcessorService reviewDocument Sample", - "origin": "API_DEFINITION", - "description": " Send a document for Human Review. The input document should be processed by the specified processor.", - "canonical": true, - "file": "document_processor_service.review_document.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReviewDocument", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ReviewDocument", - "async": true, - "parameters": [ - { - "name": "inline_document", - "type": ".google.cloud.documentai.v1beta3.Document" - }, - { - "name": "human_review_config", - "type": "TYPE_STRING" - }, - { - "name": "document", - "type": ".google.cloud.documentai.v1beta3.Document" - }, - { - "name": "enable_schema_validation", - "type": "TYPE_BOOL" - }, - { - "name": "priority", - "type": ".google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DocumentProcessorServiceClient", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_DisableProcessor_async", + "title": "DocumentProcessorService disableProcessor Sample", + "origin": "API_DEFINITION", + "description": " Disables a processor", + "canonical": true, + "file": "document_processor_service.disable_processor.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DisableProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.DisableProcessor", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "DisableProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.DisableProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } }, - "method": { - "shortName": "ReviewDocument", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ReviewDocument", - "service": { - "shortName": "DocumentProcessorService", - "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" - } + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_ReviewDocument_async", + "title": "DocumentProcessorService reviewDocument Sample", + "origin": "API_DEFINITION", + "description": " Send a document for Human Review. The input document should be processed by the specified processor.", + "canonical": true, + "file": "document_processor_service.review_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReviewDocument", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ReviewDocument", + "async": true, + "parameters": [ + { + "name": "inline_document", + "type": ".google.cloud.documentai.v1beta3.Document" + }, + { + "name": "human_review_config", + "type": "TYPE_STRING" + }, + { + "name": "document", + "type": ".google.cloud.documentai.v1beta3.Document" + }, + { + "name": "enable_schema_validation", + "type": "TYPE_BOOL" + }, + { + "name": "priority", + "type": ".google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ReviewDocument", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ReviewDocument", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } } - } - } - ] -} + ] +} \ No newline at end of file From 5b05857c4e11c5017b2a8cdd90385f8d03c47244 Mon Sep 17 00:00:00 2001 From: Gal Zahavi <38544478+galz10@users.noreply.github.com> Date: Fri, 22 Apr 2022 12:37:14 -0700 Subject: [PATCH 182/213] chore: removed v1beta2 samples (#325) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: removed v1beta2 samples * removed v1beta2 links in readme * 🦉 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 --- packages/google-cloud-documentai/README.md | 6 - .../google-cloud-documentai/samples/README.md | 108 ------------------ 2 files changed, 114 deletions(-) diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index f432a138efc..4601929647c 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -135,12 +135,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-document-ai | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | -| Batch-parse-form.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/batch-parse-form.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-parse-form.v1beta2.js,samples/README.md) | -| Batch-parse-table.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/batch-parse-table.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-parse-table.v1beta2.js,samples/README.md) | | Batch-process-document | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/batch-process-document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-process-document.js,samples/README.md) | -| Parse-form.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/parse-form.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-form.v1beta2.js,samples/README.md) | -| Parse-table.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/parse-table.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-table.v1beta2.js,samples/README.md) | -| Parse-with-model.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/parse-with-model.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-with-model.v1beta2.js,samples/README.md) | | Process-document-form | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-form.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-form.js,samples/README.md) | | Process-document-ocr | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-ocr.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-ocr.js,samples/README.md) | | Process-document-quality | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-quality.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-quality.js,samples/README.md) | @@ -148,7 +143,6 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-document-ai | Process-document-splitter | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-splitter.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-splitter.js,samples/README.md) | | Process-document | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document.js,samples/README.md) | | Quickstart | [source code](https://github.com/googleapis/nodejs-document-ai/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-document-ai&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | -| Set-endpoint.v1beta2 | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/set-endpoint.v1beta2.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/set-endpoint.v1beta2.js,samples/README.md) | diff --git a/packages/google-cloud-documentai/samples/README.md b/packages/google-cloud-documentai/samples/README.md index d8910e35f35..25a1e445fe4 100644 --- a/packages/google-cloud-documentai/samples/README.md +++ b/packages/google-cloud-documentai/samples/README.md @@ -12,12 +12,7 @@ * [Before you begin](#before-you-begin) * [Samples](#samples) - * [Batch-parse-form.v1beta2](#batch-parse-form.v1beta2) - * [Batch-parse-table.v1beta2](#batch-parse-table.v1beta2) * [Batch-process-document](#batch-process-document) - * [Parse-form.v1beta2](#parse-form.v1beta2) - * [Parse-table.v1beta2](#parse-table.v1beta2) - * [Parse-with-model.v1beta2](#parse-with-model.v1beta2) * [Process-document-form](#process-document-form) * [Process-document-ocr](#process-document-ocr) * [Process-document-quality](#process-document-quality) @@ -25,7 +20,6 @@ * [Process-document-splitter](#process-document-splitter) * [Process-document](#process-document) * [Quickstart](#quickstart) - * [Set-endpoint.v1beta2](#set-endpoint.v1beta2) ## Before you begin @@ -42,40 +36,6 @@ Before running the samples, make sure you've followed the steps outlined in -### Batch-parse-form.v1beta2 - -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/batch-parse-form.v1beta2.js). - -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-parse-form.v1beta2.js,samples/README.md) - -__Usage:__ - - -`node samples/batch-parse-form.v1beta2.js` - - ------ - - - - -### Batch-parse-table.v1beta2 - -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/batch-parse-table.v1beta2.js). - -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-parse-table.v1beta2.js,samples/README.md) - -__Usage:__ - - -`node samples/batch-parse-table.v1beta2.js` - - ------ - - - - ### Batch-process-document View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/batch-process-document.js). @@ -93,57 +53,6 @@ __Usage:__ -### Parse-form.v1beta2 - -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/parse-form.v1beta2.js). - -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-form.v1beta2.js,samples/README.md) - -__Usage:__ - - -`node samples/parse-form.v1beta2.js` - - ------ - - - - -### Parse-table.v1beta2 - -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/parse-table.v1beta2.js). - -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-table.v1beta2.js,samples/README.md) - -__Usage:__ - - -`node samples/parse-table.v1beta2.js` - - ------ - - - - -### Parse-with-model.v1beta2 - -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/parse-with-model.v1beta2.js). - -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/parse-with-model.v1beta2.js,samples/README.md) - -__Usage:__ - - -`node samples/parse-with-model.v1beta2.js` - - ------ - - - - ### Process-document-form View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-form.js). @@ -258,23 +167,6 @@ __Usage:__ `node samples/quickstart.js` ------ - - - - -### Set-endpoint.v1beta2 - -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/set-endpoint.v1beta2.js). - -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/set-endpoint.v1beta2.js,samples/README.md) - -__Usage:__ - - -`node samples/set-endpoint.v1beta2.js` - - From ddea961a36c13b8b98a61b26a1c3a2fae03db410 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 27 Apr 2022 12:07:54 -0700 Subject: [PATCH 183/213] fix!: mark Document.Entity.type as REQUIRED in all versions (#326) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix!: mark Document.Entity.type as REQUIRED in all versions fix!: remove Document.Entity.bounding_poly_for_demo_frontend from v1beta2 The type field was always required by the backend, so this formally breaking change can likely be accepted without bumping the major version. Field removal is in beta version so can be accepted as well. PiperOrigin-RevId: 444656928 Source-Link: https://github.com/googleapis/googleapis/commit/a0d4c5c2a714a7317714ba6f0066a74ec8a9c10b Source-Link: https://github.com/googleapis/googleapis-gen/commit/d3a3f6dde18ec3721fceba933e4327a7b6dd2c2d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDNhM2Y2ZGRlMThlYzM3MjFmY2ViYTkzM2U0MzI3YTdiNmRkMmMyZCJ9 * 🦉 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/documentai/v1/document.proto | 4 +-- .../cloud/documentai/v1beta1/document.proto | 5 ++-- .../cloud/documentai/v1beta2/document.proto | 8 ++---- .../cloud/documentai/v1beta3/document.proto | 4 +-- .../protos/protos.d.ts | 6 ----- .../google-cloud-documentai/protos/protos.js | 27 ------------------- .../protos/protos.json | 27 +++++++++++-------- 7 files changed, 25 insertions(+), 56 deletions(-) diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto index aed16a998e3..4512affa5d2 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto @@ -476,8 +476,8 @@ message Document { // [Document.text][google.cloud.documentai.v1.Document.text]. TextAnchor text_anchor = 1 [(google.api.field_behavior) = OPTIONAL]; - // Entity type from a schema e.g. `Address`. - string type = 2; + // Required. Entity type from a schema e.g. `Address`. + string type = 2 [(google.api.field_behavior) = REQUIRED]; // Optional. Text value in the document e.g. `1600 Amphitheatre Pkwy`. If // the entity is not present in the document, this field will be empty. diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document.proto index 2c47f6f2228..0ac64a57f5f 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document.proto @@ -18,6 +18,7 @@ syntax = "proto3"; package google.cloud.documentai.v1beta1; import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; import "google/cloud/documentai/v1beta1/geometry.proto"; import "google/rpc/status.proto"; import "google/type/color.proto"; @@ -351,8 +352,8 @@ message Document { // [Document.text][google.cloud.documentai.v1beta1.Document.text]. TextAnchor text_anchor = 1; - // Entity type from a schema e.g. `Address`. - string type = 2; + // Required. Entity type from a schema e.g. `Address`. + string type = 2 [(google.api.field_behavior) = REQUIRED]; // Text value in the document e.g. `1600 Amphitheatre Pkwy`. string mention_text = 3; diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto index b8af15b5225..846fcd26578 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto @@ -368,8 +368,8 @@ message Document { // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta2.Document.text]. TextAnchor text_anchor = 1; - // Entity type from a schema e.g. `Address`. - string type = 2; + // Required. Entity type from a schema e.g. `Address`. + string type = 2 [(google.api.field_behavior) = REQUIRED]; // Text value in the document e.g. `1600 Amphitheatre Pkwy`. string mention_text = 3; @@ -387,10 +387,6 @@ message Document { // Optional. Canonical id. This will be a unique value in the entity list // for this document. string id = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Temporary field to store the bounding poly for short-term POCs. Used by - // the frontend only. Do not use before you talk to ybo@ and lukasr@. - BoundingPoly bounding_poly_for_demo_frontend = 8 [(google.api.field_behavior) = OPTIONAL]; } // Relationship between [Entities][google.cloud.documentai.v1beta2.Document.Entity]. diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto index 760cd511530..f9bec08b90b 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto @@ -480,8 +480,8 @@ message Document { // [Document.text][google.cloud.documentai.v1beta3.Document.text]. TextAnchor text_anchor = 1 [(google.api.field_behavior) = OPTIONAL]; - // Entity type from a schema e.g. `Address`. - string type = 2; + // Required. Entity type from a schema e.g. `Address`. + string type = 2 [(google.api.field_behavior) = REQUIRED]; // Optional. Text value in the document e.g. `1600 Amphitheatre Pkwy`. If // the entity is not present in the document, this field will be empty. diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 0d6b8928276..52c11c025aa 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -12237,9 +12237,6 @@ export namespace google { /** Entity id */ id?: (string|null); - - /** Entity boundingPolyForDemoFrontend */ - boundingPolyForDemoFrontend?: (google.cloud.documentai.v1beta2.IBoundingPoly|null); } /** Represents an Entity. */ @@ -12272,9 +12269,6 @@ export namespace google { /** Entity id. */ public id: string; - /** Entity boundingPolyForDemoFrontend. */ - public boundingPolyForDemoFrontend?: (google.cloud.documentai.v1beta2.IBoundingPoly|null); - /** * Creates a new Entity instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 7e024ef519b..7f75f503cba 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -31283,7 +31283,6 @@ * @property {number|null} [confidence] Entity confidence * @property {google.cloud.documentai.v1beta2.Document.IPageAnchor|null} [pageAnchor] Entity pageAnchor * @property {string|null} [id] Entity id - * @property {google.cloud.documentai.v1beta2.IBoundingPoly|null} [boundingPolyForDemoFrontend] Entity boundingPolyForDemoFrontend */ /** @@ -31357,14 +31356,6 @@ */ Entity.prototype.id = ""; - /** - * Entity boundingPolyForDemoFrontend. - * @member {google.cloud.documentai.v1beta2.IBoundingPoly|null|undefined} boundingPolyForDemoFrontend - * @memberof google.cloud.documentai.v1beta2.Document.Entity - * @instance - */ - Entity.prototype.boundingPolyForDemoFrontend = null; - /** * Creates a new Entity instance using the specified properties. * @function create @@ -31403,8 +31394,6 @@ $root.google.cloud.documentai.v1beta2.Document.PageAnchor.encode(message.pageAnchor, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); if (message.id != null && Object.hasOwnProperty.call(message, "id")) writer.uint32(/* id 7, wireType 2 =*/58).string(message.id); - if (message.boundingPolyForDemoFrontend != null && Object.hasOwnProperty.call(message, "boundingPolyForDemoFrontend")) - $root.google.cloud.documentai.v1beta2.BoundingPoly.encode(message.boundingPolyForDemoFrontend, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); return writer; }; @@ -31460,9 +31449,6 @@ case 7: message.id = reader.string(); break; - case 8: - message.boundingPolyForDemoFrontend = $root.google.cloud.documentai.v1beta2.BoundingPoly.decode(reader, reader.uint32()); - break; default: reader.skipType(tag & 7); break; @@ -31523,11 +31509,6 @@ if (message.id != null && message.hasOwnProperty("id")) if (!$util.isString(message.id)) return "id: string expected"; - if (message.boundingPolyForDemoFrontend != null && message.hasOwnProperty("boundingPolyForDemoFrontend")) { - var error = $root.google.cloud.documentai.v1beta2.BoundingPoly.verify(message.boundingPolyForDemoFrontend); - if (error) - return "boundingPolyForDemoFrontend." + error; - } return null; }; @@ -31563,11 +31544,6 @@ } if (object.id != null) message.id = String(object.id); - if (object.boundingPolyForDemoFrontend != null) { - if (typeof object.boundingPolyForDemoFrontend !== "object") - throw TypeError(".google.cloud.documentai.v1beta2.Document.Entity.boundingPolyForDemoFrontend: object expected"); - message.boundingPolyForDemoFrontend = $root.google.cloud.documentai.v1beta2.BoundingPoly.fromObject(object.boundingPolyForDemoFrontend); - } return message; }; @@ -31592,7 +31568,6 @@ object.confidence = 0; object.pageAnchor = null; object.id = ""; - object.boundingPolyForDemoFrontend = null; } if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) object.textAnchor = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.toObject(message.textAnchor, options); @@ -31608,8 +31583,6 @@ object.pageAnchor = $root.google.cloud.documentai.v1beta2.Document.PageAnchor.toObject(message.pageAnchor, options); if (message.id != null && message.hasOwnProperty("id")) object.id = message.id; - if (message.boundingPolyForDemoFrontend != null && message.hasOwnProperty("boundingPolyForDemoFrontend")) - object.boundingPolyForDemoFrontend = $root.google.cloud.documentai.v1beta2.BoundingPoly.toObject(message.boundingPolyForDemoFrontend, options); return object; }; diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index d293c9d9a80..7773f8661b9 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -549,7 +549,10 @@ }, "type": { "type": "string", - "id": 2 + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, "mentionText": { "type": "string", @@ -1782,7 +1785,10 @@ }, "type": { "type": "string", - "id": 2 + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, "mentionText": { "type": "string", @@ -2653,7 +2659,10 @@ }, "type": { "type": "string", - "id": 2 + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, "mentionText": { "type": "string", @@ -2683,13 +2692,6 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } - }, - "boundingPolyForDemoFrontend": { - "type": "BoundingPoly", - "id": 8, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } } } }, @@ -3721,7 +3723,10 @@ }, "type": { "type": "string", - "id": 2 + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, "mentionText": { "type": "string", From 32cdb8b82b7b03d214386bf4e17e1cf1b9b69a3f Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 3 May 2022 02:24:21 +0200 Subject: [PATCH 184/213] chore(deps): update dependency @types/mocha to v9 (#328) 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.0` -> `^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-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 94429523898..253d5c1344a 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -30,7 +30,7 @@ "google-gax": "^2.24.1" }, "devDependencies": { - "@types/mocha": "^8.0.0", + "@types/mocha": "^9.0.0", "@types/node": "^16.0.0", "@types/sinon": "^10.0.0", "c8": "^7.1.0", From 52cb0d8cdaf706b624abc262fb2782a982c70dd8 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 9 May 2022 17:34:13 +0200 Subject: [PATCH 185/213] chore(deps): update dependency sinon to v14 (#331) 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-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 253d5c1344a..cc7a67d4803 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -43,7 +43,7 @@ "mocha": "^8.0.0", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", + "sinon": "^14.0.0", "ts-loader": "^9.0.0", "typescript": "^3.8.3", "webpack": "^5.0.0", From fc7533157504f94f801822b8fc862d20bea52197 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Mon, 16 May 2022 17:35:44 -0700 Subject: [PATCH 186/213] build!: update library to use Node 12 (#333) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat!: Update library to use Node 12 * 🦉 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 --- packages/google-cloud-documentai/package.json | 10 +++++----- packages/google-cloud-documentai/samples/package.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index cc7a67d4803..a9d1af45130 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -27,7 +27,7 @@ "precompile": "gts clean" }, "dependencies": { - "google-gax": "^2.24.1" + "google-gax": "^3.0.1" }, "devDependencies": { "@types/mocha": "^9.0.0", @@ -35,21 +35,21 @@ "@types/sinon": "^10.0.0", "c8": "^7.1.0", "chai": "^4.2.0", - "gts": "^3.0.0", + "gts": "^3.1.0", "jsdoc": "^3.6.3", "jsdoc-fresh": "^1.0.2", "jsdoc-region-tag": "^1.0.4", "linkinator": "^2.0.3", - "mocha": "^8.0.0", + "mocha": "^9.2.2", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", "sinon": "^14.0.0", "ts-loader": "^9.0.0", - "typescript": "^3.8.3", + "typescript": "^4.6.4", "webpack": "^5.0.0", "webpack-cli": "^4.0.0" }, "engines": { - "node": ">=10" + "node": ">=12.0.0" } } diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 7ccfa2d1d60..5898c2cff83 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -4,7 +4,7 @@ "license": "Apache-2.0", "author": "Google LLC", "engines": { - "node": ">= 10.17.0" + "node": ">=12.0.0" }, "files": [ "*.js" From 2adceec9fa32bd8d0ce17ec5c0306a216f392c0b Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 10 Jun 2022 16:58:32 +0200 Subject: [PATCH 187/213] chore(deps): update dependency jsdoc-fresh to v2 (#337) 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-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index a9d1af45130..c957f1e5b8f 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -37,7 +37,7 @@ "chai": "^4.2.0", "gts": "^3.1.0", "jsdoc": "^3.6.3", - "jsdoc-fresh": "^1.0.2", + "jsdoc-fresh": "^2.0.0", "jsdoc-region-tag": "^1.0.4", "linkinator": "^2.0.3", "mocha": "^9.2.2", From 11f393304568510b274fe87cb930700a1b4480ef Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 10 Jun 2022 17:22:52 +0200 Subject: [PATCH 188/213] chore(deps): update dependency jsdoc-region-tag to v2 (#338) 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.4` -> `^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-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index c957f1e5b8f..b3ae773ad89 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -38,7 +38,7 @@ "gts": "^3.1.0", "jsdoc": "^3.6.3", "jsdoc-fresh": "^2.0.0", - "jsdoc-region-tag": "^1.0.4", + "jsdoc-region-tag": "^2.0.0", "linkinator": "^2.0.3", "mocha": "^9.2.2", "null-loader": "^4.0.0", From 4e6bd6cb10c153def95554b0b1d4dd747daa148d Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 20 Jun 2022 21:16:56 +0200 Subject: [PATCH 189/213] fix(deps): update dependency @google-cloud/storage to v6 (#335) --- packages/google-cloud-documentai/samples/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 5898c2cff83..9774903c7c6 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -14,7 +14,7 @@ }, "dependencies": { "@google-cloud/documentai": "^3.3.0", - "@google-cloud/storage": "^5.0.0", + "@google-cloud/storage": "^6.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" }, From 98bc4578a8d604da16ef4f4a5a3a517565e61274 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 20 Jun 2022 15:33:48 -0400 Subject: [PATCH 190/213] chore(main): release 4.0.0 (#334) 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-documentai/CHANGELOG.md | 23 +++++++++++++++++++ packages/google-cloud-documentai/package.json | 2 +- ...t_metadata.google.cloud.documentai.v1.json | 2 +- ...adata.google.cloud.documentai.v1beta1.json | 2 +- ...adata.google.cloud.documentai.v1beta2.json | 2 +- ...adata.google.cloud.documentai.v1beta3.json | 2 +- .../samples/package.json | 2 +- 7 files changed, 29 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index 5b75d045093..c628353d300 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog +## [4.0.0](https://github.com/googleapis/nodejs-document-ai/compare/v3.3.0...v4.0.0) (2022-06-20) + + +### ⚠ BREAKING CHANGES + +* update library to use Node 12 (#333) +* mark Document.Entity.type as REQUIRED in all versions (#326) + +### Features + +* add `content` field in TextAnchor ([#315](https://github.com/googleapis/nodejs-document-ai/issues/315)) ([1fa9195](https://github.com/googleapis/nodejs-document-ai/commit/1fa9195d555bef2fc2c45668338200d95fec47cb)) + + +### Bug Fixes + +* **deps:** update dependency @google-cloud/storage to v6 ([#335](https://github.com/googleapis/nodejs-document-ai/issues/335)) ([0259e67](https://github.com/googleapis/nodejs-document-ai/commit/0259e67e411622dbe4acf2ece931b09adf7aaafd)) +* mark Document.Entity.type as REQUIRED in all versions ([#326](https://github.com/googleapis/nodejs-document-ai/issues/326)) ([8ef4cca](https://github.com/googleapis/nodejs-document-ai/commit/8ef4cca05d7095ed51befbb791991209b0d1a3f8)) + + +### Build System + +* update library to use Node 12 ([#333](https://github.com/googleapis/nodejs-document-ai/issues/333)) ([f51470c](https://github.com/googleapis/nodejs-document-ai/commit/f51470cff119edca6d5ad38ba89652fec80cb429)) + ## [3.3.0](https://github.com/googleapis/nodejs-document-ai/compare/v3.2.1...v3.3.0) (2022-02-22) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index b3ae773ad89..143aa304e23 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "3.3.0", + "version": "4.0.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json index 79b7584d87e..8f094b9b56f 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json +++ b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-documentai", - "version": "3.3.0", + "version": "4.0.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json b/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json index 74b43f46584..508f795ed85 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-documentai", - "version": "3.3.0", + "version": "4.0.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json b/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json index d35bfc1233b..ed0447c1111 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-documentai", - "version": "3.3.0", + "version": "4.0.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json index d7b945733cf..38e3dd1d689 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-documentai", - "version": "3.3.0", + "version": "4.0.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 9774903c7c6..44ccecfaa59 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^3.3.0", + "@google-cloud/documentai": "^4.0.0", "@google-cloud/storage": "^6.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" From 2cfb444270232d0928374f592ebbf75ed73d02aa Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Jul 2022 02:06:49 -0700 Subject: [PATCH 191/213] feat: support regapic LRO (#339) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: support regapic LRO Use gapic-generator-typescript v2.15.1. PiperOrigin-RevId: 456946341 Source-Link: https://github.com/googleapis/googleapis/commit/88fd18d9d3b872b3d06a3d9392879f50b5bf3ce5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/accfa371f667439313335c64042b063c1c53102e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWNjZmEzNzFmNjY3NDM5MzEzMzM1YzY0MDQyYjA2M2MxYzUzMTAyZSJ9 * 🦉 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 --- .../v1/document_processor_service_client.ts | 66 +++++++++++++++---- .../document_understanding_service_client.ts | 27 ++++---- .../document_understanding_service_client.ts | 27 ++++---- .../document_processor_service_client.ts | 27 ++++---- 4 files changed, 99 insertions(+), 48 deletions(-) diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts index 038d6c11d62..d5b6c3542c2 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, } from 'google-gax'; @@ -71,7 +72,7 @@ export class DocumentProcessorServiceClient { * * @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 DocumentProcessorServiceClient { * 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. @@ -170,16 +170,58 @@ export class DocumentProcessorServiceClient { }; 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.cloud.location.Locations.GetLocation', + get: '/v1/{name=projects/*/locations/*}', + additional_bindings: [ + {get: '/uiv1beta3/{name=projects/*/locations/*}'}, + ], + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + additional_bindings: [ + {get: '/uiv1beta3/{name=projects/*}/locations'}, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', + additional_bindings: [ + { + post: '/uiv1beta3/{name=projects/*/locations/*/operations/*}:cancel', + }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/operations/*}', + additional_bindings: [ + {get: '/v1/{name=projects/*/locations/*/operations/*}'}, + {get: '/uiv1beta3/{name=projects/*/locations/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*/operations}', + additional_bindings: [ + {get: '/uiv1beta3/{name=projects/*/locations/*/operations}'}, + ], + }, + ]; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const batchProcessDocumentsResponse = protoFilesRoot.lookup( '.google.cloud.documentai.v1.BatchProcessResponse' diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts index 238a9b91361..85e83bdb9d6 100644 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, } from 'google-gax'; @@ -69,7 +70,7 @@ export class DocumentUnderstandingServiceClient { * * @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] @@ -92,11 +93,10 @@ export class DocumentUnderstandingServiceClient { * 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. @@ -156,16 +156,19 @@ export class DocumentUnderstandingServiceClient { this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); 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 = []; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const batchProcessDocumentsResponse = protoFilesRoot.lookup( '.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse' diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index 24c3cd2fa1f..fd7b71fecc5 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, } from 'google-gax'; @@ -69,7 +70,7 @@ export class DocumentUnderstandingServiceClient { * * @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] @@ -92,11 +93,10 @@ export class DocumentUnderstandingServiceClient { * 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. @@ -156,16 +156,19 @@ export class DocumentUnderstandingServiceClient { this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); 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 = []; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const batchProcessDocumentsResponse = protoFilesRoot.lookup( '.google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse' diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index 0d5704520e9..5fa75e4be12 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, PaginationCallback, GaxCall, @@ -75,7 +76,7 @@ export class DocumentProcessorServiceClient { * * @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] @@ -98,11 +99,10 @@ export class DocumentProcessorServiceClient { * 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. @@ -194,16 +194,19 @@ export class DocumentProcessorServiceClient { }; 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 = []; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const batchProcessDocumentsResponse = protoFilesRoot.lookup( '.google.cloud.documentai.v1beta3.BatchProcessResponse' From 6d483e399172e49bfe033ef47ae47db353f26263 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 6 Jul 2022 15:42:11 -0700 Subject: [PATCH 192/213] chore(main): release 4.1.0 (#340) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 4.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-documentai/CHANGELOG.md | 7 +++++++ packages/google-cloud-documentai/package.json | 2 +- .../v1/snippet_metadata.google.cloud.documentai.v1.json | 2 +- .../snippet_metadata.google.cloud.documentai.v1beta1.json | 2 +- .../snippet_metadata.google.cloud.documentai.v1beta2.json | 2 +- .../snippet_metadata.google.cloud.documentai.v1beta3.json | 2 +- packages/google-cloud-documentai/samples/package.json | 2 +- 7 files changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index c628353d300..04c9a978dab 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [4.1.0](https://github.com/googleapis/nodejs-document-ai/compare/v4.0.0...v4.1.0) (2022-07-01) + + +### Features + +* support regapic LRO ([#339](https://github.com/googleapis/nodejs-document-ai/issues/339)) ([2be6744](https://github.com/googleapis/nodejs-document-ai/commit/2be67448def326a68a4f81557c536a8a4eed6aad)) + ## [4.0.0](https://github.com/googleapis/nodejs-document-ai/compare/v3.3.0...v4.0.0) (2022-06-20) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 143aa304e23..010758224ef 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "4.0.0", + "version": "4.1.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json index 8f094b9b56f..aae86640725 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json +++ b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-documentai", - "version": "4.0.0", + "version": "4.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json b/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json index 508f795ed85..a999e3fff3a 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-documentai", - "version": "4.0.0", + "version": "4.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json b/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json index ed0447c1111..49186ec5287 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-documentai", - "version": "4.0.0", + "version": "4.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json index 38e3dd1d689..60a583dc17d 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-documentai", - "version": "4.0.0", + "version": "4.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 44ccecfaa59..19f58f5b3f3 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^4.0.0", + "@google-cloud/documentai": "^4.1.0", "@google-cloud/storage": "^6.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" From bf463d1511b4ac740bd81f13c8df821605276587 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 8 Jul 2022 22:58:28 +0200 Subject: [PATCH 193/213] chore(deps): update dependency linkinator to v4 (#342) 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.0.3` -> `^4.0.0`](https://renovatebot.com/diffs/npm/linkinator/2.16.2/4.0.0) | [![age](https://badges.renovateapi.com/packages/npm/linkinator/4.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/linkinator/4.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/linkinator/4.0.0/compatibility-slim/2.16.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/linkinator/4.0.0/confidence-slim/2.16.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
JustinBeckwith/linkinator ### [`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-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 010758224ef..0117c3e3846 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -39,7 +39,7 @@ "jsdoc": "^3.6.3", "jsdoc-fresh": "^2.0.0", "jsdoc-region-tag": "^2.0.0", - "linkinator": "^2.0.3", + "linkinator": "^4.0.0", "mocha": "^9.2.2", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", From 40b0df9f0775286588a3b51db7cbc2929cbb4861 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 12 Aug 2022 16:01:36 -0700 Subject: [PATCH 194/213] docs: fix minor docstring formatting (#343) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Added field_mask to ProcessRequest object in document_processor_service.proto feat: Added parent_ids to Revision object in document.proto feat: Added integer_values, float_values and non_present to Entity object in document.proto feat: Added corrected_key_text, correct_value_text to FormField object in document.proto feat: Added OperationMetadata resource feat!: Added Processor Management and Processor Version support to v1 library BREAKING CHANGE: Changed the name field for ProcessRequest and BatchProcessorRequest to accept * so the name field can accept Processor and ProcessorVersion. PiperOrigin-RevId: 466168406 Source-Link: https://github.com/googleapis/googleapis/commit/19bf693ab9e33f85e0b6b290fe486016fbc7b966 Source-Link: https://github.com/googleapis/googleapis-gen/commit/90986a3608bdc0a150e88650cffbfd44ae66d59b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTA5ODZhMzYwOGJkYzBhMTUwZTg4NjUwY2ZmYmZkNDRhZTY2ZDU5YiJ9 * 🦉 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 * docs: fix minor docstring formatting PiperOrigin-RevId: 466493520 Source-Link: https://github.com/googleapis/googleapis/commit/c2674a3456a83c24023ff7246851b2e672b9efbd Source-Link: https://github.com/googleapis/googleapis-gen/commit/30077cfdd7aa06b94264ed733e7f68722f65b870 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzAwNzdjZmRkN2FhMDZiOTQyNjRlZDczM2U3ZjY4NzIyZjY1Yjg3MCJ9 * 🦉 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/documentai/v1/barcode.proto | 67 + .../google/cloud/documentai/v1/document.proto | 250 +- .../cloud/documentai/v1/document_io.proto | 2 +- .../v1/document_processor_service.proto | 534 +- .../cloud/documentai/v1/document_schema.proto | 140 + .../google/cloud/documentai/v1/geometry.proto | 2 +- .../documentai/v1/operation_metadata.proto | 5 +- .../cloud/documentai/v1/processor.proto | 185 + .../cloud/documentai/v1/processor_type.proto | 63 + .../protos/protos.d.ts | 5660 +++++++- .../google-cloud-documentai/protos/protos.js | 11070 +++++++++++++++- .../protos/protos.json | 1398 +- ...ocessor_service.batch_process_documents.js | 6 +- ...ment_processor_service.create_processor.js | 65 + ...ment_processor_service.delete_processor.js | 59 + ...cessor_service.delete_processor_version.js | 59 + ...cessor_service.deploy_processor_version.js | 59 + ...ent_processor_service.disable_processor.js | 59 + ...ment_processor_service.enable_processor.js | 59 + ...processor_service.fetch_processor_types.js | 60 + ...ocument_processor_service.get_processor.js | 58 + ...processor_service.get_processor_version.js | 58 + ..._processor_service.list_processor_types.js | 72 + ...ocessor_service.list_processor_versions.js | 72 + ...ument_processor_service.list_processors.js | 72 + ...ment_processor_service.process_document.js | 11 +- ...ument_processor_service.review_document.js | 4 + ...r_service.set_default_processor_version.js | 66 + ...ssor_service.undeploy_processor_version.js | 59 + ...t_metadata.google.cloud.documentai.v1.json | 606 +- .../v1/document_processor_service_client.ts | 2891 +++- ...ument_processor_service_client_config.json | 56 + ...document_processor_service_proto_list.json | 6 +- .../src/v1/gapic_metadata.json | 152 + .../gapic_document_processor_service_v1.ts | 3988 +++++- 35 files changed, 26232 insertions(+), 1741 deletions(-) create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1/barcode.proto create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_schema.proto create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor.proto create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor_type.proto create mode 100644 packages/google-cloud-documentai/samples/generated/v1/document_processor_service.create_processor.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor_version.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1/document_processor_service.deploy_processor_version.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1/document_processor_service.disable_processor.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1/document_processor_service.enable_processor.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1/document_processor_service.fetch_processor_types.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor_version.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_types.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_versions.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processors.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1/document_processor_service.set_default_processor_version.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1/document_processor_service.undeploy_processor_version.js diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/barcode.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/barcode.proto new file mode 100644 index 00000000000..28e588d6c6e --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/barcode.proto @@ -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 +// +// 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.documentai.v1; + +option csharp_namespace = "Google.Cloud.DocumentAI.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai"; +option java_multiple_files = true; +option java_outer_classname = "BarcodeProto"; +option java_package = "com.google.cloud.documentai.v1"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1"; +option ruby_package = "Google::Cloud::DocumentAI::V1"; + +// Encodes the detailed information of a barcode. +message Barcode { + // Format of a barcode. + // The supported formats are: + // CODE_128: Code 128 type. + // CODE_39: Code 39 type. + // CODE_93: Code 93 type. + // CODABAR: Codabar type. + // DATA_MATRIX: 2D Data Matrix type. + // ITF: ITF type. + // EAN_13: EAN-13 type. + // EAN_8: EAN-8 type. + // QR_CODE: 2D QR code type. + // UPC_A: UPC-A type. + // UPC_E: UPC-E type. + // PDF417: PDF417 type. + // AZTEC: 2D Aztec code type. + // DATABAR: GS1 DataBar code type. + string format = 1; + + // Value format describes the format of the value that a barcode + // encodes. + // The supported formats are: + // CONTACT_INFO: Contact information. + // EMAIL: Email address. + // ISBN: ISBN identifier. + // PHONE: Phone number. + // PRODUCT: Product. + // SMS: SMS message. + // TEXT: Text string. + // URL: URL address. + // WIFI: Wifi information. + // GEO: Geo-localization. + // CALENDAR_EVENT: Calendar event. + // DRIVER_LICENSE: Driver's license. + string value_format = 2; + + // Raw value encoded in the barcode. + // For example, 'MEBKM:TITLE:Google;URL:https://www.google.com;;'. + string raw_value = 3; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto index 4512affa5d2..d8bbf6b574d 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto @@ -17,6 +17,7 @@ syntax = "proto3"; package google.cloud.documentai.v1; import "google/api/field_behavior.proto"; +import "google/cloud/documentai/v1/barcode.proto"; import "google/cloud/documentai/v1/geometry.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/status.proto"; @@ -34,11 +35,10 @@ option java_package = "com.google.cloud.documentai.v1"; option php_namespace = "Google\\Cloud\\DocumentAI\\V1"; option ruby_package = "Google::Cloud::DocumentAI::V1"; -// Document represents the canonical document resource in Document Understanding -// AI. -// It is an interchange format that provides insights into documents and allows -// for collaboration between users and Document Understanding AI to iterate and -// optimize for quality. +// Document represents the canonical document resource in Document AI. It is an +// interchange format that provides insights into documents and allows for +// collaboration between users and Document AI to iterate and optimize for +// quality. message Document { // For a large document, sharding may be performed to produce several // document shards. Each document shard contains this field to detail which @@ -50,8 +50,7 @@ message Document { // Total number of shards. int64 shard_count = 2; - // The index of the first character in - // [Document.text][google.cloud.documentai.v1.Document.text] in the overall + // The index of the first character in [Document.text][google.cloud.documentai.v1.Document.text] in the overall // document global text. int64 text_offset = 3; } @@ -68,8 +67,7 @@ message Document { string unit = 2; } - // Text anchor indexing into the - // [Document.text][google.cloud.documentai.v1.Document.text]. + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1.Document.text]. TextAnchor text_anchor = 1; // Text color. @@ -166,31 +164,25 @@ message Document { PAGE_LEFT = 4; } - // Text anchor indexing into the - // [Document.text][google.cloud.documentai.v1.Document.text]. + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1.Document.text]. TextAnchor text_anchor = 1; - // Confidence of the current - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] within - // context of the object this layout is for. e.g. confidence can be for a - // single token, a table, a visual element, etc. depending on context. - // Range [0, 1]. + // Confidence of the current [Layout][google.cloud.documentai.v1.Document.Page.Layout] within context of the object this + // layout is for. e.g. confidence can be for a single token, a table, + // a visual element, etc. depending on context. Range [0, 1]. float confidence = 2; - // The bounding polygon for the - // [Layout][google.cloud.documentai.v1.Document.Page.Layout]. + // The bounding polygon for the [Layout][google.cloud.documentai.v1.Document.Page.Layout]. BoundingPoly bounding_poly = 3; - // Detected orientation for the - // [Layout][google.cloud.documentai.v1.Document.Page.Layout]. + // Detected orientation for the [Layout][google.cloud.documentai.v1.Document.Page.Layout]. Orientation orientation = 4; } // A block has a set of lines (collected into paragraphs) that have a // common line-spacing and orientation. message Block { - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for - // [Block][google.cloud.documentai.v1.Document.Page.Block]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Block][google.cloud.documentai.v1.Document.Page.Block]. Layout layout = 1; // A list of detected languages together with confidence. @@ -202,8 +194,7 @@ message Document { // A collection of lines that a human would perceive as a paragraph. message Paragraph { - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for - // [Paragraph][google.cloud.documentai.v1.Document.Page.Paragraph]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Paragraph][google.cloud.documentai.v1.Document.Page.Paragraph]. Layout layout = 1; // A list of detected languages together with confidence. @@ -216,8 +207,7 @@ message Document { // A collection of tokens that a human would perceive as a line. // Does not cross column boundaries, can be horizontal, vertical, etc. message Line { - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for - // [Line][google.cloud.documentai.v1.Document.Page.Line]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Line][google.cloud.documentai.v1.Document.Page.Line]. Layout layout = 1; // A list of detected languages together with confidence. @@ -229,8 +219,7 @@ message Document { // A detected token. message Token { - // Detected break at the end of a - // [Token][google.cloud.documentai.v1.Document.Page.Token]. + // Detected break at the end of a [Token][google.cloud.documentai.v1.Document.Page.Token]. message DetectedBreak { // Enum to denote the type of break found. enum Type { @@ -251,12 +240,10 @@ message Document { Type type = 1; } - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for - // [Token][google.cloud.documentai.v1.Document.Page.Token]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Token][google.cloud.documentai.v1.Document.Page.Token]. Layout layout = 1; - // Detected break at the end of a - // [Token][google.cloud.documentai.v1.Document.Page.Token]. + // Detected break at the end of a [Token][google.cloud.documentai.v1.Document.Page.Token]. DetectedBreak detected_break = 2; // A list of detected languages together with confidence. @@ -268,8 +255,7 @@ message Document { // A detected symbol. message Symbol { - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for - // [Symbol][google.cloud.documentai.v1.Document.Page.Symbol]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Symbol][google.cloud.documentai.v1.Document.Page.Symbol]. Layout layout = 1; // A list of detected languages together with confidence. @@ -279,12 +265,10 @@ message Document { // Detected non-text visual elements e.g. checkbox, signature etc. on the // page. message VisualElement { - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for - // [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. Layout layout = 1; - // Type of the - // [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. + // Type of the [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. string type = 2; // A list of detected languages together with confidence. @@ -301,8 +285,7 @@ message Document { // A cell representation inside the table. message TableCell { - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for - // [TableCell][google.cloud.documentai.v1.Document.Page.Table.TableCell]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [TableCell][google.cloud.documentai.v1.Document.Page.Table.TableCell]. Layout layout = 1; // How many rows this cell spans. @@ -315,8 +298,7 @@ message Document { repeated DetectedLanguage detected_languages = 4; } - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for - // [Table][google.cloud.documentai.v1.Document.Page.Table]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Table][google.cloud.documentai.v1.Document.Page.Table]. Layout layout = 1; // Header rows of the table. @@ -331,13 +313,11 @@ message Document { // A form field detected on the page. message FormField { - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the - // [FormField][google.cloud.documentai.v1.Document.Page.FormField] name. - // e.g. `Address`, `Email`, `Grand total`, `Phone number`, etc. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the [FormField][google.cloud.documentai.v1.Document.Page.FormField] name. e.g. `Address`, `Email`, + // `Grand total`, `Phone number`, etc. Layout field_name = 1; - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the - // [FormField][google.cloud.documentai.v1.Document.Page.FormField] value. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the [FormField][google.cloud.documentai.v1.Document.Page.FormField] value. Layout field_value = 2; // A list of detected languages for name together with confidence. @@ -353,10 +333,29 @@ message Document { // - "filled_checkbox" string value_type = 5; + // Created for Labeling UI to export key text. + // If corrections were made to the text identified by the + // `field_name.text_anchor`, this field will contain the correction. + string corrected_key_text = 6; + + // Created for Labeling UI to export value text. + // If corrections were made to the text identified by the + // `field_value.text_anchor`, this field will contain the correction. + string corrected_value_text = 7; + // The history of this annotation. Provenance provenance = 8; } + // A detected barcode. + message DetectedBarcode { + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode]. + Layout layout = 1; + + // Detailed barcode information of the [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode]. + Barcode barcode = 2; + } + // Detected language for a structural component. message DetectedLanguage { // The BCP-47 language code, such as "en-US" or "sr-Latn". For more @@ -368,11 +367,9 @@ message Document { float confidence = 2; } - // 1-based index for current - // [Page][google.cloud.documentai.v1.Document.Page] in a parent - // [Document][google.cloud.documentai.v1.Document]. Useful when a page is - // taken out of a [Document][google.cloud.documentai.v1.Document] for - // individual processing. + // 1-based index for current [Page][google.cloud.documentai.v1.Document.Page] in a parent [Document][google.cloud.documentai.v1.Document]. + // Useful when a page is taken out of a [Document][google.cloud.documentai.v1.Document] for individual + // processing. int32 page_number = 1; // Rendered image for this page. This image is preprocessed to remove any @@ -422,6 +419,9 @@ message Document { // A list of visually detected symbols on the page. repeated Symbol symbols = 12; + // A list of detected barcodes. + repeated DetectedBarcode detected_barcodes = 15; + // The history of this page. Provenance provenance = 16; } @@ -456,6 +456,12 @@ message Document { // Boolean value. Can be used for entities with binary values, or for // checkboxes. bool boolean_value = 6; + + // Integer value. + int32 integer_value = 7; + + // Float value. + float float_value = 8; } // Optional. An optional field to store a normalized string. @@ -472,15 +478,14 @@ message Document { } // Optional. Provenance of the entity. - // Text anchor indexing into the - // [Document.text][google.cloud.documentai.v1.Document.text]. + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1.Document.text]. TextAnchor text_anchor = 1 [(google.api.field_behavior) = OPTIONAL]; // Required. Entity type from a schema e.g. `Address`. string type = 2 [(google.api.field_behavior) = REQUIRED]; - // Optional. Text value in the document e.g. `1600 Amphitheatre Pkwy`. If - // the entity is not present in the document, this field will be empty. + // Optional. Text value in the document e.g. `1600 Amphitheatre Pkwy`. If the entity + // is not present in the document, this field will be empty. string mention_text = 3 [(google.api.field_behavior) = OPTIONAL]; // Optional. Deprecated. Use `id` field instead. @@ -489,35 +494,32 @@ message Document { // Optional. Confidence of detected Schema entity. Range [0, 1]. float confidence = 5 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Represents the provenance of this entity wrt. the location on - // the page where it was found. + // Optional. Represents the provenance of this entity wrt. the location on the + // page where it was found. PageAnchor page_anchor = 6 [(google.api.field_behavior) = OPTIONAL]; // Optional. Canonical id. This will be a unique value in the entity list // for this document. string id = 7 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Normalized entity value. Absent if the extracted value could - // not be converted or the type (e.g. address) is not supported for certain + // Optional. Normalized entity value. Absent if the extracted value could not be + // converted or the type (e.g. address) is not supported for certain // parsers. This field is also only populated for certain supported document // types. - NormalizedValue normalized_value = 9 - [(google.api.field_behavior) = OPTIONAL]; + NormalizedValue normalized_value = 9 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Entities can be nested to form a hierarchical data structure - // representing the content in the document. + // Optional. Entities can be nested to form a hierarchical data structure representing + // the content in the document. repeated Entity properties = 10 [(google.api.field_behavior) = OPTIONAL]; // Optional. The history of this annotation. Provenance provenance = 11 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Whether the entity will be redacted for de-identification - // purposes. + // Optional. Whether the entity will be redacted for de-identification purposes. bool redacted = 12 [(google.api.field_behavior) = OPTIONAL]; } - // Relationship between - // [Entities][google.cloud.documentai.v1.Document.Entity]. + // Relationship between [Entities][google.cloud.documentai.v1.Document.Entity]. message EntityRelation { // Subject entity id. string subject_id = 1; @@ -529,28 +531,21 @@ message Document { string relation = 3; } - // Text reference indexing into the - // [Document.text][google.cloud.documentai.v1.Document.text]. + // Text reference indexing into the [Document.text][google.cloud.documentai.v1.Document.text]. message TextAnchor { - // A text segment in the - // [Document.text][google.cloud.documentai.v1.Document.text]. The indices - // may be out of bounds which indicate that the text extends into another - // document shard for large sharded documents. See - // [ShardInfo.text_offset][google.cloud.documentai.v1.Document.ShardInfo.text_offset] + // A text segment in the [Document.text][google.cloud.documentai.v1.Document.text]. The indices may be out of bounds + // which indicate that the text extends into another document shard for + // large sharded documents. See [ShardInfo.text_offset][google.cloud.documentai.v1.Document.ShardInfo.text_offset] message TextSegment { - // [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] - // start UTF-8 char index in the - // [Document.text][google.cloud.documentai.v1.Document.text]. + // [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] start UTF-8 char index in the [Document.text][google.cloud.documentai.v1.Document.text]. int64 start_index = 1; - // [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] - // half open end UTF-8 char index in the + // [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] half open end UTF-8 char index in the // [Document.text][google.cloud.documentai.v1.Document.text]. int64 end_index = 2; } - // The text segments from the - // [Document.text][google.cloud.documentai.v1.Document.text]. + // The text segments from the [Document.text][google.cloud.documentai.v1.Document.text]. repeated TextSegment text_segments = 1; // Contains the content of the text span so that users do @@ -559,10 +554,9 @@ message Document { string content = 2; } - // Referencing the visual context of the entity in the - // [Document.pages][google.cloud.documentai.v1.Document.pages]. Page anchors - // can be cross-page, consist of multiple bounding polygons and optionally - // reference specific layout element types. + // Referencing the visual context of the entity in the [Document.pages][google.cloud.documentai.v1.Document.pages]. + // Page anchors can be cross-page, consist of multiple bounding polygons and + // optionally reference specific layout element types. message PageAnchor { // Represents a weak reference to a page element within a document. message PageRef { @@ -571,65 +565,47 @@ message Document { // Layout Unspecified. LAYOUT_TYPE_UNSPECIFIED = 0; - // References a - // [Page.blocks][google.cloud.documentai.v1.Document.Page.blocks] - // element. + // References a [Page.blocks][google.cloud.documentai.v1.Document.Page.blocks] element. BLOCK = 1; - // References a - // [Page.paragraphs][google.cloud.documentai.v1.Document.Page.paragraphs] - // element. + // References a [Page.paragraphs][google.cloud.documentai.v1.Document.Page.paragraphs] element. PARAGRAPH = 2; - // References a - // [Page.lines][google.cloud.documentai.v1.Document.Page.lines] element. + // References a [Page.lines][google.cloud.documentai.v1.Document.Page.lines] element. LINE = 3; - // References a - // [Page.tokens][google.cloud.documentai.v1.Document.Page.tokens] - // element. + // References a [Page.tokens][google.cloud.documentai.v1.Document.Page.tokens] element. TOKEN = 4; - // References a - // [Page.visual_elements][google.cloud.documentai.v1.Document.Page.visual_elements] - // element. + // References a [Page.visual_elements][google.cloud.documentai.v1.Document.Page.visual_elements] element. VISUAL_ELEMENT = 5; - // Refrrences a - // [Page.tables][google.cloud.documentai.v1.Document.Page.tables] - // element. + // Refrrences a [Page.tables][google.cloud.documentai.v1.Document.Page.tables] element. TABLE = 6; - // References a - // [Page.form_fields][google.cloud.documentai.v1.Document.Page.form_fields] - // element. + // References a [Page.form_fields][google.cloud.documentai.v1.Document.Page.form_fields] element. FORM_FIELD = 7; } - // Required. Index into the - // [Document.pages][google.cloud.documentai.v1.Document.pages] element, - // for example using [Document.pages][page_refs.page] to locate the - // related page element. This field is skipped when its value is the - // default 0. See + // Required. Index into the [Document.pages][google.cloud.documentai.v1.Document.pages] element, for example using + // [Document.pages][page_refs.page] to locate the related page element. + // This field is skipped when its value is the default 0. See // https://developers.google.com/protocol-buffers/docs/proto3#json. int64 page = 1 [(google.api.field_behavior) = REQUIRED]; - // Optional. The type of the layout element that is being referenced if - // any. + // Optional. The type of the layout element that is being referenced if any. LayoutType layout_type = 2 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Deprecated. Use - // [PageRef.bounding_poly][google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly] - // instead. - string layout_id = 3 - [deprecated = true, (google.api.field_behavior) = OPTIONAL]; + // Optional. Deprecated. Use [PageRef.bounding_poly][google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly] instead. + string layout_id = 3 [ + deprecated = true, + (google.api.field_behavior) = OPTIONAL + ]; - // Optional. Identifies the bounding polygon of a layout element on the - // page. + // Optional. Identifies the bounding polygon of a layout element on the page. BoundingPoly bounding_poly = 4 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Confidence of detected page element, if applicable. Range [0, - // 1]. + // Optional. Confidence of detected page element, if applicable. Range [0, 1]. float confidence = 5 [(google.api.field_behavior) = OPTIONAL]; } @@ -723,7 +699,12 @@ message Document { // The revisions that this revision is based on. This can include one or // more parent (when documents are merged.) This field represents the // index into the `revisions` field. - repeated int32 parent = 2; + repeated int32 parent = 2 [deprecated = true]; + + // The revisions that this revision is based on. Must include all the ids + // that have anything to do with this revision - eg. there are + // `provenance.parent.revision` fields that index into this field. + repeated string parent_ids = 7; // The time that the revision was created. google.protobuf.Timestamp create_time = 3; @@ -735,9 +716,8 @@ message Document { // This message is used for text changes aka. OCR corrections. message TextChange { // Provenance of the correction. - // Text anchor indexing into the - // [Document.text][google.cloud.documentai.v1.Document.text]. There can - // only be a single `TextAnchor.text_segments` element. If the start and + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1.Document.text]. There can only be a + // single `TextAnchor.text_segments` element. If the start and // end index of the text segment are the same, the text change is inserted // before that index. TextAnchor text_anchor = 1; @@ -772,24 +752,22 @@ message Document { // Optional. UTF-8 encoded text in reading order from the document. string text = 4 [(google.api.field_behavior) = OPTIONAL]; - // Styles for the [Document.text][google.cloud.documentai.v1.Document.text]. + // Placeholder. Styles for the [Document.text][google.cloud.documentai.v1.Document.text]. repeated Style text_styles = 5; // Visual page layout for the [Document][google.cloud.documentai.v1.Document]. repeated Page pages = 6; - // A list of entities detected on - // [Document.text][google.cloud.documentai.v1.Document.text]. For document - // shards, entities in this list may cross shard boundaries. + // A list of entities detected on [Document.text][google.cloud.documentai.v1.Document.text]. For document shards, + // entities in this list may cross shard boundaries. repeated Entity entities = 7; - // Relationship among - // [Document.entities][google.cloud.documentai.v1.Document.entities]. + // Placeholder. Relationship among [Document.entities][google.cloud.documentai.v1.Document.entities]. repeated EntityRelation entity_relations = 8; - // A list of text corrections made to [Document.text]. This is usually - // used for annotating corrections to OCR mistakes. Text changes for a given - // revision may not overlap with each other. + // Placeholder. A list of text corrections made to [Document.text]. This is + // usually used for annotating corrections to OCR mistakes. Text changes for + // a given revision may not overlap with each other. repeated TextChange text_changes = 14; // Information about the sharding if this document is sharded part of a larger @@ -799,6 +777,6 @@ message Document { // Any error that occurred while processing this document. google.rpc.Status error = 10; - // Revision history of this document. + // Placeholder. Revision history of this document. repeated Revision revisions = 13; } diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto index 281a379fab6..17630a03592 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto @@ -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-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto index d0c21feb2a3..9c944f259a0 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto @@ -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. @@ -22,8 +22,12 @@ import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/documentai/v1/document.proto"; import "google/cloud/documentai/v1/document_io.proto"; +import "google/cloud/documentai/v1/document_schema.proto"; import "google/cloud/documentai/v1/operation_metadata.proto"; +import "google/cloud/documentai/v1/processor.proto"; +import "google/cloud/documentai/v1/processor_type.proto"; import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/status.proto"; @@ -34,18 +38,14 @@ option java_outer_classname = "DocumentAiProcessorService"; option java_package = "com.google.cloud.documentai.v1"; option php_namespace = "Google\\Cloud\\DocumentAI\\V1"; option ruby_package = "Google::Cloud::DocumentAI::V1"; -option (google.api.resource_definition) = { - type: "documentai.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; -option (google.api.resource_definition) = { - type: "documentai.googleapis.com/Processor" - pattern: "projects/{project}/locations/{location}/processors/{processor}" -}; option (google.api.resource_definition) = { type: "documentai.googleapis.com/HumanReviewConfig" pattern: "projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig" }; +option (google.api.resource_definition) = { + type: "documentai.googleapis.com/Location" + pattern: "projects/{project}/locations/{location}" +}; // Service to call Cloud DocumentAI to process documents according to the // processor's definition. Processors are built using state-of-the-art Google @@ -60,6 +60,10 @@ service DocumentProcessorService { option (google.api.http) = { post: "/v1/{name=projects/*/locations/*/processors/*}:process" body: "*" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:process" + body: "*" + } }; option (google.api.method_signature) = "name"; } @@ -70,6 +74,10 @@ service DocumentProcessorService { option (google.api.http) = { post: "/v1/{name=projects/*/locations/*/processors/*}:batchProcess" body: "*" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:batchProcess" + body: "*" + } }; option (google.api.method_signature) = "name"; option (google.longrunning.operation_info) = { @@ -78,6 +86,155 @@ service DocumentProcessorService { }; } + // Fetches processor types. Note that we do not use ListProcessorTypes here + // because it is not paginated. + rpc FetchProcessorTypes(FetchProcessorTypesRequest) returns (FetchProcessorTypesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}:fetchProcessorTypes" + }; + option (google.api.method_signature) = "parent"; + } + + // Lists the processor types that exist. + rpc ListProcessorTypes(ListProcessorTypesRequest) returns (ListProcessorTypesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/processorTypes" + }; + option (google.api.method_signature) = "parent"; + } + + // Lists all processors which belong to this project. + rpc ListProcessors(ListProcessorsRequest) returns (ListProcessorsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/processors" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a processor detail. + rpc GetProcessor(GetProcessorRequest) returns (Processor) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/processors/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a processor version detail. + rpc GetProcessorVersion(GetProcessorVersionRequest) returns (ProcessorVersion) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all versions of a processor. + rpc ListProcessorVersions(ListProcessorVersionsRequest) returns (ListProcessorVersionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/processors/*}/processorVersions" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes the processor version, all artifacts under the processor version + // will be deleted. + rpc DeleteProcessorVersion(DeleteProcessorVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "DeleteProcessorVersionMetadata" + }; + } + + // Deploys the processor version. + rpc DeployProcessorVersion(DeployProcessorVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:deploy" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "DeployProcessorVersionResponse" + metadata_type: "DeployProcessorVersionMetadata" + }; + } + + // Undeploys the processor version. + rpc UndeployProcessorVersion(UndeployProcessorVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:undeploy" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "UndeployProcessorVersionResponse" + metadata_type: "UndeployProcessorVersionMetadata" + }; + } + + // Creates a processor from the type processor that the user chose. + // The processor will be at "ENABLED" state by default after its creation. + rpc CreateProcessor(CreateProcessorRequest) returns (Processor) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/processors" + body: "processor" + }; + option (google.api.method_signature) = "parent,processor"; + } + + // Deletes the processor, unloads all deployed model artifacts if it was + // enabled and then deletes all artifacts associated with this processor. + rpc DeleteProcessor(DeleteProcessorRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/processors/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "DeleteProcessorMetadata" + }; + } + + // Enables a processor + rpc EnableProcessor(EnableProcessorRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/processors/*}:enable" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "EnableProcessorResponse" + metadata_type: "EnableProcessorMetadata" + }; + } + + // Disables a processor + rpc DisableProcessor(DisableProcessorRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/processors/*}:disable" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "DisableProcessorResponse" + metadata_type: "DisableProcessorMetadata" + }; + } + + // Set the default (active) version of a [Processor][google.cloud.documentai.v1.Processor] that will be used in + // [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument] and + // [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]. + rpc SetDefaultProcessorVersion(SetDefaultProcessorVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{processor=projects/*/locations/*/processors/*}:setDefaultProcessorVersion" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "SetDefaultProcessorVersionResponse" + metadata_type: "SetDefaultProcessorVersionMetadata" + }; + } + // Send a document for Human Review. The input document should be processed by // the specified processor. rpc ReviewDocument(ReviewDocumentRequest) returns (google.longrunning.Operation) { @@ -104,17 +261,25 @@ message ProcessRequest { RawDocument raw_document = 5; } - // Required. The processor resource name. + // Required. The resource name of the [Processor][google.cloud.documentai.v1.Processor] or + // [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] + // to use for processing. If a [Processor][google.cloud.documentai.v1.Processor] is specified, the server will use + // its [default version][google.cloud.documentai.v1.Processor.default_processor_version]. Format: + // `projects/{project}/locations/{location}/processors/{processor}`, or + // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { - type: "documentai.googleapis.com/Processor" + type: "*" } ]; // Whether Human Review feature should be skipped for this request. Default to // false. bool skip_human_review = 3; + + // Specifies which fields to include in ProcessResponse's document. + google.protobuf.FieldMask field_mask = 6; } // The status of human review on a processed document. @@ -165,11 +330,15 @@ message ProcessResponse { // Request message for batch process document method. message BatchProcessRequest { - // Required. The processor resource name. + // Required. The resource name of [Processor][google.cloud.documentai.v1.Processor] or + // [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. + // Format: `projects/{project}/locations/{location}/processors/{processor}`, + // or + // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { - type: "documentai.googleapis.com/Processor" + type: "*" } ]; @@ -199,10 +368,10 @@ message BatchProcessMetadata { // document during the process. string input_gcs_source = 1; - // The status of the processing of the document. + // The status processing the document. google.rpc.Status status = 2; - // The output_gcs_destination (in the request as 'output_gcs_destination') + // The output_gcs_destination (in the request as `output_gcs_destination`) // of the processed document if it was successful, otherwise empty. string output_gcs_destination = 3; @@ -251,10 +420,315 @@ message BatchProcessMetadata { repeated IndividualProcessStatus individual_process_statuses = 5; } +// Request message for fetch processor types. +message FetchProcessorTypesRequest { + // Required. The project of processor type to list. + // The available processor types may depend on the allow-listing on projects. + // Format: `projects/{project}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "documentai.googleapis.com/ProcessorType" + } + ]; +} + +// Response message for fetch processor types. +message FetchProcessorTypesResponse { + // The list of processor types. + repeated ProcessorType processor_types = 1; +} + +// Request message for list processor types. +message ListProcessorTypesRequest { + // Required. The location of processor type to list. + // The available processor types may depend on the allow-listing on projects. + // Format: `projects/{project}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "documentai.googleapis.com/ProcessorType" + } + ]; + + // The maximum number of processor types to return. + // If unspecified, at most 100 processor types will be returned. + // The maximum value is 500; values above 500 will be coerced to 500. + int32 page_size = 2; + + // Used to retrieve the next page of results, empty if at the end of the list. + string page_token = 3; +} + +// Response message for list processor types. +message ListProcessorTypesResponse { + // The processor types. + repeated ProcessorType processor_types = 1; + + // Points to the next page, otherwise empty. + string next_page_token = 2; +} + +// Request message for list all processors belongs to a project. +message ListProcessorsRequest { + // Required. The parent (project and location) which owns this collection of Processors. + // Format: `projects/{project}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "documentai.googleapis.com/Processor" + } + ]; + + // The maximum number of processors to return. + // If unspecified, at most 50 processors will be returned. + // The maximum value is 100; values above 100 will be coerced to 100. + int32 page_size = 2; + + // We will return the processors sorted by creation time. The page token + // will point to the next processor. + string page_token = 3; +} + +// Response message for list processors. +message ListProcessorsResponse { + // The list of processors. + repeated Processor processors = 1; + + // Points to the next processor, otherwise empty. + string next_page_token = 2; +} + +// Request message for get processor. +message GetProcessorRequest { + // Required. The processor resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/Processor" + } + ]; +} + +// Request message for get processor version. +message GetProcessorVersionRequest { + // Required. The processor resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + } + ]; +} + +// Request message for list all processor versions belongs to a processor. +message ListProcessorVersionsRequest { + // Required. The parent (project, location and processor) to list all versions. + // Format: `projects/{project}/locations/{location}/processors/{processor}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "documentai.googleapis.com/ProcessorVersion" + } + ]; + + // The maximum number of processor versions to return. + // If unspecified, at most 10 processor versions will be returned. + // The maximum value is 20; values above 20 will be coerced to 20. + int32 page_size = 2; + + // We will return the processor versions sorted by creation time. The page + // token will point to the next processor version. + string page_token = 3; +} + +// Response message for list processors. +message ListProcessorVersionsResponse { + // The list of processors. + repeated ProcessorVersion processor_versions = 1; + + // Points to the next processor, otherwise empty. + string next_page_token = 2; +} + +// Request message for the delete processor version method. +message DeleteProcessorVersionRequest { + // Required. The processor version resource name to be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + } + ]; +} + +// The long running operation metadata for delete processor version method. +message DeleteProcessorVersionMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 1; +} + +// Request message for the deploy processor version method. +message DeployProcessorVersionRequest { + // Required. The processor version resource name to be deployed. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + } + ]; +} + +// Response message for the deploy processor version method. +message DeployProcessorVersionResponse { + +} + +// The long running operation metadata for deploy processor version method. +message DeployProcessorVersionMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 1; +} + +// Request message for the undeploy processor version method. +message UndeployProcessorVersionRequest { + // Required. The processor version resource name to be undeployed. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + } + ]; +} + +// Response message for the undeploy processor version method. +message UndeployProcessorVersionResponse { + +} + +// The long running operation metadata for the undeploy processor version +// method. +message UndeployProcessorVersionMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 1; +} + +// Request message for create a processor. Notice this request is sent to +// a regionalized backend service, and if the processor type is not available +// on that region, the creation will fail. +message CreateProcessorRequest { + // Required. The parent (project and location) under which to create the processor. + // Format: `projects/{project}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "documentai.googleapis.com/Processor" + } + ]; + + // Required. The processor to be created, requires [processor_type] and [display_name] + // to be set. Also, the processor is under CMEK if CMEK fields are set. + Processor processor = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for the delete processor method. +message DeleteProcessorRequest { + // Required. The processor resource name to be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/Processor" + } + ]; +} + +// The long running operation metadata for delete processor method. +message DeleteProcessorMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 5; +} + +// Request message for the enable processor method. +message EnableProcessorRequest { + // Required. The processor resource name to be enabled. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/Processor" + } + ]; +} + +// Response message for the enable processor method. +// Intentionally empty proto for adding fields in future. +message EnableProcessorResponse { + +} + +// The long running operation metadata for enable processor method. +message EnableProcessorMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 5; +} + +// Request message for the disable processor method. +message DisableProcessorRequest { + // Required. The processor resource name to be disabled. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/Processor" + } + ]; +} + +// Response message for the disable processor method. +// Intentionally empty proto for adding fields in future. +message DisableProcessorResponse { + +} + +// The long running operation metadata for disable processor method. +message DisableProcessorMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 5; +} + +// Request message for the set default processor version method. +message SetDefaultProcessorVersionRequest { + // Required. The resource name of the [Processor][google.cloud.documentai.v1.Processor] to change default version. + string processor = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/Processor" + } + ]; + + // Required. The resource name of child [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to use as default. + // Format: + // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}` + string default_processor_version = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + } + ]; +} + +// Response message for set default processor version method. +message SetDefaultProcessorVersionResponse { + +} + +// The long running operation metadata for set default processor version +// method. +message SetDefaultProcessorVersionMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 1; +} + // Request message for review document method. message ReviewDocumentRequest { - reserved 2; - // The priority level of the human review task. enum Priority { // The default priority level. @@ -285,12 +759,34 @@ message ReviewDocumentRequest { // The priority of the human review task. Priority priority = 5; + + // The document schema of the human review task. + DocumentSchema document_schema = 6; } // Response message for review document method. message ReviewDocumentResponse { - // The Cloud Storage uri for the human reviewed document. + // Possible states of the review operation. + enum State { + // The default value. This value is used if the state is omitted. + STATE_UNSPECIFIED = 0; + + // The review operation is rejected by the reviewer. + REJECTED = 1; + + // The review operation is succeeded. + SUCCEEDED = 2; + } + + // The Cloud Storage uri for the human reviewed document if the review is + // succeeded. string gcs_destination = 1; + + // The state of the review operation. + State state = 2; + + // The reason why the review is rejected by reviewer. + string rejection_reason = 3; } // The long running operation metadata for review document method. @@ -298,6 +794,6 @@ message ReviewDocumentOperationMetadata { // The basic metadata of the long running operation. CommonOperationMetadata common_metadata = 5; - // The question ID. + // The Crowd Compute question ID. string question_id = 6; } diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_schema.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_schema.proto new file mode 100644 index 00000000000..24bd42285d9 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_schema.proto @@ -0,0 +1,140 @@ +// 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.documentai.v1; + +option csharp_namespace = "Google.Cloud.DocumentAI.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai"; +option java_multiple_files = true; +option java_outer_classname = "DocumentAiDocumentSchema"; +option java_package = "com.google.cloud.documentai.v1"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1"; +option ruby_package = "Google::Cloud::DocumentAI::V1"; + +// The schema defines the output of the processed document by a processor. +message DocumentSchema { + // EntityType is the wrapper of a label of the corresponding model with + // detailed attributes and limitations for entity-based processors. Multiple + // types can also compose a dependency tree to represent nested types. + message EntityType { + // Defines the a list of enum values. + message EnumValues { + // The individual values that this enum values type can include. + repeated string values = 1; + } + + // Defines properties that can be part of the entity type. + message Property { + // Types of occurrences of the entity type in the document. Note: this + // represents the number of instances of an entity types, not number of + // mentions of a given entity instance. + enum OccurrenceType { + // Unspecified occurrence type. + OCCURRENCE_TYPE_UNSPECIFIED = 0; + + // There will be zero or one instance of this entity type. + OPTIONAL_ONCE = 1; + + // The entity type will appear zero or multiple times. + OPTIONAL_MULTIPLE = 2; + + // The entity type will only appear exactly once. + REQUIRED_ONCE = 3; + + // The entity type will appear once or more times. + REQUIRED_MULTIPLE = 4; + } + + // The name of the property. Follows the same guidelines as the + // EntityType name. + string name = 1; + + // A reference to the value type of the property. This type is subject + // to the same conventions as the `Entity.base_types` field. + string value_type = 2; + + // Occurrence type limits the number of instances an entity type appears + // in the document. + OccurrenceType occurrence_type = 3; + } + + oneof value_source { + // If specified, lists all the possible values for this entity. This + // should not be more than a handful of values. If the number of values + // is >10 or could change frequently use the `EntityType.value_ontology` + // field and specify a list of all possible values in a value ontology + // file. + EnumValues enum_values = 14; + } + + // User defined name for the type. + string display_name = 13; + + // Name of the type. It must be unique within the schema file and + // cannot be a 'Common Type'. Besides that we use the following naming + // conventions: + // - *use snake_casing* + // - name matching is case-insensitive + // - Maximum 64 characters. + // - Must start with a letter. + // - Allowed characters: ASCII letters `[a-z0-9_-]`. (For backward + // compatibility internal infrastructure and tooling can handle any ascii + // character) + // - The '/' is sometimes used to denote a property of a type. For example + // line_item/amount. This convention is deprecated, but will still be + // honored for backward compatibility. + string name = 1; + + // The entity type that this type is derived from. For now, one and only + // one should be set. + repeated string base_types = 2; + + // Describing the nested structure, or composition of an entity. + repeated Property properties = 6; + } + + // Metadata for global schema behavior. + message Metadata { + // If true, a `document` entity type can be applied to subdocument ( + // splitting). Otherwise, it can only be applied to the entire document + // (classification). + bool document_splitter = 1; + + // If true, on a given page, there can be multiple `document` annotations + // covering it. + bool document_allow_multiple_labels = 2; + + // If set, all the nested entities must be prefixed with the parents. + bool prefixed_naming_on_properties = 6; + + // If set, we will skip the naming format validation in the schema. So the + // string values in `DocumentSchema.EntityType.name` and + // `DocumentSchema.EntityType.Property.name` will not be checked. + bool skip_naming_validation = 7; + } + + // Display name to show to users. + string display_name = 1; + + // Description of the schema. + string description = 2; + + // Entity types of the schema. + repeated EntityType entity_types = 3; + + // Metadata of the schema. + Metadata metadata = 4; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto index 6f83ee7beb0..7471ef01247 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto @@ -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-documentai/protos/google/cloud/documentai/v1/operation_metadata.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/operation_metadata.proto index 773222439ed..5698b0a4f3c 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/operation_metadata.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/operation_metadata.proto @@ -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. @@ -55,6 +55,9 @@ message CommonOperationMetadata { // A message providing more details about the current state of processing. string state_message = 2; + // A related resource to this operation. + string resource = 5; + // The creation time of the operation. google.protobuf.Timestamp create_time = 3; diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor.proto new file mode 100644 index 00000000000..b7eb95ef3f5 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor.proto @@ -0,0 +1,185 @@ +// 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.documentai.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.DocumentAI.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai"; +option java_multiple_files = true; +option java_outer_classname = "DocumentAiProcessor"; +option java_package = "com.google.cloud.documentai.v1"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1"; +option ruby_package = "Google::Cloud::DocumentAI::V1"; + +// A processor version is an implementation of a processor. Each processor +// can have multiple versions, pre-trained by Google internally or up-trained +// by the customer. At a time, a processor can only have one default version +// version. So the processor's behavior (when processing documents) is defined +// by a default version +message ProcessorVersion { + option (google.api.resource) = { + type: "documentai.googleapis.com/ProcessorVersion" + pattern: "projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}" + }; + + // Information about the upcoming deprecation of this processor version. + message DeprecationInfo { + // The time at which this processor version will be deprecated. + google.protobuf.Timestamp deprecation_time = 1; + + // If set, the processor version that will be used as a replacement. + string replacement_processor_version = 2 [(google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + }]; + } + + // The possible states of the processor version. + enum State { + // The processor version is in an unspecified state. + STATE_UNSPECIFIED = 0; + + // The processor version is deployed and can be used for processing. + DEPLOYED = 1; + + // The processor version is being deployed. + DEPLOYING = 2; + + // The processor version is not deployed and cannot be used for processing. + UNDEPLOYED = 3; + + // The processor version is being undeployed. + UNDEPLOYING = 4; + + // The processor version is being created. + CREATING = 5; + + // The processor version is being deleted. + DELETING = 6; + + // The processor version failed and is in an indeterminate state. + FAILED = 7; + } + + // The resource name of the processor version. + // Format: + // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}` + string name = 1; + + // The display name of the processor version. + string display_name = 2; + + // The state of the processor version. + State state = 6; + + // The time the processor version was created. + google.protobuf.Timestamp create_time = 7; + + // The KMS key name used for encryption. + string kms_key_name = 9; + + // The KMS key version with which data is encrypted. + string kms_key_version_name = 10; + + // Denotes that this ProcessorVersion is managed by google. + bool google_managed = 11; + + // If set, information about the eventual deprecation of this version. + DeprecationInfo deprecation_info = 13; +} + +// The first-class citizen for Document AI. Each processor defines how to +// extract structural information from a document. +message Processor { + option (google.api.resource) = { + type: "documentai.googleapis.com/Processor" + pattern: "projects/{project}/locations/{location}/processors/{processor}" + }; + + // The possible states of the processor. + enum State { + // The processor is in an unspecified state. + STATE_UNSPECIFIED = 0; + + // The processor is enabled, i.e., has an enabled version which can + // currently serve processing requests and all the feature dependencies have + // been successfully initialized. + ENABLED = 1; + + // The processor is disabled. + DISABLED = 2; + + // The processor is being enabled, will become ENABLED if successful. + ENABLING = 3; + + // The processor is being disabled, will become DISABLED if successful. + DISABLING = 4; + + // The processor is being created, will become either ENABLED (for + // successful creation) or FAILED (for failed ones). + // Once a processor is in this state, it can then be used for document + // processing, but the feature dependencies of the processor might not be + // fully created yet. + CREATING = 5; + + // The processor failed during creation or initialization of feature + // dependencies. The user should delete the processor and recreate one as + // all the functionalities of the processor are disabled. + FAILED = 6; + + // The processor is being deleted, will be removed if successful. + DELETING = 7; + } + + // Output only. Immutable. The resource name of the processor. + // Format: `projects/{project}/locations/{location}/processors/{processor}` + string name = 1 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = OUTPUT_ONLY + ]; + + // The processor type, e.g., OCR_PROCESSOR, INVOICE_PROCESSOR, etc. + // To get a list of processors types, see + // [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]. + string type = 2; + + // The display name of the processor. + string display_name = 3; + + // Output only. The state of the processor. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The default processor version. + string default_processor_version = 9 [(google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + }]; + + // Output only. Immutable. The http endpoint that can be called to invoke processing. + string process_endpoint = 6 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = IMMUTABLE + ]; + + // The time the processor was created. + google.protobuf.Timestamp create_time = 7; + + // The KMS key used for encryption/decryption in CMEK scenarios. + // See https://cloud.google.com/security-key-management. + string kms_key_name = 8; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor_type.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor_type.proto new file mode 100644 index 00000000000..dd5ef470011 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor_type.proto @@ -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 +// +// 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.documentai.v1; + +import "google/api/launch_stage.proto"; +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.DocumentAI.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai"; +option java_multiple_files = true; +option java_outer_classname = "DocumentAiProcessorType"; +option java_package = "com.google.cloud.documentai.v1"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1"; +option ruby_package = "Google::Cloud::DocumentAI::V1"; + +// A processor type is responsible for performing a certain document +// understanding task on a certain type of document. +message ProcessorType { + option (google.api.resource) = { + type: "documentai.googleapis.com/ProcessorType" + pattern: "projects/{project}/locations/{location}/processorTypes/{processor_type}" + }; + + // The location information about where the processor is available. + message LocationInfo { + // The location id, currently must be one of [us, eu]. + string location_id = 1; + } + + // The resource name of the processor type. + // Format: projects/{project}/processorTypes/{processor_type} + string name = 1; + + // The type of the processor, e.g., "invoice_parsing". + string type = 2; + + // The processor category, used by UI to group processor types. + string category = 3; + + // The locations in which this processor is available. + repeated LocationInfo available_locations = 4; + + // Whether the processor type allows creation. If true, users can create a + // processor of this processor type. Otherwise, users need to request access. + bool allow_creation = 6; + + // Launch stage of the processor type + google.api.LaunchStage launch_stage = 8; +} diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 52c11c025aa..7ecdc12c436 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -26,6 +26,108 @@ export namespace google { /** Namespace v1. */ namespace v1 { + /** Properties of a Barcode. */ + interface IBarcode { + + /** Barcode format */ + format?: (string|null); + + /** Barcode valueFormat */ + valueFormat?: (string|null); + + /** Barcode rawValue */ + rawValue?: (string|null); + } + + /** Represents a Barcode. */ + class Barcode implements IBarcode { + + /** + * Constructs a new Barcode. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IBarcode); + + /** Barcode format. */ + public format: string; + + /** Barcode valueFormat. */ + public valueFormat: string; + + /** Barcode rawValue. */ + public rawValue: string; + + /** + * Creates a new Barcode instance using the specified properties. + * @param [properties] Properties to set + * @returns Barcode instance + */ + public static create(properties?: google.cloud.documentai.v1.IBarcode): google.cloud.documentai.v1.Barcode; + + /** + * Encodes the specified Barcode message. Does not implicitly {@link google.cloud.documentai.v1.Barcode.verify|verify} messages. + * @param message Barcode message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IBarcode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Barcode message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Barcode.verify|verify} messages. + * @param message Barcode message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IBarcode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Barcode message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Barcode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Barcode; + + /** + * Decodes a Barcode message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Barcode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Barcode; + + /** + * Verifies a Barcode message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Barcode message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Barcode + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Barcode; + + /** + * Creates a plain object from a Barcode message. Also converts values to other types if specified. + * @param message Barcode + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Barcode, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Barcode to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a Document. */ interface IDocument { @@ -559,6 +661,9 @@ export namespace google { /** Page symbols */ symbols?: (google.cloud.documentai.v1.Document.Page.ISymbol[]|null); + /** Page detectedBarcodes */ + detectedBarcodes?: (google.cloud.documentai.v1.Document.Page.IDetectedBarcode[]|null); + /** Page provenance */ provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); } @@ -614,6 +719,9 @@ export namespace google { /** Page symbols. */ public symbols: google.cloud.documentai.v1.Document.Page.ISymbol[]; + /** Page detectedBarcodes. */ + public detectedBarcodes: google.cloud.documentai.v1.Document.Page.IDetectedBarcode[]; + /** Page provenance. */ public provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); @@ -2171,6 +2279,12 @@ export namespace google { /** FormField valueType */ valueType?: (string|null); + /** FormField correctedKeyText */ + correctedKeyText?: (string|null); + + /** FormField correctedValueText */ + correctedValueText?: (string|null); + /** FormField provenance */ provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); } @@ -2199,6 +2313,12 @@ export namespace google { /** FormField valueType. */ public valueType: string; + /** FormField correctedKeyText. */ + public correctedKeyText: string; + + /** FormField correctedValueText. */ + public correctedValueText: string; + /** FormField provenance. */ public provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); @@ -2273,6 +2393,102 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of a DetectedBarcode. */ + interface IDetectedBarcode { + + /** DetectedBarcode layout */ + layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** DetectedBarcode barcode */ + barcode?: (google.cloud.documentai.v1.IBarcode|null); + } + + /** Represents a DetectedBarcode. */ + class DetectedBarcode implements IDetectedBarcode { + + /** + * Constructs a new DetectedBarcode. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.IDetectedBarcode); + + /** DetectedBarcode layout. */ + public layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** DetectedBarcode barcode. */ + public barcode?: (google.cloud.documentai.v1.IBarcode|null); + + /** + * Creates a new DetectedBarcode instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectedBarcode instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.IDetectedBarcode): google.cloud.documentai.v1.Document.Page.DetectedBarcode; + + /** + * Encodes the specified DetectedBarcode message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.DetectedBarcode.verify|verify} messages. + * @param message DetectedBarcode message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Page.IDetectedBarcode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectedBarcode message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.DetectedBarcode.verify|verify} messages. + * @param message DetectedBarcode message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Page.IDetectedBarcode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectedBarcode message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectedBarcode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Page.DetectedBarcode; + + /** + * Decodes a DetectedBarcode message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectedBarcode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Page.DetectedBarcode; + + /** + * Verifies a DetectedBarcode message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DetectedBarcode message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectedBarcode + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page.DetectedBarcode; + + /** + * Creates a plain object from a DetectedBarcode message. Also converts values to other types if specified. + * @param message DetectedBarcode + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page.DetectedBarcode, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectedBarcode to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a DetectedLanguage. */ interface IDetectedLanguage { @@ -2540,6 +2756,12 @@ export namespace google { /** NormalizedValue booleanValue */ booleanValue?: (boolean|null); + /** NormalizedValue integerValue */ + integerValue?: (number|null); + + /** NormalizedValue floatValue */ + floatValue?: (number|null); + /** NormalizedValue text */ text?: (string|null); } @@ -2568,11 +2790,17 @@ export namespace google { /** NormalizedValue booleanValue. */ public booleanValue?: (boolean|null); + /** NormalizedValue integerValue. */ + public integerValue?: (number|null); + + /** NormalizedValue floatValue. */ + public floatValue?: (number|null); + /** NormalizedValue text. */ public text: string; /** NormalizedValue structuredValue. */ - public structuredValue?: ("moneyValue"|"dateValue"|"datetimeValue"|"addressValue"|"booleanValue"); + public structuredValue?: ("moneyValue"|"dateValue"|"datetimeValue"|"addressValue"|"booleanValue"|"integerValue"|"floatValue"); /** * Creates a new NormalizedValue instance using the specified properties. @@ -3404,6 +3632,9 @@ export namespace google { /** Revision parent */ parent?: (number[]|null); + /** Revision parentIds */ + parentIds?: (string[]|null); + /** Revision createTime */ createTime?: (google.protobuf.ITimestamp|null); @@ -3432,6 +3663,9 @@ export namespace google { /** Revision parent. */ public parent: number[]; + /** Revision parentIds. */ + public parentIds: string[]; + /** Revision createTime. */ public createTime?: (google.protobuf.ITimestamp|null); @@ -4708,1217 +4942,5433 @@ export namespace google { public batchProcessDocuments(request: google.cloud.documentai.v1.IBatchProcessRequest): Promise; /** - * Calls ReviewDocument. - * @param request ReviewDocumentRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Calls FetchProcessorTypes. + * @param request FetchProcessorTypesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and FetchProcessorTypesResponse */ - public reviewDocument(request: google.cloud.documentai.v1.IReviewDocumentRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.ReviewDocumentCallback): void; + public fetchProcessorTypes(request: google.cloud.documentai.v1.IFetchProcessorTypesRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypesCallback): void; /** - * Calls ReviewDocument. - * @param request ReviewDocumentRequest message or plain object + * Calls FetchProcessorTypes. + * @param request FetchProcessorTypesRequest message or plain object * @returns Promise */ - public reviewDocument(request: google.cloud.documentai.v1.IReviewDocumentRequest): Promise; - } - - namespace DocumentProcessorService { + public fetchProcessorTypes(request: google.cloud.documentai.v1.IFetchProcessorTypesRequest): Promise; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#processDocument}. - * @param error Error, if any - * @param [response] ProcessResponse + * Calls ListProcessorTypes. + * @param request ListProcessorTypesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListProcessorTypesResponse */ - type ProcessDocumentCallback = (error: (Error|null), response?: google.cloud.documentai.v1.ProcessResponse) => void; + public listProcessorTypes(request: google.cloud.documentai.v1.IListProcessorTypesRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypesCallback): void; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#batchProcessDocuments}. - * @param error Error, if any - * @param [response] Operation + * Calls ListProcessorTypes. + * @param request ListProcessorTypesRequest message or plain object + * @returns Promise */ - type BatchProcessDocumentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public listProcessorTypes(request: google.cloud.documentai.v1.IListProcessorTypesRequest): Promise; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#reviewDocument}. - * @param error Error, if any - * @param [response] Operation + * Calls ListProcessors. + * @param request ListProcessorsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListProcessorsResponse */ - type ReviewDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - } - - /** Properties of a ProcessRequest. */ - interface IProcessRequest { - - /** ProcessRequest inlineDocument */ - inlineDocument?: (google.cloud.documentai.v1.IDocument|null); - - /** ProcessRequest rawDocument */ - rawDocument?: (google.cloud.documentai.v1.IRawDocument|null); - - /** ProcessRequest name */ - name?: (string|null); - - /** ProcessRequest skipHumanReview */ - skipHumanReview?: (boolean|null); - } - - /** Represents a ProcessRequest. */ - class ProcessRequest implements IProcessRequest { + public listProcessors(request: google.cloud.documentai.v1.IListProcessorsRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.ListProcessorsCallback): void; /** - * Constructs a new ProcessRequest. - * @param [properties] Properties to set + * Calls ListProcessors. + * @param request ListProcessorsRequest message or plain object + * @returns Promise */ - constructor(properties?: google.cloud.documentai.v1.IProcessRequest); - - /** ProcessRequest inlineDocument. */ - public inlineDocument?: (google.cloud.documentai.v1.IDocument|null); - - /** ProcessRequest rawDocument. */ - public rawDocument?: (google.cloud.documentai.v1.IRawDocument|null); - - /** ProcessRequest name. */ - public name: string; - - /** ProcessRequest skipHumanReview. */ - public skipHumanReview: boolean; - - /** ProcessRequest source. */ - public source?: ("inlineDocument"|"rawDocument"); + public listProcessors(request: google.cloud.documentai.v1.IListProcessorsRequest): Promise; /** - * Creates a new ProcessRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ProcessRequest instance + * Calls GetProcessor. + * @param request GetProcessorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Processor */ - public static create(properties?: google.cloud.documentai.v1.IProcessRequest): google.cloud.documentai.v1.ProcessRequest; + public getProcessor(request: google.cloud.documentai.v1.IGetProcessorRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.GetProcessorCallback): void; /** - * Encodes the specified ProcessRequest message. Does not implicitly {@link google.cloud.documentai.v1.ProcessRequest.verify|verify} messages. - * @param message ProcessRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls GetProcessor. + * @param request GetProcessorRequest message or plain object + * @returns Promise */ - public static encode(message: google.cloud.documentai.v1.IProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public getProcessor(request: google.cloud.documentai.v1.IGetProcessorRequest): Promise; /** - * Encodes the specified ProcessRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessRequest.verify|verify} messages. - * @param message ProcessRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls GetProcessorVersion. + * @param request GetProcessorVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ProcessorVersion */ - public static encodeDelimited(message: google.cloud.documentai.v1.IProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public getProcessorVersion(request: google.cloud.documentai.v1.IGetProcessorVersionRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersionCallback): void; /** - * Decodes a ProcessRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ProcessRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls GetProcessorVersion. + * @param request GetProcessorVersionRequest message or plain object + * @returns Promise */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ProcessRequest; + public getProcessorVersion(request: google.cloud.documentai.v1.IGetProcessorVersionRequest): Promise; /** - * Decodes a ProcessRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ProcessRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls ListProcessorVersions. + * @param request ListProcessorVersionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListProcessorVersionsResponse */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ProcessRequest; + public listProcessorVersions(request: google.cloud.documentai.v1.IListProcessorVersionsRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersionsCallback): void; /** - * Verifies a ProcessRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Calls ListProcessorVersions. + * @param request ListProcessorVersionsRequest message or plain object + * @returns Promise */ - public static verify(message: { [k: string]: any }): (string|null); + public listProcessorVersions(request: google.cloud.documentai.v1.IListProcessorVersionsRequest): Promise; /** - * Creates a ProcessRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ProcessRequest + * Calls DeleteProcessorVersion. + * @param request DeleteProcessorVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ProcessRequest; + public deleteProcessorVersion(request: google.cloud.documentai.v1.IDeleteProcessorVersionRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersionCallback): void; /** - * Creates a plain object from a ProcessRequest message. Also converts values to other types if specified. + * Calls DeleteProcessorVersion. + * @param request DeleteProcessorVersionRequest message or plain object + * @returns Promise + */ + public deleteProcessorVersion(request: google.cloud.documentai.v1.IDeleteProcessorVersionRequest): Promise; + + /** + * Calls DeployProcessorVersion. + * @param request DeployProcessorVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deployProcessorVersion(request: google.cloud.documentai.v1.IDeployProcessorVersionRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersionCallback): void; + + /** + * Calls DeployProcessorVersion. + * @param request DeployProcessorVersionRequest message or plain object + * @returns Promise + */ + public deployProcessorVersion(request: google.cloud.documentai.v1.IDeployProcessorVersionRequest): Promise; + + /** + * Calls UndeployProcessorVersion. + * @param request UndeployProcessorVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public undeployProcessorVersion(request: google.cloud.documentai.v1.IUndeployProcessorVersionRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersionCallback): void; + + /** + * Calls UndeployProcessorVersion. + * @param request UndeployProcessorVersionRequest message or plain object + * @returns Promise + */ + public undeployProcessorVersion(request: google.cloud.documentai.v1.IUndeployProcessorVersionRequest): Promise; + + /** + * Calls CreateProcessor. + * @param request CreateProcessorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Processor + */ + public createProcessor(request: google.cloud.documentai.v1.ICreateProcessorRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.CreateProcessorCallback): void; + + /** + * Calls CreateProcessor. + * @param request CreateProcessorRequest message or plain object + * @returns Promise + */ + public createProcessor(request: google.cloud.documentai.v1.ICreateProcessorRequest): Promise; + + /** + * Calls DeleteProcessor. + * @param request DeleteProcessorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteProcessor(request: google.cloud.documentai.v1.IDeleteProcessorRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorCallback): void; + + /** + * Calls DeleteProcessor. + * @param request DeleteProcessorRequest message or plain object + * @returns Promise + */ + public deleteProcessor(request: google.cloud.documentai.v1.IDeleteProcessorRequest): Promise; + + /** + * Calls EnableProcessor. + * @param request EnableProcessorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public enableProcessor(request: google.cloud.documentai.v1.IEnableProcessorRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.EnableProcessorCallback): void; + + /** + * Calls EnableProcessor. + * @param request EnableProcessorRequest message or plain object + * @returns Promise + */ + public enableProcessor(request: google.cloud.documentai.v1.IEnableProcessorRequest): Promise; + + /** + * Calls DisableProcessor. + * @param request DisableProcessorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public disableProcessor(request: google.cloud.documentai.v1.IDisableProcessorRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.DisableProcessorCallback): void; + + /** + * Calls DisableProcessor. + * @param request DisableProcessorRequest message or plain object + * @returns Promise + */ + public disableProcessor(request: google.cloud.documentai.v1.IDisableProcessorRequest): Promise; + + /** + * Calls SetDefaultProcessorVersion. + * @param request SetDefaultProcessorVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public setDefaultProcessorVersion(request: google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersionCallback): void; + + /** + * Calls SetDefaultProcessorVersion. + * @param request SetDefaultProcessorVersionRequest message or plain object + * @returns Promise + */ + public setDefaultProcessorVersion(request: google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest): Promise; + + /** + * Calls ReviewDocument. + * @param request ReviewDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public reviewDocument(request: google.cloud.documentai.v1.IReviewDocumentRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.ReviewDocumentCallback): void; + + /** + * Calls ReviewDocument. + * @param request ReviewDocumentRequest message or plain object + * @returns Promise + */ + public reviewDocument(request: google.cloud.documentai.v1.IReviewDocumentRequest): Promise; + } + + namespace DocumentProcessorService { + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#processDocument}. + * @param error Error, if any + * @param [response] ProcessResponse + */ + type ProcessDocumentCallback = (error: (Error|null), response?: google.cloud.documentai.v1.ProcessResponse) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#batchProcessDocuments}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchProcessDocumentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#fetchProcessorTypes}. + * @param error Error, if any + * @param [response] FetchProcessorTypesResponse + */ + type FetchProcessorTypesCallback = (error: (Error|null), response?: google.cloud.documentai.v1.FetchProcessorTypesResponse) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#listProcessorTypes}. + * @param error Error, if any + * @param [response] ListProcessorTypesResponse + */ + type ListProcessorTypesCallback = (error: (Error|null), response?: google.cloud.documentai.v1.ListProcessorTypesResponse) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#listProcessors}. + * @param error Error, if any + * @param [response] ListProcessorsResponse + */ + type ListProcessorsCallback = (error: (Error|null), response?: google.cloud.documentai.v1.ListProcessorsResponse) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#getProcessor}. + * @param error Error, if any + * @param [response] Processor + */ + type GetProcessorCallback = (error: (Error|null), response?: google.cloud.documentai.v1.Processor) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#getProcessorVersion}. + * @param error Error, if any + * @param [response] ProcessorVersion + */ + type GetProcessorVersionCallback = (error: (Error|null), response?: google.cloud.documentai.v1.ProcessorVersion) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#listProcessorVersions}. + * @param error Error, if any + * @param [response] ListProcessorVersionsResponse + */ + type ListProcessorVersionsCallback = (error: (Error|null), response?: google.cloud.documentai.v1.ListProcessorVersionsResponse) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#deleteProcessorVersion}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#deployProcessorVersion}. + * @param error Error, if any + * @param [response] Operation + */ + type DeployProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#undeployProcessorVersion}. + * @param error Error, if any + * @param [response] Operation + */ + type UndeployProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#createProcessor}. + * @param error Error, if any + * @param [response] Processor + */ + type CreateProcessorCallback = (error: (Error|null), response?: google.cloud.documentai.v1.Processor) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#deleteProcessor}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteProcessorCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#enableProcessor}. + * @param error Error, if any + * @param [response] Operation + */ + type EnableProcessorCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#disableProcessor}. + * @param error Error, if any + * @param [response] Operation + */ + type DisableProcessorCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#setDefaultProcessorVersion}. + * @param error Error, if any + * @param [response] Operation + */ + type SetDefaultProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#reviewDocument}. + * @param error Error, if any + * @param [response] Operation + */ + type ReviewDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a ProcessRequest. */ + interface IProcessRequest { + + /** ProcessRequest inlineDocument */ + inlineDocument?: (google.cloud.documentai.v1.IDocument|null); + + /** ProcessRequest rawDocument */ + rawDocument?: (google.cloud.documentai.v1.IRawDocument|null); + + /** ProcessRequest name */ + name?: (string|null); + + /** ProcessRequest skipHumanReview */ + skipHumanReview?: (boolean|null); + + /** ProcessRequest fieldMask */ + fieldMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents a ProcessRequest. */ + class ProcessRequest implements IProcessRequest { + + /** + * Constructs a new ProcessRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IProcessRequest); + + /** ProcessRequest inlineDocument. */ + public inlineDocument?: (google.cloud.documentai.v1.IDocument|null); + + /** ProcessRequest rawDocument. */ + public rawDocument?: (google.cloud.documentai.v1.IRawDocument|null); + + /** ProcessRequest name. */ + public name: string; + + /** ProcessRequest skipHumanReview. */ + public skipHumanReview: boolean; + + /** ProcessRequest fieldMask. */ + public fieldMask?: (google.protobuf.IFieldMask|null); + + /** ProcessRequest source. */ + public source?: ("inlineDocument"|"rawDocument"); + + /** + * Creates a new ProcessRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ProcessRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IProcessRequest): google.cloud.documentai.v1.ProcessRequest; + + /** + * Encodes the specified ProcessRequest message. Does not implicitly {@link google.cloud.documentai.v1.ProcessRequest.verify|verify} messages. + * @param message ProcessRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProcessRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessRequest.verify|verify} messages. + * @param message ProcessRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProcessRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ProcessRequest; + + /** + * Decodes a ProcessRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ProcessRequest; + + /** + * Verifies a ProcessRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProcessRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProcessRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ProcessRequest; + + /** + * Creates a plain object from a ProcessRequest message. Also converts values to other types if specified. * @param message ProcessRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1.ProcessRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1.ProcessRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProcessRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a HumanReviewStatus. */ + interface IHumanReviewStatus { + + /** HumanReviewStatus state */ + state?: (google.cloud.documentai.v1.HumanReviewStatus.State|keyof typeof google.cloud.documentai.v1.HumanReviewStatus.State|null); + + /** HumanReviewStatus stateMessage */ + stateMessage?: (string|null); + + /** HumanReviewStatus humanReviewOperation */ + humanReviewOperation?: (string|null); + } + + /** Represents a HumanReviewStatus. */ + class HumanReviewStatus implements IHumanReviewStatus { + + /** + * Constructs a new HumanReviewStatus. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IHumanReviewStatus); + + /** HumanReviewStatus state. */ + public state: (google.cloud.documentai.v1.HumanReviewStatus.State|keyof typeof google.cloud.documentai.v1.HumanReviewStatus.State); + + /** HumanReviewStatus stateMessage. */ + public stateMessage: string; + + /** HumanReviewStatus humanReviewOperation. */ + public humanReviewOperation: string; + + /** + * Creates a new HumanReviewStatus instance using the specified properties. + * @param [properties] Properties to set + * @returns HumanReviewStatus instance + */ + public static create(properties?: google.cloud.documentai.v1.IHumanReviewStatus): google.cloud.documentai.v1.HumanReviewStatus; + + /** + * Encodes the specified HumanReviewStatus message. Does not implicitly {@link google.cloud.documentai.v1.HumanReviewStatus.verify|verify} messages. + * @param message HumanReviewStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IHumanReviewStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HumanReviewStatus message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.HumanReviewStatus.verify|verify} messages. + * @param message HumanReviewStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IHumanReviewStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HumanReviewStatus message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HumanReviewStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.HumanReviewStatus; + + /** + * Decodes a HumanReviewStatus message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HumanReviewStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.HumanReviewStatus; + + /** + * Verifies a HumanReviewStatus message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HumanReviewStatus message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HumanReviewStatus + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.HumanReviewStatus; + + /** + * Creates a plain object from a HumanReviewStatus message. Also converts values to other types if specified. + * @param message HumanReviewStatus + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.HumanReviewStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HumanReviewStatus to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace HumanReviewStatus { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + SKIPPED = 1, + VALIDATION_PASSED = 2, + IN_PROGRESS = 3, + ERROR = 4 + } + } + + /** Properties of a ProcessResponse. */ + interface IProcessResponse { + + /** ProcessResponse document */ + document?: (google.cloud.documentai.v1.IDocument|null); + + /** ProcessResponse humanReviewStatus */ + humanReviewStatus?: (google.cloud.documentai.v1.IHumanReviewStatus|null); + } + + /** Represents a ProcessResponse. */ + class ProcessResponse implements IProcessResponse { + + /** + * Constructs a new ProcessResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IProcessResponse); + + /** ProcessResponse document. */ + public document?: (google.cloud.documentai.v1.IDocument|null); + + /** ProcessResponse humanReviewStatus. */ + public humanReviewStatus?: (google.cloud.documentai.v1.IHumanReviewStatus|null); + + /** + * Creates a new ProcessResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ProcessResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IProcessResponse): google.cloud.documentai.v1.ProcessResponse; + + /** + * Encodes the specified ProcessResponse message. Does not implicitly {@link google.cloud.documentai.v1.ProcessResponse.verify|verify} messages. + * @param message ProcessResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProcessResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessResponse.verify|verify} messages. + * @param message ProcessResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProcessResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProcessResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ProcessResponse; + + /** + * Decodes a ProcessResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProcessResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ProcessResponse; + + /** + * Verifies a ProcessResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProcessResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProcessResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ProcessResponse; + + /** + * Creates a plain object from a ProcessResponse message. Also converts values to other types if specified. + * @param message ProcessResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ProcessResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProcessResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BatchProcessRequest. */ + interface IBatchProcessRequest { + + /** BatchProcessRequest name */ + name?: (string|null); + + /** BatchProcessRequest inputDocuments */ + inputDocuments?: (google.cloud.documentai.v1.IBatchDocumentsInputConfig|null); + + /** BatchProcessRequest documentOutputConfig */ + documentOutputConfig?: (google.cloud.documentai.v1.IDocumentOutputConfig|null); + + /** BatchProcessRequest skipHumanReview */ + skipHumanReview?: (boolean|null); + } + + /** Represents a BatchProcessRequest. */ + class BatchProcessRequest implements IBatchProcessRequest { + + /** + * Constructs a new BatchProcessRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IBatchProcessRequest); + + /** BatchProcessRequest name. */ + public name: string; + + /** BatchProcessRequest inputDocuments. */ + public inputDocuments?: (google.cloud.documentai.v1.IBatchDocumentsInputConfig|null); + + /** BatchProcessRequest documentOutputConfig. */ + public documentOutputConfig?: (google.cloud.documentai.v1.IDocumentOutputConfig|null); + + /** BatchProcessRequest skipHumanReview. */ + public skipHumanReview: boolean; + + /** + * Creates a new BatchProcessRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchProcessRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IBatchProcessRequest): google.cloud.documentai.v1.BatchProcessRequest; + + /** + * Encodes the specified BatchProcessRequest message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessRequest.verify|verify} messages. + * @param message BatchProcessRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IBatchProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchProcessRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessRequest.verify|verify} messages. + * @param message BatchProcessRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IBatchProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchProcessRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.BatchProcessRequest; + + /** + * Decodes a BatchProcessRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchProcessRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.BatchProcessRequest; + + /** + * Verifies a BatchProcessRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchProcessRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchProcessRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchProcessRequest; + + /** + * Creates a plain object from a BatchProcessRequest message. Also converts values to other types if specified. + * @param message BatchProcessRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.BatchProcessRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchProcessRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BatchProcessResponse. */ + interface IBatchProcessResponse { + } + + /** Represents a BatchProcessResponse. */ + class BatchProcessResponse implements IBatchProcessResponse { + + /** + * Constructs a new BatchProcessResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IBatchProcessResponse); + + /** + * Creates a new BatchProcessResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchProcessResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IBatchProcessResponse): google.cloud.documentai.v1.BatchProcessResponse; + + /** + * Encodes the specified BatchProcessResponse message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessResponse.verify|verify} messages. + * @param message BatchProcessResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IBatchProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchProcessResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessResponse.verify|verify} messages. + * @param message BatchProcessResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IBatchProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchProcessResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchProcessResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.BatchProcessResponse; + + /** + * Decodes a BatchProcessResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchProcessResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.BatchProcessResponse; + + /** + * Verifies a BatchProcessResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchProcessResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchProcessResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchProcessResponse; + + /** + * Creates a plain object from a BatchProcessResponse message. Also converts values to other types if specified. + * @param message BatchProcessResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.BatchProcessResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchProcessResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BatchProcessMetadata. */ + interface IBatchProcessMetadata { + + /** BatchProcessMetadata state */ + state?: (google.cloud.documentai.v1.BatchProcessMetadata.State|keyof typeof google.cloud.documentai.v1.BatchProcessMetadata.State|null); + + /** BatchProcessMetadata stateMessage */ + stateMessage?: (string|null); + + /** BatchProcessMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** BatchProcessMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** BatchProcessMetadata individualProcessStatuses */ + individualProcessStatuses?: (google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus[]|null); + } + + /** Represents a BatchProcessMetadata. */ + class BatchProcessMetadata implements IBatchProcessMetadata { + + /** + * Constructs a new BatchProcessMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IBatchProcessMetadata); + + /** BatchProcessMetadata state. */ + public state: (google.cloud.documentai.v1.BatchProcessMetadata.State|keyof typeof google.cloud.documentai.v1.BatchProcessMetadata.State); + + /** BatchProcessMetadata stateMessage. */ + public stateMessage: string; + + /** BatchProcessMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** BatchProcessMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** BatchProcessMetadata individualProcessStatuses. */ + public individualProcessStatuses: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus[]; + + /** + * Creates a new BatchProcessMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchProcessMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1.IBatchProcessMetadata): google.cloud.documentai.v1.BatchProcessMetadata; + + /** + * Encodes the specified BatchProcessMetadata message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.verify|verify} messages. + * @param message BatchProcessMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IBatchProcessMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchProcessMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.verify|verify} messages. + * @param message BatchProcessMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IBatchProcessMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchProcessMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchProcessMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.BatchProcessMetadata; + + /** + * Decodes a BatchProcessMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchProcessMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.BatchProcessMetadata; + + /** + * Verifies a BatchProcessMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchProcessMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchProcessMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchProcessMetadata; + + /** + * Creates a plain object from a BatchProcessMetadata message. Also converts values to other types if specified. + * @param message BatchProcessMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.BatchProcessMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchProcessMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace BatchProcessMetadata { + + /** Properties of an IndividualProcessStatus. */ + interface IIndividualProcessStatus { + + /** IndividualProcessStatus inputGcsSource */ + inputGcsSource?: (string|null); + + /** IndividualProcessStatus status */ + status?: (google.rpc.IStatus|null); + + /** IndividualProcessStatus outputGcsDestination */ + outputGcsDestination?: (string|null); + + /** IndividualProcessStatus humanReviewStatus */ + humanReviewStatus?: (google.cloud.documentai.v1.IHumanReviewStatus|null); + } + + /** Represents an IndividualProcessStatus. */ + class IndividualProcessStatus implements IIndividualProcessStatus { + + /** + * Constructs a new IndividualProcessStatus. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus); + + /** IndividualProcessStatus inputGcsSource. */ + public inputGcsSource: string; + + /** IndividualProcessStatus status. */ + public status?: (google.rpc.IStatus|null); + + /** IndividualProcessStatus outputGcsDestination. */ + public outputGcsDestination: string; + + /** IndividualProcessStatus humanReviewStatus. */ + public humanReviewStatus?: (google.cloud.documentai.v1.IHumanReviewStatus|null); + + /** + * Creates a new IndividualProcessStatus instance using the specified properties. + * @param [properties] Properties to set + * @returns IndividualProcessStatus instance + */ + public static create(properties?: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus): google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus; + + /** + * Encodes the specified IndividualProcessStatus message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.verify|verify} messages. + * @param message IndividualProcessStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IndividualProcessStatus message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.verify|verify} messages. + * @param message IndividualProcessStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IndividualProcessStatus message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IndividualProcessStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus; + + /** + * Decodes an IndividualProcessStatus message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IndividualProcessStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus; + + /** + * Verifies an IndividualProcessStatus message. + * @param message Plain 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 IndividualProcessStatus message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IndividualProcessStatus + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus; + + /** + * Creates a plain object from an IndividualProcessStatus message. Also converts values to other types if specified. + * @param message IndividualProcessStatus + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IndividualProcessStatus to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + WAITING = 1, + RUNNING = 2, + SUCCEEDED = 3, + CANCELLING = 4, + CANCELLED = 5, + FAILED = 6 + } + } + + /** Properties of a FetchProcessorTypesRequest. */ + interface IFetchProcessorTypesRequest { + + /** FetchProcessorTypesRequest parent */ + parent?: (string|null); + } + + /** Represents a FetchProcessorTypesRequest. */ + class FetchProcessorTypesRequest implements IFetchProcessorTypesRequest { + + /** + * Constructs a new FetchProcessorTypesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IFetchProcessorTypesRequest); + + /** FetchProcessorTypesRequest parent. */ + public parent: string; + + /** + * Creates a new FetchProcessorTypesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns FetchProcessorTypesRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IFetchProcessorTypesRequest): google.cloud.documentai.v1.FetchProcessorTypesRequest; + + /** + * Encodes the specified FetchProcessorTypesRequest message. Does not implicitly {@link google.cloud.documentai.v1.FetchProcessorTypesRequest.verify|verify} messages. + * @param message FetchProcessorTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IFetchProcessorTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FetchProcessorTypesRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.FetchProcessorTypesRequest.verify|verify} messages. + * @param message FetchProcessorTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IFetchProcessorTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FetchProcessorTypesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FetchProcessorTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.FetchProcessorTypesRequest; + + /** + * Decodes a FetchProcessorTypesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FetchProcessorTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.FetchProcessorTypesRequest; + + /** + * Verifies a FetchProcessorTypesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FetchProcessorTypesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FetchProcessorTypesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.FetchProcessorTypesRequest; + + /** + * Creates a plain object from a FetchProcessorTypesRequest message. Also converts values to other types if specified. + * @param message FetchProcessorTypesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.FetchProcessorTypesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FetchProcessorTypesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FetchProcessorTypesResponse. */ + interface IFetchProcessorTypesResponse { + + /** FetchProcessorTypesResponse processorTypes */ + processorTypes?: (google.cloud.documentai.v1.IProcessorType[]|null); + } + + /** Represents a FetchProcessorTypesResponse. */ + class FetchProcessorTypesResponse implements IFetchProcessorTypesResponse { + + /** + * Constructs a new FetchProcessorTypesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IFetchProcessorTypesResponse); + + /** FetchProcessorTypesResponse processorTypes. */ + public processorTypes: google.cloud.documentai.v1.IProcessorType[]; + + /** + * Creates a new FetchProcessorTypesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns FetchProcessorTypesResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IFetchProcessorTypesResponse): google.cloud.documentai.v1.FetchProcessorTypesResponse; + + /** + * Encodes the specified FetchProcessorTypesResponse message. Does not implicitly {@link google.cloud.documentai.v1.FetchProcessorTypesResponse.verify|verify} messages. + * @param message FetchProcessorTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IFetchProcessorTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FetchProcessorTypesResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.FetchProcessorTypesResponse.verify|verify} messages. + * @param message FetchProcessorTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IFetchProcessorTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FetchProcessorTypesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FetchProcessorTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.FetchProcessorTypesResponse; + + /** + * Decodes a FetchProcessorTypesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FetchProcessorTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.FetchProcessorTypesResponse; + + /** + * Verifies a FetchProcessorTypesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FetchProcessorTypesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FetchProcessorTypesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.FetchProcessorTypesResponse; + + /** + * Creates a plain object from a FetchProcessorTypesResponse message. Also converts values to other types if specified. + * @param message FetchProcessorTypesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.FetchProcessorTypesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FetchProcessorTypesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListProcessorTypesRequest. */ + interface IListProcessorTypesRequest { + + /** ListProcessorTypesRequest parent */ + parent?: (string|null); + + /** ListProcessorTypesRequest pageSize */ + pageSize?: (number|null); + + /** ListProcessorTypesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListProcessorTypesRequest. */ + class ListProcessorTypesRequest implements IListProcessorTypesRequest { + + /** + * Constructs a new ListProcessorTypesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IListProcessorTypesRequest); + + /** ListProcessorTypesRequest parent. */ + public parent: string; + + /** ListProcessorTypesRequest pageSize. */ + public pageSize: number; + + /** ListProcessorTypesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListProcessorTypesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProcessorTypesRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IListProcessorTypesRequest): google.cloud.documentai.v1.ListProcessorTypesRequest; + + /** + * Encodes the specified ListProcessorTypesRequest message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorTypesRequest.verify|verify} messages. + * @param message ListProcessorTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IListProcessorTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListProcessorTypesRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorTypesRequest.verify|verify} messages. + * @param message ListProcessorTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IListProcessorTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListProcessorTypesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProcessorTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ListProcessorTypesRequest; + + /** + * Decodes a ListProcessorTypesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProcessorTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ListProcessorTypesRequest; + + /** + * Verifies a ListProcessorTypesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListProcessorTypesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProcessorTypesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ListProcessorTypesRequest; + + /** + * Creates a plain object from a ListProcessorTypesRequest message. Also converts values to other types if specified. + * @param message ListProcessorTypesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ListProcessorTypesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProcessorTypesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListProcessorTypesResponse. */ + interface IListProcessorTypesResponse { + + /** ListProcessorTypesResponse processorTypes */ + processorTypes?: (google.cloud.documentai.v1.IProcessorType[]|null); + + /** ListProcessorTypesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListProcessorTypesResponse. */ + class ListProcessorTypesResponse implements IListProcessorTypesResponse { + + /** + * Constructs a new ListProcessorTypesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IListProcessorTypesResponse); + + /** ListProcessorTypesResponse processorTypes. */ + public processorTypes: google.cloud.documentai.v1.IProcessorType[]; + + /** ListProcessorTypesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListProcessorTypesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProcessorTypesResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IListProcessorTypesResponse): google.cloud.documentai.v1.ListProcessorTypesResponse; + + /** + * Encodes the specified ListProcessorTypesResponse message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorTypesResponse.verify|verify} messages. + * @param message ListProcessorTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IListProcessorTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListProcessorTypesResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorTypesResponse.verify|verify} messages. + * @param message ListProcessorTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IListProcessorTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListProcessorTypesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProcessorTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ListProcessorTypesResponse; + + /** + * Decodes a ListProcessorTypesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProcessorTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ListProcessorTypesResponse; + + /** + * Verifies a ListProcessorTypesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListProcessorTypesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProcessorTypesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ListProcessorTypesResponse; + + /** + * Creates a plain object from a ListProcessorTypesResponse message. Also converts values to other types if specified. + * @param message ListProcessorTypesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ListProcessorTypesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProcessorTypesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListProcessorsRequest. */ + interface IListProcessorsRequest { + + /** ListProcessorsRequest parent */ + parent?: (string|null); + + /** ListProcessorsRequest pageSize */ + pageSize?: (number|null); + + /** ListProcessorsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListProcessorsRequest. */ + class ListProcessorsRequest implements IListProcessorsRequest { + + /** + * Constructs a new ListProcessorsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IListProcessorsRequest); + + /** ListProcessorsRequest parent. */ + public parent: string; + + /** ListProcessorsRequest pageSize. */ + public pageSize: number; + + /** ListProcessorsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListProcessorsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProcessorsRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IListProcessorsRequest): google.cloud.documentai.v1.ListProcessorsRequest; + + /** + * Encodes the specified ListProcessorsRequest message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorsRequest.verify|verify} messages. + * @param message ListProcessorsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IListProcessorsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListProcessorsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorsRequest.verify|verify} messages. + * @param message ListProcessorsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IListProcessorsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListProcessorsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProcessorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ListProcessorsRequest; + + /** + * Decodes a ListProcessorsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProcessorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ListProcessorsRequest; + + /** + * Verifies a ListProcessorsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListProcessorsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProcessorsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ListProcessorsRequest; + + /** + * Creates a plain object from a ListProcessorsRequest message. Also converts values to other types if specified. + * @param message ListProcessorsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ListProcessorsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProcessorsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListProcessorsResponse. */ + interface IListProcessorsResponse { + + /** ListProcessorsResponse processors */ + processors?: (google.cloud.documentai.v1.IProcessor[]|null); + + /** ListProcessorsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListProcessorsResponse. */ + class ListProcessorsResponse implements IListProcessorsResponse { + + /** + * Constructs a new ListProcessorsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IListProcessorsResponse); + + /** ListProcessorsResponse processors. */ + public processors: google.cloud.documentai.v1.IProcessor[]; + + /** ListProcessorsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListProcessorsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProcessorsResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IListProcessorsResponse): google.cloud.documentai.v1.ListProcessorsResponse; + + /** + * Encodes the specified ListProcessorsResponse message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorsResponse.verify|verify} messages. + * @param message ListProcessorsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IListProcessorsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListProcessorsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorsResponse.verify|verify} messages. + * @param message ListProcessorsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IListProcessorsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListProcessorsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProcessorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ListProcessorsResponse; + + /** + * Decodes a ListProcessorsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProcessorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ListProcessorsResponse; + + /** + * Verifies a ListProcessorsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListProcessorsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProcessorsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ListProcessorsResponse; + + /** + * Creates a plain object from a ListProcessorsResponse message. Also converts values to other types if specified. + * @param message ListProcessorsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ListProcessorsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProcessorsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetProcessorRequest. */ + interface IGetProcessorRequest { + + /** GetProcessorRequest name */ + name?: (string|null); + } + + /** Represents a GetProcessorRequest. */ + class GetProcessorRequest implements IGetProcessorRequest { + + /** + * Constructs a new GetProcessorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IGetProcessorRequest); + + /** GetProcessorRequest name. */ + public name: string; + + /** + * Creates a new GetProcessorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetProcessorRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IGetProcessorRequest): google.cloud.documentai.v1.GetProcessorRequest; + + /** + * Encodes the specified GetProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1.GetProcessorRequest.verify|verify} messages. + * @param message GetProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IGetProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.GetProcessorRequest.verify|verify} messages. + * @param message GetProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IGetProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetProcessorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.GetProcessorRequest; + + /** + * Decodes a GetProcessorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.GetProcessorRequest; + + /** + * Verifies a GetProcessorRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetProcessorRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.GetProcessorRequest; + + /** + * Creates a plain object from a GetProcessorRequest message. Also converts values to other types if specified. + * @param message GetProcessorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.GetProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetProcessorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetProcessorVersionRequest. */ + interface IGetProcessorVersionRequest { + + /** GetProcessorVersionRequest name */ + name?: (string|null); + } + + /** Represents a GetProcessorVersionRequest. */ + class GetProcessorVersionRequest implements IGetProcessorVersionRequest { + + /** + * Constructs a new GetProcessorVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IGetProcessorVersionRequest); + + /** GetProcessorVersionRequest name. */ + public name: string; + + /** + * Creates a new GetProcessorVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetProcessorVersionRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IGetProcessorVersionRequest): google.cloud.documentai.v1.GetProcessorVersionRequest; + + /** + * Encodes the specified GetProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1.GetProcessorVersionRequest.verify|verify} messages. + * @param message GetProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IGetProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.GetProcessorVersionRequest.verify|verify} messages. + * @param message GetProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IGetProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetProcessorVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.GetProcessorVersionRequest; + + /** + * Decodes a GetProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.GetProcessorVersionRequest; + + /** + * Verifies a GetProcessorVersionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetProcessorVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.GetProcessorVersionRequest; + + /** + * Creates a plain object from a GetProcessorVersionRequest message. Also converts values to other types if specified. + * @param message GetProcessorVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.GetProcessorVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetProcessorVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListProcessorVersionsRequest. */ + interface IListProcessorVersionsRequest { + + /** ListProcessorVersionsRequest parent */ + parent?: (string|null); + + /** ListProcessorVersionsRequest pageSize */ + pageSize?: (number|null); + + /** ListProcessorVersionsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListProcessorVersionsRequest. */ + class ListProcessorVersionsRequest implements IListProcessorVersionsRequest { + + /** + * Constructs a new ListProcessorVersionsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IListProcessorVersionsRequest); + + /** ListProcessorVersionsRequest parent. */ + public parent: string; + + /** ListProcessorVersionsRequest pageSize. */ + public pageSize: number; + + /** ListProcessorVersionsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListProcessorVersionsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProcessorVersionsRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IListProcessorVersionsRequest): google.cloud.documentai.v1.ListProcessorVersionsRequest; + + /** + * Encodes the specified ListProcessorVersionsRequest message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorVersionsRequest.verify|verify} messages. + * @param message ListProcessorVersionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IListProcessorVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListProcessorVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorVersionsRequest.verify|verify} messages. + * @param message ListProcessorVersionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IListProcessorVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListProcessorVersionsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProcessorVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ListProcessorVersionsRequest; + + /** + * Decodes a ListProcessorVersionsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProcessorVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ListProcessorVersionsRequest; + + /** + * Verifies a ListProcessorVersionsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListProcessorVersionsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProcessorVersionsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ListProcessorVersionsRequest; + + /** + * Creates a plain object from a ListProcessorVersionsRequest message. Also converts values to other types if specified. + * @param message ListProcessorVersionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ListProcessorVersionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProcessorVersionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListProcessorVersionsResponse. */ + interface IListProcessorVersionsResponse { + + /** ListProcessorVersionsResponse processorVersions */ + processorVersions?: (google.cloud.documentai.v1.IProcessorVersion[]|null); + + /** ListProcessorVersionsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListProcessorVersionsResponse. */ + class ListProcessorVersionsResponse implements IListProcessorVersionsResponse { + + /** + * Constructs a new ListProcessorVersionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IListProcessorVersionsResponse); + + /** ListProcessorVersionsResponse processorVersions. */ + public processorVersions: google.cloud.documentai.v1.IProcessorVersion[]; + + /** ListProcessorVersionsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListProcessorVersionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProcessorVersionsResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IListProcessorVersionsResponse): google.cloud.documentai.v1.ListProcessorVersionsResponse; + + /** + * Encodes the specified ListProcessorVersionsResponse message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorVersionsResponse.verify|verify} messages. + * @param message ListProcessorVersionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IListProcessorVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListProcessorVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorVersionsResponse.verify|verify} messages. + * @param message ListProcessorVersionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IListProcessorVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListProcessorVersionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProcessorVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ListProcessorVersionsResponse; + + /** + * Decodes a ListProcessorVersionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProcessorVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ListProcessorVersionsResponse; + + /** + * Verifies a ListProcessorVersionsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListProcessorVersionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProcessorVersionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ListProcessorVersionsResponse; + + /** + * Creates a plain object from a ListProcessorVersionsResponse message. Also converts values to other types if specified. + * @param message ListProcessorVersionsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ListProcessorVersionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProcessorVersionsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteProcessorVersionRequest. */ + interface IDeleteProcessorVersionRequest { + + /** DeleteProcessorVersionRequest name */ + name?: (string|null); + } + + /** Represents a DeleteProcessorVersionRequest. */ + class DeleteProcessorVersionRequest implements IDeleteProcessorVersionRequest { + + /** + * Constructs a new DeleteProcessorVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDeleteProcessorVersionRequest); + + /** DeleteProcessorVersionRequest name. */ + public name: string; + + /** + * Creates a new DeleteProcessorVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteProcessorVersionRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IDeleteProcessorVersionRequest): google.cloud.documentai.v1.DeleteProcessorVersionRequest; + + /** + * Encodes the specified DeleteProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorVersionRequest.verify|verify} messages. + * @param message DeleteProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDeleteProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorVersionRequest.verify|verify} messages. + * @param message DeleteProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDeleteProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteProcessorVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.DeleteProcessorVersionRequest; + + /** + * Decodes a DeleteProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.DeleteProcessorVersionRequest; + + /** + * Verifies a DeleteProcessorVersionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteProcessorVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DeleteProcessorVersionRequest; + + /** + * Creates a plain object from a DeleteProcessorVersionRequest message. Also converts values to other types if specified. + * @param message DeleteProcessorVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DeleteProcessorVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteProcessorVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteProcessorVersionMetadata. */ + interface IDeleteProcessorVersionMetadata { + + /** DeleteProcessorVersionMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + } + + /** Represents a DeleteProcessorVersionMetadata. */ + class DeleteProcessorVersionMetadata implements IDeleteProcessorVersionMetadata { + + /** + * Constructs a new DeleteProcessorVersionMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDeleteProcessorVersionMetadata); + + /** DeleteProcessorVersionMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + + /** + * Creates a new DeleteProcessorVersionMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteProcessorVersionMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1.IDeleteProcessorVersionMetadata): google.cloud.documentai.v1.DeleteProcessorVersionMetadata; + + /** + * Encodes the specified DeleteProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorVersionMetadata.verify|verify} messages. + * @param message DeleteProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDeleteProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorVersionMetadata.verify|verify} messages. + * @param message DeleteProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDeleteProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteProcessorVersionMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.DeleteProcessorVersionMetadata; + + /** + * Decodes a DeleteProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.DeleteProcessorVersionMetadata; + + /** + * Verifies a DeleteProcessorVersionMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteProcessorVersionMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DeleteProcessorVersionMetadata; + + /** + * Creates a plain object from a DeleteProcessorVersionMetadata message. Also converts values to other types if specified. + * @param message DeleteProcessorVersionMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DeleteProcessorVersionMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteProcessorVersionMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeployProcessorVersionRequest. */ + interface IDeployProcessorVersionRequest { + + /** DeployProcessorVersionRequest name */ + name?: (string|null); + } + + /** Represents a DeployProcessorVersionRequest. */ + class DeployProcessorVersionRequest implements IDeployProcessorVersionRequest { + + /** + * Constructs a new DeployProcessorVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDeployProcessorVersionRequest); + + /** DeployProcessorVersionRequest name. */ + public name: string; + + /** + * Creates a new DeployProcessorVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeployProcessorVersionRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IDeployProcessorVersionRequest): google.cloud.documentai.v1.DeployProcessorVersionRequest; + + /** + * Encodes the specified DeployProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionRequest.verify|verify} messages. + * @param message DeployProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDeployProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeployProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionRequest.verify|verify} messages. + * @param message DeployProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDeployProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeployProcessorVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeployProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.DeployProcessorVersionRequest; + + /** + * Decodes a DeployProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeployProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.DeployProcessorVersionRequest; + + /** + * Verifies a DeployProcessorVersionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeployProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeployProcessorVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DeployProcessorVersionRequest; + + /** + * Creates a plain object from a DeployProcessorVersionRequest message. Also converts values to other types if specified. + * @param message DeployProcessorVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DeployProcessorVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeployProcessorVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeployProcessorVersionResponse. */ + interface IDeployProcessorVersionResponse { + } + + /** Represents a DeployProcessorVersionResponse. */ + class DeployProcessorVersionResponse implements IDeployProcessorVersionResponse { + + /** + * Constructs a new DeployProcessorVersionResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDeployProcessorVersionResponse); + + /** + * Creates a new DeployProcessorVersionResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DeployProcessorVersionResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IDeployProcessorVersionResponse): google.cloud.documentai.v1.DeployProcessorVersionResponse; + + /** + * Encodes the specified DeployProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionResponse.verify|verify} messages. + * @param message DeployProcessorVersionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDeployProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeployProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionResponse.verify|verify} messages. + * @param message DeployProcessorVersionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDeployProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeployProcessorVersionResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeployProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.DeployProcessorVersionResponse; + + /** + * Decodes a DeployProcessorVersionResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeployProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.DeployProcessorVersionResponse; + + /** + * Verifies a DeployProcessorVersionResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeployProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeployProcessorVersionResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DeployProcessorVersionResponse; + + /** + * Creates a plain object from a DeployProcessorVersionResponse message. Also converts values to other types if specified. + * @param message DeployProcessorVersionResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DeployProcessorVersionResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeployProcessorVersionResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeployProcessorVersionMetadata. */ + interface IDeployProcessorVersionMetadata { + + /** DeployProcessorVersionMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + } + + /** Represents a DeployProcessorVersionMetadata. */ + class DeployProcessorVersionMetadata implements IDeployProcessorVersionMetadata { + + /** + * Constructs a new DeployProcessorVersionMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDeployProcessorVersionMetadata); + + /** DeployProcessorVersionMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + + /** + * Creates a new DeployProcessorVersionMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DeployProcessorVersionMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1.IDeployProcessorVersionMetadata): google.cloud.documentai.v1.DeployProcessorVersionMetadata; + + /** + * Encodes the specified DeployProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionMetadata.verify|verify} messages. + * @param message DeployProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDeployProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeployProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionMetadata.verify|verify} messages. + * @param message DeployProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDeployProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeployProcessorVersionMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeployProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.DeployProcessorVersionMetadata; + + /** + * Decodes a DeployProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeployProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.DeployProcessorVersionMetadata; + + /** + * Verifies a DeployProcessorVersionMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeployProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeployProcessorVersionMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DeployProcessorVersionMetadata; + + /** + * Creates a plain object from a DeployProcessorVersionMetadata message. Also converts values to other types if specified. + * @param message DeployProcessorVersionMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DeployProcessorVersionMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeployProcessorVersionMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UndeployProcessorVersionRequest. */ + interface IUndeployProcessorVersionRequest { + + /** UndeployProcessorVersionRequest name */ + name?: (string|null); + } + + /** Represents an UndeployProcessorVersionRequest. */ + class UndeployProcessorVersionRequest implements IUndeployProcessorVersionRequest { + + /** + * Constructs a new UndeployProcessorVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IUndeployProcessorVersionRequest); + + /** UndeployProcessorVersionRequest name. */ + public name: string; + + /** + * Creates a new UndeployProcessorVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UndeployProcessorVersionRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IUndeployProcessorVersionRequest): google.cloud.documentai.v1.UndeployProcessorVersionRequest; + + /** + * Encodes the specified UndeployProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionRequest.verify|verify} messages. + * @param message UndeployProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IUndeployProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UndeployProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionRequest.verify|verify} messages. + * @param message UndeployProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IUndeployProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UndeployProcessorVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UndeployProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.UndeployProcessorVersionRequest; + + /** + * Decodes an UndeployProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UndeployProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.UndeployProcessorVersionRequest; + + /** + * Verifies an UndeployProcessorVersionRequest message. + * @param message Plain 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 UndeployProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UndeployProcessorVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.UndeployProcessorVersionRequest; + + /** + * Creates a plain object from an UndeployProcessorVersionRequest message. Also converts values to other types if specified. + * @param message UndeployProcessorVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.UndeployProcessorVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UndeployProcessorVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UndeployProcessorVersionResponse. */ + interface IUndeployProcessorVersionResponse { + } + + /** Represents an UndeployProcessorVersionResponse. */ + class UndeployProcessorVersionResponse implements IUndeployProcessorVersionResponse { + + /** + * Constructs a new UndeployProcessorVersionResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IUndeployProcessorVersionResponse); + + /** + * Creates a new UndeployProcessorVersionResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns UndeployProcessorVersionResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IUndeployProcessorVersionResponse): google.cloud.documentai.v1.UndeployProcessorVersionResponse; + + /** + * Encodes the specified UndeployProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionResponse.verify|verify} messages. + * @param message UndeployProcessorVersionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IUndeployProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UndeployProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionResponse.verify|verify} messages. + * @param message UndeployProcessorVersionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IUndeployProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UndeployProcessorVersionResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UndeployProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.UndeployProcessorVersionResponse; + + /** + * Decodes an UndeployProcessorVersionResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UndeployProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.UndeployProcessorVersionResponse; + + /** + * Verifies an UndeployProcessorVersionResponse message. + * @param message Plain 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 UndeployProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UndeployProcessorVersionResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.UndeployProcessorVersionResponse; + + /** + * Creates a plain object from an UndeployProcessorVersionResponse message. Also converts values to other types if specified. + * @param message UndeployProcessorVersionResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.UndeployProcessorVersionResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UndeployProcessorVersionResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UndeployProcessorVersionMetadata. */ + interface IUndeployProcessorVersionMetadata { + + /** UndeployProcessorVersionMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + } + + /** Represents an UndeployProcessorVersionMetadata. */ + class UndeployProcessorVersionMetadata implements IUndeployProcessorVersionMetadata { + + /** + * Constructs a new UndeployProcessorVersionMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IUndeployProcessorVersionMetadata); + + /** UndeployProcessorVersionMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + + /** + * Creates a new UndeployProcessorVersionMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns UndeployProcessorVersionMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1.IUndeployProcessorVersionMetadata): google.cloud.documentai.v1.UndeployProcessorVersionMetadata; + + /** + * Encodes the specified UndeployProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionMetadata.verify|verify} messages. + * @param message UndeployProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IUndeployProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UndeployProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionMetadata.verify|verify} messages. + * @param message UndeployProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IUndeployProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UndeployProcessorVersionMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UndeployProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.UndeployProcessorVersionMetadata; + + /** + * Decodes an UndeployProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UndeployProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.UndeployProcessorVersionMetadata; + + /** + * Verifies an UndeployProcessorVersionMetadata message. + * @param message Plain 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 UndeployProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UndeployProcessorVersionMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.UndeployProcessorVersionMetadata; + + /** + * Creates a plain object from an UndeployProcessorVersionMetadata message. Also converts values to other types if specified. + * @param message UndeployProcessorVersionMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.UndeployProcessorVersionMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UndeployProcessorVersionMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateProcessorRequest. */ + interface ICreateProcessorRequest { + + /** CreateProcessorRequest parent */ + parent?: (string|null); + + /** CreateProcessorRequest processor */ + processor?: (google.cloud.documentai.v1.IProcessor|null); + } + + /** Represents a CreateProcessorRequest. */ + class CreateProcessorRequest implements ICreateProcessorRequest { + + /** + * Constructs a new CreateProcessorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.ICreateProcessorRequest); + + /** CreateProcessorRequest parent. */ + public parent: string; + + /** CreateProcessorRequest processor. */ + public processor?: (google.cloud.documentai.v1.IProcessor|null); + + /** + * Creates a new CreateProcessorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateProcessorRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.ICreateProcessorRequest): google.cloud.documentai.v1.CreateProcessorRequest; + + /** + * Encodes the specified CreateProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1.CreateProcessorRequest.verify|verify} messages. + * @param message CreateProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.ICreateProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.CreateProcessorRequest.verify|verify} messages. + * @param message CreateProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.ICreateProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateProcessorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.CreateProcessorRequest; + + /** + * Decodes a CreateProcessorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.CreateProcessorRequest; + + /** + * Verifies a CreateProcessorRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateProcessorRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.CreateProcessorRequest; + + /** + * Creates a plain object from a CreateProcessorRequest message. Also converts values to other types if specified. + * @param message CreateProcessorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.CreateProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateProcessorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteProcessorRequest. */ + interface IDeleteProcessorRequest { + + /** DeleteProcessorRequest name */ + name?: (string|null); + } + + /** Represents a DeleteProcessorRequest. */ + class DeleteProcessorRequest implements IDeleteProcessorRequest { + + /** + * Constructs a new DeleteProcessorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDeleteProcessorRequest); + + /** DeleteProcessorRequest name. */ + public name: string; + + /** + * Creates a new DeleteProcessorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteProcessorRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IDeleteProcessorRequest): google.cloud.documentai.v1.DeleteProcessorRequest; + + /** + * Encodes the specified DeleteProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorRequest.verify|verify} messages. + * @param message DeleteProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDeleteProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorRequest.verify|verify} messages. + * @param message DeleteProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDeleteProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteProcessorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.DeleteProcessorRequest; + + /** + * Decodes a DeleteProcessorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.DeleteProcessorRequest; + + /** + * Verifies a DeleteProcessorRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteProcessorRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DeleteProcessorRequest; + + /** + * Creates a plain object from a DeleteProcessorRequest message. Also converts values to other types if specified. + * @param message DeleteProcessorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DeleteProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteProcessorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteProcessorMetadata. */ + interface IDeleteProcessorMetadata { + + /** DeleteProcessorMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + } + + /** Represents a DeleteProcessorMetadata. */ + class DeleteProcessorMetadata implements IDeleteProcessorMetadata { + + /** + * Constructs a new DeleteProcessorMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDeleteProcessorMetadata); + + /** DeleteProcessorMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + + /** + * Creates a new DeleteProcessorMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteProcessorMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1.IDeleteProcessorMetadata): google.cloud.documentai.v1.DeleteProcessorMetadata; + + /** + * Encodes the specified DeleteProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorMetadata.verify|verify} messages. + * @param message DeleteProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDeleteProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorMetadata.verify|verify} messages. + * @param message DeleteProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDeleteProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteProcessorMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.DeleteProcessorMetadata; + + /** + * Decodes a DeleteProcessorMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.DeleteProcessorMetadata; + + /** + * Verifies a DeleteProcessorMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteProcessorMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DeleteProcessorMetadata; + + /** + * Creates a plain object from a DeleteProcessorMetadata message. Also converts values to other types if specified. + * @param message DeleteProcessorMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DeleteProcessorMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteProcessorMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnableProcessorRequest. */ + interface IEnableProcessorRequest { + + /** EnableProcessorRequest name */ + name?: (string|null); + } + + /** Represents an EnableProcessorRequest. */ + class EnableProcessorRequest implements IEnableProcessorRequest { + + /** + * Constructs a new EnableProcessorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IEnableProcessorRequest); + + /** EnableProcessorRequest name. */ + public name: string; + + /** + * Creates a new EnableProcessorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns EnableProcessorRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IEnableProcessorRequest): google.cloud.documentai.v1.EnableProcessorRequest; + + /** + * Encodes the specified EnableProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorRequest.verify|verify} messages. + * @param message EnableProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IEnableProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnableProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorRequest.verify|verify} messages. + * @param message EnableProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IEnableProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnableProcessorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.EnableProcessorRequest; + + /** + * Decodes an EnableProcessorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.EnableProcessorRequest; + + /** + * Verifies an EnableProcessorRequest message. + * @param message Plain 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 EnableProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnableProcessorRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.EnableProcessorRequest; + + /** + * Creates a plain object from an EnableProcessorRequest message. Also converts values to other types if specified. + * @param message EnableProcessorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.EnableProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnableProcessorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnableProcessorResponse. */ + interface IEnableProcessorResponse { + } + + /** Represents an EnableProcessorResponse. */ + class EnableProcessorResponse implements IEnableProcessorResponse { + + /** + * Constructs a new EnableProcessorResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IEnableProcessorResponse); + + /** + * Creates a new EnableProcessorResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns EnableProcessorResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IEnableProcessorResponse): google.cloud.documentai.v1.EnableProcessorResponse; + + /** + * Encodes the specified EnableProcessorResponse message. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorResponse.verify|verify} messages. + * @param message EnableProcessorResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IEnableProcessorResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnableProcessorResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorResponse.verify|verify} messages. + * @param message EnableProcessorResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IEnableProcessorResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnableProcessorResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.EnableProcessorResponse; + + /** + * Decodes an EnableProcessorResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.EnableProcessorResponse; + + /** + * Verifies an EnableProcessorResponse message. + * @param message Plain 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 EnableProcessorResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnableProcessorResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.EnableProcessorResponse; + + /** + * Creates a plain object from an EnableProcessorResponse message. Also converts values to other types if specified. + * @param message EnableProcessorResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.EnableProcessorResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnableProcessorResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnableProcessorMetadata. */ + interface IEnableProcessorMetadata { + + /** EnableProcessorMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + } + + /** Represents an EnableProcessorMetadata. */ + class EnableProcessorMetadata implements IEnableProcessorMetadata { + + /** + * Constructs a new EnableProcessorMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IEnableProcessorMetadata); + + /** EnableProcessorMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + + /** + * Creates a new EnableProcessorMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns EnableProcessorMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1.IEnableProcessorMetadata): google.cloud.documentai.v1.EnableProcessorMetadata; + + /** + * Encodes the specified EnableProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorMetadata.verify|verify} messages. + * @param message EnableProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IEnableProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnableProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorMetadata.verify|verify} messages. + * @param message EnableProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IEnableProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnableProcessorMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.EnableProcessorMetadata; + + /** + * Decodes an EnableProcessorMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.EnableProcessorMetadata; + + /** + * Verifies an EnableProcessorMetadata message. + * @param message Plain 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 EnableProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnableProcessorMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.EnableProcessorMetadata; + + /** + * Creates a plain object from an EnableProcessorMetadata message. Also converts values to other types if specified. + * @param message EnableProcessorMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.EnableProcessorMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnableProcessorMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DisableProcessorRequest. */ + interface IDisableProcessorRequest { + + /** DisableProcessorRequest name */ + name?: (string|null); + } + + /** Represents a DisableProcessorRequest. */ + class DisableProcessorRequest implements IDisableProcessorRequest { + + /** + * Constructs a new DisableProcessorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDisableProcessorRequest); + + /** DisableProcessorRequest name. */ + public name: string; + + /** + * Creates a new DisableProcessorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DisableProcessorRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IDisableProcessorRequest): google.cloud.documentai.v1.DisableProcessorRequest; + + /** + * Encodes the specified DisableProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorRequest.verify|verify} messages. + * @param message DisableProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDisableProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DisableProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorRequest.verify|verify} messages. + * @param message DisableProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDisableProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DisableProcessorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DisableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.DisableProcessorRequest; + + /** + * Decodes a DisableProcessorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DisableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.DisableProcessorRequest; + + /** + * Verifies a DisableProcessorRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DisableProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DisableProcessorRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DisableProcessorRequest; + + /** + * Creates a plain object from a DisableProcessorRequest message. Also converts values to other types if specified. + * @param message DisableProcessorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DisableProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DisableProcessorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DisableProcessorResponse. */ + interface IDisableProcessorResponse { + } + + /** Represents a DisableProcessorResponse. */ + class DisableProcessorResponse implements IDisableProcessorResponse { + + /** + * Constructs a new DisableProcessorResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDisableProcessorResponse); + + /** + * Creates a new DisableProcessorResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DisableProcessorResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IDisableProcessorResponse): google.cloud.documentai.v1.DisableProcessorResponse; + + /** + * Encodes the specified DisableProcessorResponse message. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorResponse.verify|verify} messages. + * @param message DisableProcessorResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDisableProcessorResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DisableProcessorResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorResponse.verify|verify} messages. + * @param message DisableProcessorResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDisableProcessorResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DisableProcessorResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DisableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.DisableProcessorResponse; + + /** + * Decodes a DisableProcessorResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DisableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.DisableProcessorResponse; + + /** + * Verifies a DisableProcessorResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DisableProcessorResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DisableProcessorResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DisableProcessorResponse; + + /** + * Creates a plain object from a DisableProcessorResponse message. Also converts values to other types if specified. + * @param message DisableProcessorResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DisableProcessorResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DisableProcessorResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DisableProcessorMetadata. */ + interface IDisableProcessorMetadata { + + /** DisableProcessorMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + } + + /** Represents a DisableProcessorMetadata. */ + class DisableProcessorMetadata implements IDisableProcessorMetadata { + + /** + * Constructs a new DisableProcessorMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDisableProcessorMetadata); + + /** DisableProcessorMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + + /** + * Creates a new DisableProcessorMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DisableProcessorMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1.IDisableProcessorMetadata): google.cloud.documentai.v1.DisableProcessorMetadata; + + /** + * Encodes the specified DisableProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorMetadata.verify|verify} messages. + * @param message DisableProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDisableProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DisableProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorMetadata.verify|verify} messages. + * @param message DisableProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDisableProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DisableProcessorMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DisableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.DisableProcessorMetadata; + + /** + * Decodes a DisableProcessorMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DisableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.DisableProcessorMetadata; + + /** + * Verifies a DisableProcessorMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DisableProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DisableProcessorMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DisableProcessorMetadata; + + /** + * Creates a plain object from a DisableProcessorMetadata message. Also converts values to other types if specified. + * @param message DisableProcessorMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DisableProcessorMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DisableProcessorMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SetDefaultProcessorVersionRequest. */ + interface ISetDefaultProcessorVersionRequest { + + /** SetDefaultProcessorVersionRequest processor */ + processor?: (string|null); + + /** SetDefaultProcessorVersionRequest defaultProcessorVersion */ + defaultProcessorVersion?: (string|null); + } + + /** Represents a SetDefaultProcessorVersionRequest. */ + class SetDefaultProcessorVersionRequest implements ISetDefaultProcessorVersionRequest { + + /** + * Constructs a new SetDefaultProcessorVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest); + + /** SetDefaultProcessorVersionRequest processor. */ + public processor: string; + + /** SetDefaultProcessorVersionRequest defaultProcessorVersion. */ + public defaultProcessorVersion: string; + + /** + * Creates a new SetDefaultProcessorVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SetDefaultProcessorVersionRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest): google.cloud.documentai.v1.SetDefaultProcessorVersionRequest; + + /** + * Encodes the specified SetDefaultProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionRequest.verify|verify} messages. + * @param message SetDefaultProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetDefaultProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionRequest.verify|verify} messages. + * @param message SetDefaultProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetDefaultProcessorVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetDefaultProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.SetDefaultProcessorVersionRequest; + + /** + * Decodes a SetDefaultProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetDefaultProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.SetDefaultProcessorVersionRequest; + + /** + * Verifies a SetDefaultProcessorVersionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetDefaultProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetDefaultProcessorVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.SetDefaultProcessorVersionRequest; + + /** + * Creates a plain object from a SetDefaultProcessorVersionRequest message. Also converts values to other types if specified. + * @param message SetDefaultProcessorVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.SetDefaultProcessorVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetDefaultProcessorVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SetDefaultProcessorVersionResponse. */ + interface ISetDefaultProcessorVersionResponse { + } + + /** Represents a SetDefaultProcessorVersionResponse. */ + class SetDefaultProcessorVersionResponse implements ISetDefaultProcessorVersionResponse { + + /** + * Constructs a new SetDefaultProcessorVersionResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse); + + /** + * Creates a new SetDefaultProcessorVersionResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SetDefaultProcessorVersionResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse): google.cloud.documentai.v1.SetDefaultProcessorVersionResponse; + + /** + * Encodes the specified SetDefaultProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionResponse.verify|verify} messages. + * @param message SetDefaultProcessorVersionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetDefaultProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionResponse.verify|verify} messages. + * @param message SetDefaultProcessorVersionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetDefaultProcessorVersionResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetDefaultProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.SetDefaultProcessorVersionResponse; + + /** + * Decodes a SetDefaultProcessorVersionResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetDefaultProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.SetDefaultProcessorVersionResponse; + + /** + * Verifies a SetDefaultProcessorVersionResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetDefaultProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetDefaultProcessorVersionResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.SetDefaultProcessorVersionResponse; + + /** + * Creates a plain object from a SetDefaultProcessorVersionResponse message. Also converts values to other types if specified. + * @param message SetDefaultProcessorVersionResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.SetDefaultProcessorVersionResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProcessRequest to JSON. + * Converts this SetDefaultProcessorVersionResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a HumanReviewStatus. */ - interface IHumanReviewStatus { + /** Properties of a SetDefaultProcessorVersionMetadata. */ + interface ISetDefaultProcessorVersionMetadata { - /** HumanReviewStatus state */ - state?: (google.cloud.documentai.v1.HumanReviewStatus.State|keyof typeof google.cloud.documentai.v1.HumanReviewStatus.State|null); + /** SetDefaultProcessorVersionMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + } - /** HumanReviewStatus stateMessage */ - stateMessage?: (string|null); + /** Represents a SetDefaultProcessorVersionMetadata. */ + class SetDefaultProcessorVersionMetadata implements ISetDefaultProcessorVersionMetadata { - /** HumanReviewStatus humanReviewOperation */ - humanReviewOperation?: (string|null); + /** + * Constructs a new SetDefaultProcessorVersionMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata); + + /** SetDefaultProcessorVersionMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + + /** + * Creates a new SetDefaultProcessorVersionMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns SetDefaultProcessorVersionMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata): google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata; + + /** + * Encodes the specified SetDefaultProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata.verify|verify} messages. + * @param message SetDefaultProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetDefaultProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata.verify|verify} messages. + * @param message SetDefaultProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetDefaultProcessorVersionMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetDefaultProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata; + + /** + * Decodes a SetDefaultProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetDefaultProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata; + + /** + * Verifies a SetDefaultProcessorVersionMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetDefaultProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetDefaultProcessorVersionMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata; + + /** + * Creates a plain object from a SetDefaultProcessorVersionMetadata message. Also converts values to other types if specified. + * @param message SetDefaultProcessorVersionMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetDefaultProcessorVersionMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; } - /** Represents a HumanReviewStatus. */ - class HumanReviewStatus implements IHumanReviewStatus { + /** Properties of a ReviewDocumentRequest. */ + interface IReviewDocumentRequest { + + /** ReviewDocumentRequest inlineDocument */ + inlineDocument?: (google.cloud.documentai.v1.IDocument|null); + + /** ReviewDocumentRequest humanReviewConfig */ + humanReviewConfig?: (string|null); + + /** ReviewDocumentRequest enableSchemaValidation */ + enableSchemaValidation?: (boolean|null); + + /** ReviewDocumentRequest priority */ + priority?: (google.cloud.documentai.v1.ReviewDocumentRequest.Priority|keyof typeof google.cloud.documentai.v1.ReviewDocumentRequest.Priority|null); + + /** ReviewDocumentRequest documentSchema */ + documentSchema?: (google.cloud.documentai.v1.IDocumentSchema|null); + } + + /** Represents a ReviewDocumentRequest. */ + class ReviewDocumentRequest implements IReviewDocumentRequest { /** - * Constructs a new HumanReviewStatus. + * Constructs a new ReviewDocumentRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1.IHumanReviewStatus); + constructor(properties?: google.cloud.documentai.v1.IReviewDocumentRequest); - /** HumanReviewStatus state. */ - public state: (google.cloud.documentai.v1.HumanReviewStatus.State|keyof typeof google.cloud.documentai.v1.HumanReviewStatus.State); + /** ReviewDocumentRequest inlineDocument. */ + public inlineDocument?: (google.cloud.documentai.v1.IDocument|null); - /** HumanReviewStatus stateMessage. */ - public stateMessage: string; + /** ReviewDocumentRequest humanReviewConfig. */ + public humanReviewConfig: string; - /** HumanReviewStatus humanReviewOperation. */ - public humanReviewOperation: string; + /** ReviewDocumentRequest enableSchemaValidation. */ + public enableSchemaValidation: boolean; + + /** ReviewDocumentRequest priority. */ + public priority: (google.cloud.documentai.v1.ReviewDocumentRequest.Priority|keyof typeof google.cloud.documentai.v1.ReviewDocumentRequest.Priority); + + /** ReviewDocumentRequest documentSchema. */ + public documentSchema?: (google.cloud.documentai.v1.IDocumentSchema|null); + + /** ReviewDocumentRequest source. */ + public source?: "inlineDocument"; /** - * Creates a new HumanReviewStatus instance using the specified properties. + * Creates a new ReviewDocumentRequest instance using the specified properties. * @param [properties] Properties to set - * @returns HumanReviewStatus instance + * @returns ReviewDocumentRequest instance */ - public static create(properties?: google.cloud.documentai.v1.IHumanReviewStatus): google.cloud.documentai.v1.HumanReviewStatus; + public static create(properties?: google.cloud.documentai.v1.IReviewDocumentRequest): google.cloud.documentai.v1.ReviewDocumentRequest; /** - * Encodes the specified HumanReviewStatus message. Does not implicitly {@link google.cloud.documentai.v1.HumanReviewStatus.verify|verify} messages. - * @param message HumanReviewStatus message or plain object to encode + * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentRequest.verify|verify} messages. + * @param message ReviewDocumentRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1.IHumanReviewStatus, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified HumanReviewStatus message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.HumanReviewStatus.verify|verify} messages. - * @param message HumanReviewStatus message or plain object to encode + * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentRequest.verify|verify} messages. + * @param message ReviewDocumentRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1.IHumanReviewStatus, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a HumanReviewStatus message from the specified reader or buffer. + * Decodes a ReviewDocumentRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns HumanReviewStatus + * @returns ReviewDocumentRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.HumanReviewStatus; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ReviewDocumentRequest; /** - * Decodes a HumanReviewStatus message from the specified reader or buffer, length delimited. + * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns HumanReviewStatus + * @returns ReviewDocumentRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.HumanReviewStatus; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ReviewDocumentRequest; /** - * Verifies a HumanReviewStatus message. + * Verifies a ReviewDocumentRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a HumanReviewStatus message from a plain object. Also converts values to their respective internal types. + * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns HumanReviewStatus + * @returns ReviewDocumentRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.HumanReviewStatus; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ReviewDocumentRequest; /** - * Creates a plain object from a HumanReviewStatus message. Also converts values to other types if specified. - * @param message HumanReviewStatus + * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. + * @param message ReviewDocumentRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1.HumanReviewStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1.ReviewDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this HumanReviewStatus to JSON. + * Converts this ReviewDocumentRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace HumanReviewStatus { + namespace ReviewDocumentRequest { - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - SKIPPED = 1, - VALIDATION_PASSED = 2, - IN_PROGRESS = 3, - ERROR = 4 + /** Priority enum. */ + enum Priority { + DEFAULT = 0, + URGENT = 1 } } - /** Properties of a ProcessResponse. */ - interface IProcessResponse { + /** Properties of a ReviewDocumentResponse. */ + interface IReviewDocumentResponse { - /** ProcessResponse document */ - document?: (google.cloud.documentai.v1.IDocument|null); + /** ReviewDocumentResponse gcsDestination */ + gcsDestination?: (string|null); - /** ProcessResponse humanReviewStatus */ - humanReviewStatus?: (google.cloud.documentai.v1.IHumanReviewStatus|null); + /** ReviewDocumentResponse state */ + state?: (google.cloud.documentai.v1.ReviewDocumentResponse.State|keyof typeof google.cloud.documentai.v1.ReviewDocumentResponse.State|null); + + /** ReviewDocumentResponse rejectionReason */ + rejectionReason?: (string|null); } - /** Represents a ProcessResponse. */ - class ProcessResponse implements IProcessResponse { + /** Represents a ReviewDocumentResponse. */ + class ReviewDocumentResponse implements IReviewDocumentResponse { /** - * Constructs a new ProcessResponse. + * Constructs a new ReviewDocumentResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1.IProcessResponse); + constructor(properties?: google.cloud.documentai.v1.IReviewDocumentResponse); - /** ProcessResponse document. */ - public document?: (google.cloud.documentai.v1.IDocument|null); + /** ReviewDocumentResponse gcsDestination. */ + public gcsDestination: string; - /** ProcessResponse humanReviewStatus. */ - public humanReviewStatus?: (google.cloud.documentai.v1.IHumanReviewStatus|null); + /** ReviewDocumentResponse state. */ + public state: (google.cloud.documentai.v1.ReviewDocumentResponse.State|keyof typeof google.cloud.documentai.v1.ReviewDocumentResponse.State); + + /** ReviewDocumentResponse rejectionReason. */ + public rejectionReason: string; /** - * Creates a new ProcessResponse instance using the specified properties. + * Creates a new ReviewDocumentResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ProcessResponse instance + * @returns ReviewDocumentResponse instance */ - public static create(properties?: google.cloud.documentai.v1.IProcessResponse): google.cloud.documentai.v1.ProcessResponse; + public static create(properties?: google.cloud.documentai.v1.IReviewDocumentResponse): google.cloud.documentai.v1.ReviewDocumentResponse; /** - * Encodes the specified ProcessResponse message. Does not implicitly {@link google.cloud.documentai.v1.ProcessResponse.verify|verify} messages. - * @param message ProcessResponse message or plain object to encode + * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentResponse.verify|verify} messages. + * @param message ReviewDocumentResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1.IProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified ProcessResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessResponse.verify|verify} messages. - * @param message ProcessResponse message or plain object to encode + /** + * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentResponse.verify|verify} messages. + * @param message ReviewDocumentResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1.IProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProcessResponse message from the specified reader or buffer. + * Decodes a ReviewDocumentResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProcessResponse + * @returns ReviewDocumentResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ProcessResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ReviewDocumentResponse; /** - * Decodes a ProcessResponse message from the specified reader or buffer, length delimited. + * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProcessResponse + * @returns ReviewDocumentResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ProcessResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ReviewDocumentResponse; /** - * Verifies a ProcessResponse message. + * Verifies a ReviewDocumentResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProcessResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProcessResponse + * @returns ReviewDocumentResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ProcessResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ReviewDocumentResponse; /** - * Creates a plain object from a ProcessResponse message. Also converts values to other types if specified. - * @param message ProcessResponse + * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. + * @param message ReviewDocumentResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1.ProcessResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1.ReviewDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProcessResponse to JSON. + * Converts this ReviewDocumentResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a BatchProcessRequest. */ - interface IBatchProcessRequest { + namespace ReviewDocumentResponse { - /** BatchProcessRequest name */ - name?: (string|null); + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + REJECTED = 1, + SUCCEEDED = 2 + } + } - /** BatchProcessRequest inputDocuments */ - inputDocuments?: (google.cloud.documentai.v1.IBatchDocumentsInputConfig|null); + /** Properties of a ReviewDocumentOperationMetadata. */ + interface IReviewDocumentOperationMetadata { - /** BatchProcessRequest documentOutputConfig */ - documentOutputConfig?: (google.cloud.documentai.v1.IDocumentOutputConfig|null); + /** ReviewDocumentOperationMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); - /** BatchProcessRequest skipHumanReview */ - skipHumanReview?: (boolean|null); + /** ReviewDocumentOperationMetadata questionId */ + questionId?: (string|null); } - /** Represents a BatchProcessRequest. */ - class BatchProcessRequest implements IBatchProcessRequest { + /** Represents a ReviewDocumentOperationMetadata. */ + class ReviewDocumentOperationMetadata implements IReviewDocumentOperationMetadata { /** - * Constructs a new BatchProcessRequest. + * Constructs a new ReviewDocumentOperationMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1.IBatchProcessRequest); - - /** BatchProcessRequest name. */ - public name: string; - - /** BatchProcessRequest inputDocuments. */ - public inputDocuments?: (google.cloud.documentai.v1.IBatchDocumentsInputConfig|null); + constructor(properties?: google.cloud.documentai.v1.IReviewDocumentOperationMetadata); - /** BatchProcessRequest documentOutputConfig. */ - public documentOutputConfig?: (google.cloud.documentai.v1.IDocumentOutputConfig|null); + /** ReviewDocumentOperationMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); - /** BatchProcessRequest skipHumanReview. */ - public skipHumanReview: boolean; + /** ReviewDocumentOperationMetadata questionId. */ + public questionId: string; /** - * Creates a new BatchProcessRequest instance using the specified properties. + * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns BatchProcessRequest instance + * @returns ReviewDocumentOperationMetadata instance */ - public static create(properties?: google.cloud.documentai.v1.IBatchProcessRequest): google.cloud.documentai.v1.BatchProcessRequest; + public static create(properties?: google.cloud.documentai.v1.IReviewDocumentOperationMetadata): google.cloud.documentai.v1.ReviewDocumentOperationMetadata; /** - * Encodes the specified BatchProcessRequest message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessRequest.verify|verify} messages. - * @param message BatchProcessRequest message or plain object to encode + * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentOperationMetadata.verify|verify} messages. + * @param message ReviewDocumentOperationMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1.IBatchProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BatchProcessRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessRequest.verify|verify} messages. - * @param message BatchProcessRequest message or plain object to encode + * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentOperationMetadata.verify|verify} messages. + * @param message ReviewDocumentOperationMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1.IBatchProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BatchProcessRequest message from the specified reader or buffer. + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BatchProcessRequest + * @returns ReviewDocumentOperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.BatchProcessRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ReviewDocumentOperationMetadata; /** - * Decodes a BatchProcessRequest message from the specified reader or buffer, length delimited. + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BatchProcessRequest + * @returns ReviewDocumentOperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.BatchProcessRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ReviewDocumentOperationMetadata; /** - * Verifies a BatchProcessRequest message. + * Verifies a ReviewDocumentOperationMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a BatchProcessRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BatchProcessRequest + * @returns ReviewDocumentOperationMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchProcessRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ReviewDocumentOperationMetadata; /** - * Creates a plain object from a BatchProcessRequest message. Also converts values to other types if specified. - * @param message BatchProcessRequest + * Creates a plain object from a ReviewDocumentOperationMetadata message. Also converts values to other types if specified. + * @param message ReviewDocumentOperationMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1.BatchProcessRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1.ReviewDocumentOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BatchProcessRequest to JSON. + * Converts this ReviewDocumentOperationMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a BatchProcessResponse. */ - interface IBatchProcessResponse { + /** Properties of a DocumentSchema. */ + interface IDocumentSchema { + + /** DocumentSchema displayName */ + displayName?: (string|null); + + /** DocumentSchema description */ + description?: (string|null); + + /** DocumentSchema entityTypes */ + entityTypes?: (google.cloud.documentai.v1.DocumentSchema.IEntityType[]|null); + + /** DocumentSchema metadata */ + metadata?: (google.cloud.documentai.v1.DocumentSchema.IMetadata|null); } - /** Represents a BatchProcessResponse. */ - class BatchProcessResponse implements IBatchProcessResponse { + /** Represents a DocumentSchema. */ + class DocumentSchema implements IDocumentSchema { /** - * Constructs a new BatchProcessResponse. + * Constructs a new DocumentSchema. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1.IBatchProcessResponse); + constructor(properties?: google.cloud.documentai.v1.IDocumentSchema); + + /** DocumentSchema displayName. */ + public displayName: string; + + /** DocumentSchema description. */ + public description: string; + + /** DocumentSchema entityTypes. */ + public entityTypes: google.cloud.documentai.v1.DocumentSchema.IEntityType[]; + + /** DocumentSchema metadata. */ + public metadata?: (google.cloud.documentai.v1.DocumentSchema.IMetadata|null); /** - * Creates a new BatchProcessResponse instance using the specified properties. + * Creates a new DocumentSchema instance using the specified properties. * @param [properties] Properties to set - * @returns BatchProcessResponse instance + * @returns DocumentSchema instance */ - public static create(properties?: google.cloud.documentai.v1.IBatchProcessResponse): google.cloud.documentai.v1.BatchProcessResponse; + public static create(properties?: google.cloud.documentai.v1.IDocumentSchema): google.cloud.documentai.v1.DocumentSchema; /** - * Encodes the specified BatchProcessResponse message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessResponse.verify|verify} messages. - * @param message BatchProcessResponse message or plain object to encode + * Encodes the specified DocumentSchema message. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.verify|verify} messages. + * @param message DocumentSchema message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1.IBatchProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1.IDocumentSchema, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BatchProcessResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessResponse.verify|verify} messages. - * @param message BatchProcessResponse message or plain object to encode + * Encodes the specified DocumentSchema message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.verify|verify} messages. + * @param message DocumentSchema message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1.IBatchProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1.IDocumentSchema, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BatchProcessResponse message from the specified reader or buffer. + * Decodes a DocumentSchema message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BatchProcessResponse + * @returns DocumentSchema * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.BatchProcessResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.DocumentSchema; /** - * Decodes a BatchProcessResponse message from the specified reader or buffer, length delimited. + * Decodes a DocumentSchema message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BatchProcessResponse + * @returns DocumentSchema * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.BatchProcessResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.DocumentSchema; /** - * Verifies a BatchProcessResponse message. + * Verifies a DocumentSchema message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a BatchProcessResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchProcessResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchProcessResponse; + /** + * Creates a DocumentSchema message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentSchema + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DocumentSchema; + + /** + * Creates a plain object from a DocumentSchema message. Also converts values to other types if specified. + * @param message DocumentSchema + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DocumentSchema, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentSchema to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace DocumentSchema { + + /** Properties of an EntityType. */ + interface IEntityType { + + /** EntityType enumValues */ + enumValues?: (google.cloud.documentai.v1.DocumentSchema.EntityType.IEnumValues|null); + + /** EntityType displayName */ + displayName?: (string|null); + + /** EntityType name */ + name?: (string|null); + + /** EntityType baseTypes */ + baseTypes?: (string[]|null); + + /** EntityType properties */ + properties?: (google.cloud.documentai.v1.DocumentSchema.EntityType.IProperty[]|null); + } + + /** Represents an EntityType. */ + class EntityType implements IEntityType { + + /** + * Constructs a new EntityType. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.DocumentSchema.IEntityType); + + /** EntityType enumValues. */ + public enumValues?: (google.cloud.documentai.v1.DocumentSchema.EntityType.IEnumValues|null); + + /** EntityType displayName. */ + public displayName: string; + + /** EntityType name. */ + public name: string; + + /** EntityType baseTypes. */ + public baseTypes: string[]; + + /** EntityType properties. */ + public properties: google.cloud.documentai.v1.DocumentSchema.EntityType.IProperty[]; + + /** EntityType valueSource. */ + public valueSource?: "enumValues"; + + /** + * Creates a new EntityType instance using the specified properties. + * @param [properties] Properties to set + * @returns EntityType instance + */ + public static create(properties?: google.cloud.documentai.v1.DocumentSchema.IEntityType): google.cloud.documentai.v1.DocumentSchema.EntityType; + + /** + * Encodes the specified EntityType message. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.EntityType.verify|verify} messages. + * @param message EntityType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.DocumentSchema.IEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EntityType message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.EntityType.verify|verify} messages. + * @param message EntityType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.DocumentSchema.IEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EntityType message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.DocumentSchema.EntityType; + + /** + * Decodes an EntityType message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.DocumentSchema.EntityType; + + /** + * Verifies an EntityType message. + * @param message Plain 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 EntityType message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EntityType + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DocumentSchema.EntityType; + + /** + * Creates a plain object from an EntityType message. Also converts values to other types if specified. + * @param message EntityType + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DocumentSchema.EntityType, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EntityType to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace EntityType { + + /** Properties of an EnumValues. */ + interface IEnumValues { + + /** EnumValues values */ + values?: (string[]|null); + } + + /** Represents an EnumValues. */ + class EnumValues implements IEnumValues { + + /** + * Constructs a new EnumValues. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.DocumentSchema.EntityType.IEnumValues); + + /** EnumValues values. */ + public values: string[]; + + /** + * Creates a new EnumValues instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumValues instance + */ + public static create(properties?: google.cloud.documentai.v1.DocumentSchema.EntityType.IEnumValues): google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues; + + /** + * Encodes the specified EnumValues message. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues.verify|verify} messages. + * @param message EnumValues message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.DocumentSchema.EntityType.IEnumValues, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumValues message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues.verify|verify} messages. + * @param message EnumValues message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.DocumentSchema.EntityType.IEnumValues, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a plain object from a BatchProcessResponse message. Also converts values to other types if specified. - * @param message BatchProcessResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.documentai.v1.BatchProcessResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Decodes an EnumValues message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumValues + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues; - /** - * Converts this BatchProcessResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Decodes an EnumValues message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumValues + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues; - /** Properties of a BatchProcessMetadata. */ - interface IBatchProcessMetadata { + /** + * Verifies an EnumValues message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** BatchProcessMetadata state */ - state?: (google.cloud.documentai.v1.BatchProcessMetadata.State|keyof typeof google.cloud.documentai.v1.BatchProcessMetadata.State|null); + /** + * Creates an EnumValues message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumValues + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues; - /** BatchProcessMetadata stateMessage */ - stateMessage?: (string|null); + /** + * Creates a plain object from an EnumValues message. Also converts values to other types if specified. + * @param message EnumValues + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** BatchProcessMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); + /** + * Converts this EnumValues to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** BatchProcessMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); + /** Properties of a Property. */ + interface IProperty { - /** BatchProcessMetadata individualProcessStatuses */ - individualProcessStatuses?: (google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus[]|null); - } + /** Property name */ + name?: (string|null); - /** Represents a BatchProcessMetadata. */ - class BatchProcessMetadata implements IBatchProcessMetadata { + /** Property valueType */ + valueType?: (string|null); - /** - * Constructs a new BatchProcessMetadata. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.documentai.v1.IBatchProcessMetadata); + /** Property occurrenceType */ + occurrenceType?: (google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType|keyof typeof google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType|null); + } - /** BatchProcessMetadata state. */ - public state: (google.cloud.documentai.v1.BatchProcessMetadata.State|keyof typeof google.cloud.documentai.v1.BatchProcessMetadata.State); + /** Represents a Property. */ + class Property implements IProperty { - /** BatchProcessMetadata stateMessage. */ - public stateMessage: string; + /** + * Constructs a new Property. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.DocumentSchema.EntityType.IProperty); - /** BatchProcessMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); + /** Property name. */ + public name: string; - /** BatchProcessMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); + /** Property valueType. */ + public valueType: string; - /** BatchProcessMetadata individualProcessStatuses. */ - public individualProcessStatuses: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus[]; + /** Property occurrenceType. */ + public occurrenceType: (google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType|keyof typeof google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType); - /** - * Creates a new BatchProcessMetadata instance using the specified properties. - * @param [properties] Properties to set - * @returns BatchProcessMetadata instance - */ - public static create(properties?: google.cloud.documentai.v1.IBatchProcessMetadata): google.cloud.documentai.v1.BatchProcessMetadata; + /** + * Creates a new Property instance using the specified properties. + * @param [properties] Properties to set + * @returns Property instance + */ + public static create(properties?: google.cloud.documentai.v1.DocumentSchema.EntityType.IProperty): google.cloud.documentai.v1.DocumentSchema.EntityType.Property; - /** - * Encodes the specified BatchProcessMetadata message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.verify|verify} messages. - * @param message BatchProcessMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.documentai.v1.IBatchProcessMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified Property message. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.EntityType.Property.verify|verify} messages. + * @param message Property message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.DocumentSchema.EntityType.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified BatchProcessMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.verify|verify} messages. - * @param message BatchProcessMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.documentai.v1.IBatchProcessMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.EntityType.Property.verify|verify} messages. + * @param message Property message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.DocumentSchema.EntityType.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a BatchProcessMetadata message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BatchProcessMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.BatchProcessMetadata; + /** + * Decodes a Property message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Property + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.DocumentSchema.EntityType.Property; - /** - * Decodes a BatchProcessMetadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BatchProcessMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.BatchProcessMetadata; + /** + * Decodes a Property message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Property + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.DocumentSchema.EntityType.Property; - /** - * Verifies a BatchProcessMetadata message. - * @param message 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 Property message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a BatchProcessMetadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchProcessMetadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchProcessMetadata; + /** + * Creates a Property message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Property + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DocumentSchema.EntityType.Property; - /** - * Creates a plain object from a BatchProcessMetadata message. Also converts values to other types if specified. - * @param message BatchProcessMetadata - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.documentai.v1.BatchProcessMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a plain object from a Property message. Also converts values to other types if specified. + * @param message Property + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DocumentSchema.EntityType.Property, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Converts this BatchProcessMetadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Converts this Property to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - namespace BatchProcessMetadata { + namespace Property { - /** Properties of an IndividualProcessStatus. */ - interface IIndividualProcessStatus { + /** OccurrenceType enum. */ + enum OccurrenceType { + OCCURRENCE_TYPE_UNSPECIFIED = 0, + OPTIONAL_ONCE = 1, + OPTIONAL_MULTIPLE = 2, + REQUIRED_ONCE = 3, + REQUIRED_MULTIPLE = 4 + } + } + } - /** IndividualProcessStatus inputGcsSource */ - inputGcsSource?: (string|null); + /** Properties of a Metadata. */ + interface IMetadata { - /** IndividualProcessStatus status */ - status?: (google.rpc.IStatus|null); + /** Metadata documentSplitter */ + documentSplitter?: (boolean|null); - /** IndividualProcessStatus outputGcsDestination */ - outputGcsDestination?: (string|null); + /** Metadata documentAllowMultipleLabels */ + documentAllowMultipleLabels?: (boolean|null); - /** IndividualProcessStatus humanReviewStatus */ - humanReviewStatus?: (google.cloud.documentai.v1.IHumanReviewStatus|null); + /** Metadata prefixedNamingOnProperties */ + prefixedNamingOnProperties?: (boolean|null); + + /** Metadata skipNamingValidation */ + skipNamingValidation?: (boolean|null); } - /** Represents an IndividualProcessStatus. */ - class IndividualProcessStatus implements IIndividualProcessStatus { + /** Represents a Metadata. */ + class Metadata implements IMetadata { /** - * Constructs a new IndividualProcessStatus. + * Constructs a new Metadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus); + constructor(properties?: google.cloud.documentai.v1.DocumentSchema.IMetadata); - /** IndividualProcessStatus inputGcsSource. */ - public inputGcsSource: string; + /** Metadata documentSplitter. */ + public documentSplitter: boolean; - /** IndividualProcessStatus status. */ - public status?: (google.rpc.IStatus|null); + /** Metadata documentAllowMultipleLabels. */ + public documentAllowMultipleLabels: boolean; - /** IndividualProcessStatus outputGcsDestination. */ - public outputGcsDestination: string; + /** Metadata prefixedNamingOnProperties. */ + public prefixedNamingOnProperties: boolean; - /** IndividualProcessStatus humanReviewStatus. */ - public humanReviewStatus?: (google.cloud.documentai.v1.IHumanReviewStatus|null); + /** Metadata skipNamingValidation. */ + public skipNamingValidation: boolean; /** - * Creates a new IndividualProcessStatus instance using the specified properties. + * Creates a new Metadata instance using the specified properties. * @param [properties] Properties to set - * @returns IndividualProcessStatus instance + * @returns Metadata instance */ - public static create(properties?: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus): google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus; + public static create(properties?: google.cloud.documentai.v1.DocumentSchema.IMetadata): google.cloud.documentai.v1.DocumentSchema.Metadata; /** - * Encodes the specified IndividualProcessStatus message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.verify|verify} messages. - * @param message IndividualProcessStatus message or plain object to encode + * Encodes the specified Metadata message. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.Metadata.verify|verify} messages. + * @param message Metadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1.DocumentSchema.IMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified IndividualProcessStatus message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.verify|verify} messages. - * @param message IndividualProcessStatus message or plain object to encode + * Encodes the specified Metadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.Metadata.verify|verify} messages. + * @param message Metadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1.DocumentSchema.IMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an IndividualProcessStatus message from the specified reader or buffer. + * Decodes a Metadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns IndividualProcessStatus + * @returns Metadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.DocumentSchema.Metadata; /** - * Decodes an IndividualProcessStatus message from the specified reader or buffer, length delimited. + * Decodes a Metadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns IndividualProcessStatus + * @returns Metadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.DocumentSchema.Metadata; /** - * Verifies an IndividualProcessStatus message. + * Verifies a Metadata message. * @param message Plain 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 IndividualProcessStatus message from a plain object. Also converts values to their respective internal types. + * Creates a Metadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns IndividualProcessStatus + * @returns Metadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DocumentSchema.Metadata; /** - * Creates a plain object from an IndividualProcessStatus message. Also converts values to other types if specified. - * @param message IndividualProcessStatus + * Creates a plain object from a Metadata message. Also converts values to other types if specified. + * @param message Metadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1.DocumentSchema.Metadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this IndividualProcessStatus to JSON. + * Converts this Metadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - WAITING = 1, - RUNNING = 2, - SUCCEEDED = 3, - CANCELLING = 4, - CANCELLED = 5, - FAILED = 6 - } } - /** Properties of a ReviewDocumentRequest. */ - interface IReviewDocumentRequest { + /** Properties of a CommonOperationMetadata. */ + interface ICommonOperationMetadata { + + /** CommonOperationMetadata state */ + state?: (google.cloud.documentai.v1.CommonOperationMetadata.State|keyof typeof google.cloud.documentai.v1.CommonOperationMetadata.State|null); - /** ReviewDocumentRequest inlineDocument */ - inlineDocument?: (google.cloud.documentai.v1.IDocument|null); + /** CommonOperationMetadata stateMessage */ + stateMessage?: (string|null); - /** ReviewDocumentRequest humanReviewConfig */ - humanReviewConfig?: (string|null); + /** CommonOperationMetadata resource */ + resource?: (string|null); - /** ReviewDocumentRequest enableSchemaValidation */ - enableSchemaValidation?: (boolean|null); + /** CommonOperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); - /** ReviewDocumentRequest priority */ - priority?: (google.cloud.documentai.v1.ReviewDocumentRequest.Priority|keyof typeof google.cloud.documentai.v1.ReviewDocumentRequest.Priority|null); + /** CommonOperationMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); } - /** Represents a ReviewDocumentRequest. */ - class ReviewDocumentRequest implements IReviewDocumentRequest { + /** Represents a CommonOperationMetadata. */ + class CommonOperationMetadata implements ICommonOperationMetadata { /** - * Constructs a new ReviewDocumentRequest. + * Constructs a new CommonOperationMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1.IReviewDocumentRequest); + constructor(properties?: google.cloud.documentai.v1.ICommonOperationMetadata); - /** ReviewDocumentRequest inlineDocument. */ - public inlineDocument?: (google.cloud.documentai.v1.IDocument|null); + /** CommonOperationMetadata state. */ + public state: (google.cloud.documentai.v1.CommonOperationMetadata.State|keyof typeof google.cloud.documentai.v1.CommonOperationMetadata.State); - /** ReviewDocumentRequest humanReviewConfig. */ - public humanReviewConfig: string; + /** CommonOperationMetadata stateMessage. */ + public stateMessage: string; - /** ReviewDocumentRequest enableSchemaValidation. */ - public enableSchemaValidation: boolean; + /** CommonOperationMetadata resource. */ + public resource: string; - /** ReviewDocumentRequest priority. */ - public priority: (google.cloud.documentai.v1.ReviewDocumentRequest.Priority|keyof typeof google.cloud.documentai.v1.ReviewDocumentRequest.Priority); + /** CommonOperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); - /** ReviewDocumentRequest source. */ - public source?: "inlineDocument"; + /** CommonOperationMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); /** - * Creates a new ReviewDocumentRequest instance using the specified properties. + * Creates a new CommonOperationMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns ReviewDocumentRequest instance + * @returns CommonOperationMetadata instance */ - public static create(properties?: google.cloud.documentai.v1.IReviewDocumentRequest): google.cloud.documentai.v1.ReviewDocumentRequest; + public static create(properties?: google.cloud.documentai.v1.ICommonOperationMetadata): google.cloud.documentai.v1.CommonOperationMetadata; /** - * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentRequest.verify|verify} messages. - * @param message ReviewDocumentRequest message or plain object to encode + * Encodes the specified CommonOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1.CommonOperationMetadata.verify|verify} messages. + * @param message CommonOperationMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1.ICommonOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentRequest.verify|verify} messages. - * @param message ReviewDocumentRequest message or plain object to encode + * Encodes the specified CommonOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.CommonOperationMetadata.verify|verify} messages. + * @param message CommonOperationMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1.ICommonOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * Decodes a CommonOperationMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ReviewDocumentRequest + * @returns CommonOperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ReviewDocumentRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.CommonOperationMetadata; /** - * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * Decodes a CommonOperationMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ReviewDocumentRequest + * @returns CommonOperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ReviewDocumentRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.CommonOperationMetadata; /** - * Verifies a ReviewDocumentRequest message. + * Verifies a CommonOperationMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CommonOperationMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ReviewDocumentRequest + * @returns CommonOperationMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ReviewDocumentRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.CommonOperationMetadata; /** - * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. - * @param message ReviewDocumentRequest + * Creates a plain object from a CommonOperationMetadata message. Also converts values to other types if specified. + * @param message CommonOperationMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1.ReviewDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1.CommonOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ReviewDocumentRequest to JSON. + * Converts this CommonOperationMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace ReviewDocumentRequest { + namespace CommonOperationMetadata { - /** Priority enum. */ - enum Priority { - DEFAULT = 0, - URGENT = 1 + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + CANCELLING = 2, + SUCCEEDED = 3, + FAILED = 4, + CANCELLED = 5 } } - /** Properties of a ReviewDocumentResponse. */ - interface IReviewDocumentResponse { + /** Properties of a ProcessorVersion. */ + interface IProcessorVersion { - /** ReviewDocumentResponse gcsDestination */ - gcsDestination?: (string|null); + /** ProcessorVersion name */ + name?: (string|null); + + /** ProcessorVersion displayName */ + displayName?: (string|null); + + /** ProcessorVersion state */ + state?: (google.cloud.documentai.v1.ProcessorVersion.State|keyof typeof google.cloud.documentai.v1.ProcessorVersion.State|null); + + /** ProcessorVersion createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ProcessorVersion kmsKeyName */ + kmsKeyName?: (string|null); + + /** ProcessorVersion kmsKeyVersionName */ + kmsKeyVersionName?: (string|null); + + /** ProcessorVersion googleManaged */ + googleManaged?: (boolean|null); + + /** ProcessorVersion deprecationInfo */ + deprecationInfo?: (google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo|null); } - /** Represents a ReviewDocumentResponse. */ - class ReviewDocumentResponse implements IReviewDocumentResponse { + /** Represents a ProcessorVersion. */ + class ProcessorVersion implements IProcessorVersion { /** - * Constructs a new ReviewDocumentResponse. + * Constructs a new ProcessorVersion. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1.IReviewDocumentResponse); + constructor(properties?: google.cloud.documentai.v1.IProcessorVersion); - /** ReviewDocumentResponse gcsDestination. */ - public gcsDestination: string; + /** ProcessorVersion name. */ + public name: string; + + /** ProcessorVersion displayName. */ + public displayName: string; + + /** ProcessorVersion state. */ + public state: (google.cloud.documentai.v1.ProcessorVersion.State|keyof typeof google.cloud.documentai.v1.ProcessorVersion.State); + + /** ProcessorVersion createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ProcessorVersion kmsKeyName. */ + public kmsKeyName: string; + + /** ProcessorVersion kmsKeyVersionName. */ + public kmsKeyVersionName: string; + + /** ProcessorVersion googleManaged. */ + public googleManaged: boolean; + + /** ProcessorVersion deprecationInfo. */ + public deprecationInfo?: (google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo|null); /** - * Creates a new ReviewDocumentResponse instance using the specified properties. + * Creates a new ProcessorVersion instance using the specified properties. * @param [properties] Properties to set - * @returns ReviewDocumentResponse instance + * @returns ProcessorVersion instance */ - public static create(properties?: google.cloud.documentai.v1.IReviewDocumentResponse): google.cloud.documentai.v1.ReviewDocumentResponse; + public static create(properties?: google.cloud.documentai.v1.IProcessorVersion): google.cloud.documentai.v1.ProcessorVersion; /** - * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentResponse.verify|verify} messages. - * @param message ReviewDocumentResponse message or plain object to encode + * Encodes the specified ProcessorVersion message. Does not implicitly {@link google.cloud.documentai.v1.ProcessorVersion.verify|verify} messages. + * @param message ProcessorVersion message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1.IProcessorVersion, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentResponse.verify|verify} messages. - * @param message ReviewDocumentResponse message or plain object to encode + * Encodes the specified ProcessorVersion message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessorVersion.verify|verify} messages. + * @param message ProcessorVersion message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1.IProcessorVersion, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * Decodes a ProcessorVersion message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ReviewDocumentResponse + * @returns ProcessorVersion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ReviewDocumentResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ProcessorVersion; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * Decodes a ProcessorVersion message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ReviewDocumentResponse + * @returns ProcessorVersion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ReviewDocumentResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ProcessorVersion; /** - * Verifies a ReviewDocumentResponse message. + * Verifies a ProcessorVersion message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ProcessorVersion message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ReviewDocumentResponse + * @returns ProcessorVersion */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ReviewDocumentResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ProcessorVersion; /** - * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. - * @param message ReviewDocumentResponse + * Creates a plain object from a ProcessorVersion message. Also converts values to other types if specified. + * @param message ProcessorVersion * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1.ReviewDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1.ProcessorVersion, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ReviewDocumentResponse to JSON. + * Converts this ProcessorVersion to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ReviewDocumentOperationMetadata. */ - interface IReviewDocumentOperationMetadata { + namespace ProcessorVersion { - /** ReviewDocumentOperationMetadata commonMetadata */ - commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + /** Properties of a DeprecationInfo. */ + interface IDeprecationInfo { - /** ReviewDocumentOperationMetadata questionId */ - questionId?: (string|null); + /** DeprecationInfo deprecationTime */ + deprecationTime?: (google.protobuf.ITimestamp|null); + + /** DeprecationInfo replacementProcessorVersion */ + replacementProcessorVersion?: (string|null); + } + + /** Represents a DeprecationInfo. */ + class DeprecationInfo implements IDeprecationInfo { + + /** + * Constructs a new DeprecationInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo); + + /** DeprecationInfo deprecationTime. */ + public deprecationTime?: (google.protobuf.ITimestamp|null); + + /** DeprecationInfo replacementProcessorVersion. */ + public replacementProcessorVersion: string; + + /** + * Creates a new DeprecationInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns DeprecationInfo instance + */ + public static create(properties?: google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo): google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo; + + /** + * Encodes the specified DeprecationInfo message. Does not implicitly {@link google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.verify|verify} messages. + * @param message DeprecationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeprecationInfo message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.verify|verify} messages. + * @param message DeprecationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeprecationInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeprecationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo; + + /** + * Decodes a DeprecationInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeprecationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo; + + /** + * Verifies a DeprecationInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeprecationInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeprecationInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo; + + /** + * Creates a plain object from a DeprecationInfo message. Also converts values to other types if specified. + * @param message DeprecationInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeprecationInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + DEPLOYED = 1, + DEPLOYING = 2, + UNDEPLOYED = 3, + UNDEPLOYING = 4, + CREATING = 5, + DELETING = 6, + FAILED = 7 + } } - /** Represents a ReviewDocumentOperationMetadata. */ - class ReviewDocumentOperationMetadata implements IReviewDocumentOperationMetadata { + /** Properties of a Processor. */ + interface IProcessor { + + /** Processor name */ + name?: (string|null); + + /** Processor type */ + type?: (string|null); + + /** Processor displayName */ + displayName?: (string|null); + + /** Processor state */ + state?: (google.cloud.documentai.v1.Processor.State|keyof typeof google.cloud.documentai.v1.Processor.State|null); + + /** Processor defaultProcessorVersion */ + defaultProcessorVersion?: (string|null); + + /** Processor processEndpoint */ + processEndpoint?: (string|null); + + /** Processor createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Processor kmsKeyName */ + kmsKeyName?: (string|null); + } + + /** Represents a Processor. */ + class Processor implements IProcessor { /** - * Constructs a new ReviewDocumentOperationMetadata. + * Constructs a new Processor. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1.IReviewDocumentOperationMetadata); + constructor(properties?: google.cloud.documentai.v1.IProcessor); - /** ReviewDocumentOperationMetadata commonMetadata. */ - public commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + /** Processor name. */ + public name: string; - /** ReviewDocumentOperationMetadata questionId. */ - public questionId: string; + /** Processor type. */ + public type: string; + + /** Processor displayName. */ + public displayName: string; + + /** Processor state. */ + public state: (google.cloud.documentai.v1.Processor.State|keyof typeof google.cloud.documentai.v1.Processor.State); + + /** Processor defaultProcessorVersion. */ + public defaultProcessorVersion: string; + + /** Processor processEndpoint. */ + public processEndpoint: string; + + /** Processor createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Processor kmsKeyName. */ + public kmsKeyName: string; /** - * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * Creates a new Processor instance using the specified properties. * @param [properties] Properties to set - * @returns ReviewDocumentOperationMetadata instance + * @returns Processor instance */ - public static create(properties?: google.cloud.documentai.v1.IReviewDocumentOperationMetadata): google.cloud.documentai.v1.ReviewDocumentOperationMetadata; + public static create(properties?: google.cloud.documentai.v1.IProcessor): google.cloud.documentai.v1.Processor; /** - * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentOperationMetadata.verify|verify} messages. - * @param message ReviewDocumentOperationMetadata message or plain object to encode + * Encodes the specified Processor message. Does not implicitly {@link google.cloud.documentai.v1.Processor.verify|verify} messages. + * @param message Processor message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1.IProcessor, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentOperationMetadata.verify|verify} messages. - * @param message ReviewDocumentOperationMetadata message or plain object to encode + * Encodes the specified Processor message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Processor.verify|verify} messages. + * @param message Processor message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1.IProcessor, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * Decodes a Processor message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ReviewDocumentOperationMetadata + * @returns Processor * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ReviewDocumentOperationMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Processor; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * Decodes a Processor message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ReviewDocumentOperationMetadata + * @returns Processor * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ReviewDocumentOperationMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Processor; /** - * Verifies a ReviewDocumentOperationMetadata message. + * Verifies a Processor message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a Processor message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ReviewDocumentOperationMetadata + * @returns Processor */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ReviewDocumentOperationMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Processor; /** - * Creates a plain object from a ReviewDocumentOperationMetadata message. Also converts values to other types if specified. - * @param message ReviewDocumentOperationMetadata + * Creates a plain object from a Processor message. Also converts values to other types if specified. + * @param message Processor * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1.ReviewDocumentOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1.Processor, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ReviewDocumentOperationMetadata to JSON. + * Converts this Processor to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CommonOperationMetadata. */ - interface ICommonOperationMetadata { + namespace Processor { - /** CommonOperationMetadata state */ - state?: (google.cloud.documentai.v1.CommonOperationMetadata.State|keyof typeof google.cloud.documentai.v1.CommonOperationMetadata.State|null); + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + ENABLED = 1, + DISABLED = 2, + ENABLING = 3, + DISABLING = 4, + CREATING = 5, + FAILED = 6, + DELETING = 7 + } + } - /** CommonOperationMetadata stateMessage */ - stateMessage?: (string|null); + /** Properties of a ProcessorType. */ + interface IProcessorType { - /** CommonOperationMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); + /** ProcessorType name */ + name?: (string|null); - /** CommonOperationMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); + /** ProcessorType type */ + type?: (string|null); + + /** ProcessorType category */ + category?: (string|null); + + /** ProcessorType availableLocations */ + availableLocations?: (google.cloud.documentai.v1.ProcessorType.ILocationInfo[]|null); + + /** ProcessorType allowCreation */ + allowCreation?: (boolean|null); + + /** ProcessorType launchStage */ + launchStage?: (google.api.LaunchStage|keyof typeof google.api.LaunchStage|null); } - /** Represents a CommonOperationMetadata. */ - class CommonOperationMetadata implements ICommonOperationMetadata { + /** Represents a ProcessorType. */ + class ProcessorType implements IProcessorType { /** - * Constructs a new CommonOperationMetadata. + * Constructs a new ProcessorType. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1.ICommonOperationMetadata); + constructor(properties?: google.cloud.documentai.v1.IProcessorType); - /** CommonOperationMetadata state. */ - public state: (google.cloud.documentai.v1.CommonOperationMetadata.State|keyof typeof google.cloud.documentai.v1.CommonOperationMetadata.State); + /** ProcessorType name. */ + public name: string; - /** CommonOperationMetadata stateMessage. */ - public stateMessage: string; + /** ProcessorType type. */ + public type: string; - /** CommonOperationMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); + /** ProcessorType category. */ + public category: string; - /** CommonOperationMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); + /** ProcessorType availableLocations. */ + public availableLocations: google.cloud.documentai.v1.ProcessorType.ILocationInfo[]; + + /** ProcessorType allowCreation. */ + public allowCreation: boolean; + + /** ProcessorType launchStage. */ + public launchStage: (google.api.LaunchStage|keyof typeof google.api.LaunchStage); /** - * Creates a new CommonOperationMetadata instance using the specified properties. + * Creates a new ProcessorType instance using the specified properties. * @param [properties] Properties to set - * @returns CommonOperationMetadata instance + * @returns ProcessorType instance */ - public static create(properties?: google.cloud.documentai.v1.ICommonOperationMetadata): google.cloud.documentai.v1.CommonOperationMetadata; + public static create(properties?: google.cloud.documentai.v1.IProcessorType): google.cloud.documentai.v1.ProcessorType; /** - * Encodes the specified CommonOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1.CommonOperationMetadata.verify|verify} messages. - * @param message CommonOperationMetadata message or plain object to encode + * Encodes the specified ProcessorType message. Does not implicitly {@link google.cloud.documentai.v1.ProcessorType.verify|verify} messages. + * @param message ProcessorType message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1.ICommonOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1.IProcessorType, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CommonOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.CommonOperationMetadata.verify|verify} messages. - * @param message CommonOperationMetadata message or plain object to encode + * Encodes the specified ProcessorType message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessorType.verify|verify} messages. + * @param message ProcessorType message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1.ICommonOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1.IProcessorType, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CommonOperationMetadata message from the specified reader or buffer. + * Decodes a ProcessorType message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CommonOperationMetadata + * @returns ProcessorType * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.CommonOperationMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ProcessorType; /** - * Decodes a CommonOperationMetadata message from the specified reader or buffer, length delimited. + * Decodes a ProcessorType message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CommonOperationMetadata + * @returns ProcessorType * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.CommonOperationMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ProcessorType; /** - * Verifies a CommonOperationMetadata message. + * Verifies a ProcessorType message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CommonOperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a ProcessorType message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CommonOperationMetadata + * @returns ProcessorType */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.CommonOperationMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ProcessorType; /** - * Creates a plain object from a CommonOperationMetadata message. Also converts values to other types if specified. - * @param message CommonOperationMetadata + * Creates a plain object from a ProcessorType message. Also converts values to other types if specified. + * @param message ProcessorType * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1.CommonOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1.ProcessorType, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CommonOperationMetadata to JSON. + * Converts this ProcessorType to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace CommonOperationMetadata { + namespace ProcessorType { - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - RUNNING = 1, - CANCELLING = 2, - SUCCEEDED = 3, - FAILED = 4, - CANCELLED = 5 + /** Properties of a LocationInfo. */ + interface ILocationInfo { + + /** LocationInfo locationId */ + locationId?: (string|null); + } + + /** Represents a LocationInfo. */ + class LocationInfo implements ILocationInfo { + + /** + * Constructs a new LocationInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.ProcessorType.ILocationInfo); + + /** LocationInfo locationId. */ + public locationId: string; + + /** + * Creates a new LocationInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns LocationInfo instance + */ + public static create(properties?: google.cloud.documentai.v1.ProcessorType.ILocationInfo): google.cloud.documentai.v1.ProcessorType.LocationInfo; + + /** + * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.documentai.v1.ProcessorType.LocationInfo.verify|verify} messages. + * @param message LocationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.ProcessorType.ILocationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessorType.LocationInfo.verify|verify} messages. + * @param message LocationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.ProcessorType.ILocationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LocationInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LocationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ProcessorType.LocationInfo; + + /** + * Decodes a LocationInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LocationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ProcessorType.LocationInfo; + + /** + * Verifies a LocationInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LocationInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ProcessorType.LocationInfo; + + /** + * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. + * @param message LocationInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ProcessorType.LocationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LocationInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; } } } @@ -23224,6 +27674,18 @@ export namespace google { */ public toJSON(): { [k: string]: any }; } + + /** LaunchStage enum. */ + enum LaunchStage { + LAUNCH_STAGE_UNSPECIFIED = 0, + UNIMPLEMENTED = 6, + PRELAUNCH = 7, + EARLY_ACCESS = 1, + ALPHA = 2, + BETA = 3, + GA = 4, + DEPRECATED = 5 + } } /** Namespace protobuf. */ diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 7f75f503cba..0b85aec5689 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -66,6 +66,238 @@ */ var v1 = {}; + v1.Barcode = (function() { + + /** + * Properties of a Barcode. + * @memberof google.cloud.documentai.v1 + * @interface IBarcode + * @property {string|null} [format] Barcode format + * @property {string|null} [valueFormat] Barcode valueFormat + * @property {string|null} [rawValue] Barcode rawValue + */ + + /** + * Constructs a new Barcode. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a Barcode. + * @implements IBarcode + * @constructor + * @param {google.cloud.documentai.v1.IBarcode=} [properties] Properties to set + */ + function Barcode(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Barcode format. + * @member {string} format + * @memberof google.cloud.documentai.v1.Barcode + * @instance + */ + Barcode.prototype.format = ""; + + /** + * Barcode valueFormat. + * @member {string} valueFormat + * @memberof google.cloud.documentai.v1.Barcode + * @instance + */ + Barcode.prototype.valueFormat = ""; + + /** + * Barcode rawValue. + * @member {string} rawValue + * @memberof google.cloud.documentai.v1.Barcode + * @instance + */ + Barcode.prototype.rawValue = ""; + + /** + * Creates a new Barcode instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Barcode + * @static + * @param {google.cloud.documentai.v1.IBarcode=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Barcode} Barcode instance + */ + Barcode.create = function create(properties) { + return new Barcode(properties); + }; + + /** + * Encodes the specified Barcode message. Does not implicitly {@link google.cloud.documentai.v1.Barcode.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Barcode + * @static + * @param {google.cloud.documentai.v1.IBarcode} message Barcode message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Barcode.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.format != null && Object.hasOwnProperty.call(message, "format")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.format); + if (message.valueFormat != null && Object.hasOwnProperty.call(message, "valueFormat")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.valueFormat); + if (message.rawValue != null && Object.hasOwnProperty.call(message, "rawValue")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.rawValue); + return writer; + }; + + /** + * Encodes the specified Barcode message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Barcode.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Barcode + * @static + * @param {google.cloud.documentai.v1.IBarcode} message Barcode message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Barcode.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Barcode message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Barcode + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Barcode} Barcode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Barcode.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Barcode(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.format = reader.string(); + break; + case 2: + message.valueFormat = reader.string(); + break; + case 3: + message.rawValue = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Barcode message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Barcode + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Barcode} Barcode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Barcode.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Barcode message. + * @function verify + * @memberof google.cloud.documentai.v1.Barcode + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Barcode.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.format != null && message.hasOwnProperty("format")) + if (!$util.isString(message.format)) + return "format: string expected"; + if (message.valueFormat != null && message.hasOwnProperty("valueFormat")) + if (!$util.isString(message.valueFormat)) + return "valueFormat: string expected"; + if (message.rawValue != null && message.hasOwnProperty("rawValue")) + if (!$util.isString(message.rawValue)) + return "rawValue: string expected"; + return null; + }; + + /** + * Creates a Barcode message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Barcode + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Barcode} Barcode + */ + Barcode.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Barcode) + return object; + var message = new $root.google.cloud.documentai.v1.Barcode(); + if (object.format != null) + message.format = String(object.format); + if (object.valueFormat != null) + message.valueFormat = String(object.valueFormat); + if (object.rawValue != null) + message.rawValue = String(object.rawValue); + return message; + }; + + /** + * Creates a plain object from a Barcode message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Barcode + * @static + * @param {google.cloud.documentai.v1.Barcode} message Barcode + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Barcode.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.format = ""; + object.valueFormat = ""; + object.rawValue = ""; + } + if (message.format != null && message.hasOwnProperty("format")) + object.format = message.format; + if (message.valueFormat != null && message.hasOwnProperty("valueFormat")) + object.valueFormat = message.valueFormat; + if (message.rawValue != null && message.hasOwnProperty("rawValue")) + object.rawValue = message.rawValue; + return object; + }; + + /** + * Converts this Barcode to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Barcode + * @instance + * @returns {Object.} JSON object + */ + Barcode.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Barcode; + })(); + v1.Document = (function() { /** @@ -1503,6 +1735,7 @@ * @property {Array.|null} [tables] Page tables * @property {Array.|null} [formFields] Page formFields * @property {Array.|null} [symbols] Page symbols + * @property {Array.|null} [detectedBarcodes] Page detectedBarcodes * @property {google.cloud.documentai.v1.Document.IProvenance|null} [provenance] Page provenance */ @@ -1525,6 +1758,7 @@ this.tables = []; this.formFields = []; this.symbols = []; + this.detectedBarcodes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1643,6 +1877,14 @@ */ Page.prototype.symbols = $util.emptyArray; + /** + * Page detectedBarcodes. + * @member {Array.} detectedBarcodes + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.detectedBarcodes = $util.emptyArray; + /** * Page provenance. * @member {google.cloud.documentai.v1.Document.IProvenance|null|undefined} provenance @@ -1713,6 +1955,9 @@ if (message.transforms != null && message.transforms.length) for (var i = 0; i < message.transforms.length; ++i) $root.google.cloud.documentai.v1.Document.Page.Matrix.encode(message.transforms[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.detectedBarcodes != null && message.detectedBarcodes.length) + for (var i = 0; i < message.detectedBarcodes.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.DetectedBarcode.encode(message.detectedBarcodes[i], writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) $root.google.cloud.documentai.v1.Document.Provenance.encode(message.provenance, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); return writer; @@ -1811,6 +2056,11 @@ message.symbols = []; message.symbols.push($root.google.cloud.documentai.v1.Document.Page.Symbol.decode(reader, reader.uint32())); break; + case 15: + if (!(message.detectedBarcodes && message.detectedBarcodes.length)) + message.detectedBarcodes = []; + message.detectedBarcodes.push($root.google.cloud.documentai.v1.Document.Page.DetectedBarcode.decode(reader, reader.uint32())); + break; case 16: message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); break; @@ -1957,6 +2207,15 @@ return "symbols." + error; } } + if (message.detectedBarcodes != null && message.hasOwnProperty("detectedBarcodes")) { + if (!Array.isArray(message.detectedBarcodes)) + return "detectedBarcodes: array expected"; + for (var i = 0; i < message.detectedBarcodes.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.DetectedBarcode.verify(message.detectedBarcodes[i]); + if (error) + return "detectedBarcodes." + error; + } + } if (message.provenance != null && message.hasOwnProperty("provenance")) { var error = $root.google.cloud.documentai.v1.Document.Provenance.verify(message.provenance); if (error) @@ -2094,6 +2353,16 @@ message.symbols[i] = $root.google.cloud.documentai.v1.Document.Page.Symbol.fromObject(object.symbols[i]); } } + if (object.detectedBarcodes) { + if (!Array.isArray(object.detectedBarcodes)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.detectedBarcodes: array expected"); + message.detectedBarcodes = []; + for (var i = 0; i < object.detectedBarcodes.length; ++i) { + if (typeof object.detectedBarcodes[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.detectedBarcodes: object expected"); + message.detectedBarcodes[i] = $root.google.cloud.documentai.v1.Document.Page.DetectedBarcode.fromObject(object.detectedBarcodes[i]); + } + } if (object.provenance != null) { if (typeof object.provenance !== "object") throw TypeError(".google.cloud.documentai.v1.Document.Page.provenance: object expected"); @@ -2126,6 +2395,7 @@ object.formFields = []; object.symbols = []; object.transforms = []; + object.detectedBarcodes = []; } if (options.defaults) { object.pageNumber = 0; @@ -2192,6 +2462,11 @@ for (var j = 0; j < message.transforms.length; ++j) object.transforms[j] = $root.google.cloud.documentai.v1.Document.Page.Matrix.toObject(message.transforms[j], options); } + if (message.detectedBarcodes && message.detectedBarcodes.length) { + object.detectedBarcodes = []; + for (var j = 0; j < message.detectedBarcodes.length; ++j) + object.detectedBarcodes[j] = $root.google.cloud.documentai.v1.Document.Page.DetectedBarcode.toObject(message.detectedBarcodes[j], options); + } if (message.provenance != null && message.hasOwnProperty("provenance")) object.provenance = $root.google.cloud.documentai.v1.Document.Provenance.toObject(message.provenance, options); return object; @@ -5907,6 +6182,8 @@ * @property {Array.|null} [nameDetectedLanguages] FormField nameDetectedLanguages * @property {Array.|null} [valueDetectedLanguages] FormField valueDetectedLanguages * @property {string|null} [valueType] FormField valueType + * @property {string|null} [correctedKeyText] FormField correctedKeyText + * @property {string|null} [correctedValueText] FormField correctedValueText * @property {google.cloud.documentai.v1.Document.IProvenance|null} [provenance] FormField provenance */ @@ -5967,6 +6244,22 @@ */ FormField.prototype.valueType = ""; + /** + * FormField correctedKeyText. + * @member {string} correctedKeyText + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @instance + */ + FormField.prototype.correctedKeyText = ""; + + /** + * FormField correctedValueText. + * @member {string} correctedValueText + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @instance + */ + FormField.prototype.correctedValueText = ""; + /** * FormField provenance. * @member {google.cloud.documentai.v1.Document.IProvenance|null|undefined} provenance @@ -6011,6 +6304,10 @@ $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.encode(message.valueDetectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.valueType != null && Object.hasOwnProperty.call(message, "valueType")) writer.uint32(/* id 5, wireType 2 =*/42).string(message.valueType); + if (message.correctedKeyText != null && Object.hasOwnProperty.call(message, "correctedKeyText")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.correctedKeyText); + if (message.correctedValueText != null && Object.hasOwnProperty.call(message, "correctedValueText")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.correctedValueText); if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) $root.google.cloud.documentai.v1.Document.Provenance.encode(message.provenance, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); return writer; @@ -6066,6 +6363,12 @@ case 5: message.valueType = reader.string(); break; + case 6: + message.correctedKeyText = reader.string(); + break; + case 7: + message.correctedValueText = reader.string(); + break; case 8: message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); break; @@ -6135,6 +6438,12 @@ if (message.valueType != null && message.hasOwnProperty("valueType")) if (!$util.isString(message.valueType)) return "valueType: string expected"; + if (message.correctedKeyText != null && message.hasOwnProperty("correctedKeyText")) + if (!$util.isString(message.correctedKeyText)) + return "correctedKeyText: string expected"; + if (message.correctedValueText != null && message.hasOwnProperty("correctedValueText")) + if (!$util.isString(message.correctedValueText)) + return "correctedValueText: string expected"; if (message.provenance != null && message.hasOwnProperty("provenance")) { var error = $root.google.cloud.documentai.v1.Document.Provenance.verify(message.provenance); if (error) @@ -6187,6 +6496,10 @@ } if (object.valueType != null) message.valueType = String(object.valueType); + if (object.correctedKeyText != null) + message.correctedKeyText = String(object.correctedKeyText); + if (object.correctedValueText != null) + message.correctedValueText = String(object.correctedValueText); if (object.provenance != null) { if (typeof object.provenance !== "object") throw TypeError(".google.cloud.documentai.v1.Document.Page.FormField.provenance: object expected"); @@ -6216,6 +6529,8 @@ object.fieldName = null; object.fieldValue = null; object.valueType = ""; + object.correctedKeyText = ""; + object.correctedValueText = ""; object.provenance = null; } if (message.fieldName != null && message.hasOwnProperty("fieldName")) @@ -6234,6 +6549,10 @@ } if (message.valueType != null && message.hasOwnProperty("valueType")) object.valueType = message.valueType; + if (message.correctedKeyText != null && message.hasOwnProperty("correctedKeyText")) + object.correctedKeyText = message.correctedKeyText; + if (message.correctedValueText != null && message.hasOwnProperty("correctedValueText")) + object.correctedValueText = message.correctedValueText; if (message.provenance != null && message.hasOwnProperty("provenance")) object.provenance = $root.google.cloud.documentai.v1.Document.Provenance.toObject(message.provenance, options); return object; @@ -6253,6 +6572,226 @@ return FormField; })(); + Page.DetectedBarcode = (function() { + + /** + * Properties of a DetectedBarcode. + * @memberof google.cloud.documentai.v1.Document.Page + * @interface IDetectedBarcode + * @property {google.cloud.documentai.v1.Document.Page.ILayout|null} [layout] DetectedBarcode layout + * @property {google.cloud.documentai.v1.IBarcode|null} [barcode] DetectedBarcode barcode + */ + + /** + * Constructs a new DetectedBarcode. + * @memberof google.cloud.documentai.v1.Document.Page + * @classdesc Represents a DetectedBarcode. + * @implements IDetectedBarcode + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.IDetectedBarcode=} [properties] Properties to set + */ + function DetectedBarcode(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DetectedBarcode layout. + * @member {google.cloud.documentai.v1.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @instance + */ + DetectedBarcode.prototype.layout = null; + + /** + * DetectedBarcode barcode. + * @member {google.cloud.documentai.v1.IBarcode|null|undefined} barcode + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @instance + */ + DetectedBarcode.prototype.barcode = null; + + /** + * Creates a new DetectedBarcode instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @static + * @param {google.cloud.documentai.v1.Document.Page.IDetectedBarcode=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.DetectedBarcode} DetectedBarcode instance + */ + DetectedBarcode.create = function create(properties) { + return new DetectedBarcode(properties); + }; + + /** + * Encodes the specified DetectedBarcode message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.DetectedBarcode.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @static + * @param {google.cloud.documentai.v1.Document.Page.IDetectedBarcode} message DetectedBarcode message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedBarcode.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.barcode != null && Object.hasOwnProperty.call(message, "barcode")) + $root.google.cloud.documentai.v1.Barcode.encode(message.barcode, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DetectedBarcode message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.DetectedBarcode.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @static + * @param {google.cloud.documentai.v1.Document.Page.IDetectedBarcode} message DetectedBarcode message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedBarcode.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectedBarcode message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page.DetectedBarcode} DetectedBarcode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedBarcode.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Page.DetectedBarcode(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + message.barcode = $root.google.cloud.documentai.v1.Barcode.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectedBarcode message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.DetectedBarcode} DetectedBarcode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedBarcode.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectedBarcode message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectedBarcode.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.barcode != null && message.hasOwnProperty("barcode")) { + var error = $root.google.cloud.documentai.v1.Barcode.verify(message.barcode); + if (error) + return "barcode." + error; + } + return null; + }; + + /** + * Creates a DetectedBarcode message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.DetectedBarcode} DetectedBarcode + */ + DetectedBarcode.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.DetectedBarcode) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.DetectedBarcode(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.DetectedBarcode.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.fromObject(object.layout); + } + if (object.barcode != null) { + if (typeof object.barcode !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.DetectedBarcode.barcode: object expected"); + message.barcode = $root.google.cloud.documentai.v1.Barcode.fromObject(object.barcode); + } + return message; + }; + + /** + * Creates a plain object from a DetectedBarcode message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @static + * @param {google.cloud.documentai.v1.Document.Page.DetectedBarcode} message DetectedBarcode + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectedBarcode.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.layout = null; + object.barcode = null; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.toObject(message.layout, options); + if (message.barcode != null && message.hasOwnProperty("barcode")) + object.barcode = $root.google.cloud.documentai.v1.Barcode.toObject(message.barcode, options); + return object; + }; + + /** + * Converts this DetectedBarcode to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @instance + * @returns {Object.} JSON object + */ + DetectedBarcode.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DetectedBarcode; + })(); + Page.DetectedLanguage = (function() { /** @@ -6924,6 +7463,8 @@ * @property {google.type.IDateTime|null} [datetimeValue] NormalizedValue datetimeValue * @property {google.type.IPostalAddress|null} [addressValue] NormalizedValue addressValue * @property {boolean|null} [booleanValue] NormalizedValue booleanValue + * @property {number|null} [integerValue] NormalizedValue integerValue + * @property {number|null} [floatValue] NormalizedValue floatValue * @property {string|null} [text] NormalizedValue text */ @@ -6982,6 +7523,22 @@ */ NormalizedValue.prototype.booleanValue = null; + /** + * NormalizedValue integerValue. + * @member {number|null|undefined} integerValue + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @instance + */ + NormalizedValue.prototype.integerValue = null; + + /** + * NormalizedValue floatValue. + * @member {number|null|undefined} floatValue + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @instance + */ + NormalizedValue.prototype.floatValue = null; + /** * NormalizedValue text. * @member {string} text @@ -6995,12 +7552,12 @@ /** * NormalizedValue structuredValue. - * @member {"moneyValue"|"dateValue"|"datetimeValue"|"addressValue"|"booleanValue"|undefined} structuredValue + * @member {"moneyValue"|"dateValue"|"datetimeValue"|"addressValue"|"booleanValue"|"integerValue"|"floatValue"|undefined} structuredValue * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue * @instance */ Object.defineProperty(NormalizedValue.prototype, "structuredValue", { - get: $util.oneOfGetter($oneOfFields = ["moneyValue", "dateValue", "datetimeValue", "addressValue", "booleanValue"]), + get: $util.oneOfGetter($oneOfFields = ["moneyValue", "dateValue", "datetimeValue", "addressValue", "booleanValue", "integerValue", "floatValue"]), set: $util.oneOfSetter($oneOfFields) }); @@ -7040,6 +7597,10 @@ $root.google.type.PostalAddress.encode(message.addressValue, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); if (message.booleanValue != null && Object.hasOwnProperty.call(message, "booleanValue")) writer.uint32(/* id 6, wireType 0 =*/48).bool(message.booleanValue); + if (message.integerValue != null && Object.hasOwnProperty.call(message, "integerValue")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.integerValue); + if (message.floatValue != null && Object.hasOwnProperty.call(message, "floatValue")) + writer.uint32(/* id 8, wireType 5 =*/69).float(message.floatValue); return writer; }; @@ -7089,6 +7650,12 @@ case 6: message.booleanValue = reader.bool(); break; + case 7: + message.integerValue = reader.int32(); + break; + case 8: + message.floatValue = reader.float(); + break; case 1: message.text = reader.string(); break; @@ -7173,6 +7740,20 @@ if (typeof message.booleanValue !== "boolean") return "booleanValue: boolean expected"; } + if (message.integerValue != null && message.hasOwnProperty("integerValue")) { + if (properties.structuredValue === 1) + return "structuredValue: multiple values"; + properties.structuredValue = 1; + if (!$util.isInteger(message.integerValue)) + return "integerValue: integer expected"; + } + if (message.floatValue != null && message.hasOwnProperty("floatValue")) { + if (properties.structuredValue === 1) + return "structuredValue: multiple values"; + properties.structuredValue = 1; + if (typeof message.floatValue !== "number") + return "floatValue: number expected"; + } if (message.text != null && message.hasOwnProperty("text")) if (!$util.isString(message.text)) return "text: string expected"; @@ -7213,6 +7794,10 @@ } if (object.booleanValue != null) message.booleanValue = Boolean(object.booleanValue); + if (object.integerValue != null) + message.integerValue = object.integerValue | 0; + if (object.floatValue != null) + message.floatValue = Number(object.floatValue); if (object.text != null) message.text = String(object.text); return message; @@ -7260,6 +7845,16 @@ if (options.oneofs) object.structuredValue = "booleanValue"; } + if (message.integerValue != null && message.hasOwnProperty("integerValue")) { + object.integerValue = message.integerValue; + if (options.oneofs) + object.structuredValue = "integerValue"; + } + if (message.floatValue != null && message.hasOwnProperty("floatValue")) { + object.floatValue = options.json && !isFinite(message.floatValue) ? String(message.floatValue) : message.floatValue; + if (options.oneofs) + object.structuredValue = "floatValue"; + } return object; }; @@ -9133,6 +9728,7 @@ * @property {string|null} [processor] Revision processor * @property {string|null} [id] Revision id * @property {Array.|null} [parent] Revision parent + * @property {Array.|null} [parentIds] Revision parentIds * @property {google.protobuf.ITimestamp|null} [createTime] Revision createTime * @property {google.cloud.documentai.v1.Document.Revision.IHumanReview|null} [humanReview] Revision humanReview */ @@ -9147,6 +9743,7 @@ */ function Revision(properties) { this.parent = []; + this.parentIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -9185,6 +9782,14 @@ */ Revision.prototype.parent = $util.emptyArray; + /** + * Revision parentIds. + * @member {Array.} parentIds + * @memberof google.cloud.documentai.v1.Document.Revision + * @instance + */ + Revision.prototype.parentIds = $util.emptyArray; + /** * Revision createTime. * @member {google.protobuf.ITimestamp|null|undefined} createTime @@ -9255,6 +9860,9 @@ writer.uint32(/* id 5, wireType 2 =*/42).string(message.processor); if (message.humanReview != null && Object.hasOwnProperty.call(message, "humanReview")) $root.google.cloud.documentai.v1.Document.Revision.HumanReview.encode(message.humanReview, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.parentIds != null && message.parentIds.length) + for (var i = 0; i < message.parentIds.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.parentIds[i]); return writer; }; @@ -9308,6 +9916,11 @@ } else message.parent.push(reader.int32()); break; + case 7: + if (!(message.parentIds && message.parentIds.length)) + message.parentIds = []; + message.parentIds.push(reader.string()); + break; case 3: message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; @@ -9372,6 +9985,13 @@ if (!$util.isInteger(message.parent[i])) return "parent: integer[] expected"; } + if (message.parentIds != null && message.hasOwnProperty("parentIds")) { + if (!Array.isArray(message.parentIds)) + return "parentIds: array expected"; + for (var i = 0; i < message.parentIds.length; ++i) + if (!$util.isString(message.parentIds[i])) + return "parentIds: string[] expected"; + } if (message.createTime != null && message.hasOwnProperty("createTime")) { var error = $root.google.protobuf.Timestamp.verify(message.createTime); if (error) @@ -9410,6 +10030,13 @@ for (var i = 0; i < object.parent.length; ++i) message.parent[i] = object.parent[i] | 0; } + if (object.parentIds) { + if (!Array.isArray(object.parentIds)) + throw TypeError(".google.cloud.documentai.v1.Document.Revision.parentIds: array expected"); + message.parentIds = []; + for (var i = 0; i < object.parentIds.length; ++i) + message.parentIds[i] = String(object.parentIds[i]); + } if (object.createTime != null) { if (typeof object.createTime !== "object") throw TypeError(".google.cloud.documentai.v1.Document.Revision.createTime: object expected"); @@ -9436,8 +10063,10 @@ if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) + if (options.arrays || options.defaults) { object.parent = []; + object.parentIds = []; + } if (options.defaults) { object.id = ""; object.createTime = null; @@ -9464,6 +10093,11 @@ } if (message.humanReview != null && message.hasOwnProperty("humanReview")) object.humanReview = $root.google.cloud.documentai.v1.Document.Revision.HumanReview.toObject(message.humanReview, options); + if (message.parentIds && message.parentIds.length) { + object.parentIds = []; + for (var j = 0; j < message.parentIds.length; ++j) + object.parentIds[j] = message.parentIds[j]; + } return object; }; @@ -12190,6 +12824,468 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#fetchProcessorTypes}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef FetchProcessorTypesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1.FetchProcessorTypesResponse} [response] FetchProcessorTypesResponse + */ + + /** + * Calls FetchProcessorTypes. + * @function fetchProcessorTypes + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IFetchProcessorTypesRequest} request FetchProcessorTypesRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypesCallback} callback Node-style callback called with the error, if any, and FetchProcessorTypesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.fetchProcessorTypes = function fetchProcessorTypes(request, callback) { + return this.rpcCall(fetchProcessorTypes, $root.google.cloud.documentai.v1.FetchProcessorTypesRequest, $root.google.cloud.documentai.v1.FetchProcessorTypesResponse, request, callback); + }, "name", { value: "FetchProcessorTypes" }); + + /** + * Calls FetchProcessorTypes. + * @function fetchProcessorTypes + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IFetchProcessorTypesRequest} request FetchProcessorTypesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#listProcessorTypes}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef ListProcessorTypesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1.ListProcessorTypesResponse} [response] ListProcessorTypesResponse + */ + + /** + * Calls ListProcessorTypes. + * @function listProcessorTypes + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IListProcessorTypesRequest} request ListProcessorTypesRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypesCallback} callback Node-style callback called with the error, if any, and ListProcessorTypesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.listProcessorTypes = function listProcessorTypes(request, callback) { + return this.rpcCall(listProcessorTypes, $root.google.cloud.documentai.v1.ListProcessorTypesRequest, $root.google.cloud.documentai.v1.ListProcessorTypesResponse, request, callback); + }, "name", { value: "ListProcessorTypes" }); + + /** + * Calls ListProcessorTypes. + * @function listProcessorTypes + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IListProcessorTypesRequest} request ListProcessorTypesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#listProcessors}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef ListProcessorsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1.ListProcessorsResponse} [response] ListProcessorsResponse + */ + + /** + * Calls ListProcessors. + * @function listProcessors + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IListProcessorsRequest} request ListProcessorsRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.ListProcessorsCallback} callback Node-style callback called with the error, if any, and ListProcessorsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.listProcessors = function listProcessors(request, callback) { + return this.rpcCall(listProcessors, $root.google.cloud.documentai.v1.ListProcessorsRequest, $root.google.cloud.documentai.v1.ListProcessorsResponse, request, callback); + }, "name", { value: "ListProcessors" }); + + /** + * Calls ListProcessors. + * @function listProcessors + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IListProcessorsRequest} request ListProcessorsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#getProcessor}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef GetProcessorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1.Processor} [response] Processor + */ + + /** + * Calls GetProcessor. + * @function getProcessor + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IGetProcessorRequest} request GetProcessorRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.GetProcessorCallback} callback Node-style callback called with the error, if any, and Processor + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.getProcessor = function getProcessor(request, callback) { + return this.rpcCall(getProcessor, $root.google.cloud.documentai.v1.GetProcessorRequest, $root.google.cloud.documentai.v1.Processor, request, callback); + }, "name", { value: "GetProcessor" }); + + /** + * Calls GetProcessor. + * @function getProcessor + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IGetProcessorRequest} request GetProcessorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#getProcessorVersion}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef GetProcessorVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1.ProcessorVersion} [response] ProcessorVersion + */ + + /** + * Calls GetProcessorVersion. + * @function getProcessorVersion + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IGetProcessorVersionRequest} request GetProcessorVersionRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersionCallback} callback Node-style callback called with the error, if any, and ProcessorVersion + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.getProcessorVersion = function getProcessorVersion(request, callback) { + return this.rpcCall(getProcessorVersion, $root.google.cloud.documentai.v1.GetProcessorVersionRequest, $root.google.cloud.documentai.v1.ProcessorVersion, request, callback); + }, "name", { value: "GetProcessorVersion" }); + + /** + * Calls GetProcessorVersion. + * @function getProcessorVersion + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IGetProcessorVersionRequest} request GetProcessorVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#listProcessorVersions}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef ListProcessorVersionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1.ListProcessorVersionsResponse} [response] ListProcessorVersionsResponse + */ + + /** + * Calls ListProcessorVersions. + * @function listProcessorVersions + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IListProcessorVersionsRequest} request ListProcessorVersionsRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersionsCallback} callback Node-style callback called with the error, if any, and ListProcessorVersionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.listProcessorVersions = function listProcessorVersions(request, callback) { + return this.rpcCall(listProcessorVersions, $root.google.cloud.documentai.v1.ListProcessorVersionsRequest, $root.google.cloud.documentai.v1.ListProcessorVersionsResponse, request, callback); + }, "name", { value: "ListProcessorVersions" }); + + /** + * Calls ListProcessorVersions. + * @function listProcessorVersions + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IListProcessorVersionsRequest} request ListProcessorVersionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#deleteProcessorVersion}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef DeleteProcessorVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteProcessorVersion. + * @function deleteProcessorVersion + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IDeleteProcessorVersionRequest} request DeleteProcessorVersionRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.deleteProcessorVersion = function deleteProcessorVersion(request, callback) { + return this.rpcCall(deleteProcessorVersion, $root.google.cloud.documentai.v1.DeleteProcessorVersionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteProcessorVersion" }); + + /** + * Calls DeleteProcessorVersion. + * @function deleteProcessorVersion + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IDeleteProcessorVersionRequest} request DeleteProcessorVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#deployProcessorVersion}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef DeployProcessorVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeployProcessorVersion. + * @function deployProcessorVersion + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IDeployProcessorVersionRequest} request DeployProcessorVersionRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.deployProcessorVersion = function deployProcessorVersion(request, callback) { + return this.rpcCall(deployProcessorVersion, $root.google.cloud.documentai.v1.DeployProcessorVersionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeployProcessorVersion" }); + + /** + * Calls DeployProcessorVersion. + * @function deployProcessorVersion + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IDeployProcessorVersionRequest} request DeployProcessorVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#undeployProcessorVersion}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef UndeployProcessorVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UndeployProcessorVersion. + * @function undeployProcessorVersion + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionRequest} request UndeployProcessorVersionRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.undeployProcessorVersion = function undeployProcessorVersion(request, callback) { + return this.rpcCall(undeployProcessorVersion, $root.google.cloud.documentai.v1.UndeployProcessorVersionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UndeployProcessorVersion" }); + + /** + * Calls UndeployProcessorVersion. + * @function undeployProcessorVersion + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionRequest} request UndeployProcessorVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#createProcessor}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef CreateProcessorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1.Processor} [response] Processor + */ + + /** + * Calls CreateProcessor. + * @function createProcessor + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.ICreateProcessorRequest} request CreateProcessorRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.CreateProcessorCallback} callback Node-style callback called with the error, if any, and Processor + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.createProcessor = function createProcessor(request, callback) { + return this.rpcCall(createProcessor, $root.google.cloud.documentai.v1.CreateProcessorRequest, $root.google.cloud.documentai.v1.Processor, request, callback); + }, "name", { value: "CreateProcessor" }); + + /** + * Calls CreateProcessor. + * @function createProcessor + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.ICreateProcessorRequest} request CreateProcessorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#deleteProcessor}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef DeleteProcessorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteProcessor. + * @function deleteProcessor + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IDeleteProcessorRequest} request DeleteProcessorRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.deleteProcessor = function deleteProcessor(request, callback) { + return this.rpcCall(deleteProcessor, $root.google.cloud.documentai.v1.DeleteProcessorRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteProcessor" }); + + /** + * Calls DeleteProcessor. + * @function deleteProcessor + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IDeleteProcessorRequest} request DeleteProcessorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#enableProcessor}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef EnableProcessorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls EnableProcessor. + * @function enableProcessor + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IEnableProcessorRequest} request EnableProcessorRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.EnableProcessorCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.enableProcessor = function enableProcessor(request, callback) { + return this.rpcCall(enableProcessor, $root.google.cloud.documentai.v1.EnableProcessorRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "EnableProcessor" }); + + /** + * Calls EnableProcessor. + * @function enableProcessor + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IEnableProcessorRequest} request EnableProcessorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#disableProcessor}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef DisableProcessorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DisableProcessor. + * @function disableProcessor + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IDisableProcessorRequest} request DisableProcessorRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.DisableProcessorCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.disableProcessor = function disableProcessor(request, callback) { + return this.rpcCall(disableProcessor, $root.google.cloud.documentai.v1.DisableProcessorRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DisableProcessor" }); + + /** + * Calls DisableProcessor. + * @function disableProcessor + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IDisableProcessorRequest} request DisableProcessorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#setDefaultProcessorVersion}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef SetDefaultProcessorVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls SetDefaultProcessorVersion. + * @function setDefaultProcessorVersion + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest} request SetDefaultProcessorVersionRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.setDefaultProcessorVersion = function setDefaultProcessorVersion(request, callback) { + return this.rpcCall(setDefaultProcessorVersion, $root.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "SetDefaultProcessorVersion" }); + + /** + * Calls SetDefaultProcessorVersion. + * @function setDefaultProcessorVersion + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest} request SetDefaultProcessorVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#reviewDocument}. * @memberof google.cloud.documentai.v1.DocumentProcessorService @@ -12236,6 +13332,7 @@ * @property {google.cloud.documentai.v1.IRawDocument|null} [rawDocument] ProcessRequest rawDocument * @property {string|null} [name] ProcessRequest name * @property {boolean|null} [skipHumanReview] ProcessRequest skipHumanReview + * @property {google.protobuf.IFieldMask|null} [fieldMask] ProcessRequest fieldMask */ /** @@ -12285,6 +13382,14 @@ */ ProcessRequest.prototype.skipHumanReview = false; + /** + * ProcessRequest fieldMask. + * @member {google.protobuf.IFieldMask|null|undefined} fieldMask + * @memberof google.cloud.documentai.v1.ProcessRequest + * @instance + */ + ProcessRequest.prototype.fieldMask = null; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -12331,6 +13436,8 @@ $root.google.cloud.documentai.v1.Document.encode(message.inlineDocument, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.rawDocument != null && Object.hasOwnProperty.call(message, "rawDocument")) $root.google.cloud.documentai.v1.RawDocument.encode(message.rawDocument, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.fieldMask != null && Object.hasOwnProperty.call(message, "fieldMask")) + $root.google.protobuf.FieldMask.encode(message.fieldMask, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; @@ -12377,6 +13484,9 @@ case 3: message.skipHumanReview = reader.bool(); break; + case 6: + message.fieldMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -12437,6 +13547,11 @@ if (message.skipHumanReview != null && message.hasOwnProperty("skipHumanReview")) if (typeof message.skipHumanReview !== "boolean") return "skipHumanReview: boolean expected"; + if (message.fieldMask != null && message.hasOwnProperty("fieldMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.fieldMask); + if (error) + return "fieldMask." + error; + } return null; }; @@ -12466,6 +13581,11 @@ message.name = String(object.name); if (object.skipHumanReview != null) message.skipHumanReview = Boolean(object.skipHumanReview); + if (object.fieldMask != null) { + if (typeof object.fieldMask !== "object") + throw TypeError(".google.cloud.documentai.v1.ProcessRequest.fieldMask: object expected"); + message.fieldMask = $root.google.protobuf.FieldMask.fromObject(object.fieldMask); + } return message; }; @@ -12485,6 +13605,7 @@ if (options.defaults) { object.name = ""; object.skipHumanReview = false; + object.fieldMask = null; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -12500,6 +13621,8 @@ if (options.oneofs) object.source = "rawDocument"; } + if (message.fieldMask != null && message.hasOwnProperty("fieldMask")) + object.fieldMask = $root.google.protobuf.FieldMask.toObject(message.fieldMask, options); return object; }; @@ -14075,27 +15198,24 @@ return BatchProcessMetadata; })(); - v1.ReviewDocumentRequest = (function() { + v1.FetchProcessorTypesRequest = (function() { /** - * Properties of a ReviewDocumentRequest. + * Properties of a FetchProcessorTypesRequest. * @memberof google.cloud.documentai.v1 - * @interface IReviewDocumentRequest - * @property {google.cloud.documentai.v1.IDocument|null} [inlineDocument] ReviewDocumentRequest inlineDocument - * @property {string|null} [humanReviewConfig] ReviewDocumentRequest humanReviewConfig - * @property {boolean|null} [enableSchemaValidation] ReviewDocumentRequest enableSchemaValidation - * @property {google.cloud.documentai.v1.ReviewDocumentRequest.Priority|null} [priority] ReviewDocumentRequest priority + * @interface IFetchProcessorTypesRequest + * @property {string|null} [parent] FetchProcessorTypesRequest parent */ /** - * Constructs a new ReviewDocumentRequest. + * Constructs a new FetchProcessorTypesRequest. * @memberof google.cloud.documentai.v1 - * @classdesc Represents a ReviewDocumentRequest. - * @implements IReviewDocumentRequest + * @classdesc Represents a FetchProcessorTypesRequest. + * @implements IFetchProcessorTypesRequest * @constructor - * @param {google.cloud.documentai.v1.IReviewDocumentRequest=} [properties] Properties to set + * @param {google.cloud.documentai.v1.IFetchProcessorTypesRequest=} [properties] Properties to set */ - function ReviewDocumentRequest(properties) { + function FetchProcessorTypesRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14103,128 +15223,75 @@ } /** - * ReviewDocumentRequest inlineDocument. - * @member {google.cloud.documentai.v1.IDocument|null|undefined} inlineDocument - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest - * @instance - */ - ReviewDocumentRequest.prototype.inlineDocument = null; - - /** - * ReviewDocumentRequest humanReviewConfig. - * @member {string} humanReviewConfig - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest - * @instance - */ - ReviewDocumentRequest.prototype.humanReviewConfig = ""; - - /** - * ReviewDocumentRequest enableSchemaValidation. - * @member {boolean} enableSchemaValidation - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest - * @instance - */ - ReviewDocumentRequest.prototype.enableSchemaValidation = false; - - /** - * ReviewDocumentRequest priority. - * @member {google.cloud.documentai.v1.ReviewDocumentRequest.Priority} priority - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest - * @instance - */ - ReviewDocumentRequest.prototype.priority = 0; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * ReviewDocumentRequest source. - * @member {"inlineDocument"|undefined} source - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * FetchProcessorTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest * @instance */ - Object.defineProperty(ReviewDocumentRequest.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["inlineDocument"]), - set: $util.oneOfSetter($oneOfFields) - }); + FetchProcessorTypesRequest.prototype.parent = ""; /** - * Creates a new ReviewDocumentRequest instance using the specified properties. + * Creates a new FetchProcessorTypesRequest instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1.IReviewDocumentRequest=} [properties] Properties to set - * @returns {google.cloud.documentai.v1.ReviewDocumentRequest} ReviewDocumentRequest instance + * @param {google.cloud.documentai.v1.IFetchProcessorTypesRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.FetchProcessorTypesRequest} FetchProcessorTypesRequest instance */ - ReviewDocumentRequest.create = function create(properties) { - return new ReviewDocumentRequest(properties); + FetchProcessorTypesRequest.create = function create(properties) { + return new FetchProcessorTypesRequest(properties); }; /** - * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentRequest.verify|verify} messages. + * Encodes the specified FetchProcessorTypesRequest message. Does not implicitly {@link google.cloud.documentai.v1.FetchProcessorTypesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {google.cloud.documentai.v1.IFetchProcessorTypesRequest} message FetchProcessorTypesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentRequest.encode = function encode(message, writer) { + FetchProcessorTypesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.humanReviewConfig != null && Object.hasOwnProperty.call(message, "humanReviewConfig")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.humanReviewConfig); - if (message.enableSchemaValidation != null && Object.hasOwnProperty.call(message, "enableSchemaValidation")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableSchemaValidation); - if (message.inlineDocument != null && Object.hasOwnProperty.call(message, "inlineDocument")) - $root.google.cloud.documentai.v1.Document.encode(message.inlineDocument, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.priority != null && Object.hasOwnProperty.call(message, "priority")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.priority); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); return writer; }; /** - * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentRequest.verify|verify} messages. + * Encodes the specified FetchProcessorTypesRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.FetchProcessorTypesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {google.cloud.documentai.v1.IFetchProcessorTypesRequest} message FetchProcessorTypesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + FetchProcessorTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * Decodes a FetchProcessorTypesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1.ReviewDocumentRequest} ReviewDocumentRequest + * @returns {google.cloud.documentai.v1.FetchProcessorTypesRequest} FetchProcessorTypesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentRequest.decode = function decode(reader, length) { + FetchProcessorTypesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ReviewDocumentRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.FetchProcessorTypesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 4: - message.inlineDocument = $root.google.cloud.documentai.v1.Document.decode(reader, reader.uint32()); - break; case 1: - message.humanReviewConfig = reader.string(); - break; - case 3: - message.enableSchemaValidation = reader.bool(); - break; - case 5: - message.priority = reader.int32(); + message.parent = reader.string(); break; default: reader.skipType(tag & 7); @@ -14235,170 +15302,108 @@ }; /** - * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * Decodes a FetchProcessorTypesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1.ReviewDocumentRequest} ReviewDocumentRequest + * @returns {google.cloud.documentai.v1.FetchProcessorTypesRequest} FetchProcessorTypesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + FetchProcessorTypesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReviewDocumentRequest message. + * Verifies a FetchProcessorTypesRequest message. * @function verify - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ReviewDocumentRequest.verify = function verify(message) { + FetchProcessorTypesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { - properties.source = 1; - { - var error = $root.google.cloud.documentai.v1.Document.verify(message.inlineDocument); - if (error) - return "inlineDocument." + error; - } - } - if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) - if (!$util.isString(message.humanReviewConfig)) - return "humanReviewConfig: string expected"; - if (message.enableSchemaValidation != null && message.hasOwnProperty("enableSchemaValidation")) - if (typeof message.enableSchemaValidation !== "boolean") - return "enableSchemaValidation: boolean expected"; - if (message.priority != null && message.hasOwnProperty("priority")) - switch (message.priority) { - default: - return "priority: enum value expected"; - case 0: - case 1: - break; - } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; return null; }; /** - * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. + * Creates a FetchProcessorTypesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1.ReviewDocumentRequest} ReviewDocumentRequest + * @returns {google.cloud.documentai.v1.FetchProcessorTypesRequest} FetchProcessorTypesRequest */ - ReviewDocumentRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1.ReviewDocumentRequest) + FetchProcessorTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.FetchProcessorTypesRequest) return object; - var message = new $root.google.cloud.documentai.v1.ReviewDocumentRequest(); - if (object.inlineDocument != null) { - if (typeof object.inlineDocument !== "object") - throw TypeError(".google.cloud.documentai.v1.ReviewDocumentRequest.inlineDocument: object expected"); - message.inlineDocument = $root.google.cloud.documentai.v1.Document.fromObject(object.inlineDocument); - } - if (object.humanReviewConfig != null) - message.humanReviewConfig = String(object.humanReviewConfig); - if (object.enableSchemaValidation != null) - message.enableSchemaValidation = Boolean(object.enableSchemaValidation); - switch (object.priority) { - case "DEFAULT": - case 0: - message.priority = 0; - break; - case "URGENT": - case 1: - message.priority = 1; - break; - } + var message = new $root.google.cloud.documentai.v1.FetchProcessorTypesRequest(); + if (object.parent != null) + message.parent = String(object.parent); return message; }; /** - * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. + * Creates a plain object from a FetchProcessorTypesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1.ReviewDocumentRequest} message ReviewDocumentRequest + * @param {google.cloud.documentai.v1.FetchProcessorTypesRequest} message FetchProcessorTypesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReviewDocumentRequest.toObject = function toObject(message, options) { + FetchProcessorTypesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.humanReviewConfig = ""; - object.enableSchemaValidation = false; - object.priority = options.enums === String ? "DEFAULT" : 0; - } - if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) - object.humanReviewConfig = message.humanReviewConfig; - if (message.enableSchemaValidation != null && message.hasOwnProperty("enableSchemaValidation")) - object.enableSchemaValidation = message.enableSchemaValidation; - if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { - object.inlineDocument = $root.google.cloud.documentai.v1.Document.toObject(message.inlineDocument, options); - if (options.oneofs) - object.source = "inlineDocument"; - } - if (message.priority != null && message.hasOwnProperty("priority")) - object.priority = options.enums === String ? $root.google.cloud.documentai.v1.ReviewDocumentRequest.Priority[message.priority] : message.priority; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; return object; }; /** - * Converts this ReviewDocumentRequest to JSON. + * Converts this FetchProcessorTypesRequest to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest * @instance * @returns {Object.} JSON object */ - ReviewDocumentRequest.prototype.toJSON = function toJSON() { + FetchProcessorTypesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * Priority enum. - * @name google.cloud.documentai.v1.ReviewDocumentRequest.Priority - * @enum {number} - * @property {number} DEFAULT=0 DEFAULT value - * @property {number} URGENT=1 URGENT value - */ - ReviewDocumentRequest.Priority = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "DEFAULT"] = 0; - values[valuesById[1] = "URGENT"] = 1; - return values; - })(); - - return ReviewDocumentRequest; + return FetchProcessorTypesRequest; })(); - v1.ReviewDocumentResponse = (function() { + v1.FetchProcessorTypesResponse = (function() { /** - * Properties of a ReviewDocumentResponse. + * Properties of a FetchProcessorTypesResponse. * @memberof google.cloud.documentai.v1 - * @interface IReviewDocumentResponse - * @property {string|null} [gcsDestination] ReviewDocumentResponse gcsDestination + * @interface IFetchProcessorTypesResponse + * @property {Array.|null} [processorTypes] FetchProcessorTypesResponse processorTypes */ /** - * Constructs a new ReviewDocumentResponse. + * Constructs a new FetchProcessorTypesResponse. * @memberof google.cloud.documentai.v1 - * @classdesc Represents a ReviewDocumentResponse. - * @implements IReviewDocumentResponse + * @classdesc Represents a FetchProcessorTypesResponse. + * @implements IFetchProcessorTypesResponse * @constructor - * @param {google.cloud.documentai.v1.IReviewDocumentResponse=} [properties] Properties to set + * @param {google.cloud.documentai.v1.IFetchProcessorTypesResponse=} [properties] Properties to set */ - function ReviewDocumentResponse(properties) { + function FetchProcessorTypesResponse(properties) { + this.processorTypes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14406,75 +15411,78 @@ } /** - * ReviewDocumentResponse gcsDestination. - * @member {string} gcsDestination - * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * FetchProcessorTypesResponse processorTypes. + * @member {Array.} processorTypes + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse * @instance */ - ReviewDocumentResponse.prototype.gcsDestination = ""; + FetchProcessorTypesResponse.prototype.processorTypes = $util.emptyArray; /** - * Creates a new ReviewDocumentResponse instance using the specified properties. + * Creates a new FetchProcessorTypesResponse instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse * @static - * @param {google.cloud.documentai.v1.IReviewDocumentResponse=} [properties] Properties to set - * @returns {google.cloud.documentai.v1.ReviewDocumentResponse} ReviewDocumentResponse instance + * @param {google.cloud.documentai.v1.IFetchProcessorTypesResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.FetchProcessorTypesResponse} FetchProcessorTypesResponse instance */ - ReviewDocumentResponse.create = function create(properties) { - return new ReviewDocumentResponse(properties); + FetchProcessorTypesResponse.create = function create(properties) { + return new FetchProcessorTypesResponse(properties); }; /** - * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentResponse.verify|verify} messages. + * Encodes the specified FetchProcessorTypesResponse message. Does not implicitly {@link google.cloud.documentai.v1.FetchProcessorTypesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse * @static - * @param {google.cloud.documentai.v1.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {google.cloud.documentai.v1.IFetchProcessorTypesResponse} message FetchProcessorTypesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentResponse.encode = function encode(message, writer) { + FetchProcessorTypesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsDestination); + if (message.processorTypes != null && message.processorTypes.length) + for (var i = 0; i < message.processorTypes.length; ++i) + $root.google.cloud.documentai.v1.ProcessorType.encode(message.processorTypes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentResponse.verify|verify} messages. + * Encodes the specified FetchProcessorTypesResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.FetchProcessorTypesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse * @static - * @param {google.cloud.documentai.v1.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {google.cloud.documentai.v1.IFetchProcessorTypesResponse} message FetchProcessorTypesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { + FetchProcessorTypesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * Decodes a FetchProcessorTypesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1.ReviewDocumentResponse} ReviewDocumentResponse + * @returns {google.cloud.documentai.v1.FetchProcessorTypesResponse} FetchProcessorTypesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentResponse.decode = function decode(reader, length) { + FetchProcessorTypesResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ReviewDocumentResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.FetchProcessorTypesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsDestination = reader.string(); + if (!(message.processorTypes && message.processorTypes.length)) + message.processorTypes = []; + message.processorTypes.push($root.google.cloud.documentai.v1.ProcessorType.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -14485,108 +15493,126 @@ }; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * Decodes a FetchProcessorTypesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1.ReviewDocumentResponse} ReviewDocumentResponse + * @returns {google.cloud.documentai.v1.FetchProcessorTypesResponse} FetchProcessorTypesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentResponse.decodeDelimited = function decodeDelimited(reader) { + FetchProcessorTypesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReviewDocumentResponse message. + * Verifies a FetchProcessorTypesResponse message. * @function verify - * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ReviewDocumentResponse.verify = function verify(message) { + FetchProcessorTypesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) - if (!$util.isString(message.gcsDestination)) - return "gcsDestination: string expected"; + if (message.processorTypes != null && message.hasOwnProperty("processorTypes")) { + if (!Array.isArray(message.processorTypes)) + return "processorTypes: array expected"; + for (var i = 0; i < message.processorTypes.length; ++i) { + var error = $root.google.cloud.documentai.v1.ProcessorType.verify(message.processorTypes[i]); + if (error) + return "processorTypes." + error; + } + } return null; }; /** - * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * Creates a FetchProcessorTypesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1.ReviewDocumentResponse} ReviewDocumentResponse + * @returns {google.cloud.documentai.v1.FetchProcessorTypesResponse} FetchProcessorTypesResponse */ - ReviewDocumentResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1.ReviewDocumentResponse) + FetchProcessorTypesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.FetchProcessorTypesResponse) return object; - var message = new $root.google.cloud.documentai.v1.ReviewDocumentResponse(); - if (object.gcsDestination != null) - message.gcsDestination = String(object.gcsDestination); + var message = new $root.google.cloud.documentai.v1.FetchProcessorTypesResponse(); + if (object.processorTypes) { + if (!Array.isArray(object.processorTypes)) + throw TypeError(".google.cloud.documentai.v1.FetchProcessorTypesResponse.processorTypes: array expected"); + message.processorTypes = []; + for (var i = 0; i < object.processorTypes.length; ++i) { + if (typeof object.processorTypes[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.FetchProcessorTypesResponse.processorTypes: object expected"); + message.processorTypes[i] = $root.google.cloud.documentai.v1.ProcessorType.fromObject(object.processorTypes[i]); + } + } return message; }; /** - * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. + * Creates a plain object from a FetchProcessorTypesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse * @static - * @param {google.cloud.documentai.v1.ReviewDocumentResponse} message ReviewDocumentResponse + * @param {google.cloud.documentai.v1.FetchProcessorTypesResponse} message FetchProcessorTypesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReviewDocumentResponse.toObject = function toObject(message, options) { + FetchProcessorTypesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.gcsDestination = ""; - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) - object.gcsDestination = message.gcsDestination; + if (options.arrays || options.defaults) + object.processorTypes = []; + if (message.processorTypes && message.processorTypes.length) { + object.processorTypes = []; + for (var j = 0; j < message.processorTypes.length; ++j) + object.processorTypes[j] = $root.google.cloud.documentai.v1.ProcessorType.toObject(message.processorTypes[j], options); + } return object; }; /** - * Converts this ReviewDocumentResponse to JSON. + * Converts this FetchProcessorTypesResponse to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse * @instance * @returns {Object.} JSON object */ - ReviewDocumentResponse.prototype.toJSON = function toJSON() { + FetchProcessorTypesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ReviewDocumentResponse; + return FetchProcessorTypesResponse; })(); - v1.ReviewDocumentOperationMetadata = (function() { + v1.ListProcessorTypesRequest = (function() { /** - * Properties of a ReviewDocumentOperationMetadata. + * Properties of a ListProcessorTypesRequest. * @memberof google.cloud.documentai.v1 - * @interface IReviewDocumentOperationMetadata - * @property {google.cloud.documentai.v1.ICommonOperationMetadata|null} [commonMetadata] ReviewDocumentOperationMetadata commonMetadata - * @property {string|null} [questionId] ReviewDocumentOperationMetadata questionId + * @interface IListProcessorTypesRequest + * @property {string|null} [parent] ListProcessorTypesRequest parent + * @property {number|null} [pageSize] ListProcessorTypesRequest pageSize + * @property {string|null} [pageToken] ListProcessorTypesRequest pageToken */ /** - * Constructs a new ReviewDocumentOperationMetadata. + * Constructs a new ListProcessorTypesRequest. * @memberof google.cloud.documentai.v1 - * @classdesc Represents a ReviewDocumentOperationMetadata. - * @implements IReviewDocumentOperationMetadata + * @classdesc Represents a ListProcessorTypesRequest. + * @implements IListProcessorTypesRequest * @constructor - * @param {google.cloud.documentai.v1.IReviewDocumentOperationMetadata=} [properties] Properties to set + * @param {google.cloud.documentai.v1.IListProcessorTypesRequest=} [properties] Properties to set */ - function ReviewDocumentOperationMetadata(properties) { + function ListProcessorTypesRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14594,88 +15620,101 @@ } /** - * ReviewDocumentOperationMetadata commonMetadata. - * @member {google.cloud.documentai.v1.ICommonOperationMetadata|null|undefined} commonMetadata - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * ListProcessorTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest * @instance */ - ReviewDocumentOperationMetadata.prototype.commonMetadata = null; + ListProcessorTypesRequest.prototype.parent = ""; /** - * ReviewDocumentOperationMetadata questionId. - * @member {string} questionId - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * ListProcessorTypesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest * @instance */ - ReviewDocumentOperationMetadata.prototype.questionId = ""; + ListProcessorTypesRequest.prototype.pageSize = 0; /** - * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * ListProcessorTypesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest + * @instance + */ + ListProcessorTypesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListProcessorTypesRequest instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1.IReviewDocumentOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata instance + * @param {google.cloud.documentai.v1.IListProcessorTypesRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ListProcessorTypesRequest} ListProcessorTypesRequest instance */ - ReviewDocumentOperationMetadata.create = function create(properties) { - return new ReviewDocumentOperationMetadata(properties); + ListProcessorTypesRequest.create = function create(properties) { + return new ListProcessorTypesRequest(properties); }; /** - * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentOperationMetadata.verify|verify} messages. + * Encodes the specified ListProcessorTypesRequest message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorTypesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1.IListProcessorTypesRequest} message ListProcessorTypesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentOperationMetadata.encode = function encode(message, writer) { + ListProcessorTypesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) - $root.google.cloud.documentai.v1.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.questionId != null && Object.hasOwnProperty.call(message, "questionId")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.questionId); + 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 ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentOperationMetadata.verify|verify} messages. + * Encodes the specified ListProcessorTypesRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorTypesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1.IListProcessorTypesRequest} message ListProcessorTypesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + ListProcessorTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * Decodes a ListProcessorTypesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @returns {google.cloud.documentai.v1.ListProcessorTypesRequest} ListProcessorTypesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentOperationMetadata.decode = function decode(reader, length) { + ListProcessorTypesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ReviewDocumentOperationMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ListProcessorTypesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 5: - message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + case 1: + message.parent = reader.string(); break; - case 6: - message.questionId = reader.string(); + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -14686,124 +15725,8917 @@ }; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * Decodes a ListProcessorTypesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @returns {google.cloud.documentai.v1.ListProcessorTypesRequest} ListProcessorTypesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + ListProcessorTypesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReviewDocumentOperationMetadata message. + * Verifies a ListProcessorTypesRequest message. * @function verify - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ReviewDocumentOperationMetadata.verify = function verify(message) { + ListProcessorTypesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { - var error = $root.google.cloud.documentai.v1.CommonOperationMetadata.verify(message.commonMetadata); - if (error) - return "commonMetadata." + error; - } - if (message.questionId != null && message.hasOwnProperty("questionId")) - if (!$util.isString(message.questionId)) - return "questionId: 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 a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a ListProcessorTypesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @returns {google.cloud.documentai.v1.ListProcessorTypesRequest} ListProcessorTypesRequest */ - ReviewDocumentOperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1.ReviewDocumentOperationMetadata) + ListProcessorTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ListProcessorTypesRequest) return object; - var message = new $root.google.cloud.documentai.v1.ReviewDocumentOperationMetadata(); - if (object.commonMetadata != null) { - if (typeof object.commonMetadata !== "object") - throw TypeError(".google.cloud.documentai.v1.ReviewDocumentOperationMetadata.commonMetadata: object expected"); - message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.fromObject(object.commonMetadata); - } - if (object.questionId != null) - message.questionId = String(object.questionId); + var message = new $root.google.cloud.documentai.v1.ListProcessorTypesRequest(); + 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 ReviewDocumentOperationMetadata message. Also converts values to other types if specified. + * Creates a plain object from a ListProcessorTypesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata + * @param {google.cloud.documentai.v1.ListProcessorTypesRequest} message ListProcessorTypesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListProcessorTypesRequest.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 ListProcessorTypesRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest + * @instance + * @returns {Object.} JSON object + */ + ListProcessorTypesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListProcessorTypesRequest; + })(); + + v1.ListProcessorTypesResponse = (function() { + + /** + * Properties of a ListProcessorTypesResponse. + * @memberof google.cloud.documentai.v1 + * @interface IListProcessorTypesResponse + * @property {Array.|null} [processorTypes] ListProcessorTypesResponse processorTypes + * @property {string|null} [nextPageToken] ListProcessorTypesResponse nextPageToken + */ + + /** + * Constructs a new ListProcessorTypesResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ListProcessorTypesResponse. + * @implements IListProcessorTypesResponse + * @constructor + * @param {google.cloud.documentai.v1.IListProcessorTypesResponse=} [properties] Properties to set + */ + function ListProcessorTypesResponse(properties) { + this.processorTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListProcessorTypesResponse processorTypes. + * @member {Array.} processorTypes + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @instance + */ + ListProcessorTypesResponse.prototype.processorTypes = $util.emptyArray; + + /** + * ListProcessorTypesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @instance + */ + ListProcessorTypesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListProcessorTypesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @static + * @param {google.cloud.documentai.v1.IListProcessorTypesResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ListProcessorTypesResponse} ListProcessorTypesResponse instance + */ + ListProcessorTypesResponse.create = function create(properties) { + return new ListProcessorTypesResponse(properties); + }; + + /** + * Encodes the specified ListProcessorTypesResponse message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorTypesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @static + * @param {google.cloud.documentai.v1.IListProcessorTypesResponse} message ListProcessorTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProcessorTypesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.processorTypes != null && message.processorTypes.length) + for (var i = 0; i < message.processorTypes.length; ++i) + $root.google.cloud.documentai.v1.ProcessorType.encode(message.processorTypes[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 ListProcessorTypesResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorTypesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @static + * @param {google.cloud.documentai.v1.IListProcessorTypesResponse} message ListProcessorTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProcessorTypesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListProcessorTypesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ListProcessorTypesResponse} ListProcessorTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProcessorTypesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ListProcessorTypesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.processorTypes && message.processorTypes.length)) + message.processorTypes = []; + message.processorTypes.push($root.google.cloud.documentai.v1.ProcessorType.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListProcessorTypesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ListProcessorTypesResponse} ListProcessorTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProcessorTypesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListProcessorTypesResponse message. + * @function verify + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListProcessorTypesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.processorTypes != null && message.hasOwnProperty("processorTypes")) { + if (!Array.isArray(message.processorTypes)) + return "processorTypes: array expected"; + for (var i = 0; i < message.processorTypes.length; ++i) { + var error = $root.google.cloud.documentai.v1.ProcessorType.verify(message.processorTypes[i]); + if (error) + return "processorTypes." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListProcessorTypesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ListProcessorTypesResponse} ListProcessorTypesResponse + */ + ListProcessorTypesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ListProcessorTypesResponse) + return object; + var message = new $root.google.cloud.documentai.v1.ListProcessorTypesResponse(); + if (object.processorTypes) { + if (!Array.isArray(object.processorTypes)) + throw TypeError(".google.cloud.documentai.v1.ListProcessorTypesResponse.processorTypes: array expected"); + message.processorTypes = []; + for (var i = 0; i < object.processorTypes.length; ++i) { + if (typeof object.processorTypes[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.ListProcessorTypesResponse.processorTypes: object expected"); + message.processorTypes[i] = $root.google.cloud.documentai.v1.ProcessorType.fromObject(object.processorTypes[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListProcessorTypesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @static + * @param {google.cloud.documentai.v1.ListProcessorTypesResponse} message ListProcessorTypesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListProcessorTypesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.processorTypes = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.processorTypes && message.processorTypes.length) { + object.processorTypes = []; + for (var j = 0; j < message.processorTypes.length; ++j) + object.processorTypes[j] = $root.google.cloud.documentai.v1.ProcessorType.toObject(message.processorTypes[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListProcessorTypesResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @instance + * @returns {Object.} JSON object + */ + ListProcessorTypesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListProcessorTypesResponse; + })(); + + v1.ListProcessorsRequest = (function() { + + /** + * Properties of a ListProcessorsRequest. + * @memberof google.cloud.documentai.v1 + * @interface IListProcessorsRequest + * @property {string|null} [parent] ListProcessorsRequest parent + * @property {number|null} [pageSize] ListProcessorsRequest pageSize + * @property {string|null} [pageToken] ListProcessorsRequest pageToken + */ + + /** + * Constructs a new ListProcessorsRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ListProcessorsRequest. + * @implements IListProcessorsRequest + * @constructor + * @param {google.cloud.documentai.v1.IListProcessorsRequest=} [properties] Properties to set + */ + function ListProcessorsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListProcessorsRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @instance + */ + ListProcessorsRequest.prototype.parent = ""; + + /** + * ListProcessorsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @instance + */ + ListProcessorsRequest.prototype.pageSize = 0; + + /** + * ListProcessorsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @instance + */ + ListProcessorsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListProcessorsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @static + * @param {google.cloud.documentai.v1.IListProcessorsRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ListProcessorsRequest} ListProcessorsRequest instance + */ + ListProcessorsRequest.create = function create(properties) { + return new ListProcessorsRequest(properties); + }; + + /** + * Encodes the specified ListProcessorsRequest message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @static + * @param {google.cloud.documentai.v1.IListProcessorsRequest} message ListProcessorsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProcessorsRequest.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 ListProcessorsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @static + * @param {google.cloud.documentai.v1.IListProcessorsRequest} message ListProcessorsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProcessorsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListProcessorsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ListProcessorsRequest} ListProcessorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProcessorsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ListProcessorsRequest(); + 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 ListProcessorsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ListProcessorsRequest} ListProcessorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProcessorsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListProcessorsRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListProcessorsRequest.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 ListProcessorsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ListProcessorsRequest} ListProcessorsRequest + */ + ListProcessorsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ListProcessorsRequest) + return object; + var message = new $root.google.cloud.documentai.v1.ListProcessorsRequest(); + 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 ListProcessorsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @static + * @param {google.cloud.documentai.v1.ListProcessorsRequest} message ListProcessorsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListProcessorsRequest.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 ListProcessorsRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @instance + * @returns {Object.} JSON object + */ + ListProcessorsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListProcessorsRequest; + })(); + + v1.ListProcessorsResponse = (function() { + + /** + * Properties of a ListProcessorsResponse. + * @memberof google.cloud.documentai.v1 + * @interface IListProcessorsResponse + * @property {Array.|null} [processors] ListProcessorsResponse processors + * @property {string|null} [nextPageToken] ListProcessorsResponse nextPageToken + */ + + /** + * Constructs a new ListProcessorsResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ListProcessorsResponse. + * @implements IListProcessorsResponse + * @constructor + * @param {google.cloud.documentai.v1.IListProcessorsResponse=} [properties] Properties to set + */ + function ListProcessorsResponse(properties) { + this.processors = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListProcessorsResponse processors. + * @member {Array.} processors + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @instance + */ + ListProcessorsResponse.prototype.processors = $util.emptyArray; + + /** + * ListProcessorsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @instance + */ + ListProcessorsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListProcessorsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @static + * @param {google.cloud.documentai.v1.IListProcessorsResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ListProcessorsResponse} ListProcessorsResponse instance + */ + ListProcessorsResponse.create = function create(properties) { + return new ListProcessorsResponse(properties); + }; + + /** + * Encodes the specified ListProcessorsResponse message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @static + * @param {google.cloud.documentai.v1.IListProcessorsResponse} message ListProcessorsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProcessorsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.processors != null && message.processors.length) + for (var i = 0; i < message.processors.length; ++i) + $root.google.cloud.documentai.v1.Processor.encode(message.processors[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 ListProcessorsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @static + * @param {google.cloud.documentai.v1.IListProcessorsResponse} message ListProcessorsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProcessorsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListProcessorsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ListProcessorsResponse} ListProcessorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProcessorsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ListProcessorsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.processors && message.processors.length)) + message.processors = []; + message.processors.push($root.google.cloud.documentai.v1.Processor.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListProcessorsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ListProcessorsResponse} ListProcessorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProcessorsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListProcessorsResponse message. + * @function verify + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListProcessorsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.processors != null && message.hasOwnProperty("processors")) { + if (!Array.isArray(message.processors)) + return "processors: array expected"; + for (var i = 0; i < message.processors.length; ++i) { + var error = $root.google.cloud.documentai.v1.Processor.verify(message.processors[i]); + if (error) + return "processors." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListProcessorsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ListProcessorsResponse} ListProcessorsResponse + */ + ListProcessorsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ListProcessorsResponse) + return object; + var message = new $root.google.cloud.documentai.v1.ListProcessorsResponse(); + if (object.processors) { + if (!Array.isArray(object.processors)) + throw TypeError(".google.cloud.documentai.v1.ListProcessorsResponse.processors: array expected"); + message.processors = []; + for (var i = 0; i < object.processors.length; ++i) { + if (typeof object.processors[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.ListProcessorsResponse.processors: object expected"); + message.processors[i] = $root.google.cloud.documentai.v1.Processor.fromObject(object.processors[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListProcessorsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @static + * @param {google.cloud.documentai.v1.ListProcessorsResponse} message ListProcessorsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListProcessorsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.processors = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.processors && message.processors.length) { + object.processors = []; + for (var j = 0; j < message.processors.length; ++j) + object.processors[j] = $root.google.cloud.documentai.v1.Processor.toObject(message.processors[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListProcessorsResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @instance + * @returns {Object.} JSON object + */ + ListProcessorsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListProcessorsResponse; + })(); + + v1.GetProcessorRequest = (function() { + + /** + * Properties of a GetProcessorRequest. + * @memberof google.cloud.documentai.v1 + * @interface IGetProcessorRequest + * @property {string|null} [name] GetProcessorRequest name + */ + + /** + * Constructs a new GetProcessorRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a GetProcessorRequest. + * @implements IGetProcessorRequest + * @constructor + * @param {google.cloud.documentai.v1.IGetProcessorRequest=} [properties] Properties to set + */ + function GetProcessorRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetProcessorRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @instance + */ + GetProcessorRequest.prototype.name = ""; + + /** + * Creates a new GetProcessorRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IGetProcessorRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.GetProcessorRequest} GetProcessorRequest instance + */ + GetProcessorRequest.create = function create(properties) { + return new GetProcessorRequest(properties); + }; + + /** + * Encodes the specified GetProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1.GetProcessorRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IGetProcessorRequest} message GetProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProcessorRequest.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 GetProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.GetProcessorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IGetProcessorRequest} message GetProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetProcessorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.GetProcessorRequest} GetProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProcessorRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.GetProcessorRequest(); + 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 GetProcessorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.GetProcessorRequest} GetProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetProcessorRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetProcessorRequest.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 GetProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.GetProcessorRequest} GetProcessorRequest + */ + GetProcessorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.GetProcessorRequest) + return object; + var message = new $root.google.cloud.documentai.v1.GetProcessorRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetProcessorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @static + * @param {google.cloud.documentai.v1.GetProcessorRequest} message GetProcessorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProcessorRequest.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 GetProcessorRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @instance + * @returns {Object.} JSON object + */ + GetProcessorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetProcessorRequest; + })(); + + v1.GetProcessorVersionRequest = (function() { + + /** + * Properties of a GetProcessorVersionRequest. + * @memberof google.cloud.documentai.v1 + * @interface IGetProcessorVersionRequest + * @property {string|null} [name] GetProcessorVersionRequest name + */ + + /** + * Constructs a new GetProcessorVersionRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a GetProcessorVersionRequest. + * @implements IGetProcessorVersionRequest + * @constructor + * @param {google.cloud.documentai.v1.IGetProcessorVersionRequest=} [properties] Properties to set + */ + function GetProcessorVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetProcessorVersionRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @instance + */ + GetProcessorVersionRequest.prototype.name = ""; + + /** + * Creates a new GetProcessorVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IGetProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.GetProcessorVersionRequest} GetProcessorVersionRequest instance + */ + GetProcessorVersionRequest.create = function create(properties) { + return new GetProcessorVersionRequest(properties); + }; + + /** + * Encodes the specified GetProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1.GetProcessorVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IGetProcessorVersionRequest} message GetProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProcessorVersionRequest.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 GetProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.GetProcessorVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IGetProcessorVersionRequest} message GetProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProcessorVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetProcessorVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.GetProcessorVersionRequest} GetProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProcessorVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.GetProcessorVersionRequest(); + 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 GetProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.GetProcessorVersionRequest} GetProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProcessorVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetProcessorVersionRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetProcessorVersionRequest.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 GetProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.GetProcessorVersionRequest} GetProcessorVersionRequest + */ + GetProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.GetProcessorVersionRequest) + return object; + var message = new $root.google.cloud.documentai.v1.GetProcessorVersionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetProcessorVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.GetProcessorVersionRequest} message GetProcessorVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProcessorVersionRequest.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 GetProcessorVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @instance + * @returns {Object.} JSON object + */ + GetProcessorVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetProcessorVersionRequest; + })(); + + v1.ListProcessorVersionsRequest = (function() { + + /** + * Properties of a ListProcessorVersionsRequest. + * @memberof google.cloud.documentai.v1 + * @interface IListProcessorVersionsRequest + * @property {string|null} [parent] ListProcessorVersionsRequest parent + * @property {number|null} [pageSize] ListProcessorVersionsRequest pageSize + * @property {string|null} [pageToken] ListProcessorVersionsRequest pageToken + */ + + /** + * Constructs a new ListProcessorVersionsRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ListProcessorVersionsRequest. + * @implements IListProcessorVersionsRequest + * @constructor + * @param {google.cloud.documentai.v1.IListProcessorVersionsRequest=} [properties] Properties to set + */ + function ListProcessorVersionsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListProcessorVersionsRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @instance + */ + ListProcessorVersionsRequest.prototype.parent = ""; + + /** + * ListProcessorVersionsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @instance + */ + ListProcessorVersionsRequest.prototype.pageSize = 0; + + /** + * ListProcessorVersionsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @instance + */ + ListProcessorVersionsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListProcessorVersionsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @static + * @param {google.cloud.documentai.v1.IListProcessorVersionsRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ListProcessorVersionsRequest} ListProcessorVersionsRequest instance + */ + ListProcessorVersionsRequest.create = function create(properties) { + return new ListProcessorVersionsRequest(properties); + }; + + /** + * Encodes the specified ListProcessorVersionsRequest message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorVersionsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @static + * @param {google.cloud.documentai.v1.IListProcessorVersionsRequest} message ListProcessorVersionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProcessorVersionsRequest.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 ListProcessorVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorVersionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @static + * @param {google.cloud.documentai.v1.IListProcessorVersionsRequest} message ListProcessorVersionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProcessorVersionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListProcessorVersionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ListProcessorVersionsRequest} ListProcessorVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProcessorVersionsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ListProcessorVersionsRequest(); + 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 ListProcessorVersionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ListProcessorVersionsRequest} ListProcessorVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProcessorVersionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListProcessorVersionsRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListProcessorVersionsRequest.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 ListProcessorVersionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ListProcessorVersionsRequest} ListProcessorVersionsRequest + */ + ListProcessorVersionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ListProcessorVersionsRequest) + return object; + var message = new $root.google.cloud.documentai.v1.ListProcessorVersionsRequest(); + 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 ListProcessorVersionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @static + * @param {google.cloud.documentai.v1.ListProcessorVersionsRequest} message ListProcessorVersionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListProcessorVersionsRequest.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 ListProcessorVersionsRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @instance + * @returns {Object.} JSON object + */ + ListProcessorVersionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListProcessorVersionsRequest; + })(); + + v1.ListProcessorVersionsResponse = (function() { + + /** + * Properties of a ListProcessorVersionsResponse. + * @memberof google.cloud.documentai.v1 + * @interface IListProcessorVersionsResponse + * @property {Array.|null} [processorVersions] ListProcessorVersionsResponse processorVersions + * @property {string|null} [nextPageToken] ListProcessorVersionsResponse nextPageToken + */ + + /** + * Constructs a new ListProcessorVersionsResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ListProcessorVersionsResponse. + * @implements IListProcessorVersionsResponse + * @constructor + * @param {google.cloud.documentai.v1.IListProcessorVersionsResponse=} [properties] Properties to set + */ + function ListProcessorVersionsResponse(properties) { + this.processorVersions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListProcessorVersionsResponse processorVersions. + * @member {Array.} processorVersions + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @instance + */ + ListProcessorVersionsResponse.prototype.processorVersions = $util.emptyArray; + + /** + * ListProcessorVersionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @instance + */ + ListProcessorVersionsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListProcessorVersionsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @static + * @param {google.cloud.documentai.v1.IListProcessorVersionsResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ListProcessorVersionsResponse} ListProcessorVersionsResponse instance + */ + ListProcessorVersionsResponse.create = function create(properties) { + return new ListProcessorVersionsResponse(properties); + }; + + /** + * Encodes the specified ListProcessorVersionsResponse message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorVersionsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @static + * @param {google.cloud.documentai.v1.IListProcessorVersionsResponse} message ListProcessorVersionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProcessorVersionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.processorVersions != null && message.processorVersions.length) + for (var i = 0; i < message.processorVersions.length; ++i) + $root.google.cloud.documentai.v1.ProcessorVersion.encode(message.processorVersions[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 ListProcessorVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorVersionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @static + * @param {google.cloud.documentai.v1.IListProcessorVersionsResponse} message ListProcessorVersionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProcessorVersionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListProcessorVersionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ListProcessorVersionsResponse} ListProcessorVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProcessorVersionsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ListProcessorVersionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.processorVersions && message.processorVersions.length)) + message.processorVersions = []; + message.processorVersions.push($root.google.cloud.documentai.v1.ProcessorVersion.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListProcessorVersionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ListProcessorVersionsResponse} ListProcessorVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProcessorVersionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListProcessorVersionsResponse message. + * @function verify + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListProcessorVersionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.processorVersions != null && message.hasOwnProperty("processorVersions")) { + if (!Array.isArray(message.processorVersions)) + return "processorVersions: array expected"; + for (var i = 0; i < message.processorVersions.length; ++i) { + var error = $root.google.cloud.documentai.v1.ProcessorVersion.verify(message.processorVersions[i]); + if (error) + return "processorVersions." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListProcessorVersionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ListProcessorVersionsResponse} ListProcessorVersionsResponse + */ + ListProcessorVersionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ListProcessorVersionsResponse) + return object; + var message = new $root.google.cloud.documentai.v1.ListProcessorVersionsResponse(); + if (object.processorVersions) { + if (!Array.isArray(object.processorVersions)) + throw TypeError(".google.cloud.documentai.v1.ListProcessorVersionsResponse.processorVersions: array expected"); + message.processorVersions = []; + for (var i = 0; i < object.processorVersions.length; ++i) { + if (typeof object.processorVersions[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.ListProcessorVersionsResponse.processorVersions: object expected"); + message.processorVersions[i] = $root.google.cloud.documentai.v1.ProcessorVersion.fromObject(object.processorVersions[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListProcessorVersionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @static + * @param {google.cloud.documentai.v1.ListProcessorVersionsResponse} message ListProcessorVersionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListProcessorVersionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.processorVersions = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.processorVersions && message.processorVersions.length) { + object.processorVersions = []; + for (var j = 0; j < message.processorVersions.length; ++j) + object.processorVersions[j] = $root.google.cloud.documentai.v1.ProcessorVersion.toObject(message.processorVersions[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListProcessorVersionsResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @instance + * @returns {Object.} JSON object + */ + ListProcessorVersionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListProcessorVersionsResponse; + })(); + + v1.DeleteProcessorVersionRequest = (function() { + + /** + * Properties of a DeleteProcessorVersionRequest. + * @memberof google.cloud.documentai.v1 + * @interface IDeleteProcessorVersionRequest + * @property {string|null} [name] DeleteProcessorVersionRequest name + */ + + /** + * Constructs a new DeleteProcessorVersionRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DeleteProcessorVersionRequest. + * @implements IDeleteProcessorVersionRequest + * @constructor + * @param {google.cloud.documentai.v1.IDeleteProcessorVersionRequest=} [properties] Properties to set + */ + function DeleteProcessorVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteProcessorVersionRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @instance + */ + DeleteProcessorVersionRequest.prototype.name = ""; + + /** + * Creates a new DeleteProcessorVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DeleteProcessorVersionRequest} DeleteProcessorVersionRequest instance + */ + DeleteProcessorVersionRequest.create = function create(properties) { + return new DeleteProcessorVersionRequest(properties); + }; + + /** + * Encodes the specified DeleteProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorVersionRequest} message DeleteProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorVersionRequest.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 DeleteProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorVersionRequest} message DeleteProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteProcessorVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DeleteProcessorVersionRequest} DeleteProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.DeleteProcessorVersionRequest(); + 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 DeleteProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DeleteProcessorVersionRequest} DeleteProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteProcessorVersionRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteProcessorVersionRequest.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 DeleteProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DeleteProcessorVersionRequest} DeleteProcessorVersionRequest + */ + DeleteProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DeleteProcessorVersionRequest) + return object; + var message = new $root.google.cloud.documentai.v1.DeleteProcessorVersionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteProcessorVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.DeleteProcessorVersionRequest} message DeleteProcessorVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteProcessorVersionRequest.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 DeleteProcessorVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteProcessorVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteProcessorVersionRequest; + })(); + + v1.DeleteProcessorVersionMetadata = (function() { + + /** + * Properties of a DeleteProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1 + * @interface IDeleteProcessorVersionMetadata + * @property {google.cloud.documentai.v1.ICommonOperationMetadata|null} [commonMetadata] DeleteProcessorVersionMetadata commonMetadata + */ + + /** + * Constructs a new DeleteProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DeleteProcessorVersionMetadata. + * @implements IDeleteProcessorVersionMetadata + * @constructor + * @param {google.cloud.documentai.v1.IDeleteProcessorVersionMetadata=} [properties] Properties to set + */ + function DeleteProcessorVersionMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteProcessorVersionMetadata commonMetadata. + * @member {google.cloud.documentai.v1.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @instance + */ + DeleteProcessorVersionMetadata.prototype.commonMetadata = null; + + /** + * Creates a new DeleteProcessorVersionMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorVersionMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DeleteProcessorVersionMetadata} DeleteProcessorVersionMetadata instance + */ + DeleteProcessorVersionMetadata.create = function create(properties) { + return new DeleteProcessorVersionMetadata(properties); + }; + + /** + * Encodes the specified DeleteProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorVersionMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorVersionMetadata} message DeleteProcessorVersionMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorVersionMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DeleteProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorVersionMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorVersionMetadata} message DeleteProcessorVersionMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorVersionMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteProcessorVersionMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DeleteProcessorVersionMetadata} DeleteProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorVersionMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.DeleteProcessorVersionMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DeleteProcessorVersionMetadata} DeleteProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorVersionMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteProcessorVersionMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteProcessorVersionMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates a DeleteProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DeleteProcessorVersionMetadata} DeleteProcessorVersionMetadata + */ + DeleteProcessorVersionMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DeleteProcessorVersionMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.DeleteProcessorVersionMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1.DeleteProcessorVersionMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from a DeleteProcessorVersionMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.DeleteProcessorVersionMetadata} message DeleteProcessorVersionMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteProcessorVersionMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.commonMetadata = null; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this DeleteProcessorVersionMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @instance + * @returns {Object.} JSON object + */ + DeleteProcessorVersionMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteProcessorVersionMetadata; + })(); + + v1.DeployProcessorVersionRequest = (function() { + + /** + * Properties of a DeployProcessorVersionRequest. + * @memberof google.cloud.documentai.v1 + * @interface IDeployProcessorVersionRequest + * @property {string|null} [name] DeployProcessorVersionRequest name + */ + + /** + * Constructs a new DeployProcessorVersionRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DeployProcessorVersionRequest. + * @implements IDeployProcessorVersionRequest + * @constructor + * @param {google.cloud.documentai.v1.IDeployProcessorVersionRequest=} [properties] Properties to set + */ + function DeployProcessorVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeployProcessorVersionRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @instance + */ + DeployProcessorVersionRequest.prototype.name = ""; + + /** + * Creates a new DeployProcessorVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IDeployProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DeployProcessorVersionRequest} DeployProcessorVersionRequest instance + */ + DeployProcessorVersionRequest.create = function create(properties) { + return new DeployProcessorVersionRequest(properties); + }; + + /** + * Encodes the specified DeployProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IDeployProcessorVersionRequest} message DeployProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeployProcessorVersionRequest.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 DeployProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IDeployProcessorVersionRequest} message DeployProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeployProcessorVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeployProcessorVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DeployProcessorVersionRequest} DeployProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeployProcessorVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.DeployProcessorVersionRequest(); + 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 DeployProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DeployProcessorVersionRequest} DeployProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeployProcessorVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeployProcessorVersionRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeployProcessorVersionRequest.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 DeployProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DeployProcessorVersionRequest} DeployProcessorVersionRequest + */ + DeployProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DeployProcessorVersionRequest) + return object; + var message = new $root.google.cloud.documentai.v1.DeployProcessorVersionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeployProcessorVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.DeployProcessorVersionRequest} message DeployProcessorVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeployProcessorVersionRequest.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 DeployProcessorVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @instance + * @returns {Object.} JSON object + */ + DeployProcessorVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeployProcessorVersionRequest; + })(); + + v1.DeployProcessorVersionResponse = (function() { + + /** + * Properties of a DeployProcessorVersionResponse. + * @memberof google.cloud.documentai.v1 + * @interface IDeployProcessorVersionResponse + */ + + /** + * Constructs a new DeployProcessorVersionResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DeployProcessorVersionResponse. + * @implements IDeployProcessorVersionResponse + * @constructor + * @param {google.cloud.documentai.v1.IDeployProcessorVersionResponse=} [properties] Properties to set + */ + function DeployProcessorVersionResponse(properties) { + if (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 DeployProcessorVersionResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.IDeployProcessorVersionResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DeployProcessorVersionResponse} DeployProcessorVersionResponse instance + */ + DeployProcessorVersionResponse.create = function create(properties) { + return new DeployProcessorVersionResponse(properties); + }; + + /** + * Encodes the specified DeployProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.IDeployProcessorVersionResponse} message DeployProcessorVersionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeployProcessorVersionResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified DeployProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.IDeployProcessorVersionResponse} message DeployProcessorVersionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeployProcessorVersionResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeployProcessorVersionResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DeployProcessorVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DeployProcessorVersionResponse} DeployProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeployProcessorVersionResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.DeployProcessorVersionResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeployProcessorVersionResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DeployProcessorVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DeployProcessorVersionResponse} DeployProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeployProcessorVersionResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeployProcessorVersionResponse message. + * @function verify + * @memberof google.cloud.documentai.v1.DeployProcessorVersionResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeployProcessorVersionResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a DeployProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DeployProcessorVersionResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DeployProcessorVersionResponse} DeployProcessorVersionResponse + */ + DeployProcessorVersionResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DeployProcessorVersionResponse) + return object; + return new $root.google.cloud.documentai.v1.DeployProcessorVersionResponse(); + }; + + /** + * Creates a plain object from a DeployProcessorVersionResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.DeployProcessorVersionResponse} message DeployProcessorVersionResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeployProcessorVersionResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this DeployProcessorVersionResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DeployProcessorVersionResponse + * @instance + * @returns {Object.} JSON object + */ + DeployProcessorVersionResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeployProcessorVersionResponse; + })(); + + v1.DeployProcessorVersionMetadata = (function() { + + /** + * Properties of a DeployProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1 + * @interface IDeployProcessorVersionMetadata + * @property {google.cloud.documentai.v1.ICommonOperationMetadata|null} [commonMetadata] DeployProcessorVersionMetadata commonMetadata + */ + + /** + * Constructs a new DeployProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DeployProcessorVersionMetadata. + * @implements IDeployProcessorVersionMetadata + * @constructor + * @param {google.cloud.documentai.v1.IDeployProcessorVersionMetadata=} [properties] Properties to set + */ + function DeployProcessorVersionMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeployProcessorVersionMetadata commonMetadata. + * @member {google.cloud.documentai.v1.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @instance + */ + DeployProcessorVersionMetadata.prototype.commonMetadata = null; + + /** + * Creates a new DeployProcessorVersionMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.IDeployProcessorVersionMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DeployProcessorVersionMetadata} DeployProcessorVersionMetadata instance + */ + DeployProcessorVersionMetadata.create = function create(properties) { + return new DeployProcessorVersionMetadata(properties); + }; + + /** + * Encodes the specified DeployProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.IDeployProcessorVersionMetadata} message DeployProcessorVersionMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeployProcessorVersionMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DeployProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.IDeployProcessorVersionMetadata} message DeployProcessorVersionMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeployProcessorVersionMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeployProcessorVersionMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DeployProcessorVersionMetadata} DeployProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeployProcessorVersionMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.DeployProcessorVersionMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeployProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DeployProcessorVersionMetadata} DeployProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeployProcessorVersionMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeployProcessorVersionMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeployProcessorVersionMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates a DeployProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DeployProcessorVersionMetadata} DeployProcessorVersionMetadata + */ + DeployProcessorVersionMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DeployProcessorVersionMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.DeployProcessorVersionMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1.DeployProcessorVersionMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from a DeployProcessorVersionMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.DeployProcessorVersionMetadata} message DeployProcessorVersionMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeployProcessorVersionMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.commonMetadata = null; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this DeployProcessorVersionMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @instance + * @returns {Object.} JSON object + */ + DeployProcessorVersionMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeployProcessorVersionMetadata; + })(); + + v1.UndeployProcessorVersionRequest = (function() { + + /** + * Properties of an UndeployProcessorVersionRequest. + * @memberof google.cloud.documentai.v1 + * @interface IUndeployProcessorVersionRequest + * @property {string|null} [name] UndeployProcessorVersionRequest name + */ + + /** + * Constructs a new UndeployProcessorVersionRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents an UndeployProcessorVersionRequest. + * @implements IUndeployProcessorVersionRequest + * @constructor + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionRequest=} [properties] Properties to set + */ + function UndeployProcessorVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UndeployProcessorVersionRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @instance + */ + UndeployProcessorVersionRequest.prototype.name = ""; + + /** + * Creates a new UndeployProcessorVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionRequest} UndeployProcessorVersionRequest instance + */ + UndeployProcessorVersionRequest.create = function create(properties) { + return new UndeployProcessorVersionRequest(properties); + }; + + /** + * Encodes the specified UndeployProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionRequest} message UndeployProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeployProcessorVersionRequest.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 UndeployProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionRequest} message UndeployProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeployProcessorVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UndeployProcessorVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionRequest} UndeployProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeployProcessorVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.UndeployProcessorVersionRequest(); + 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 an UndeployProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionRequest} UndeployProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeployProcessorVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UndeployProcessorVersionRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UndeployProcessorVersionRequest.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 UndeployProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionRequest} UndeployProcessorVersionRequest + */ + UndeployProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.UndeployProcessorVersionRequest) + return object; + var message = new $root.google.cloud.documentai.v1.UndeployProcessorVersionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from an UndeployProcessorVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.UndeployProcessorVersionRequest} message UndeployProcessorVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UndeployProcessorVersionRequest.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 UndeployProcessorVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @instance + * @returns {Object.} JSON object + */ + UndeployProcessorVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UndeployProcessorVersionRequest; + })(); + + v1.UndeployProcessorVersionResponse = (function() { + + /** + * Properties of an UndeployProcessorVersionResponse. + * @memberof google.cloud.documentai.v1 + * @interface IUndeployProcessorVersionResponse + */ + + /** + * Constructs a new UndeployProcessorVersionResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents an UndeployProcessorVersionResponse. + * @implements IUndeployProcessorVersionResponse + * @constructor + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionResponse=} [properties] Properties to set + */ + function UndeployProcessorVersionResponse(properties) { + if (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 UndeployProcessorVersionResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionResponse} UndeployProcessorVersionResponse instance + */ + UndeployProcessorVersionResponse.create = function create(properties) { + return new UndeployProcessorVersionResponse(properties); + }; + + /** + * Encodes the specified UndeployProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionResponse} message UndeployProcessorVersionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeployProcessorVersionResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified UndeployProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionResponse} message UndeployProcessorVersionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeployProcessorVersionResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UndeployProcessorVersionResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionResponse} UndeployProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeployProcessorVersionResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.UndeployProcessorVersionResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UndeployProcessorVersionResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionResponse} UndeployProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeployProcessorVersionResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UndeployProcessorVersionResponse message. + * @function verify + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UndeployProcessorVersionResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an UndeployProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionResponse} UndeployProcessorVersionResponse + */ + UndeployProcessorVersionResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.UndeployProcessorVersionResponse) + return object; + return new $root.google.cloud.documentai.v1.UndeployProcessorVersionResponse(); + }; + + /** + * Creates a plain object from an UndeployProcessorVersionResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.UndeployProcessorVersionResponse} message UndeployProcessorVersionResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UndeployProcessorVersionResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this UndeployProcessorVersionResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionResponse + * @instance + * @returns {Object.} JSON object + */ + UndeployProcessorVersionResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UndeployProcessorVersionResponse; + })(); + + v1.UndeployProcessorVersionMetadata = (function() { + + /** + * Properties of an UndeployProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1 + * @interface IUndeployProcessorVersionMetadata + * @property {google.cloud.documentai.v1.ICommonOperationMetadata|null} [commonMetadata] UndeployProcessorVersionMetadata commonMetadata + */ + + /** + * Constructs a new UndeployProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents an UndeployProcessorVersionMetadata. + * @implements IUndeployProcessorVersionMetadata + * @constructor + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionMetadata=} [properties] Properties to set + */ + function UndeployProcessorVersionMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UndeployProcessorVersionMetadata commonMetadata. + * @member {google.cloud.documentai.v1.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @instance + */ + UndeployProcessorVersionMetadata.prototype.commonMetadata = null; + + /** + * Creates a new UndeployProcessorVersionMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionMetadata} UndeployProcessorVersionMetadata instance + */ + UndeployProcessorVersionMetadata.create = function create(properties) { + return new UndeployProcessorVersionMetadata(properties); + }; + + /** + * Encodes the specified UndeployProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionMetadata} message UndeployProcessorVersionMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeployProcessorVersionMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UndeployProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionMetadata} message UndeployProcessorVersionMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeployProcessorVersionMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UndeployProcessorVersionMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionMetadata} UndeployProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeployProcessorVersionMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.UndeployProcessorVersionMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UndeployProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionMetadata} UndeployProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeployProcessorVersionMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UndeployProcessorVersionMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UndeployProcessorVersionMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates an UndeployProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionMetadata} UndeployProcessorVersionMetadata + */ + UndeployProcessorVersionMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.UndeployProcessorVersionMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.UndeployProcessorVersionMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1.UndeployProcessorVersionMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from an UndeployProcessorVersionMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.UndeployProcessorVersionMetadata} message UndeployProcessorVersionMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UndeployProcessorVersionMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.commonMetadata = null; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this UndeployProcessorVersionMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @instance + * @returns {Object.} JSON object + */ + UndeployProcessorVersionMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UndeployProcessorVersionMetadata; + })(); + + v1.CreateProcessorRequest = (function() { + + /** + * Properties of a CreateProcessorRequest. + * @memberof google.cloud.documentai.v1 + * @interface ICreateProcessorRequest + * @property {string|null} [parent] CreateProcessorRequest parent + * @property {google.cloud.documentai.v1.IProcessor|null} [processor] CreateProcessorRequest processor + */ + + /** + * Constructs a new CreateProcessorRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a CreateProcessorRequest. + * @implements ICreateProcessorRequest + * @constructor + * @param {google.cloud.documentai.v1.ICreateProcessorRequest=} [properties] Properties to set + */ + function CreateProcessorRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateProcessorRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @instance + */ + CreateProcessorRequest.prototype.parent = ""; + + /** + * CreateProcessorRequest processor. + * @member {google.cloud.documentai.v1.IProcessor|null|undefined} processor + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @instance + */ + CreateProcessorRequest.prototype.processor = null; + + /** + * Creates a new CreateProcessorRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @static + * @param {google.cloud.documentai.v1.ICreateProcessorRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.CreateProcessorRequest} CreateProcessorRequest instance + */ + CreateProcessorRequest.create = function create(properties) { + return new CreateProcessorRequest(properties); + }; + + /** + * Encodes the specified CreateProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1.CreateProcessorRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @static + * @param {google.cloud.documentai.v1.ICreateProcessorRequest} message CreateProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProcessorRequest.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.processor != null && Object.hasOwnProperty.call(message, "processor")) + $root.google.cloud.documentai.v1.Processor.encode(message.processor, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.CreateProcessorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @static + * @param {google.cloud.documentai.v1.ICreateProcessorRequest} message CreateProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateProcessorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.CreateProcessorRequest} CreateProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProcessorRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.CreateProcessorRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.processor = $root.google.cloud.documentai.v1.Processor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateProcessorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.CreateProcessorRequest} CreateProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateProcessorRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateProcessorRequest.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.processor != null && message.hasOwnProperty("processor")) { + var error = $root.google.cloud.documentai.v1.Processor.verify(message.processor); + if (error) + return "processor." + error; + } + return null; + }; + + /** + * Creates a CreateProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.CreateProcessorRequest} CreateProcessorRequest + */ + CreateProcessorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.CreateProcessorRequest) + return object; + var message = new $root.google.cloud.documentai.v1.CreateProcessorRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.processor != null) { + if (typeof object.processor !== "object") + throw TypeError(".google.cloud.documentai.v1.CreateProcessorRequest.processor: object expected"); + message.processor = $root.google.cloud.documentai.v1.Processor.fromObject(object.processor); + } + return message; + }; + + /** + * Creates a plain object from a CreateProcessorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @static + * @param {google.cloud.documentai.v1.CreateProcessorRequest} message CreateProcessorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateProcessorRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.processor = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.processor != null && message.hasOwnProperty("processor")) + object.processor = $root.google.cloud.documentai.v1.Processor.toObject(message.processor, options); + return object; + }; + + /** + * Converts this CreateProcessorRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @instance + * @returns {Object.} JSON object + */ + CreateProcessorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateProcessorRequest; + })(); + + v1.DeleteProcessorRequest = (function() { + + /** + * Properties of a DeleteProcessorRequest. + * @memberof google.cloud.documentai.v1 + * @interface IDeleteProcessorRequest + * @property {string|null} [name] DeleteProcessorRequest name + */ + + /** + * Constructs a new DeleteProcessorRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DeleteProcessorRequest. + * @implements IDeleteProcessorRequest + * @constructor + * @param {google.cloud.documentai.v1.IDeleteProcessorRequest=} [properties] Properties to set + */ + function DeleteProcessorRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteProcessorRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @instance + */ + DeleteProcessorRequest.prototype.name = ""; + + /** + * Creates a new DeleteProcessorRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DeleteProcessorRequest} DeleteProcessorRequest instance + */ + DeleteProcessorRequest.create = function create(properties) { + return new DeleteProcessorRequest(properties); + }; + + /** + * Encodes the specified DeleteProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorRequest} message DeleteProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorRequest.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 DeleteProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorRequest} message DeleteProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteProcessorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DeleteProcessorRequest} DeleteProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.DeleteProcessorRequest(); + 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 DeleteProcessorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DeleteProcessorRequest} DeleteProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteProcessorRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteProcessorRequest.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 DeleteProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DeleteProcessorRequest} DeleteProcessorRequest + */ + DeleteProcessorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DeleteProcessorRequest) + return object; + var message = new $root.google.cloud.documentai.v1.DeleteProcessorRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteProcessorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @static + * @param {google.cloud.documentai.v1.DeleteProcessorRequest} message DeleteProcessorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteProcessorRequest.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 DeleteProcessorRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteProcessorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteProcessorRequest; + })(); + + v1.DeleteProcessorMetadata = (function() { + + /** + * Properties of a DeleteProcessorMetadata. + * @memberof google.cloud.documentai.v1 + * @interface IDeleteProcessorMetadata + * @property {google.cloud.documentai.v1.ICommonOperationMetadata|null} [commonMetadata] DeleteProcessorMetadata commonMetadata + */ + + /** + * Constructs a new DeleteProcessorMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DeleteProcessorMetadata. + * @implements IDeleteProcessorMetadata + * @constructor + * @param {google.cloud.documentai.v1.IDeleteProcessorMetadata=} [properties] Properties to set + */ + function DeleteProcessorMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteProcessorMetadata commonMetadata. + * @member {google.cloud.documentai.v1.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @instance + */ + DeleteProcessorMetadata.prototype.commonMetadata = null; + + /** + * Creates a new DeleteProcessorMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DeleteProcessorMetadata} DeleteProcessorMetadata instance + */ + DeleteProcessorMetadata.create = function create(properties) { + return new DeleteProcessorMetadata(properties); + }; + + /** + * Encodes the specified DeleteProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorMetadata} message DeleteProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DeleteProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorMetadata} message DeleteProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteProcessorMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DeleteProcessorMetadata} DeleteProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.DeleteProcessorMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteProcessorMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DeleteProcessorMetadata} DeleteProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteProcessorMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteProcessorMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates a DeleteProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DeleteProcessorMetadata} DeleteProcessorMetadata + */ + DeleteProcessorMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DeleteProcessorMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.DeleteProcessorMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1.DeleteProcessorMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from a DeleteProcessorMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.DeleteProcessorMetadata} message DeleteProcessorMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteProcessorMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.commonMetadata = null; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this DeleteProcessorMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @instance + * @returns {Object.} JSON object + */ + DeleteProcessorMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteProcessorMetadata; + })(); + + v1.EnableProcessorRequest = (function() { + + /** + * Properties of an EnableProcessorRequest. + * @memberof google.cloud.documentai.v1 + * @interface IEnableProcessorRequest + * @property {string|null} [name] EnableProcessorRequest name + */ + + /** + * Constructs a new EnableProcessorRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents an EnableProcessorRequest. + * @implements IEnableProcessorRequest + * @constructor + * @param {google.cloud.documentai.v1.IEnableProcessorRequest=} [properties] Properties to set + */ + function EnableProcessorRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnableProcessorRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @instance + */ + EnableProcessorRequest.prototype.name = ""; + + /** + * Creates a new EnableProcessorRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IEnableProcessorRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.EnableProcessorRequest} EnableProcessorRequest instance + */ + EnableProcessorRequest.create = function create(properties) { + return new EnableProcessorRequest(properties); + }; + + /** + * Encodes the specified EnableProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IEnableProcessorRequest} message EnableProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorRequest.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 EnableProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IEnableProcessorRequest} message EnableProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnableProcessorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.EnableProcessorRequest} EnableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.EnableProcessorRequest(); + 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 an EnableProcessorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.EnableProcessorRequest} EnableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnableProcessorRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnableProcessorRequest.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 EnableProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.EnableProcessorRequest} EnableProcessorRequest + */ + EnableProcessorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.EnableProcessorRequest) + return object; + var message = new $root.google.cloud.documentai.v1.EnableProcessorRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from an EnableProcessorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @static + * @param {google.cloud.documentai.v1.EnableProcessorRequest} message EnableProcessorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnableProcessorRequest.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 EnableProcessorRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @instance + * @returns {Object.} JSON object + */ + EnableProcessorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnableProcessorRequest; + })(); + + v1.EnableProcessorResponse = (function() { + + /** + * Properties of an EnableProcessorResponse. + * @memberof google.cloud.documentai.v1 + * @interface IEnableProcessorResponse + */ + + /** + * Constructs a new EnableProcessorResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents an EnableProcessorResponse. + * @implements IEnableProcessorResponse + * @constructor + * @param {google.cloud.documentai.v1.IEnableProcessorResponse=} [properties] Properties to set + */ + function EnableProcessorResponse(properties) { + if (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 EnableProcessorResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.EnableProcessorResponse + * @static + * @param {google.cloud.documentai.v1.IEnableProcessorResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.EnableProcessorResponse} EnableProcessorResponse instance + */ + EnableProcessorResponse.create = function create(properties) { + return new EnableProcessorResponse(properties); + }; + + /** + * Encodes the specified EnableProcessorResponse message. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.EnableProcessorResponse + * @static + * @param {google.cloud.documentai.v1.IEnableProcessorResponse} message EnableProcessorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified EnableProcessorResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.EnableProcessorResponse + * @static + * @param {google.cloud.documentai.v1.IEnableProcessorResponse} message EnableProcessorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnableProcessorResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.EnableProcessorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.EnableProcessorResponse} EnableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.EnableProcessorResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnableProcessorResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.EnableProcessorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.EnableProcessorResponse} EnableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnableProcessorResponse message. + * @function verify + * @memberof google.cloud.documentai.v1.EnableProcessorResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnableProcessorResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an EnableProcessorResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.EnableProcessorResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.EnableProcessorResponse} EnableProcessorResponse + */ + EnableProcessorResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.EnableProcessorResponse) + return object; + return new $root.google.cloud.documentai.v1.EnableProcessorResponse(); + }; + + /** + * Creates a plain object from an EnableProcessorResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.EnableProcessorResponse + * @static + * @param {google.cloud.documentai.v1.EnableProcessorResponse} message EnableProcessorResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnableProcessorResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this EnableProcessorResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.EnableProcessorResponse + * @instance + * @returns {Object.} JSON object + */ + EnableProcessorResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnableProcessorResponse; + })(); + + v1.EnableProcessorMetadata = (function() { + + /** + * Properties of an EnableProcessorMetadata. + * @memberof google.cloud.documentai.v1 + * @interface IEnableProcessorMetadata + * @property {google.cloud.documentai.v1.ICommonOperationMetadata|null} [commonMetadata] EnableProcessorMetadata commonMetadata + */ + + /** + * Constructs a new EnableProcessorMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents an EnableProcessorMetadata. + * @implements IEnableProcessorMetadata + * @constructor + * @param {google.cloud.documentai.v1.IEnableProcessorMetadata=} [properties] Properties to set + */ + function EnableProcessorMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnableProcessorMetadata commonMetadata. + * @member {google.cloud.documentai.v1.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @instance + */ + EnableProcessorMetadata.prototype.commonMetadata = null; + + /** + * Creates a new EnableProcessorMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.IEnableProcessorMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.EnableProcessorMetadata} EnableProcessorMetadata instance + */ + EnableProcessorMetadata.create = function create(properties) { + return new EnableProcessorMetadata(properties); + }; + + /** + * Encodes the specified EnableProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.IEnableProcessorMetadata} message EnableProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnableProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.IEnableProcessorMetadata} message EnableProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnableProcessorMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.EnableProcessorMetadata} EnableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.EnableProcessorMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnableProcessorMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.EnableProcessorMetadata} EnableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnableProcessorMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnableProcessorMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates an EnableProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.EnableProcessorMetadata} EnableProcessorMetadata + */ + EnableProcessorMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.EnableProcessorMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.EnableProcessorMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1.EnableProcessorMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from an EnableProcessorMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.EnableProcessorMetadata} message EnableProcessorMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnableProcessorMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.commonMetadata = null; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this EnableProcessorMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @instance + * @returns {Object.} JSON object + */ + EnableProcessorMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnableProcessorMetadata; + })(); + + v1.DisableProcessorRequest = (function() { + + /** + * Properties of a DisableProcessorRequest. + * @memberof google.cloud.documentai.v1 + * @interface IDisableProcessorRequest + * @property {string|null} [name] DisableProcessorRequest name + */ + + /** + * Constructs a new DisableProcessorRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DisableProcessorRequest. + * @implements IDisableProcessorRequest + * @constructor + * @param {google.cloud.documentai.v1.IDisableProcessorRequest=} [properties] Properties to set + */ + function DisableProcessorRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DisableProcessorRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @instance + */ + DisableProcessorRequest.prototype.name = ""; + + /** + * Creates a new DisableProcessorRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IDisableProcessorRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DisableProcessorRequest} DisableProcessorRequest instance + */ + DisableProcessorRequest.create = function create(properties) { + return new DisableProcessorRequest(properties); + }; + + /** + * Encodes the specified DisableProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IDisableProcessorRequest} message DisableProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorRequest.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 DisableProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IDisableProcessorRequest} message DisableProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DisableProcessorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DisableProcessorRequest} DisableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.DisableProcessorRequest(); + 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 DisableProcessorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DisableProcessorRequest} DisableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DisableProcessorRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DisableProcessorRequest.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 DisableProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DisableProcessorRequest} DisableProcessorRequest + */ + DisableProcessorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DisableProcessorRequest) + return object; + var message = new $root.google.cloud.documentai.v1.DisableProcessorRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DisableProcessorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @static + * @param {google.cloud.documentai.v1.DisableProcessorRequest} message DisableProcessorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DisableProcessorRequest.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 DisableProcessorRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @instance + * @returns {Object.} JSON object + */ + DisableProcessorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DisableProcessorRequest; + })(); + + v1.DisableProcessorResponse = (function() { + + /** + * Properties of a DisableProcessorResponse. + * @memberof google.cloud.documentai.v1 + * @interface IDisableProcessorResponse + */ + + /** + * Constructs a new DisableProcessorResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DisableProcessorResponse. + * @implements IDisableProcessorResponse + * @constructor + * @param {google.cloud.documentai.v1.IDisableProcessorResponse=} [properties] Properties to set + */ + function DisableProcessorResponse(properties) { + if (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 DisableProcessorResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DisableProcessorResponse + * @static + * @param {google.cloud.documentai.v1.IDisableProcessorResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DisableProcessorResponse} DisableProcessorResponse instance + */ + DisableProcessorResponse.create = function create(properties) { + return new DisableProcessorResponse(properties); + }; + + /** + * Encodes the specified DisableProcessorResponse message. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DisableProcessorResponse + * @static + * @param {google.cloud.documentai.v1.IDisableProcessorResponse} message DisableProcessorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified DisableProcessorResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DisableProcessorResponse + * @static + * @param {google.cloud.documentai.v1.IDisableProcessorResponse} message DisableProcessorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DisableProcessorResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DisableProcessorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DisableProcessorResponse} DisableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.DisableProcessorResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DisableProcessorResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DisableProcessorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DisableProcessorResponse} DisableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DisableProcessorResponse message. + * @function verify + * @memberof google.cloud.documentai.v1.DisableProcessorResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DisableProcessorResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a DisableProcessorResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DisableProcessorResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DisableProcessorResponse} DisableProcessorResponse + */ + DisableProcessorResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DisableProcessorResponse) + return object; + return new $root.google.cloud.documentai.v1.DisableProcessorResponse(); + }; + + /** + * Creates a plain object from a DisableProcessorResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DisableProcessorResponse + * @static + * @param {google.cloud.documentai.v1.DisableProcessorResponse} message DisableProcessorResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DisableProcessorResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this DisableProcessorResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DisableProcessorResponse + * @instance + * @returns {Object.} JSON object + */ + DisableProcessorResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DisableProcessorResponse; + })(); + + v1.DisableProcessorMetadata = (function() { + + /** + * Properties of a DisableProcessorMetadata. + * @memberof google.cloud.documentai.v1 + * @interface IDisableProcessorMetadata + * @property {google.cloud.documentai.v1.ICommonOperationMetadata|null} [commonMetadata] DisableProcessorMetadata commonMetadata + */ + + /** + * Constructs a new DisableProcessorMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DisableProcessorMetadata. + * @implements IDisableProcessorMetadata + * @constructor + * @param {google.cloud.documentai.v1.IDisableProcessorMetadata=} [properties] Properties to set + */ + function DisableProcessorMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DisableProcessorMetadata commonMetadata. + * @member {google.cloud.documentai.v1.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @instance + */ + DisableProcessorMetadata.prototype.commonMetadata = null; + + /** + * Creates a new DisableProcessorMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.IDisableProcessorMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DisableProcessorMetadata} DisableProcessorMetadata instance + */ + DisableProcessorMetadata.create = function create(properties) { + return new DisableProcessorMetadata(properties); + }; + + /** + * Encodes the specified DisableProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.IDisableProcessorMetadata} message DisableProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DisableProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.IDisableProcessorMetadata} message DisableProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DisableProcessorMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DisableProcessorMetadata} DisableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.DisableProcessorMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DisableProcessorMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DisableProcessorMetadata} DisableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DisableProcessorMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DisableProcessorMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates a DisableProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DisableProcessorMetadata} DisableProcessorMetadata + */ + DisableProcessorMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DisableProcessorMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.DisableProcessorMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1.DisableProcessorMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from a DisableProcessorMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.DisableProcessorMetadata} message DisableProcessorMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DisableProcessorMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.commonMetadata = null; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this DisableProcessorMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @instance + * @returns {Object.} JSON object + */ + DisableProcessorMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DisableProcessorMetadata; + })(); + + v1.SetDefaultProcessorVersionRequest = (function() { + + /** + * Properties of a SetDefaultProcessorVersionRequest. + * @memberof google.cloud.documentai.v1 + * @interface ISetDefaultProcessorVersionRequest + * @property {string|null} [processor] SetDefaultProcessorVersionRequest processor + * @property {string|null} [defaultProcessorVersion] SetDefaultProcessorVersionRequest defaultProcessorVersion + */ + + /** + * Constructs a new SetDefaultProcessorVersionRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a SetDefaultProcessorVersionRequest. + * @implements ISetDefaultProcessorVersionRequest + * @constructor + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest=} [properties] Properties to set + */ + function SetDefaultProcessorVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SetDefaultProcessorVersionRequest processor. + * @member {string} processor + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @instance + */ + SetDefaultProcessorVersionRequest.prototype.processor = ""; + + /** + * SetDefaultProcessorVersionRequest defaultProcessorVersion. + * @member {string} defaultProcessorVersion + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @instance + */ + SetDefaultProcessorVersionRequest.prototype.defaultProcessorVersion = ""; + + /** + * Creates a new SetDefaultProcessorVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionRequest} SetDefaultProcessorVersionRequest instance + */ + SetDefaultProcessorVersionRequest.create = function create(properties) { + return new SetDefaultProcessorVersionRequest(properties); + }; + + /** + * Encodes the specified SetDefaultProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest} message SetDefaultProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultProcessorVersionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.processor != null && Object.hasOwnProperty.call(message, "processor")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.processor); + if (message.defaultProcessorVersion != null && Object.hasOwnProperty.call(message, "defaultProcessorVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.defaultProcessorVersion); + return writer; + }; + + /** + * Encodes the specified SetDefaultProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest} message SetDefaultProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultProcessorVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetDefaultProcessorVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionRequest} SetDefaultProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultProcessorVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.processor = reader.string(); + break; + case 2: + message.defaultProcessorVersion = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetDefaultProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionRequest} SetDefaultProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultProcessorVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetDefaultProcessorVersionRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetDefaultProcessorVersionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.processor != null && message.hasOwnProperty("processor")) + if (!$util.isString(message.processor)) + return "processor: string expected"; + if (message.defaultProcessorVersion != null && message.hasOwnProperty("defaultProcessorVersion")) + if (!$util.isString(message.defaultProcessorVersion)) + return "defaultProcessorVersion: string expected"; + return null; + }; + + /** + * Creates a SetDefaultProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionRequest} SetDefaultProcessorVersionRequest + */ + SetDefaultProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest) + return object; + var message = new $root.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest(); + if (object.processor != null) + message.processor = String(object.processor); + if (object.defaultProcessorVersion != null) + message.defaultProcessorVersion = String(object.defaultProcessorVersion); + return message; + }; + + /** + * Creates a plain object from a SetDefaultProcessorVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.SetDefaultProcessorVersionRequest} message SetDefaultProcessorVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetDefaultProcessorVersionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.processor = ""; + object.defaultProcessorVersion = ""; + } + if (message.processor != null && message.hasOwnProperty("processor")) + object.processor = message.processor; + if (message.defaultProcessorVersion != null && message.hasOwnProperty("defaultProcessorVersion")) + object.defaultProcessorVersion = message.defaultProcessorVersion; + return object; + }; + + /** + * Converts this SetDefaultProcessorVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @instance + * @returns {Object.} JSON object + */ + SetDefaultProcessorVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SetDefaultProcessorVersionRequest; + })(); + + v1.SetDefaultProcessorVersionResponse = (function() { + + /** + * Properties of a SetDefaultProcessorVersionResponse. + * @memberof google.cloud.documentai.v1 + * @interface ISetDefaultProcessorVersionResponse + */ + + /** + * Constructs a new SetDefaultProcessorVersionResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a SetDefaultProcessorVersionResponse. + * @implements ISetDefaultProcessorVersionResponse + * @constructor + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse=} [properties] Properties to set + */ + function SetDefaultProcessorVersionResponse(properties) { + if (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 SetDefaultProcessorVersionResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionResponse} SetDefaultProcessorVersionResponse instance + */ + SetDefaultProcessorVersionResponse.create = function create(properties) { + return new SetDefaultProcessorVersionResponse(properties); + }; + + /** + * Encodes the specified SetDefaultProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse} message SetDefaultProcessorVersionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultProcessorVersionResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified SetDefaultProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse} message SetDefaultProcessorVersionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultProcessorVersionResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetDefaultProcessorVersionResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionResponse} SetDefaultProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultProcessorVersionResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.SetDefaultProcessorVersionResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetDefaultProcessorVersionResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionResponse} SetDefaultProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultProcessorVersionResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetDefaultProcessorVersionResponse message. + * @function verify + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetDefaultProcessorVersionResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a SetDefaultProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionResponse} SetDefaultProcessorVersionResponse + */ + SetDefaultProcessorVersionResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.SetDefaultProcessorVersionResponse) + return object; + return new $root.google.cloud.documentai.v1.SetDefaultProcessorVersionResponse(); + }; + + /** + * Creates a plain object from a SetDefaultProcessorVersionResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.SetDefaultProcessorVersionResponse} message SetDefaultProcessorVersionResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetDefaultProcessorVersionResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this SetDefaultProcessorVersionResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionResponse + * @instance + * @returns {Object.} JSON object + */ + SetDefaultProcessorVersionResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SetDefaultProcessorVersionResponse; + })(); + + v1.SetDefaultProcessorVersionMetadata = (function() { + + /** + * Properties of a SetDefaultProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1 + * @interface ISetDefaultProcessorVersionMetadata + * @property {google.cloud.documentai.v1.ICommonOperationMetadata|null} [commonMetadata] SetDefaultProcessorVersionMetadata commonMetadata + */ + + /** + * Constructs a new SetDefaultProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a SetDefaultProcessorVersionMetadata. + * @implements ISetDefaultProcessorVersionMetadata + * @constructor + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata=} [properties] Properties to set + */ + function SetDefaultProcessorVersionMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SetDefaultProcessorVersionMetadata commonMetadata. + * @member {google.cloud.documentai.v1.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @instance + */ + SetDefaultProcessorVersionMetadata.prototype.commonMetadata = null; + + /** + * Creates a new SetDefaultProcessorVersionMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata} SetDefaultProcessorVersionMetadata instance + */ + SetDefaultProcessorVersionMetadata.create = function create(properties) { + return new SetDefaultProcessorVersionMetadata(properties); + }; + + /** + * Encodes the specified SetDefaultProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata} message SetDefaultProcessorVersionMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultProcessorVersionMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SetDefaultProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata} message SetDefaultProcessorVersionMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultProcessorVersionMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetDefaultProcessorVersionMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata} SetDefaultProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultProcessorVersionMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetDefaultProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata} SetDefaultProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultProcessorVersionMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetDefaultProcessorVersionMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetDefaultProcessorVersionMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates a SetDefaultProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata} SetDefaultProcessorVersionMetadata + */ + SetDefaultProcessorVersionMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from a SetDefaultProcessorVersionMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata} message SetDefaultProcessorVersionMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetDefaultProcessorVersionMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.commonMetadata = null; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this SetDefaultProcessorVersionMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @instance + * @returns {Object.} JSON object + */ + SetDefaultProcessorVersionMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SetDefaultProcessorVersionMetadata; + })(); + + v1.ReviewDocumentRequest = (function() { + + /** + * Properties of a ReviewDocumentRequest. + * @memberof google.cloud.documentai.v1 + * @interface IReviewDocumentRequest + * @property {google.cloud.documentai.v1.IDocument|null} [inlineDocument] ReviewDocumentRequest inlineDocument + * @property {string|null} [humanReviewConfig] ReviewDocumentRequest humanReviewConfig + * @property {boolean|null} [enableSchemaValidation] ReviewDocumentRequest enableSchemaValidation + * @property {google.cloud.documentai.v1.ReviewDocumentRequest.Priority|null} [priority] ReviewDocumentRequest priority + * @property {google.cloud.documentai.v1.IDocumentSchema|null} [documentSchema] ReviewDocumentRequest documentSchema + */ + + /** + * Constructs a new ReviewDocumentRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ReviewDocumentRequest. + * @implements IReviewDocumentRequest + * @constructor + * @param {google.cloud.documentai.v1.IReviewDocumentRequest=} [properties] Properties to set + */ + function ReviewDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReviewDocumentRequest inlineDocument. + * @member {google.cloud.documentai.v1.IDocument|null|undefined} inlineDocument + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.inlineDocument = null; + + /** + * ReviewDocumentRequest humanReviewConfig. + * @member {string} humanReviewConfig + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.humanReviewConfig = ""; + + /** + * ReviewDocumentRequest enableSchemaValidation. + * @member {boolean} enableSchemaValidation + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.enableSchemaValidation = false; + + /** + * ReviewDocumentRequest priority. + * @member {google.cloud.documentai.v1.ReviewDocumentRequest.Priority} priority + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.priority = 0; + + /** + * ReviewDocumentRequest documentSchema. + * @member {google.cloud.documentai.v1.IDocumentSchema|null|undefined} documentSchema + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.documentSchema = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ReviewDocumentRequest source. + * @member {"inlineDocument"|undefined} source + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @instance + */ + Object.defineProperty(ReviewDocumentRequest.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["inlineDocument"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ReviewDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ReviewDocumentRequest} ReviewDocumentRequest instance + */ + ReviewDocumentRequest.create = function create(properties) { + return new ReviewDocumentRequest(properties); + }; + + /** + * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.humanReviewConfig != null && Object.hasOwnProperty.call(message, "humanReviewConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.humanReviewConfig); + if (message.enableSchemaValidation != null && Object.hasOwnProperty.call(message, "enableSchemaValidation")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableSchemaValidation); + if (message.inlineDocument != null && Object.hasOwnProperty.call(message, "inlineDocument")) + $root.google.cloud.documentai.v1.Document.encode(message.inlineDocument, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.priority != null && Object.hasOwnProperty.call(message, "priority")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.priority); + if (message.documentSchema != null && Object.hasOwnProperty.call(message, "documentSchema")) + $root.google.cloud.documentai.v1.DocumentSchema.encode(message.documentSchema, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ReviewDocumentRequest} ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ReviewDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + message.inlineDocument = $root.google.cloud.documentai.v1.Document.decode(reader, reader.uint32()); + break; + case 1: + message.humanReviewConfig = reader.string(); + break; + case 3: + message.enableSchemaValidation = reader.bool(); + break; + case 5: + message.priority = reader.int32(); + break; + case 6: + message.documentSchema = $root.google.cloud.documentai.v1.DocumentSchema.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ReviewDocumentRequest} ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReviewDocumentRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReviewDocumentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { + properties.source = 1; + { + var error = $root.google.cloud.documentai.v1.Document.verify(message.inlineDocument); + if (error) + return "inlineDocument." + error; + } + } + if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) + if (!$util.isString(message.humanReviewConfig)) + return "humanReviewConfig: string expected"; + if (message.enableSchemaValidation != null && message.hasOwnProperty("enableSchemaValidation")) + if (typeof message.enableSchemaValidation !== "boolean") + return "enableSchemaValidation: boolean expected"; + if (message.priority != null && message.hasOwnProperty("priority")) + switch (message.priority) { + default: + return "priority: enum value expected"; + case 0: + case 1: + break; + } + if (message.documentSchema != null && message.hasOwnProperty("documentSchema")) { + var error = $root.google.cloud.documentai.v1.DocumentSchema.verify(message.documentSchema); + if (error) + return "documentSchema." + error; + } + return null; + }; + + /** + * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ReviewDocumentRequest} ReviewDocumentRequest + */ + ReviewDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ReviewDocumentRequest) + return object; + var message = new $root.google.cloud.documentai.v1.ReviewDocumentRequest(); + if (object.inlineDocument != null) { + if (typeof object.inlineDocument !== "object") + throw TypeError(".google.cloud.documentai.v1.ReviewDocumentRequest.inlineDocument: object expected"); + message.inlineDocument = $root.google.cloud.documentai.v1.Document.fromObject(object.inlineDocument); + } + if (object.humanReviewConfig != null) + message.humanReviewConfig = String(object.humanReviewConfig); + if (object.enableSchemaValidation != null) + message.enableSchemaValidation = Boolean(object.enableSchemaValidation); + switch (object.priority) { + case "DEFAULT": + case 0: + message.priority = 0; + break; + case "URGENT": + case 1: + message.priority = 1; + break; + } + if (object.documentSchema != null) { + if (typeof object.documentSchema !== "object") + throw TypeError(".google.cloud.documentai.v1.ReviewDocumentRequest.documentSchema: object expected"); + message.documentSchema = $root.google.cloud.documentai.v1.DocumentSchema.fromObject(object.documentSchema); + } + return message; + }; + + /** + * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1.ReviewDocumentRequest} message ReviewDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReviewDocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.humanReviewConfig = ""; + object.enableSchemaValidation = false; + object.priority = options.enums === String ? "DEFAULT" : 0; + object.documentSchema = null; + } + if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) + object.humanReviewConfig = message.humanReviewConfig; + if (message.enableSchemaValidation != null && message.hasOwnProperty("enableSchemaValidation")) + object.enableSchemaValidation = message.enableSchemaValidation; + if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { + object.inlineDocument = $root.google.cloud.documentai.v1.Document.toObject(message.inlineDocument, options); + if (options.oneofs) + object.source = "inlineDocument"; + } + if (message.priority != null && message.hasOwnProperty("priority")) + object.priority = options.enums === String ? $root.google.cloud.documentai.v1.ReviewDocumentRequest.Priority[message.priority] : message.priority; + if (message.documentSchema != null && message.hasOwnProperty("documentSchema")) + object.documentSchema = $root.google.cloud.documentai.v1.DocumentSchema.toObject(message.documentSchema, options); + return object; + }; + + /** + * Converts this ReviewDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Priority enum. + * @name google.cloud.documentai.v1.ReviewDocumentRequest.Priority + * @enum {number} + * @property {number} DEFAULT=0 DEFAULT value + * @property {number} URGENT=1 URGENT value + */ + ReviewDocumentRequest.Priority = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT"] = 0; + values[valuesById[1] = "URGENT"] = 1; + return values; + })(); + + return ReviewDocumentRequest; + })(); + + v1.ReviewDocumentResponse = (function() { + + /** + * Properties of a ReviewDocumentResponse. + * @memberof google.cloud.documentai.v1 + * @interface IReviewDocumentResponse + * @property {string|null} [gcsDestination] ReviewDocumentResponse gcsDestination + * @property {google.cloud.documentai.v1.ReviewDocumentResponse.State|null} [state] ReviewDocumentResponse state + * @property {string|null} [rejectionReason] ReviewDocumentResponse rejectionReason + */ + + /** + * Constructs a new ReviewDocumentResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ReviewDocumentResponse. + * @implements IReviewDocumentResponse + * @constructor + * @param {google.cloud.documentai.v1.IReviewDocumentResponse=} [properties] Properties to set + */ + function ReviewDocumentResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReviewDocumentResponse gcsDestination. + * @member {string} gcsDestination + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @instance + */ + ReviewDocumentResponse.prototype.gcsDestination = ""; + + /** + * ReviewDocumentResponse state. + * @member {google.cloud.documentai.v1.ReviewDocumentResponse.State} state + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @instance + */ + ReviewDocumentResponse.prototype.state = 0; + + /** + * ReviewDocumentResponse rejectionReason. + * @member {string} rejectionReason + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @instance + */ + ReviewDocumentResponse.prototype.rejectionReason = ""; + + /** + * Creates a new ReviewDocumentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ReviewDocumentResponse} ReviewDocumentResponse instance + */ + ReviewDocumentResponse.create = function create(properties) { + return new ReviewDocumentResponse(properties); + }; + + /** + * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsDestination); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.state); + if (message.rejectionReason != null && Object.hasOwnProperty.call(message, "rejectionReason")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.rejectionReason); + return writer; + }; + + /** + * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ReviewDocumentResponse} ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ReviewDocumentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsDestination = reader.string(); + break; + case 2: + message.state = reader.int32(); + break; + case 3: + message.rejectionReason = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ReviewDocumentResponse} ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReviewDocumentResponse message. + * @function verify + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReviewDocumentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + if (!$util.isString(message.gcsDestination)) + return "gcsDestination: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.rejectionReason != null && message.hasOwnProperty("rejectionReason")) + if (!$util.isString(message.rejectionReason)) + return "rejectionReason: string expected"; + return null; + }; + + /** + * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ReviewDocumentResponse} ReviewDocumentResponse + */ + ReviewDocumentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ReviewDocumentResponse) + return object; + var message = new $root.google.cloud.documentai.v1.ReviewDocumentResponse(); + if (object.gcsDestination != null) + message.gcsDestination = String(object.gcsDestination); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "REJECTED": + case 1: + message.state = 1; + break; + case "SUCCEEDED": + case 2: + message.state = 2; + break; + } + if (object.rejectionReason != null) + message.rejectionReason = String(object.rejectionReason); + return message; + }; + + /** + * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1.ReviewDocumentResponse} message ReviewDocumentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReviewDocumentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.gcsDestination = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.rejectionReason = ""; + } + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + object.gcsDestination = message.gcsDestination; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1.ReviewDocumentResponse.State[message.state] : message.state; + if (message.rejectionReason != null && message.hasOwnProperty("rejectionReason")) + object.rejectionReason = message.rejectionReason; + return object; + }; + + /** + * Converts this ReviewDocumentResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.documentai.v1.ReviewDocumentResponse.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} REJECTED=1 REJECTED value + * @property {number} SUCCEEDED=2 SUCCEEDED value + */ + ReviewDocumentResponse.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "REJECTED"] = 1; + values[valuesById[2] = "SUCCEEDED"] = 2; + return values; + })(); + + return ReviewDocumentResponse; + })(); + + v1.ReviewDocumentOperationMetadata = (function() { + + /** + * Properties of a ReviewDocumentOperationMetadata. + * @memberof google.cloud.documentai.v1 + * @interface IReviewDocumentOperationMetadata + * @property {google.cloud.documentai.v1.ICommonOperationMetadata|null} [commonMetadata] ReviewDocumentOperationMetadata commonMetadata + * @property {string|null} [questionId] ReviewDocumentOperationMetadata questionId + */ + + /** + * Constructs a new ReviewDocumentOperationMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ReviewDocumentOperationMetadata. + * @implements IReviewDocumentOperationMetadata + * @constructor + * @param {google.cloud.documentai.v1.IReviewDocumentOperationMetadata=} [properties] Properties to set + */ + function ReviewDocumentOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReviewDocumentOperationMetadata commonMetadata. + * @member {google.cloud.documentai.v1.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.commonMetadata = null; + + /** + * ReviewDocumentOperationMetadata questionId. + * @member {string} questionId + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.questionId = ""; + + /** + * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata instance + */ + ReviewDocumentOperationMetadata.create = function create(properties) { + return new ReviewDocumentOperationMetadata(properties); + }; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.questionId != null && Object.hasOwnProperty.call(message, "questionId")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.questionId); + return writer; + }; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ReviewDocumentOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + case 6: + message.questionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReviewDocumentOperationMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReviewDocumentOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + if (message.questionId != null && message.hasOwnProperty("questionId")) + if (!$util.isString(message.questionId)) + return "questionId: string expected"; + return null; + }; + + /** + * Creates a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + */ + ReviewDocumentOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ReviewDocumentOperationMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.ReviewDocumentOperationMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1.ReviewDocumentOperationMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.fromObject(object.commonMetadata); + } + if (object.questionId != null) + message.questionId = String(object.questionId); + return message; + }; + + /** + * Creates a plain object from a ReviewDocumentOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReviewDocumentOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.commonMetadata = null; + object.questionId = ""; + } + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.toObject(message.commonMetadata, options); + if (message.questionId != null && message.hasOwnProperty("questionId")) + object.questionId = message.questionId; + return object; + }; + + /** + * Converts this ReviewDocumentOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ReviewDocumentOperationMetadata; + })(); + + v1.DocumentSchema = (function() { + + /** + * Properties of a DocumentSchema. + * @memberof google.cloud.documentai.v1 + * @interface IDocumentSchema + * @property {string|null} [displayName] DocumentSchema displayName + * @property {string|null} [description] DocumentSchema description + * @property {Array.|null} [entityTypes] DocumentSchema entityTypes + * @property {google.cloud.documentai.v1.DocumentSchema.IMetadata|null} [metadata] DocumentSchema metadata + */ + + /** + * Constructs a new DocumentSchema. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DocumentSchema. + * @implements IDocumentSchema + * @constructor + * @param {google.cloud.documentai.v1.IDocumentSchema=} [properties] Properties to set + */ + function DocumentSchema(properties) { + this.entityTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentSchema displayName. + * @member {string} displayName + * @memberof google.cloud.documentai.v1.DocumentSchema + * @instance + */ + DocumentSchema.prototype.displayName = ""; + + /** + * DocumentSchema description. + * @member {string} description + * @memberof google.cloud.documentai.v1.DocumentSchema + * @instance + */ + DocumentSchema.prototype.description = ""; + + /** + * DocumentSchema entityTypes. + * @member {Array.} entityTypes + * @memberof google.cloud.documentai.v1.DocumentSchema + * @instance + */ + DocumentSchema.prototype.entityTypes = $util.emptyArray; + + /** + * DocumentSchema metadata. + * @member {google.cloud.documentai.v1.DocumentSchema.IMetadata|null|undefined} metadata + * @memberof google.cloud.documentai.v1.DocumentSchema + * @instance + */ + DocumentSchema.prototype.metadata = null; + + /** + * Creates a new DocumentSchema instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DocumentSchema + * @static + * @param {google.cloud.documentai.v1.IDocumentSchema=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DocumentSchema} DocumentSchema instance + */ + DocumentSchema.create = function create(properties) { + return new DocumentSchema(properties); + }; + + /** + * Encodes the specified DocumentSchema message. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DocumentSchema + * @static + * @param {google.cloud.documentai.v1.IDocumentSchema} message DocumentSchema message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentSchema.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.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.entityTypes != null && message.entityTypes.length) + for (var i = 0; i < message.entityTypes.length; ++i) + $root.google.cloud.documentai.v1.DocumentSchema.EntityType.encode(message.entityTypes[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.google.cloud.documentai.v1.DocumentSchema.Metadata.encode(message.metadata, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DocumentSchema message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DocumentSchema + * @static + * @param {google.cloud.documentai.v1.IDocumentSchema} message DocumentSchema message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentSchema.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DocumentSchema message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DocumentSchema + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DocumentSchema} DocumentSchema + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentSchema.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.DocumentSchema(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.displayName = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + if (!(message.entityTypes && message.entityTypes.length)) + message.entityTypes = []; + message.entityTypes.push($root.google.cloud.documentai.v1.DocumentSchema.EntityType.decode(reader, reader.uint32())); + break; + case 4: + message.metadata = $root.google.cloud.documentai.v1.DocumentSchema.Metadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentSchema message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DocumentSchema + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DocumentSchema} DocumentSchema + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentSchema.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentSchema message. + * @function verify + * @memberof google.cloud.documentai.v1.DocumentSchema + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentSchema.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.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.entityTypes != null && message.hasOwnProperty("entityTypes")) { + if (!Array.isArray(message.entityTypes)) + return "entityTypes: array expected"; + for (var i = 0; i < message.entityTypes.length; ++i) { + var error = $root.google.cloud.documentai.v1.DocumentSchema.EntityType.verify(message.entityTypes[i]); + if (error) + return "entityTypes." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.google.cloud.documentai.v1.DocumentSchema.Metadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; + + /** + * Creates a DocumentSchema message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DocumentSchema + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DocumentSchema} DocumentSchema + */ + DocumentSchema.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DocumentSchema) + return object; + var message = new $root.google.cloud.documentai.v1.DocumentSchema(); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.description != null) + message.description = String(object.description); + if (object.entityTypes) { + if (!Array.isArray(object.entityTypes)) + throw TypeError(".google.cloud.documentai.v1.DocumentSchema.entityTypes: array expected"); + message.entityTypes = []; + for (var i = 0; i < object.entityTypes.length; ++i) { + if (typeof object.entityTypes[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.DocumentSchema.entityTypes: object expected"); + message.entityTypes[i] = $root.google.cloud.documentai.v1.DocumentSchema.EntityType.fromObject(object.entityTypes[i]); + } + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.documentai.v1.DocumentSchema.metadata: object expected"); + message.metadata = $root.google.cloud.documentai.v1.DocumentSchema.Metadata.fromObject(object.metadata); + } + return message; + }; + + /** + * Creates a plain object from a DocumentSchema message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DocumentSchema + * @static + * @param {google.cloud.documentai.v1.DocumentSchema} message DocumentSchema + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentSchema.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entityTypes = []; + if (options.defaults) { + object.displayName = ""; + object.description = ""; + object.metadata = null; + } + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.entityTypes && message.entityTypes.length) { + object.entityTypes = []; + for (var j = 0; j < message.entityTypes.length; ++j) + object.entityTypes[j] = $root.google.cloud.documentai.v1.DocumentSchema.EntityType.toObject(message.entityTypes[j], options); + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.google.cloud.documentai.v1.DocumentSchema.Metadata.toObject(message.metadata, options); + return object; + }; + + /** + * Converts this DocumentSchema to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DocumentSchema + * @instance + * @returns {Object.} JSON object + */ + DocumentSchema.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + DocumentSchema.EntityType = (function() { + + /** + * Properties of an EntityType. + * @memberof google.cloud.documentai.v1.DocumentSchema + * @interface IEntityType + * @property {google.cloud.documentai.v1.DocumentSchema.EntityType.IEnumValues|null} [enumValues] EntityType enumValues + * @property {string|null} [displayName] EntityType displayName + * @property {string|null} [name] EntityType name + * @property {Array.|null} [baseTypes] EntityType baseTypes + * @property {Array.|null} [properties] EntityType properties + */ + + /** + * Constructs a new EntityType. + * @memberof google.cloud.documentai.v1.DocumentSchema + * @classdesc Represents an EntityType. + * @implements IEntityType + * @constructor + * @param {google.cloud.documentai.v1.DocumentSchema.IEntityType=} [properties] Properties to set + */ + function EntityType(properties) { + this.baseTypes = []; + this.properties = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EntityType enumValues. + * @member {google.cloud.documentai.v1.DocumentSchema.EntityType.IEnumValues|null|undefined} enumValues + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @instance + */ + EntityType.prototype.enumValues = null; + + /** + * EntityType displayName. + * @member {string} displayName + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @instance + */ + EntityType.prototype.displayName = ""; + + /** + * EntityType name. + * @member {string} name + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @instance + */ + EntityType.prototype.name = ""; + + /** + * EntityType baseTypes. + * @member {Array.} baseTypes + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @instance + */ + EntityType.prototype.baseTypes = $util.emptyArray; + + /** + * EntityType properties. + * @member {Array.} properties + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @instance + */ + EntityType.prototype.properties = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * EntityType valueSource. + * @member {"enumValues"|undefined} valueSource + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @instance + */ + Object.defineProperty(EntityType.prototype, "valueSource", { + get: $util.oneOfGetter($oneOfFields = ["enumValues"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new EntityType instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @static + * @param {google.cloud.documentai.v1.DocumentSchema.IEntityType=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DocumentSchema.EntityType} EntityType instance + */ + EntityType.create = function create(properties) { + return new EntityType(properties); + }; + + /** + * Encodes the specified EntityType message. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.EntityType.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @static + * @param {google.cloud.documentai.v1.DocumentSchema.IEntityType} message EntityType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityType.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.baseTypes != null && message.baseTypes.length) + for (var i = 0; i < message.baseTypes.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.baseTypes[i]); + if (message.properties != null && message.properties.length) + for (var i = 0; i < message.properties.length; ++i) + $root.google.cloud.documentai.v1.DocumentSchema.EntityType.Property.encode(message.properties[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.displayName); + if (message.enumValues != null && Object.hasOwnProperty.call(message, "enumValues")) + $root.google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues.encode(message.enumValues, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EntityType message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.EntityType.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @static + * @param {google.cloud.documentai.v1.DocumentSchema.IEntityType} message EntityType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityType.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EntityType message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DocumentSchema.EntityType} EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityType.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.DocumentSchema.EntityType(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 14: + message.enumValues = $root.google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues.decode(reader, reader.uint32()); + break; + case 13: + message.displayName = reader.string(); + break; + case 1: + message.name = reader.string(); + break; + case 2: + if (!(message.baseTypes && message.baseTypes.length)) + message.baseTypes = []; + message.baseTypes.push(reader.string()); + break; + case 6: + if (!(message.properties && message.properties.length)) + message.properties = []; + message.properties.push($root.google.cloud.documentai.v1.DocumentSchema.EntityType.Property.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EntityType message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DocumentSchema.EntityType} EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityType.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EntityType message. + * @function verify + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EntityType.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.enumValues != null && message.hasOwnProperty("enumValues")) { + properties.valueSource = 1; + { + var error = $root.google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues.verify(message.enumValues); + if (error) + return "enumValues." + error; + } + } + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.baseTypes != null && message.hasOwnProperty("baseTypes")) { + if (!Array.isArray(message.baseTypes)) + return "baseTypes: array expected"; + for (var i = 0; i < message.baseTypes.length; ++i) + if (!$util.isString(message.baseTypes[i])) + return "baseTypes: string[] expected"; + } + if (message.properties != null && message.hasOwnProperty("properties")) { + if (!Array.isArray(message.properties)) + return "properties: array expected"; + for (var i = 0; i < message.properties.length; ++i) { + var error = $root.google.cloud.documentai.v1.DocumentSchema.EntityType.Property.verify(message.properties[i]); + if (error) + return "properties." + error; + } + } + return null; + }; + + /** + * Creates an EntityType message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DocumentSchema.EntityType} EntityType + */ + EntityType.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DocumentSchema.EntityType) + return object; + var message = new $root.google.cloud.documentai.v1.DocumentSchema.EntityType(); + if (object.enumValues != null) { + if (typeof object.enumValues !== "object") + throw TypeError(".google.cloud.documentai.v1.DocumentSchema.EntityType.enumValues: object expected"); + message.enumValues = $root.google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues.fromObject(object.enumValues); + } + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.name != null) + message.name = String(object.name); + if (object.baseTypes) { + if (!Array.isArray(object.baseTypes)) + throw TypeError(".google.cloud.documentai.v1.DocumentSchema.EntityType.baseTypes: array expected"); + message.baseTypes = []; + for (var i = 0; i < object.baseTypes.length; ++i) + message.baseTypes[i] = String(object.baseTypes[i]); + } + if (object.properties) { + if (!Array.isArray(object.properties)) + throw TypeError(".google.cloud.documentai.v1.DocumentSchema.EntityType.properties: array expected"); + message.properties = []; + for (var i = 0; i < object.properties.length; ++i) { + if (typeof object.properties[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.DocumentSchema.EntityType.properties: object expected"); + message.properties[i] = $root.google.cloud.documentai.v1.DocumentSchema.EntityType.Property.fromObject(object.properties[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EntityType message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @static + * @param {google.cloud.documentai.v1.DocumentSchema.EntityType} message EntityType + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EntityType.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.baseTypes = []; + object.properties = []; + } + if (options.defaults) { + object.name = ""; + object.displayName = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.baseTypes && message.baseTypes.length) { + object.baseTypes = []; + for (var j = 0; j < message.baseTypes.length; ++j) + object.baseTypes[j] = message.baseTypes[j]; + } + if (message.properties && message.properties.length) { + object.properties = []; + for (var j = 0; j < message.properties.length; ++j) + object.properties[j] = $root.google.cloud.documentai.v1.DocumentSchema.EntityType.Property.toObject(message.properties[j], options); + } + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.enumValues != null && message.hasOwnProperty("enumValues")) { + object.enumValues = $root.google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues.toObject(message.enumValues, options); + if (options.oneofs) + object.valueSource = "enumValues"; + } + return object; + }; + + /** + * Converts this EntityType to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @instance + * @returns {Object.} JSON object + */ + EntityType.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + EntityType.EnumValues = (function() { + + /** + * Properties of an EnumValues. + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @interface IEnumValues + * @property {Array.|null} [values] EnumValues values + */ + + /** + * Constructs a new EnumValues. + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @classdesc Represents an EnumValues. + * @implements IEnumValues + * @constructor + * @param {google.cloud.documentai.v1.DocumentSchema.EntityType.IEnumValues=} [properties] Properties to set + */ + function EnumValues(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]]; + } + + /** + * EnumValues values. + * @member {Array.} values + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues + * @instance + */ + EnumValues.prototype.values = $util.emptyArray; + + /** + * Creates a new EnumValues instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues + * @static + * @param {google.cloud.documentai.v1.DocumentSchema.EntityType.IEnumValues=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues} EnumValues instance + */ + EnumValues.create = function create(properties) { + return new EnumValues(properties); + }; + + /** + * Encodes the specified EnumValues message. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues + * @static + * @param {google.cloud.documentai.v1.DocumentSchema.EntityType.IEnumValues} message EnumValues message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValues.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) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.values[i]); + return writer; + }; + + /** + * Encodes the specified EnumValues message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues + * @static + * @param {google.cloud.documentai.v1.DocumentSchema.EntityType.IEnumValues} message EnumValues message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValues.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValues message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues} EnumValues + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValues.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.values && message.values.length)) + message.values = []; + message.values.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValues message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues} EnumValues + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValues.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValues message. + * @function verify + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValues.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) + if (!$util.isString(message.values[i])) + return "values: string[] expected"; + } + return null; + }; + + /** + * Creates an EnumValues message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues} EnumValues + */ + EnumValues.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues) + return object; + var message = new $root.google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues(); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) + message.values[i] = String(object.values[i]); + } + return message; + }; + + /** + * Creates a plain object from an EnumValues message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues + * @static + * @param {google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues} message EnumValues + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValues.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] = message.values[j]; + } + return object; + }; + + /** + * Converts this EnumValues to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues + * @instance + * @returns {Object.} JSON object + */ + EnumValues.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumValues; + })(); + + EntityType.Property = (function() { + + /** + * Properties of a Property. + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @interface IProperty + * @property {string|null} [name] Property name + * @property {string|null} [valueType] Property valueType + * @property {google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType|null} [occurrenceType] Property occurrenceType + */ + + /** + * Constructs a new Property. + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @classdesc Represents a Property. + * @implements IProperty + * @constructor + * @param {google.cloud.documentai.v1.DocumentSchema.EntityType.IProperty=} [properties] Properties to set + */ + function Property(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Property name. + * @member {string} name + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.Property + * @instance + */ + Property.prototype.name = ""; + + /** + * Property valueType. + * @member {string} valueType + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.Property + * @instance + */ + Property.prototype.valueType = ""; + + /** + * Property occurrenceType. + * @member {google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType} occurrenceType + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.Property + * @instance + */ + Property.prototype.occurrenceType = 0; + + /** + * Creates a new Property instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.Property + * @static + * @param {google.cloud.documentai.v1.DocumentSchema.EntityType.IProperty=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DocumentSchema.EntityType.Property} Property instance + */ + Property.create = function create(properties) { + return new Property(properties); + }; + + /** + * Encodes the specified Property message. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.EntityType.Property.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.Property + * @static + * @param {google.cloud.documentai.v1.DocumentSchema.EntityType.IProperty} message Property message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Property.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.valueType != null && Object.hasOwnProperty.call(message, "valueType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.valueType); + if (message.occurrenceType != null && Object.hasOwnProperty.call(message, "occurrenceType")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.occurrenceType); + return writer; + }; + + /** + * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.EntityType.Property.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.Property + * @static + * @param {google.cloud.documentai.v1.DocumentSchema.EntityType.IProperty} message Property message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Property.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Property message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.Property + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DocumentSchema.EntityType.Property} Property + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Property.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.DocumentSchema.EntityType.Property(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.valueType = reader.string(); + break; + case 3: + message.occurrenceType = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Property message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.Property + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DocumentSchema.EntityType.Property} Property + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Property.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Property message. + * @function verify + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.Property + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Property.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.valueType != null && message.hasOwnProperty("valueType")) + if (!$util.isString(message.valueType)) + return "valueType: string expected"; + if (message.occurrenceType != null && message.hasOwnProperty("occurrenceType")) + switch (message.occurrenceType) { + default: + return "occurrenceType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a Property message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.Property + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DocumentSchema.EntityType.Property} Property + */ + Property.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DocumentSchema.EntityType.Property) + return object; + var message = new $root.google.cloud.documentai.v1.DocumentSchema.EntityType.Property(); + if (object.name != null) + message.name = String(object.name); + if (object.valueType != null) + message.valueType = String(object.valueType); + switch (object.occurrenceType) { + case "OCCURRENCE_TYPE_UNSPECIFIED": + case 0: + message.occurrenceType = 0; + break; + case "OPTIONAL_ONCE": + case 1: + message.occurrenceType = 1; + break; + case "OPTIONAL_MULTIPLE": + case 2: + message.occurrenceType = 2; + break; + case "REQUIRED_ONCE": + case 3: + message.occurrenceType = 3; + break; + case "REQUIRED_MULTIPLE": + case 4: + message.occurrenceType = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a Property message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.Property + * @static + * @param {google.cloud.documentai.v1.DocumentSchema.EntityType.Property} message Property + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Property.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.valueType = ""; + object.occurrenceType = options.enums === String ? "OCCURRENCE_TYPE_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.valueType != null && message.hasOwnProperty("valueType")) + object.valueType = message.valueType; + if (message.occurrenceType != null && message.hasOwnProperty("occurrenceType")) + object.occurrenceType = options.enums === String ? $root.google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType[message.occurrenceType] : message.occurrenceType; + return object; + }; + + /** + * Converts this Property to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.Property + * @instance + * @returns {Object.} JSON object + */ + Property.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * OccurrenceType enum. + * @name google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType + * @enum {number} + * @property {number} OCCURRENCE_TYPE_UNSPECIFIED=0 OCCURRENCE_TYPE_UNSPECIFIED value + * @property {number} OPTIONAL_ONCE=1 OPTIONAL_ONCE value + * @property {number} OPTIONAL_MULTIPLE=2 OPTIONAL_MULTIPLE value + * @property {number} REQUIRED_ONCE=3 REQUIRED_ONCE value + * @property {number} REQUIRED_MULTIPLE=4 REQUIRED_MULTIPLE value + */ + Property.OccurrenceType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "OCCURRENCE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "OPTIONAL_ONCE"] = 1; + values[valuesById[2] = "OPTIONAL_MULTIPLE"] = 2; + values[valuesById[3] = "REQUIRED_ONCE"] = 3; + values[valuesById[4] = "REQUIRED_MULTIPLE"] = 4; + return values; + })(); + + return Property; + })(); + + return EntityType; + })(); + + DocumentSchema.Metadata = (function() { + + /** + * Properties of a Metadata. + * @memberof google.cloud.documentai.v1.DocumentSchema + * @interface IMetadata + * @property {boolean|null} [documentSplitter] Metadata documentSplitter + * @property {boolean|null} [documentAllowMultipleLabels] Metadata documentAllowMultipleLabels + * @property {boolean|null} [prefixedNamingOnProperties] Metadata prefixedNamingOnProperties + * @property {boolean|null} [skipNamingValidation] Metadata skipNamingValidation + */ + + /** + * Constructs a new Metadata. + * @memberof google.cloud.documentai.v1.DocumentSchema + * @classdesc Represents a Metadata. + * @implements IMetadata + * @constructor + * @param {google.cloud.documentai.v1.DocumentSchema.IMetadata=} [properties] Properties to set + */ + function Metadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Metadata documentSplitter. + * @member {boolean} documentSplitter + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @instance + */ + Metadata.prototype.documentSplitter = false; + + /** + * Metadata documentAllowMultipleLabels. + * @member {boolean} documentAllowMultipleLabels + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @instance + */ + Metadata.prototype.documentAllowMultipleLabels = false; + + /** + * Metadata prefixedNamingOnProperties. + * @member {boolean} prefixedNamingOnProperties + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @instance + */ + Metadata.prototype.prefixedNamingOnProperties = false; + + /** + * Metadata skipNamingValidation. + * @member {boolean} skipNamingValidation + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @instance + */ + Metadata.prototype.skipNamingValidation = false; + + /** + * Creates a new Metadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @static + * @param {google.cloud.documentai.v1.DocumentSchema.IMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DocumentSchema.Metadata} Metadata instance + */ + Metadata.create = function create(properties) { + return new Metadata(properties); + }; + + /** + * Encodes the specified Metadata message. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.Metadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @static + * @param {google.cloud.documentai.v1.DocumentSchema.IMetadata} message Metadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.documentSplitter != null && Object.hasOwnProperty.call(message, "documentSplitter")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.documentSplitter); + if (message.documentAllowMultipleLabels != null && Object.hasOwnProperty.call(message, "documentAllowMultipleLabels")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.documentAllowMultipleLabels); + if (message.prefixedNamingOnProperties != null && Object.hasOwnProperty.call(message, "prefixedNamingOnProperties")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.prefixedNamingOnProperties); + if (message.skipNamingValidation != null && Object.hasOwnProperty.call(message, "skipNamingValidation")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.skipNamingValidation); + return writer; + }; + + /** + * Encodes the specified Metadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.Metadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @static + * @param {google.cloud.documentai.v1.DocumentSchema.IMetadata} message Metadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Metadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DocumentSchema.Metadata} Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.DocumentSchema.Metadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.documentSplitter = reader.bool(); + break; + case 2: + message.documentAllowMultipleLabels = reader.bool(); + break; + case 6: + message.prefixedNamingOnProperties = reader.bool(); + break; + case 7: + message.skipNamingValidation = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Metadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DocumentSchema.Metadata} Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Metadata message. + * @function verify + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Metadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.documentSplitter != null && message.hasOwnProperty("documentSplitter")) + if (typeof message.documentSplitter !== "boolean") + return "documentSplitter: boolean expected"; + if (message.documentAllowMultipleLabels != null && message.hasOwnProperty("documentAllowMultipleLabels")) + if (typeof message.documentAllowMultipleLabels !== "boolean") + return "documentAllowMultipleLabels: boolean expected"; + if (message.prefixedNamingOnProperties != null && message.hasOwnProperty("prefixedNamingOnProperties")) + if (typeof message.prefixedNamingOnProperties !== "boolean") + return "prefixedNamingOnProperties: boolean expected"; + if (message.skipNamingValidation != null && message.hasOwnProperty("skipNamingValidation")) + if (typeof message.skipNamingValidation !== "boolean") + return "skipNamingValidation: boolean expected"; + return null; + }; + + /** + * Creates a Metadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DocumentSchema.Metadata} Metadata + */ + Metadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DocumentSchema.Metadata) + return object; + var message = new $root.google.cloud.documentai.v1.DocumentSchema.Metadata(); + if (object.documentSplitter != null) + message.documentSplitter = Boolean(object.documentSplitter); + if (object.documentAllowMultipleLabels != null) + message.documentAllowMultipleLabels = Boolean(object.documentAllowMultipleLabels); + if (object.prefixedNamingOnProperties != null) + message.prefixedNamingOnProperties = Boolean(object.prefixedNamingOnProperties); + if (object.skipNamingValidation != null) + message.skipNamingValidation = Boolean(object.skipNamingValidation); + return message; + }; + + /** + * Creates a plain object from a Metadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @static + * @param {google.cloud.documentai.v1.DocumentSchema.Metadata} message Metadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Metadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.documentSplitter = false; + object.documentAllowMultipleLabels = false; + object.prefixedNamingOnProperties = false; + object.skipNamingValidation = false; + } + if (message.documentSplitter != null && message.hasOwnProperty("documentSplitter")) + object.documentSplitter = message.documentSplitter; + if (message.documentAllowMultipleLabels != null && message.hasOwnProperty("documentAllowMultipleLabels")) + object.documentAllowMultipleLabels = message.documentAllowMultipleLabels; + if (message.prefixedNamingOnProperties != null && message.hasOwnProperty("prefixedNamingOnProperties")) + object.prefixedNamingOnProperties = message.prefixedNamingOnProperties; + if (message.skipNamingValidation != null && message.hasOwnProperty("skipNamingValidation")) + object.skipNamingValidation = message.skipNamingValidation; + return object; + }; + + /** + * Converts this Metadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @instance + * @returns {Object.} JSON object + */ + Metadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Metadata; + })(); + + return DocumentSchema; + })(); + + v1.CommonOperationMetadata = (function() { + + /** + * Properties of a CommonOperationMetadata. + * @memberof google.cloud.documentai.v1 + * @interface ICommonOperationMetadata + * @property {google.cloud.documentai.v1.CommonOperationMetadata.State|null} [state] CommonOperationMetadata state + * @property {string|null} [stateMessage] CommonOperationMetadata stateMessage + * @property {string|null} [resource] CommonOperationMetadata resource + * @property {google.protobuf.ITimestamp|null} [createTime] CommonOperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] CommonOperationMetadata updateTime + */ + + /** + * Constructs a new CommonOperationMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a CommonOperationMetadata. + * @implements ICommonOperationMetadata + * @constructor + * @param {google.cloud.documentai.v1.ICommonOperationMetadata=} [properties] Properties to set + */ + function CommonOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CommonOperationMetadata state. + * @member {google.cloud.documentai.v1.CommonOperationMetadata.State} state + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.state = 0; + + /** + * CommonOperationMetadata stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.stateMessage = ""; + + /** + * CommonOperationMetadata resource. + * @member {string} resource + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.resource = ""; + + /** + * CommonOperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.createTime = null; + + /** + * CommonOperationMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.updateTime = null; + + /** + * Creates a new CommonOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {google.cloud.documentai.v1.ICommonOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.CommonOperationMetadata} CommonOperationMetadata instance + */ + CommonOperationMetadata.create = function create(properties) { + return new CommonOperationMetadata(properties); + }; + + /** + * Encodes the specified CommonOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1.CommonOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {google.cloud.documentai.v1.ICommonOperationMetadata} message CommonOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommonOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.resource != null && Object.hasOwnProperty.call(message, "resource")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.resource); + return writer; + }; + + /** + * Encodes the specified CommonOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.CommonOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {google.cloud.documentai.v1.ICommonOperationMetadata} message CommonOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommonOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CommonOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.CommonOperationMetadata} CommonOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommonOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.CommonOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.int32(); + break; + case 2: + message.stateMessage = reader.string(); + break; + case 5: + message.resource = reader.string(); + break; + case 3: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CommonOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.CommonOperationMetadata} CommonOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommonOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CommonOperationMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CommonOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + if (!$util.isString(message.stateMessage)) + return "stateMessage: string expected"; + if (message.resource != null && message.hasOwnProperty("resource")) + if (!$util.isString(message.resource)) + return "resource: string 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 a CommonOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.CommonOperationMetadata} CommonOperationMetadata + */ + CommonOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.CommonOperationMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.CommonOperationMetadata(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "RUNNING": + case 1: + message.state = 1; + break; + case "CANCELLING": + case 2: + message.state = 2; + break; + case "SUCCEEDED": + case 3: + message.state = 3; + break; + case "FAILED": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + } + if (object.stateMessage != null) + message.stateMessage = String(object.stateMessage); + if (object.resource != null) + message.resource = String(object.resource); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1.CommonOperationMetadata.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.documentai.v1.CommonOperationMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + return message; + }; + + /** + * Creates a plain object from a CommonOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {google.cloud.documentai.v1.CommonOperationMetadata} message CommonOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CommonOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.stateMessage = ""; + object.createTime = null; + object.updateTime = null; + object.resource = ""; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1.CommonOperationMetadata.State[message.state] : message.state; + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + object.stateMessage = message.stateMessage; + 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.resource != null && message.hasOwnProperty("resource")) + object.resource = message.resource; + return object; + }; + + /** + * Converts this CommonOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + CommonOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.documentai.v1.CommonOperationMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} CANCELLING=2 CANCELLING value + * @property {number} SUCCEEDED=3 SUCCEEDED value + * @property {number} FAILED=4 FAILED value + * @property {number} CANCELLED=5 CANCELLED value + */ + CommonOperationMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "CANCELLING"] = 2; + values[valuesById[3] = "SUCCEEDED"] = 3; + values[valuesById[4] = "FAILED"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return CommonOperationMetadata; + })(); + + v1.ProcessorVersion = (function() { + + /** + * Properties of a ProcessorVersion. + * @memberof google.cloud.documentai.v1 + * @interface IProcessorVersion + * @property {string|null} [name] ProcessorVersion name + * @property {string|null} [displayName] ProcessorVersion displayName + * @property {google.cloud.documentai.v1.ProcessorVersion.State|null} [state] ProcessorVersion state + * @property {google.protobuf.ITimestamp|null} [createTime] ProcessorVersion createTime + * @property {string|null} [kmsKeyName] ProcessorVersion kmsKeyName + * @property {string|null} [kmsKeyVersionName] ProcessorVersion kmsKeyVersionName + * @property {boolean|null} [googleManaged] ProcessorVersion googleManaged + * @property {google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo|null} [deprecationInfo] ProcessorVersion deprecationInfo + */ + + /** + * Constructs a new ProcessorVersion. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ProcessorVersion. + * @implements IProcessorVersion + * @constructor + * @param {google.cloud.documentai.v1.IProcessorVersion=} [properties] Properties to set + */ + function ProcessorVersion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProcessorVersion name. + * @member {string} name + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.name = ""; + + /** + * ProcessorVersion displayName. + * @member {string} displayName + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.displayName = ""; + + /** + * ProcessorVersion state. + * @member {google.cloud.documentai.v1.ProcessorVersion.State} state + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.state = 0; + + /** + * ProcessorVersion createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.createTime = null; + + /** + * ProcessorVersion kmsKeyName. + * @member {string} kmsKeyName + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.kmsKeyName = ""; + + /** + * ProcessorVersion kmsKeyVersionName. + * @member {string} kmsKeyVersionName + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.kmsKeyVersionName = ""; + + /** + * ProcessorVersion googleManaged. + * @member {boolean} googleManaged + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.googleManaged = false; + + /** + * ProcessorVersion deprecationInfo. + * @member {google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo|null|undefined} deprecationInfo + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.deprecationInfo = null; + + /** + * Creates a new ProcessorVersion instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @static + * @param {google.cloud.documentai.v1.IProcessorVersion=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ProcessorVersion} ProcessorVersion instance + */ + ProcessorVersion.create = function create(properties) { + return new ProcessorVersion(properties); + }; + + /** + * Encodes the specified ProcessorVersion message. Does not implicitly {@link google.cloud.documentai.v1.ProcessorVersion.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @static + * @param {google.cloud.documentai.v1.IProcessorVersion} message ProcessorVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessorVersion.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.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.state); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.kmsKeyName); + if (message.kmsKeyVersionName != null && Object.hasOwnProperty.call(message, "kmsKeyVersionName")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.kmsKeyVersionName); + if (message.googleManaged != null && Object.hasOwnProperty.call(message, "googleManaged")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.googleManaged); + if (message.deprecationInfo != null && Object.hasOwnProperty.call(message, "deprecationInfo")) + $root.google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.encode(message.deprecationInfo, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProcessorVersion message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessorVersion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @static + * @param {google.cloud.documentai.v1.IProcessorVersion} message ProcessorVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessorVersion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProcessorVersion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ProcessorVersion} ProcessorVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessorVersion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ProcessorVersion(); + 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 6: + message.state = reader.int32(); + break; + case 7: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 9: + message.kmsKeyName = reader.string(); + break; + case 10: + message.kmsKeyVersionName = reader.string(); + break; + case 11: + message.googleManaged = reader.bool(); + break; + case 13: + message.deprecationInfo = $root.google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProcessorVersion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ProcessorVersion} ProcessorVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessorVersion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProcessorVersion message. + * @function verify + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProcessorVersion.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.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + if (!$util.isString(message.kmsKeyName)) + return "kmsKeyName: string expected"; + if (message.kmsKeyVersionName != null && message.hasOwnProperty("kmsKeyVersionName")) + if (!$util.isString(message.kmsKeyVersionName)) + return "kmsKeyVersionName: string expected"; + if (message.googleManaged != null && message.hasOwnProperty("googleManaged")) + if (typeof message.googleManaged !== "boolean") + return "googleManaged: boolean expected"; + if (message.deprecationInfo != null && message.hasOwnProperty("deprecationInfo")) { + var error = $root.google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.verify(message.deprecationInfo); + if (error) + return "deprecationInfo." + error; + } + return null; + }; + + /** + * Creates a ProcessorVersion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ProcessorVersion} ProcessorVersion + */ + ProcessorVersion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ProcessorVersion) + return object; + var message = new $root.google.cloud.documentai.v1.ProcessorVersion(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "DEPLOYED": + case 1: + message.state = 1; + break; + case "DEPLOYING": + case 2: + message.state = 2; + break; + case "UNDEPLOYED": + case 3: + message.state = 3; + break; + case "UNDEPLOYING": + case 4: + message.state = 4; + break; + case "CREATING": + case 5: + message.state = 5; + break; + case "DELETING": + case 6: + message.state = 6; + break; + case "FAILED": + case 7: + message.state = 7; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1.ProcessorVersion.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.kmsKeyName != null) + message.kmsKeyName = String(object.kmsKeyName); + if (object.kmsKeyVersionName != null) + message.kmsKeyVersionName = String(object.kmsKeyVersionName); + if (object.googleManaged != null) + message.googleManaged = Boolean(object.googleManaged); + if (object.deprecationInfo != null) { + if (typeof object.deprecationInfo !== "object") + throw TypeError(".google.cloud.documentai.v1.ProcessorVersion.deprecationInfo: object expected"); + message.deprecationInfo = $root.google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.fromObject(object.deprecationInfo); + } + return message; + }; + + /** + * Creates a plain object from a ProcessorVersion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @static + * @param {google.cloud.documentai.v1.ProcessorVersion} message ProcessorVersion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProcessorVersion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.createTime = null; + object.kmsKeyName = ""; + object.kmsKeyVersionName = ""; + object.googleManaged = false; + object.deprecationInfo = 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.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1.ProcessorVersion.State[message.state] : message.state; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + object.kmsKeyName = message.kmsKeyName; + if (message.kmsKeyVersionName != null && message.hasOwnProperty("kmsKeyVersionName")) + object.kmsKeyVersionName = message.kmsKeyVersionName; + if (message.googleManaged != null && message.hasOwnProperty("googleManaged")) + object.googleManaged = message.googleManaged; + if (message.deprecationInfo != null && message.hasOwnProperty("deprecationInfo")) + object.deprecationInfo = $root.google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.toObject(message.deprecationInfo, options); + return object; + }; + + /** + * Converts this ProcessorVersion to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @instance + * @returns {Object.} JSON object + */ + ProcessorVersion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + ProcessorVersion.DeprecationInfo = (function() { + + /** + * Properties of a DeprecationInfo. + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @interface IDeprecationInfo + * @property {google.protobuf.ITimestamp|null} [deprecationTime] DeprecationInfo deprecationTime + * @property {string|null} [replacementProcessorVersion] DeprecationInfo replacementProcessorVersion + */ + + /** + * Constructs a new DeprecationInfo. + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @classdesc Represents a DeprecationInfo. + * @implements IDeprecationInfo + * @constructor + * @param {google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo=} [properties] Properties to set + */ + function DeprecationInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeprecationInfo deprecationTime. + * @member {google.protobuf.ITimestamp|null|undefined} deprecationTime + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @instance + */ + DeprecationInfo.prototype.deprecationTime = null; + + /** + * DeprecationInfo replacementProcessorVersion. + * @member {string} replacementProcessorVersion + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @instance + */ + DeprecationInfo.prototype.replacementProcessorVersion = ""; + + /** + * Creates a new DeprecationInfo instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @static + * @param {google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo} DeprecationInfo instance + */ + DeprecationInfo.create = function create(properties) { + return new DeprecationInfo(properties); + }; + + /** + * Encodes the specified DeprecationInfo message. Does not implicitly {@link google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @static + * @param {google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo} message DeprecationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeprecationInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecationTime != null && Object.hasOwnProperty.call(message, "deprecationTime")) + $root.google.protobuf.Timestamp.encode(message.deprecationTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.replacementProcessorVersion != null && Object.hasOwnProperty.call(message, "replacementProcessorVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.replacementProcessorVersion); + return writer; + }; + + /** + * Encodes the specified DeprecationInfo message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @static + * @param {google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo} message DeprecationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeprecationInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeprecationInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo} DeprecationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeprecationInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deprecationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.replacementProcessorVersion = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeprecationInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo} DeprecationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeprecationInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeprecationInfo message. + * @function verify + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeprecationInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecationTime != null && message.hasOwnProperty("deprecationTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.deprecationTime); + if (error) + return "deprecationTime." + error; + } + if (message.replacementProcessorVersion != null && message.hasOwnProperty("replacementProcessorVersion")) + if (!$util.isString(message.replacementProcessorVersion)) + return "replacementProcessorVersion: string expected"; + return null; + }; + + /** + * Creates a DeprecationInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo} DeprecationInfo + */ + DeprecationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo) + return object; + var message = new $root.google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo(); + if (object.deprecationTime != null) { + if (typeof object.deprecationTime !== "object") + throw TypeError(".google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.deprecationTime: object expected"); + message.deprecationTime = $root.google.protobuf.Timestamp.fromObject(object.deprecationTime); + } + if (object.replacementProcessorVersion != null) + message.replacementProcessorVersion = String(object.replacementProcessorVersion); + return message; + }; + + /** + * Creates a plain object from a DeprecationInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @static + * @param {google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo} message DeprecationInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeprecationInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.deprecationTime = null; + object.replacementProcessorVersion = ""; + } + if (message.deprecationTime != null && message.hasOwnProperty("deprecationTime")) + object.deprecationTime = $root.google.protobuf.Timestamp.toObject(message.deprecationTime, options); + if (message.replacementProcessorVersion != null && message.hasOwnProperty("replacementProcessorVersion")) + object.replacementProcessorVersion = message.replacementProcessorVersion; + return object; + }; + + /** + * Converts this DeprecationInfo to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @instance + * @returns {Object.} JSON object + */ + DeprecationInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeprecationInfo; + })(); + + /** + * State enum. + * @name google.cloud.documentai.v1.ProcessorVersion.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} DEPLOYED=1 DEPLOYED value + * @property {number} DEPLOYING=2 DEPLOYING value + * @property {number} UNDEPLOYED=3 UNDEPLOYED value + * @property {number} UNDEPLOYING=4 UNDEPLOYING value + * @property {number} CREATING=5 CREATING value + * @property {number} DELETING=6 DELETING value + * @property {number} FAILED=7 FAILED value + */ + ProcessorVersion.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DEPLOYED"] = 1; + values[valuesById[2] = "DEPLOYING"] = 2; + values[valuesById[3] = "UNDEPLOYED"] = 3; + values[valuesById[4] = "UNDEPLOYING"] = 4; + values[valuesById[5] = "CREATING"] = 5; + values[valuesById[6] = "DELETING"] = 6; + values[valuesById[7] = "FAILED"] = 7; + return values; + })(); + + return ProcessorVersion; + })(); + + v1.Processor = (function() { + + /** + * Properties of a Processor. + * @memberof google.cloud.documentai.v1 + * @interface IProcessor + * @property {string|null} [name] Processor name + * @property {string|null} [type] Processor type + * @property {string|null} [displayName] Processor displayName + * @property {google.cloud.documentai.v1.Processor.State|null} [state] Processor state + * @property {string|null} [defaultProcessorVersion] Processor defaultProcessorVersion + * @property {string|null} [processEndpoint] Processor processEndpoint + * @property {google.protobuf.ITimestamp|null} [createTime] Processor createTime + * @property {string|null} [kmsKeyName] Processor kmsKeyName + */ + + /** + * Constructs a new Processor. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a Processor. + * @implements IProcessor + * @constructor + * @param {google.cloud.documentai.v1.IProcessor=} [properties] Properties to set + */ + function Processor(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Processor name. + * @member {string} name + * @memberof google.cloud.documentai.v1.Processor + * @instance + */ + Processor.prototype.name = ""; + + /** + * Processor type. + * @member {string} type + * @memberof google.cloud.documentai.v1.Processor + * @instance + */ + Processor.prototype.type = ""; + + /** + * Processor displayName. + * @member {string} displayName + * @memberof google.cloud.documentai.v1.Processor + * @instance + */ + Processor.prototype.displayName = ""; + + /** + * Processor state. + * @member {google.cloud.documentai.v1.Processor.State} state + * @memberof google.cloud.documentai.v1.Processor + * @instance + */ + Processor.prototype.state = 0; + + /** + * Processor defaultProcessorVersion. + * @member {string} defaultProcessorVersion + * @memberof google.cloud.documentai.v1.Processor + * @instance + */ + Processor.prototype.defaultProcessorVersion = ""; + + /** + * Processor processEndpoint. + * @member {string} processEndpoint + * @memberof google.cloud.documentai.v1.Processor + * @instance + */ + Processor.prototype.processEndpoint = ""; + + /** + * Processor createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1.Processor + * @instance + */ + Processor.prototype.createTime = null; + + /** + * Processor kmsKeyName. + * @member {string} kmsKeyName + * @memberof google.cloud.documentai.v1.Processor + * @instance + */ + Processor.prototype.kmsKeyName = ""; + + /** + * Creates a new Processor instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Processor + * @static + * @param {google.cloud.documentai.v1.IProcessor=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Processor} Processor instance + */ + Processor.create = function create(properties) { + return new Processor(properties); + }; + + /** + * Encodes the specified Processor message. Does not implicitly {@link google.cloud.documentai.v1.Processor.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Processor + * @static + * @param {google.cloud.documentai.v1.IProcessor} message Processor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Processor.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 2, wireType 2 =*/18).string(message.type); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.displayName); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.state); + if (message.processEndpoint != null && Object.hasOwnProperty.call(message, "processEndpoint")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.processEndpoint); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.kmsKeyName); + if (message.defaultProcessorVersion != null && Object.hasOwnProperty.call(message, "defaultProcessorVersion")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.defaultProcessorVersion); + return writer; + }; + + /** + * Encodes the specified Processor message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Processor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Processor + * @static + * @param {google.cloud.documentai.v1.IProcessor} message Processor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Processor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Processor message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Processor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Processor} Processor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Processor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Processor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.type = reader.string(); + break; + case 3: + message.displayName = reader.string(); + break; + case 4: + message.state = reader.int32(); + break; + case 9: + message.defaultProcessorVersion = reader.string(); + break; + case 6: + message.processEndpoint = reader.string(); + break; + case 7: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 8: + message.kmsKeyName = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Processor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Processor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Processor} Processor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Processor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Processor message. + * @function verify + * @memberof google.cloud.documentai.v1.Processor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Processor.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.defaultProcessorVersion != null && message.hasOwnProperty("defaultProcessorVersion")) + if (!$util.isString(message.defaultProcessorVersion)) + return "defaultProcessorVersion: string expected"; + if (message.processEndpoint != null && message.hasOwnProperty("processEndpoint")) + if (!$util.isString(message.processEndpoint)) + return "processEndpoint: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + if (!$util.isString(message.kmsKeyName)) + return "kmsKeyName: string expected"; + return null; + }; + + /** + * Creates a Processor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Processor + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Processor} Processor + */ + Processor.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Processor) + return object; + var message = new $root.google.cloud.documentai.v1.Processor(); + if (object.name != null) + message.name = String(object.name); + if (object.type != null) + message.type = String(object.type); + if (object.displayName != null) + message.displayName = String(object.displayName); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "ENABLED": + case 1: + message.state = 1; + break; + case "DISABLED": + case 2: + message.state = 2; + break; + case "ENABLING": + case 3: + message.state = 3; + break; + case "DISABLING": + case 4: + message.state = 4; + break; + case "CREATING": + case 5: + message.state = 5; + break; + case "FAILED": + case 6: + message.state = 6; + break; + case "DELETING": + case 7: + message.state = 7; + break; + } + if (object.defaultProcessorVersion != null) + message.defaultProcessorVersion = String(object.defaultProcessorVersion); + if (object.processEndpoint != null) + message.processEndpoint = String(object.processEndpoint); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1.Processor.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.kmsKeyName != null) + message.kmsKeyName = String(object.kmsKeyName); + return message; + }; + + /** + * Creates a plain object from a Processor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Processor + * @static + * @param {google.cloud.documentai.v1.Processor} message Processor * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReviewDocumentOperationMetadata.toObject = function toObject(message, options) { + Processor.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.commonMetadata = null; - object.questionId = ""; + object.name = ""; + object.type = ""; + object.displayName = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.processEndpoint = ""; + object.createTime = null; + object.kmsKeyName = ""; + object.defaultProcessorVersion = ""; } - if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) - object.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.toObject(message.commonMetadata, options); - if (message.questionId != null && message.hasOwnProperty("questionId")) - object.questionId = message.questionId; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1.Processor.State[message.state] : message.state; + if (message.processEndpoint != null && message.hasOwnProperty("processEndpoint")) + object.processEndpoint = message.processEndpoint; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + object.kmsKeyName = message.kmsKeyName; + if (message.defaultProcessorVersion != null && message.hasOwnProperty("defaultProcessorVersion")) + object.defaultProcessorVersion = message.defaultProcessorVersion; return object; }; /** - * Converts this ReviewDocumentOperationMetadata to JSON. + * Converts this Processor to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1.Processor * @instance * @returns {Object.} JSON object */ - ReviewDocumentOperationMetadata.prototype.toJSON = function toJSON() { + Processor.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ReviewDocumentOperationMetadata; + /** + * State enum. + * @name google.cloud.documentai.v1.Processor.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} ENABLED=1 ENABLED value + * @property {number} DISABLED=2 DISABLED value + * @property {number} ENABLING=3 ENABLING value + * @property {number} DISABLING=4 DISABLING value + * @property {number} CREATING=5 CREATING value + * @property {number} FAILED=6 FAILED value + * @property {number} DELETING=7 DELETING value + */ + Processor.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ENABLED"] = 1; + values[valuesById[2] = "DISABLED"] = 2; + values[valuesById[3] = "ENABLING"] = 3; + values[valuesById[4] = "DISABLING"] = 4; + values[valuesById[5] = "CREATING"] = 5; + values[valuesById[6] = "FAILED"] = 6; + values[valuesById[7] = "DELETING"] = 7; + return values; + })(); + + return Processor; })(); - v1.CommonOperationMetadata = (function() { + v1.ProcessorType = (function() { /** - * Properties of a CommonOperationMetadata. + * Properties of a ProcessorType. * @memberof google.cloud.documentai.v1 - * @interface ICommonOperationMetadata - * @property {google.cloud.documentai.v1.CommonOperationMetadata.State|null} [state] CommonOperationMetadata state - * @property {string|null} [stateMessage] CommonOperationMetadata stateMessage - * @property {google.protobuf.ITimestamp|null} [createTime] CommonOperationMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] CommonOperationMetadata updateTime + * @interface IProcessorType + * @property {string|null} [name] ProcessorType name + * @property {string|null} [type] ProcessorType type + * @property {string|null} [category] ProcessorType category + * @property {Array.|null} [availableLocations] ProcessorType availableLocations + * @property {boolean|null} [allowCreation] ProcessorType allowCreation + * @property {google.api.LaunchStage|null} [launchStage] ProcessorType launchStage */ /** - * Constructs a new CommonOperationMetadata. + * Constructs a new ProcessorType. * @memberof google.cloud.documentai.v1 - * @classdesc Represents a CommonOperationMetadata. - * @implements ICommonOperationMetadata + * @classdesc Represents a ProcessorType. + * @implements IProcessorType * @constructor - * @param {google.cloud.documentai.v1.ICommonOperationMetadata=} [properties] Properties to set + * @param {google.cloud.documentai.v1.IProcessorType=} [properties] Properties to set */ - function CommonOperationMetadata(properties) { + function ProcessorType(properties) { + this.availableLocations = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14811,114 +24643,143 @@ } /** - * CommonOperationMetadata state. - * @member {google.cloud.documentai.v1.CommonOperationMetadata.State} state - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * ProcessorType name. + * @member {string} name + * @memberof google.cloud.documentai.v1.ProcessorType * @instance */ - CommonOperationMetadata.prototype.state = 0; + ProcessorType.prototype.name = ""; /** - * CommonOperationMetadata stateMessage. - * @member {string} stateMessage - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * ProcessorType type. + * @member {string} type + * @memberof google.cloud.documentai.v1.ProcessorType * @instance */ - CommonOperationMetadata.prototype.stateMessage = ""; + ProcessorType.prototype.type = ""; /** - * CommonOperationMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * ProcessorType category. + * @member {string} category + * @memberof google.cloud.documentai.v1.ProcessorType * @instance */ - CommonOperationMetadata.prototype.createTime = null; + ProcessorType.prototype.category = ""; /** - * CommonOperationMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * ProcessorType availableLocations. + * @member {Array.} availableLocations + * @memberof google.cloud.documentai.v1.ProcessorType * @instance */ - CommonOperationMetadata.prototype.updateTime = null; + ProcessorType.prototype.availableLocations = $util.emptyArray; /** - * Creates a new CommonOperationMetadata instance using the specified properties. + * ProcessorType allowCreation. + * @member {boolean} allowCreation + * @memberof google.cloud.documentai.v1.ProcessorType + * @instance + */ + ProcessorType.prototype.allowCreation = false; + + /** + * ProcessorType launchStage. + * @member {google.api.LaunchStage} launchStage + * @memberof google.cloud.documentai.v1.ProcessorType + * @instance + */ + ProcessorType.prototype.launchStage = 0; + + /** + * Creates a new ProcessorType instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @memberof google.cloud.documentai.v1.ProcessorType * @static - * @param {google.cloud.documentai.v1.ICommonOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.documentai.v1.CommonOperationMetadata} CommonOperationMetadata instance + * @param {google.cloud.documentai.v1.IProcessorType=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ProcessorType} ProcessorType instance */ - CommonOperationMetadata.create = function create(properties) { - return new CommonOperationMetadata(properties); + ProcessorType.create = function create(properties) { + return new ProcessorType(properties); }; /** - * Encodes the specified CommonOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1.CommonOperationMetadata.verify|verify} messages. + * Encodes the specified ProcessorType message. Does not implicitly {@link google.cloud.documentai.v1.ProcessorType.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @memberof google.cloud.documentai.v1.ProcessorType * @static - * @param {google.cloud.documentai.v1.ICommonOperationMetadata} message CommonOperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1.IProcessorType} message ProcessorType message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CommonOperationMetadata.encode = function encode(message, writer) { + ProcessorType.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, 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.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.category != null && Object.hasOwnProperty.call(message, "category")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.category); + if (message.availableLocations != null && message.availableLocations.length) + for (var i = 0; i < message.availableLocations.length; ++i) + $root.google.cloud.documentai.v1.ProcessorType.LocationInfo.encode(message.availableLocations[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allowCreation != null && Object.hasOwnProperty.call(message, "allowCreation")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.allowCreation); + if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.launchStage); return writer; }; /** - * Encodes the specified CommonOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.CommonOperationMetadata.verify|verify} messages. + * Encodes the specified ProcessorType message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessorType.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @memberof google.cloud.documentai.v1.ProcessorType * @static - * @param {google.cloud.documentai.v1.ICommonOperationMetadata} message CommonOperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1.IProcessorType} message ProcessorType message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CommonOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + ProcessorType.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CommonOperationMetadata message from the specified reader or buffer. + * Decodes a ProcessorType message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @memberof google.cloud.documentai.v1.ProcessorType * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1.CommonOperationMetadata} CommonOperationMetadata + * @returns {google.cloud.documentai.v1.ProcessorType} ProcessorType * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CommonOperationMetadata.decode = function decode(reader, length) { + ProcessorType.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.CommonOperationMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ProcessorType(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.state = reader.int32(); + message.name = reader.string(); break; case 2: - message.stateMessage = reader.string(); + message.type = reader.string(); break; case 3: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.category = reader.string(); break; case 4: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + if (!(message.availableLocations && message.availableLocations.length)) + message.availableLocations = []; + message.availableLocations.push($root.google.cloud.documentai.v1.ProcessorType.LocationInfo.decode(reader, reader.uint32())); + break; + case 6: + message.allowCreation = reader.bool(); + break; + case 8: + message.launchStage = reader.int32(); break; default: reader.skipType(tag & 7); @@ -14929,37 +24790,60 @@ }; /** - * Decodes a CommonOperationMetadata message from the specified reader or buffer, length delimited. + * Decodes a ProcessorType message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @memberof google.cloud.documentai.v1.ProcessorType * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1.CommonOperationMetadata} CommonOperationMetadata + * @returns {google.cloud.documentai.v1.ProcessorType} ProcessorType * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CommonOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + ProcessorType.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CommonOperationMetadata message. + * Verifies a ProcessorType message. * @function verify - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @memberof google.cloud.documentai.v1.ProcessorType * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CommonOperationMetadata.verify = function verify(message) { + ProcessorType.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { + 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.category != null && message.hasOwnProperty("category")) + if (!$util.isString(message.category)) + return "category: string expected"; + if (message.availableLocations != null && message.hasOwnProperty("availableLocations")) { + if (!Array.isArray(message.availableLocations)) + return "availableLocations: array expected"; + for (var i = 0; i < message.availableLocations.length; ++i) { + var error = $root.google.cloud.documentai.v1.ProcessorType.LocationInfo.verify(message.availableLocations[i]); + if (error) + return "availableLocations." + error; + } + } + if (message.allowCreation != null && message.hasOwnProperty("allowCreation")) + if (typeof message.allowCreation !== "boolean") + return "allowCreation: boolean expected"; + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + switch (message.launchStage) { default: - return "state: enum value expected"; + return "launchStage: enum value expected"; case 0: + case 6: + case 7: case 1: case 2: case 3: @@ -14967,139 +24851,315 @@ case 5: break; } - if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) - if (!$util.isString(message.stateMessage)) - return "stateMessage: string 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 a CommonOperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a ProcessorType message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @memberof google.cloud.documentai.v1.ProcessorType * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1.CommonOperationMetadata} CommonOperationMetadata + * @returns {google.cloud.documentai.v1.ProcessorType} ProcessorType */ - CommonOperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1.CommonOperationMetadata) + ProcessorType.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ProcessorType) return object; - var message = new $root.google.cloud.documentai.v1.CommonOperationMetadata(); - switch (object.state) { - case "STATE_UNSPECIFIED": + var message = new $root.google.cloud.documentai.v1.ProcessorType(); + if (object.name != null) + message.name = String(object.name); + if (object.type != null) + message.type = String(object.type); + if (object.category != null) + message.category = String(object.category); + if (object.availableLocations) { + if (!Array.isArray(object.availableLocations)) + throw TypeError(".google.cloud.documentai.v1.ProcessorType.availableLocations: array expected"); + message.availableLocations = []; + for (var i = 0; i < object.availableLocations.length; ++i) { + if (typeof object.availableLocations[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.ProcessorType.availableLocations: object expected"); + message.availableLocations[i] = $root.google.cloud.documentai.v1.ProcessorType.LocationInfo.fromObject(object.availableLocations[i]); + } + } + if (object.allowCreation != null) + message.allowCreation = Boolean(object.allowCreation); + switch (object.launchStage) { + case "LAUNCH_STAGE_UNSPECIFIED": case 0: - message.state = 0; + message.launchStage = 0; break; - case "RUNNING": + case "UNIMPLEMENTED": + case 6: + message.launchStage = 6; + break; + case "PRELAUNCH": + case 7: + message.launchStage = 7; + break; + case "EARLY_ACCESS": case 1: - message.state = 1; + message.launchStage = 1; break; - case "CANCELLING": + case "ALPHA": case 2: - message.state = 2; + message.launchStage = 2; break; - case "SUCCEEDED": + case "BETA": case 3: - message.state = 3; + message.launchStage = 3; break; - case "FAILED": + case "GA": case 4: - message.state = 4; + message.launchStage = 4; break; - case "CANCELLED": + case "DEPRECATED": case 5: - message.state = 5; + message.launchStage = 5; break; } - if (object.stateMessage != null) - message.stateMessage = String(object.stateMessage); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.documentai.v1.CommonOperationMetadata.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.documentai.v1.CommonOperationMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); - } return message; }; /** - * Creates a plain object from a CommonOperationMetadata message. Also converts values to other types if specified. + * Creates a plain object from a ProcessorType message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @memberof google.cloud.documentai.v1.ProcessorType * @static - * @param {google.cloud.documentai.v1.CommonOperationMetadata} message CommonOperationMetadata + * @param {google.cloud.documentai.v1.ProcessorType} message ProcessorType * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CommonOperationMetadata.toObject = function toObject(message, options) { + ProcessorType.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.availableLocations = []; if (options.defaults) { - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; - object.stateMessage = ""; - object.createTime = null; - object.updateTime = null; + object.name = ""; + object.type = ""; + object.category = ""; + object.allowCreation = false; + object.launchStage = options.enums === String ? "LAUNCH_STAGE_UNSPECIFIED" : 0; } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1.CommonOperationMetadata.State[message.state] : message.state; - if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) - object.stateMessage = message.stateMessage; - 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.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.category != null && message.hasOwnProperty("category")) + object.category = message.category; + if (message.availableLocations && message.availableLocations.length) { + object.availableLocations = []; + for (var j = 0; j < message.availableLocations.length; ++j) + object.availableLocations[j] = $root.google.cloud.documentai.v1.ProcessorType.LocationInfo.toObject(message.availableLocations[j], options); + } + if (message.allowCreation != null && message.hasOwnProperty("allowCreation")) + object.allowCreation = message.allowCreation; + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] : message.launchStage; return object; }; /** - * Converts this CommonOperationMetadata to JSON. + * Converts this ProcessorType to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @memberof google.cloud.documentai.v1.ProcessorType * @instance * @returns {Object.} JSON object */ - CommonOperationMetadata.prototype.toJSON = function toJSON() { + ProcessorType.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * State enum. - * @name google.cloud.documentai.v1.CommonOperationMetadata.State - * @enum {number} - * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} RUNNING=1 RUNNING value - * @property {number} CANCELLING=2 CANCELLING value - * @property {number} SUCCEEDED=3 SUCCEEDED value - * @property {number} FAILED=4 FAILED value - * @property {number} CANCELLED=5 CANCELLED value - */ - CommonOperationMetadata.State = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "RUNNING"] = 1; - values[valuesById[2] = "CANCELLING"] = 2; - values[valuesById[3] = "SUCCEEDED"] = 3; - values[valuesById[4] = "FAILED"] = 4; - values[valuesById[5] = "CANCELLED"] = 5; - return values; + ProcessorType.LocationInfo = (function() { + + /** + * Properties of a LocationInfo. + * @memberof google.cloud.documentai.v1.ProcessorType + * @interface ILocationInfo + * @property {string|null} [locationId] LocationInfo locationId + */ + + /** + * Constructs a new LocationInfo. + * @memberof google.cloud.documentai.v1.ProcessorType + * @classdesc Represents a LocationInfo. + * @implements ILocationInfo + * @constructor + * @param {google.cloud.documentai.v1.ProcessorType.ILocationInfo=} [properties] Properties to set + */ + function LocationInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LocationInfo locationId. + * @member {string} locationId + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @instance + */ + LocationInfo.prototype.locationId = ""; + + /** + * Creates a new LocationInfo instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @static + * @param {google.cloud.documentai.v1.ProcessorType.ILocationInfo=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ProcessorType.LocationInfo} LocationInfo instance + */ + LocationInfo.create = function create(properties) { + return new LocationInfo(properties); + }; + + /** + * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.documentai.v1.ProcessorType.LocationInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @static + * @param {google.cloud.documentai.v1.ProcessorType.ILocationInfo} message LocationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocationInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.locationId != null && Object.hasOwnProperty.call(message, "locationId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.locationId); + return writer; + }; + + /** + * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessorType.LocationInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @static + * @param {google.cloud.documentai.v1.ProcessorType.ILocationInfo} message LocationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocationInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LocationInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ProcessorType.LocationInfo} LocationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ProcessorType.LocationInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.locationId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LocationInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ProcessorType.LocationInfo} LocationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LocationInfo message. + * @function verify + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LocationInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.locationId != null && message.hasOwnProperty("locationId")) + if (!$util.isString(message.locationId)) + return "locationId: string expected"; + return null; + }; + + /** + * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ProcessorType.LocationInfo} LocationInfo + */ + LocationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ProcessorType.LocationInfo) + return object; + var message = new $root.google.cloud.documentai.v1.ProcessorType.LocationInfo(); + if (object.locationId != null) + message.locationId = String(object.locationId); + return message; + }; + + /** + * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @static + * @param {google.cloud.documentai.v1.ProcessorType.LocationInfo} message LocationInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LocationInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.locationId = ""; + if (message.locationId != null && message.hasOwnProperty("locationId")) + object.locationId = message.locationId; + return object; + }; + + /** + * Converts this LocationInfo to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @instance + * @returns {Object.} JSON object + */ + LocationInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LocationInfo; })(); - return CommonOperationMetadata; + return ProcessorType; })(); return v1; @@ -58424,6 +68484,32 @@ return ResourceReference; })(); + /** + * LaunchStage enum. + * @name google.api.LaunchStage + * @enum {number} + * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value + * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value + * @property {number} PRELAUNCH=7 PRELAUNCH value + * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value + * @property {number} ALPHA=2 ALPHA value + * @property {number} BETA=3 BETA value + * @property {number} GA=4 GA value + * @property {number} DEPRECATED=5 DEPRECATED value + */ + api.LaunchStage = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; + values[valuesById[6] = "UNIMPLEMENTED"] = 6; + values[valuesById[7] = "PRELAUNCH"] = 7; + values[valuesById[1] = "EARLY_ACCESS"] = 1; + values[valuesById[2] = "ALPHA"] = 2; + values[valuesById[3] = "BETA"] = 3; + values[valuesById[4] = "GA"] = 4; + values[valuesById[5] = "DEPRECATED"] = 5; + return values; + })(); + return api; })(); diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 7773f8661b9..10ece4e69df 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -11,14 +11,30 @@ "csharp_namespace": "Google.Cloud.DocumentAI.V1", "go_package": "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai", "java_multiple_files": true, - "java_outer_classname": "OperationMetadataProto", + "java_outer_classname": "DocumentAiProcessorType", "java_package": "com.google.cloud.documentai.v1", "php_namespace": "Google\\Cloud\\DocumentAI\\V1", "ruby_package": "Google::Cloud::DocumentAI::V1", - "(google.api.resource_definition).type": "documentai.googleapis.com/HumanReviewConfig", - "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig" + "(google.api.resource_definition).type": "documentai.googleapis.com/Location", + "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}" }, "nested": { + "Barcode": { + "fields": { + "format": { + "type": "string", + "id": 1 + }, + "valueFormat": { + "type": "string", + "id": 2 + }, + "rawValue": { + "type": "string", + "id": 3 + } + } + }, "Document": { "oneofs": { "source": { @@ -224,6 +240,11 @@ "type": "Symbol", "id": 12 }, + "detectedBarcodes": { + "rule": "repeated", + "type": "DetectedBarcode", + "id": 15 + }, "provenance": { "type": "Provenance", "id": 16 @@ -518,12 +539,32 @@ "type": "string", "id": 5 }, + "correctedKeyText": { + "type": "string", + "id": 6 + }, + "correctedValueText": { + "type": "string", + "id": 7 + }, "provenance": { "type": "Provenance", "id": 8 } } }, + "DetectedBarcode": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "barcode": { + "type": "Barcode", + "id": 2 + } + } + }, "DetectedLanguage": { "fields": { "languageCode": { @@ -628,7 +669,9 @@ "dateValue", "datetimeValue", "addressValue", - "booleanValue" + "booleanValue", + "integerValue", + "floatValue" ] } }, @@ -653,6 +696,14 @@ "type": "bool", "id": 6 }, + "integerValue": { + "type": "int32", + "id": 7 + }, + "floatValue": { + "type": "float", + "id": 8 + }, "text": { "type": "string", "id": 1, @@ -853,7 +904,15 @@ "parent": { "rule": "repeated", "type": "int32", - "id": 2 + "id": 2, + "options": { + "deprecated": true + } + }, + "parentIds": { + "rule": "repeated", + "type": "string", + "id": 7 }, "createTime": { "type": "google.protobuf.Timestamp", @@ -1034,13 +1093,19 @@ "options": { "(google.api.http).post": "/v1/{name=projects/*/locations/*/processors/*}:process", "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:process", + "(google.api.http).additional_bindings.body": "*", "(google.api.method_signature)": "name" }, "parsedOptions": [ { "(google.api.http)": { "post": "/v1/{name=projects/*/locations/*/processors/*}:process", - "body": "*" + "body": "*", + "additional_bindings": { + "post": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:process", + "body": "*" + } } }, { @@ -1054,6 +1119,8 @@ "options": { "(google.api.http).post": "/v1/{name=projects/*/locations/*/processors/*}:batchProcess", "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:batchProcess", + "(google.api.http).additional_bindings.body": "*", "(google.api.method_signature)": "name", "(google.longrunning.operation_info).response_type": "BatchProcessResponse", "(google.longrunning.operation_info).metadata_type": "BatchProcessMetadata" @@ -1062,7 +1129,11 @@ { "(google.api.http)": { "post": "/v1/{name=projects/*/locations/*/processors/*}:batchProcess", - "body": "*" + "body": "*", + "additional_bindings": { + "post": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:batchProcess", + "body": "*" + } } }, { @@ -1076,69 +1147,1025 @@ } ] }, - "ReviewDocument": { - "requestType": "ReviewDocumentRequest", + "FetchProcessorTypes": { + "requestType": "FetchProcessorTypesRequest", + "responseType": "FetchProcessorTypesResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}:fetchProcessorTypes", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*}:fetchProcessorTypes" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "ListProcessorTypes": { + "requestType": "ListProcessorTypesRequest", + "responseType": "ListProcessorTypesResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/processorTypes", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*}/processorTypes" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "ListProcessors": { + "requestType": "ListProcessorsRequest", + "responseType": "ListProcessorsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/processors", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*}/processors" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetProcessor": { + "requestType": "GetProcessorRequest", + "responseType": "Processor", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/processors/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/processors/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "GetProcessorVersion": { + "requestType": "GetProcessorVersionRequest", + "responseType": "ProcessorVersion", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListProcessorVersions": { + "requestType": "ListProcessorVersionsRequest", + "responseType": "ListProcessorVersionsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*/processors/*}/processorVersions", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*/processors/*}/processorVersions" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "DeleteProcessorVersion": { + "requestType": "DeleteProcessorVersionRequest", "responseType": "google.longrunning.Operation", "options": { - "(google.api.http).post": "/v1/{human_review_config=projects/*/locations/*/processors/*/humanReviewConfig}:reviewDocument", + "(google.api.http).delete": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "DeleteProcessorVersionMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "DeleteProcessorVersionMetadata" + } + } + ] + }, + "DeployProcessorVersion": { + "requestType": "DeployProcessorVersionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:deploy", "(google.api.http).body": "*", - "(google.api.method_signature)": "human_review_config", - "(google.longrunning.operation_info).response_type": "ReviewDocumentResponse", - "(google.longrunning.operation_info).metadata_type": "ReviewDocumentOperationMetadata" + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "DeployProcessorVersionResponse", + "(google.longrunning.operation_info).metadata_type": "DeployProcessorVersionMetadata" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v1/{human_review_config=projects/*/locations/*/processors/*/humanReviewConfig}:reviewDocument", + "post": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:deploy", "body": "*" } }, { - "(google.api.method_signature)": "human_review_config" + "(google.api.method_signature)": "name" }, { "(google.longrunning.operation_info)": { - "response_type": "ReviewDocumentResponse", - "metadata_type": "ReviewDocumentOperationMetadata" + "response_type": "DeployProcessorVersionResponse", + "metadata_type": "DeployProcessorVersionMetadata" } } ] - } - } - }, - "ProcessRequest": { - "oneofs": { - "source": { - "oneof": [ - "inlineDocument", - "rawDocument" + }, + "UndeployProcessorVersion": { + "requestType": "UndeployProcessorVersionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:undeploy", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "UndeployProcessorVersionResponse", + "(google.longrunning.operation_info).metadata_type": "UndeployProcessorVersionMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:undeploy", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "UndeployProcessorVersionResponse", + "metadata_type": "UndeployProcessorVersionMetadata" + } + } ] - } - }, - "fields": { - "inlineDocument": { - "type": "Document", - "id": 4 }, - "rawDocument": { - "type": "RawDocument", - "id": 5 + "CreateProcessor": { + "requestType": "CreateProcessorRequest", + "responseType": "Processor", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/locations/*}/processors", + "(google.api.http).body": "processor", + "(google.api.method_signature)": "parent,processor" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/locations/*}/processors", + "body": "processor" + } + }, + { + "(google.api.method_signature)": "parent,processor" + } + ] }, - "name": { - "type": "string", - "id": 1, + "DeleteProcessor": { + "requestType": "DeleteProcessorRequest", + "responseType": "google.longrunning.Operation", "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + "(google.api.http).delete": "/v1/{name=projects/*/locations/*/processors/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "DeleteProcessorMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/locations/*/processors/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "DeleteProcessorMetadata" + } + } + ] + }, + "EnableProcessor": { + "requestType": "EnableProcessorRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/processors/*}:enable", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "EnableProcessorResponse", + "(google.longrunning.operation_info).metadata_type": "EnableProcessorMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/processors/*}:enable", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "EnableProcessorResponse", + "metadata_type": "EnableProcessorMetadata" + } + } + ] + }, + "DisableProcessor": { + "requestType": "DisableProcessorRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/processors/*}:disable", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "DisableProcessorResponse", + "(google.longrunning.operation_info).metadata_type": "DisableProcessorMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/processors/*}:disable", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "DisableProcessorResponse", + "metadata_type": "DisableProcessorMetadata" + } + } + ] + }, + "SetDefaultProcessorVersion": { + "requestType": "SetDefaultProcessorVersionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{processor=projects/*/locations/*/processors/*}:setDefaultProcessorVersion", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "SetDefaultProcessorVersionResponse", + "(google.longrunning.operation_info).metadata_type": "SetDefaultProcessorVersionMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{processor=projects/*/locations/*/processors/*}:setDefaultProcessorVersion", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "SetDefaultProcessorVersionResponse", + "metadata_type": "SetDefaultProcessorVersionMetadata" + } + } + ] + }, + "ReviewDocument": { + "requestType": "ReviewDocumentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{human_review_config=projects/*/locations/*/processors/*/humanReviewConfig}:reviewDocument", + "(google.api.http).body": "*", + "(google.api.method_signature)": "human_review_config", + "(google.longrunning.operation_info).response_type": "ReviewDocumentResponse", + "(google.longrunning.operation_info).metadata_type": "ReviewDocumentOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{human_review_config=projects/*/locations/*/processors/*/humanReviewConfig}:reviewDocument", + "body": "*" + } + }, + { + "(google.api.method_signature)": "human_review_config" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "ReviewDocumentResponse", + "metadata_type": "ReviewDocumentOperationMetadata" + } + } + ] + } + } + }, + "ProcessRequest": { + "oneofs": { + "source": { + "oneof": [ + "inlineDocument", + "rawDocument" + ] + } + }, + "fields": { + "inlineDocument": { + "type": "Document", + "id": 4 + }, + "rawDocument": { + "type": "RawDocument", + "id": 5 + }, + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "*" + } + }, + "skipHumanReview": { + "type": "bool", + "id": 3 + }, + "fieldMask": { + "type": "google.protobuf.FieldMask", + "id": 6 + } + } + }, + "HumanReviewStatus": { + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "stateMessage": { + "type": "string", + "id": 2 + }, + "humanReviewOperation": { + "type": "string", + "id": 3 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "SKIPPED": 1, + "VALIDATION_PASSED": 2, + "IN_PROGRESS": 3, + "ERROR": 4 + } + } + } + }, + "ProcessResponse": { + "fields": { + "document": { + "type": "Document", + "id": 1 + }, + "humanReviewStatus": { + "type": "HumanReviewStatus", + "id": 3 + } + } + }, + "BatchProcessRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "*" + } + }, + "inputDocuments": { + "type": "BatchDocumentsInputConfig", + "id": 5 + }, + "documentOutputConfig": { + "type": "DocumentOutputConfig", + "id": 6 + }, + "skipHumanReview": { + "type": "bool", + "id": 4 + } + } + }, + "BatchProcessResponse": { + "fields": {} + }, + "BatchProcessMetadata": { + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "stateMessage": { + "type": "string", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + }, + "individualProcessStatuses": { + "rule": "repeated", + "type": "IndividualProcessStatus", + "id": 5 + } + }, + "nested": { + "IndividualProcessStatus": { + "fields": { + "inputGcsSource": { + "type": "string", + "id": 1 + }, + "status": { + "type": "google.rpc.Status", + "id": 2 + }, + "outputGcsDestination": { + "type": "string", + "id": 3 + }, + "humanReviewStatus": { + "type": "HumanReviewStatus", + "id": 5 + } + } + }, + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "WAITING": 1, + "RUNNING": 2, + "SUCCEEDED": 3, + "CANCELLING": 4, + "CANCELLED": 5, + "FAILED": 6 + } + } + } + }, + "FetchProcessorTypesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "documentai.googleapis.com/ProcessorType" + } + } + } + }, + "FetchProcessorTypesResponse": { + "fields": { + "processorTypes": { + "rule": "repeated", + "type": "ProcessorType", + "id": 1 + } + } + }, + "ListProcessorTypesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "documentai.googleapis.com/ProcessorType" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListProcessorTypesResponse": { + "fields": { + "processorTypes": { + "rule": "repeated", + "type": "ProcessorType", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "ListProcessorsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "documentai.googleapis.com/Processor" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListProcessorsResponse": { + "fields": { + "processors": { + "rule": "repeated", + "type": "Processor", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetProcessorRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + } + } + } + }, + "GetProcessorVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } + } + } + }, + "ListProcessorVersionsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "documentai.googleapis.com/ProcessorVersion" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListProcessorVersionsResponse": { + "fields": { + "processorVersions": { + "rule": "repeated", + "type": "ProcessorVersion", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "DeleteProcessorVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } + } + } + }, + "DeleteProcessorVersionMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 1 + } + } + }, + "DeployProcessorVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } + } + } + }, + "DeployProcessorVersionResponse": { + "fields": {} + }, + "DeployProcessorVersionMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 1 + } + } + }, + "UndeployProcessorVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } + } + } + }, + "UndeployProcessorVersionResponse": { + "fields": {} + }, + "UndeployProcessorVersionMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 1 + } + } + }, + "CreateProcessorRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "documentai.googleapis.com/Processor" + } + }, + "processor": { + "type": "Processor", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteProcessorRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + } + } + } + }, + "DeleteProcessorMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 5 + } + } + }, + "EnableProcessorRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + } + } + } + }, + "EnableProcessorResponse": { + "fields": {} + }, + "EnableProcessorMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 5 + } + } + }, + "DisableProcessorRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + } + } + } + }, + "DisableProcessorResponse": { + "fields": {} + }, + "DisableProcessorMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 5 + } + } + }, + "SetDefaultProcessorVersionRequest": { + "fields": { + "processor": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + } + }, + "defaultProcessorVersion": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } + } + } + }, + "SetDefaultProcessorVersionResponse": { + "fields": {} + }, + "SetDefaultProcessorVersionMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 1 + } + } + }, + "ReviewDocumentRequest": { + "oneofs": { + "source": { + "oneof": [ + "inlineDocument" + ] + } + }, + "fields": { + "inlineDocument": { + "type": "Document", + "id": 4 + }, + "humanReviewConfig": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/HumanReviewConfig" + } + }, + "enableSchemaValidation": { + "type": "bool", + "id": 3 + }, + "priority": { + "type": "Priority", + "id": 5 + }, + "documentSchema": { + "type": "DocumentSchema", + "id": 6 + } + }, + "nested": { + "Priority": { + "values": { + "DEFAULT": 0, + "URGENT": 1 + } + } + } + }, + "ReviewDocumentResponse": { + "fields": { + "gcsDestination": { + "type": "string", + "id": 1 + }, + "state": { + "type": "State", + "id": 2 + }, + "rejectionReason": { + "type": "string", + "id": 3 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "REJECTED": 1, + "SUCCEEDED": 2 + } + } + } + }, + "ReviewDocumentOperationMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 5 + }, + "questionId": { + "type": "string", + "id": 6 + } + } + }, + "DocumentSchema": { + "fields": { + "displayName": { + "type": "string", + "id": 1 + }, + "description": { + "type": "string", + "id": 2 + }, + "entityTypes": { + "rule": "repeated", + "type": "EntityType", + "id": 3 + }, + "metadata": { + "type": "Metadata", + "id": 4 + } + }, + "nested": { + "EntityType": { + "oneofs": { + "valueSource": { + "oneof": [ + "enumValues" + ] + } + }, + "fields": { + "enumValues": { + "type": "EnumValues", + "id": 14 + }, + "displayName": { + "type": "string", + "id": 13 + }, + "name": { + "type": "string", + "id": 1 + }, + "baseTypes": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "properties": { + "rule": "repeated", + "type": "Property", + "id": 6 + } + }, + "nested": { + "EnumValues": { + "fields": { + "values": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "Property": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "valueType": { + "type": "string", + "id": 2 + }, + "occurrenceType": { + "type": "OccurrenceType", + "id": 3 + } + }, + "nested": { + "OccurrenceType": { + "values": { + "OCCURRENCE_TYPE_UNSPECIFIED": 0, + "OPTIONAL_ONCE": 1, + "OPTIONAL_MULTIPLE": 2, + "REQUIRED_ONCE": 3, + "REQUIRED_MULTIPLE": 4 + } + } + } + } + } + }, + "Metadata": { + "fields": { + "documentSplitter": { + "type": "bool", + "id": 1 + }, + "documentAllowMultipleLabels": { + "type": "bool", + "id": 2 + }, + "prefixedNamingOnProperties": { + "type": "bool", + "id": 6 + }, + "skipNamingValidation": { + "type": "bool", + "id": 7 + } } - }, - "skipHumanReview": { - "type": "bool", - "id": 3 } } }, - "HumanReviewStatus": { + "CommonOperationMetadata": { "fields": { "state": { "type": "State", @@ -1148,213 +2175,206 @@ "type": "string", "id": 2 }, - "humanReviewOperation": { + "resource": { "type": "string", + "id": 5 + }, + "createTime": { + "type": "google.protobuf.Timestamp", "id": 3 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 4 } }, "nested": { "State": { "values": { "STATE_UNSPECIFIED": 0, - "SKIPPED": 1, - "VALIDATION_PASSED": 2, - "IN_PROGRESS": 3, - "ERROR": 4 + "RUNNING": 1, + "CANCELLING": 2, + "SUCCEEDED": 3, + "FAILED": 4, + "CANCELLED": 5 } } } }, - "ProcessResponse": { - "fields": { - "document": { - "type": "Document", - "id": 1 - }, - "humanReviewStatus": { - "type": "HumanReviewStatus", - "id": 3 - } - } - }, - "BatchProcessRequest": { + "ProcessorVersion": { + "options": { + "(google.api.resource).type": "documentai.googleapis.com/ProcessorVersion", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}" + }, "fields": { "name": { "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" - } - }, - "inputDocuments": { - "type": "BatchDocumentsInputConfig", - "id": 5 - }, - "documentOutputConfig": { - "type": "DocumentOutputConfig", - "id": 6 - }, - "skipHumanReview": { - "type": "bool", - "id": 4 - } - } - }, - "BatchProcessResponse": { - "fields": {} - }, - "BatchProcessMetadata": { - "fields": { - "state": { - "type": "State", "id": 1 }, - "stateMessage": { + "displayName": { "type": "string", "id": 2 }, + "state": { + "type": "State", + "id": 6 + }, "createTime": { "type": "google.protobuf.Timestamp", - "id": 3 + "id": 7 }, - "updateTime": { - "type": "google.protobuf.Timestamp", - "id": 4 + "kmsKeyName": { + "type": "string", + "id": 9 }, - "individualProcessStatuses": { - "rule": "repeated", - "type": "IndividualProcessStatus", - "id": 5 + "kmsKeyVersionName": { + "type": "string", + "id": 10 + }, + "googleManaged": { + "type": "bool", + "id": 11 + }, + "deprecationInfo": { + "type": "DeprecationInfo", + "id": 13 } }, "nested": { - "IndividualProcessStatus": { + "DeprecationInfo": { "fields": { - "inputGcsSource": { - "type": "string", + "deprecationTime": { + "type": "google.protobuf.Timestamp", "id": 1 }, - "status": { - "type": "google.rpc.Status", - "id": 2 - }, - "outputGcsDestination": { + "replacementProcessorVersion": { "type": "string", - "id": 3 - }, - "humanReviewStatus": { - "type": "HumanReviewStatus", - "id": 5 + "id": 2, + "options": { + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } } } }, "State": { "values": { "STATE_UNSPECIFIED": 0, - "WAITING": 1, - "RUNNING": 2, - "SUCCEEDED": 3, - "CANCELLING": 4, - "CANCELLED": 5, - "FAILED": 6 + "DEPLOYED": 1, + "DEPLOYING": 2, + "UNDEPLOYED": 3, + "UNDEPLOYING": 4, + "CREATING": 5, + "DELETING": 6, + "FAILED": 7 } } } }, - "ReviewDocumentRequest": { - "oneofs": { - "source": { - "oneof": [ - "inlineDocument" - ] - } + "Processor": { + "options": { + "(google.api.resource).type": "documentai.googleapis.com/Processor", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/processors/{processor}" }, "fields": { - "inlineDocument": { - "type": "Document", - "id": 4 - }, - "humanReviewConfig": { + "name": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "documentai.googleapis.com/HumanReviewConfig" + "(google.api.field_behavior)": "OUTPUT_ONLY" } }, - "enableSchemaValidation": { - "type": "bool", + "type": { + "type": "string", + "id": 2 + }, + "displayName": { + "type": "string", "id": 3 }, - "priority": { - "type": "Priority", - "id": 5 + "state": { + "type": "State", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "defaultProcessorVersion": { + "type": "string", + "id": 9, + "options": { + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } + }, + "processEndpoint": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 7 + }, + "kmsKeyName": { + "type": "string", + "id": 8 } }, - "reserved": [ - [ - 2, - 2 - ] - ], "nested": { - "Priority": { + "State": { "values": { - "DEFAULT": 0, - "URGENT": 1 + "STATE_UNSPECIFIED": 0, + "ENABLED": 1, + "DISABLED": 2, + "ENABLING": 3, + "DISABLING": 4, + "CREATING": 5, + "FAILED": 6, + "DELETING": 7 } } } }, - "ReviewDocumentResponse": { - "fields": { - "gcsDestination": { - "type": "string", - "id": 1 - } - } - }, - "ReviewDocumentOperationMetadata": { + "ProcessorType": { + "options": { + "(google.api.resource).type": "documentai.googleapis.com/ProcessorType", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/processorTypes/{processor_type}" + }, "fields": { - "commonMetadata": { - "type": "CommonOperationMetadata", - "id": 5 - }, - "questionId": { + "name": { "type": "string", - "id": 6 - } - } - }, - "CommonOperationMetadata": { - "fields": { - "state": { - "type": "State", "id": 1 }, - "stateMessage": { + "type": { "type": "string", "id": 2 }, - "createTime": { - "type": "google.protobuf.Timestamp", + "category": { + "type": "string", "id": 3 }, - "updateTime": { - "type": "google.protobuf.Timestamp", + "availableLocations": { + "rule": "repeated", + "type": "LocationInfo", "id": 4 + }, + "allowCreation": { + "type": "bool", + "id": 6 + }, + "launchStage": { + "type": "google.api.LaunchStage", + "id": 8 } }, "nested": { - "State": { - "values": { - "STATE_UNSPECIFIED": 0, - "RUNNING": 1, - "CANCELLING": 2, - "SUCCEEDED": 3, - "FAILED": 4, - "CANCELLED": 5 + "LocationInfo": { + "fields": { + "locationId": { + "type": "string", + "id": 1 + } } } } @@ -5005,9 +6025,9 @@ }, "api": { "options": { - "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", + "go_package": "google.golang.org/genproto/googleapis/api;api", "java_multiple_files": true, - "java_outer_classname": "ResourceProto", + "java_outer_classname": "LaunchStageProto", "java_package": "com.google.api", "objc_class_prefix": "GAPI", "cc_enable_arenas": true @@ -5210,6 +6230,18 @@ "id": 2 } } + }, + "LaunchStage": { + "values": { + "LAUNCH_STAGE_UNSPECIFIED": 0, + "UNIMPLEMENTED": 6, + "PRELAUNCH": 7, + "EARLY_ACCESS": 1, + "ALPHA": 2, + "BETA": 3, + "GA": 4, + "DEPRECATED": 5 + } } } }, diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js index 33e8eef0fc0..b7ae22929be 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js @@ -26,7 +26,11 @@ function main(name) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The processor resource name. + * Required. The resource name of Processor google.cloud.documentai.v1.Processor or + * ProcessorVersion google.cloud.documentai.v1.ProcessorVersion. + * Format: `projects/{project}/locations/{location}/processors/{processor}`, + * or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` */ // const name = 'abc123' /** diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.create_processor.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.create_processor.js new file mode 100644 index 00000000000..dabf1797e81 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.create_processor.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(parent, processor) { + // [START documentai_v1_generated_DocumentProcessorService_CreateProcessor_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent (project and location) under which to create the processor. + * Format: `projects/{project}/locations/{location}` + */ + // const parent = 'abc123' + /** + * Required. The processor to be created, requires processor_type and display_name + * to be set. Also, the processor is under CMEK if CMEK fields are set. + */ + // const processor = {} + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callCreateProcessor() { + // Construct request + const request = { + parent, + processor, + }; + + // Run request + const response = await documentaiClient.createProcessor(request); + console.log(response); + } + + callCreateProcessor(); + // [END documentai_v1_generated_DocumentProcessorService_CreateProcessor_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor.js new file mode 100644 index 00000000000..9b6be82cf08 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor.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 documentai_v1_generated_DocumentProcessorService_DeleteProcessor_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor resource name to be deleted. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callDeleteProcessor() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await documentaiClient.deleteProcessor(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteProcessor(); + // [END documentai_v1_generated_DocumentProcessorService_DeleteProcessor_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor_version.js new file mode 100644 index 00000000000..2afd2cb69fa --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor_version.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 documentai_v1_generated_DocumentProcessorService_DeleteProcessorVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor version resource name to be deleted. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callDeleteProcessorVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await documentaiClient.deleteProcessorVersion(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteProcessorVersion(); + // [END documentai_v1_generated_DocumentProcessorService_DeleteProcessorVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.deploy_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.deploy_processor_version.js new file mode 100644 index 00000000000..e2eb5a3f5d9 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.deploy_processor_version.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 documentai_v1_generated_DocumentProcessorService_DeployProcessorVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor version resource name to be deployed. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callDeployProcessorVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await documentaiClient.deployProcessorVersion(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeployProcessorVersion(); + // [END documentai_v1_generated_DocumentProcessorService_DeployProcessorVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.disable_processor.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.disable_processor.js new file mode 100644 index 00000000000..31cb7edf0e0 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.disable_processor.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 documentai_v1_generated_DocumentProcessorService_DisableProcessor_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor resource name to be disabled. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callDisableProcessor() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await documentaiClient.disableProcessor(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDisableProcessor(); + // [END documentai_v1_generated_DocumentProcessorService_DisableProcessor_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.enable_processor.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.enable_processor.js new file mode 100644 index 00000000000..a0cb036bea4 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.enable_processor.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 documentai_v1_generated_DocumentProcessorService_EnableProcessor_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor resource name to be enabled. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callEnableProcessor() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await documentaiClient.enableProcessor(request); + const [response] = await operation.promise(); + console.log(response); + } + + callEnableProcessor(); + // [END documentai_v1_generated_DocumentProcessorService_EnableProcessor_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.fetch_processor_types.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.fetch_processor_types.js new file mode 100644 index 00000000000..d995bb995cb --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.fetch_processor_types.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(parent) { + // [START documentai_v1_generated_DocumentProcessorService_FetchProcessorTypes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project of processor type to list. + * The available processor types may depend on the allow-listing on projects. + * Format: `projects/{project}/locations/{location}` + */ + // const parent = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callFetchProcessorTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await documentaiClient.fetchProcessorTypes(request); + console.log(response); + } + + callFetchProcessorTypes(); + // [END documentai_v1_generated_DocumentProcessorService_FetchProcessorTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor.js new file mode 100644 index 00000000000..9a15ee51989 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor.js @@ -0,0 +1,58 @@ +// 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 documentai_v1_generated_DocumentProcessorService_GetProcessor_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor resource name. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callGetProcessor() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await documentaiClient.getProcessor(request); + console.log(response); + } + + callGetProcessor(); + // [END documentai_v1_generated_DocumentProcessorService_GetProcessor_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor_version.js new file mode 100644 index 00000000000..c15c9e0a94c --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor_version.js @@ -0,0 +1,58 @@ +// 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 documentai_v1_generated_DocumentProcessorService_GetProcessorVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor resource name. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callGetProcessorVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await documentaiClient.getProcessorVersion(request); + console.log(response); + } + + callGetProcessorVersion(); + // [END documentai_v1_generated_DocumentProcessorService_GetProcessorVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_types.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_types.js new file mode 100644 index 00000000000..64702298034 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_types.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 documentai_v1_generated_DocumentProcessorService_ListProcessorTypes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The location of processor type to list. + * The available processor types may depend on the allow-listing on projects. + * Format: `projects/{project}/locations/{location}` + */ + // const parent = 'abc123' + /** + * The maximum number of processor types to return. + * If unspecified, at most 100 processor types will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + */ + // const pageSize = 1234 + /** + * Used to retrieve the next page of results, empty if at the end of the list. + */ + // const pageToken = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callListProcessorTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await documentaiClient.listProcessorTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListProcessorTypes(); + // [END documentai_v1_generated_DocumentProcessorService_ListProcessorTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_versions.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_versions.js new file mode 100644 index 00000000000..0a1c16204e6 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_versions.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 documentai_v1_generated_DocumentProcessorService_ListProcessorVersions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent (project, location and processor) to list all versions. + * Format: `projects/{project}/locations/{location}/processors/{processor}` + */ + // const parent = 'abc123' + /** + * The maximum number of processor versions to return. + * If unspecified, at most 10 processor versions will be returned. + * The maximum value is 20; values above 20 will be coerced to 20. + */ + // const pageSize = 1234 + /** + * We will return the processor versions sorted by creation time. The page + * token will point to the next processor version. + */ + // const pageToken = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callListProcessorVersions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await documentaiClient.listProcessorVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListProcessorVersions(); + // [END documentai_v1_generated_DocumentProcessorService_ListProcessorVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processors.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processors.js new file mode 100644 index 00000000000..3038b092980 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processors.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 documentai_v1_generated_DocumentProcessorService_ListProcessors_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent (project and location) which owns this collection of Processors. + * Format: `projects/{project}/locations/{location}` + */ + // const parent = 'abc123' + /** + * The maximum number of processors to return. + * If unspecified, at most 50 processors will be returned. + * The maximum value is 100; values above 100 will be coerced to 100. + */ + // const pageSize = 1234 + /** + * We will return the processors sorted by creation time. The page token + * will point to the next processor. + */ + // const pageToken = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callListProcessors() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await documentaiClient.listProcessorsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListProcessors(); + // [END documentai_v1_generated_DocumentProcessorService_ListProcessors_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js index 1ff38d5a965..e22847c4216 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js @@ -34,7 +34,12 @@ function main(name) { */ // const rawDocument = {} /** - * Required. The processor resource name. + * Required. The resource name of the Processor google.cloud.documentai.v1.Processor or + * ProcessorVersion google.cloud.documentai.v1.ProcessorVersion + * to use for processing. If a Processor google.cloud.documentai.v1.Processor is specified, the server will use + * its default version google.cloud.documentai.v1.Processor.default_processor_version. Format: + * `projects/{project}/locations/{location}/processors/{processor}`, or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` */ // const name = 'abc123' /** @@ -42,6 +47,10 @@ function main(name) { * false. */ // const skipHumanReview = true + /** + * Specifies which fields to include in ProcessResponse's document. + */ + // const fieldMask = {} // Imports the Documentai library const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js index d78861aaedb..8dbd18cb467 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js @@ -42,6 +42,10 @@ function main(humanReviewConfig) { * The priority of the human review task. */ // const priority = {} + /** + * The document schema of the human review task. + */ + // const documentSchema = {} // Imports the Documentai library const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.set_default_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.set_default_processor_version.js new file mode 100644 index 00000000000..8005da6375b --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.set_default_processor_version.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(processor, defaultProcessorVersion) { + // [START documentai_v1_generated_DocumentProcessorService_SetDefaultProcessorVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Processor google.cloud.documentai.v1.Processor to change default version. + */ + // const processor = 'abc123' + /** + * Required. The resource name of child ProcessorVersion google.cloud.documentai.v1.ProcessorVersion to use as default. + * Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}` + */ + // const defaultProcessorVersion = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callSetDefaultProcessorVersion() { + // Construct request + const request = { + processor, + defaultProcessorVersion, + }; + + // Run request + const [operation] = await documentaiClient.setDefaultProcessorVersion(request); + const [response] = await operation.promise(); + console.log(response); + } + + callSetDefaultProcessorVersion(); + // [END documentai_v1_generated_DocumentProcessorService_SetDefaultProcessorVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.undeploy_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.undeploy_processor_version.js new file mode 100644 index 00000000000..7a617c1effc --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.undeploy_processor_version.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 documentai_v1_generated_DocumentProcessorService_UndeployProcessorVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor version resource name to be undeployed. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callUndeployProcessorVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await documentaiClient.undeployProcessorVersion(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUndeployProcessorVersion(); + // [END documentai_v1_generated_DocumentProcessorService_UndeployProcessorVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json index aae86640725..8c98d8e34a3 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json +++ b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 63, + "end": 72, "type": "FULL" } ], @@ -46,6 +46,10 @@ { "name": "skip_human_review", "type": "TYPE_BOOL" + }, + { + "name": "field_mask", + "type": ".google.protobuf.FieldMask" } ], "resultType": ".google.cloud.documentai.v1.ProcessResponse", @@ -74,7 +78,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 68, "type": "FULL" } ], @@ -115,6 +119,598 @@ } } }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_FetchProcessorTypes_async", + "title": "DocumentProcessorService fetchProcessorTypes Sample", + "origin": "API_DEFINITION", + "description": " Fetches processor types. Note that we do not use ListProcessorTypes here because it is not paginated.", + "canonical": true, + "file": "document_processor_service.fetch_processor_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchProcessorTypes", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1.FetchProcessorTypesResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "FetchProcessorTypes", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_ListProcessorTypes_async", + "title": "DocumentProcessorService listProcessorTypes Sample", + "origin": "API_DEFINITION", + "description": " Lists the processor types that exist.", + "canonical": true, + "file": "document_processor_service.list_processor_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListProcessorTypes", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1.ListProcessorTypesResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ListProcessorTypes", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_ListProcessors_async", + "title": "DocumentProcessorService listProcessors Sample", + "origin": "API_DEFINITION", + "description": " Lists all processors which belong to this project.", + "canonical": true, + "file": "document_processor_service.list_processors.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListProcessors", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ListProcessors", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1.ListProcessorsResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ListProcessors", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ListProcessors", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_GetProcessor_async", + "title": "DocumentProcessorService getProcessor Sample", + "origin": "API_DEFINITION", + "description": " Gets a processor detail.", + "canonical": true, + "file": "document_processor_service.get_processor.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetProcessor", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.GetProcessor", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1.Processor", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "GetProcessor", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.GetProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_GetProcessorVersion_async", + "title": "DocumentProcessorService getProcessorVersion Sample", + "origin": "API_DEFINITION", + "description": " Gets a processor version detail.", + "canonical": true, + "file": "document_processor_service.get_processor_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetProcessorVersion", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1.ProcessorVersion", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "GetProcessorVersion", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersion", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_ListProcessorVersions_async", + "title": "DocumentProcessorService listProcessorVersions Sample", + "origin": "API_DEFINITION", + "description": " Lists all versions of a processor.", + "canonical": true, + "file": "document_processor_service.list_processor_versions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListProcessorVersions", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1.ListProcessorVersionsResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ListProcessorVersions", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersions", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_DeleteProcessorVersion_async", + "title": "DocumentProcessorService deleteProcessorVersion Sample", + "origin": "API_DEFINITION", + "description": " Deletes the processor version, all artifacts under the processor version will be deleted.", + "canonical": true, + "file": "document_processor_service.delete_processor_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteProcessorVersion", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "DeleteProcessorVersion", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_DeployProcessorVersion_async", + "title": "DocumentProcessorService deployProcessorVersion Sample", + "origin": "API_DEFINITION", + "description": " Deploys the processor version.", + "canonical": true, + "file": "document_processor_service.deploy_processor_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeployProcessorVersion", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "DeployProcessorVersion", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_UndeployProcessorVersion_async", + "title": "DocumentProcessorService undeployProcessorVersion Sample", + "origin": "API_DEFINITION", + "description": " Undeploys the processor version.", + "canonical": true, + "file": "document_processor_service.undeploy_processor_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UndeployProcessorVersion", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "UndeployProcessorVersion", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_CreateProcessor_async", + "title": "DocumentProcessorService createProcessor Sample", + "origin": "API_DEFINITION", + "description": " Creates a processor from the type processor that the user chose. The processor will be at \"ENABLED\" state by default after its creation.", + "canonical": true, + "file": "document_processor_service.create_processor.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateProcessor", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.CreateProcessor", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "processor", + "type": ".google.cloud.documentai.v1.Processor" + } + ], + "resultType": ".google.cloud.documentai.v1.Processor", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "CreateProcessor", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.CreateProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_DeleteProcessor_async", + "title": "DocumentProcessorService deleteProcessor Sample", + "origin": "API_DEFINITION", + "description": " Deletes the processor, unloads all deployed model artifacts if it was enabled and then deletes all artifacts associated with this processor.", + "canonical": true, + "file": "document_processor_service.delete_processor.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteProcessor", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "DeleteProcessor", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_EnableProcessor_async", + "title": "DocumentProcessorService enableProcessor Sample", + "origin": "API_DEFINITION", + "description": " Enables a processor", + "canonical": true, + "file": "document_processor_service.enable_processor.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "EnableProcessor", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "EnableProcessor", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_DisableProcessor_async", + "title": "DocumentProcessorService disableProcessor Sample", + "origin": "API_DEFINITION", + "description": " Disables a processor", + "canonical": true, + "file": "document_processor_service.disable_processor.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DisableProcessor", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "DisableProcessor", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_SetDefaultProcessorVersion_async", + "title": "DocumentProcessorService setDefaultProcessorVersion Sample", + "origin": "API_DEFINITION", + "description": " Set the default (active) version of a [Processor][google.cloud.documentai.v1.Processor] that will be used in [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument] and [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].", + "canonical": true, + "file": "document_processor_service.set_default_processor_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetDefaultProcessorVersion", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion", + "async": true, + "parameters": [ + { + "name": "processor", + "type": "TYPE_STRING" + }, + { + "name": "default_processor_version", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "SetDefaultProcessorVersion", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, { "regionTag": "documentai_v1_generated_DocumentProcessorService_ReviewDocument_async", "title": "DocumentProcessorService reviewDocument Sample", @@ -126,7 +722,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 68, "type": "FULL" } ], @@ -150,6 +746,10 @@ { "name": "priority", "type": ".google.cloud.documentai.v1.ReviewDocumentRequest.Priority" + }, + { + "name": "document_schema", + "type": ".google.cloud.documentai.v1.DocumentSchema" } ], "resultType": ".google.longrunning.Operation", diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts index d5b6c3542c2..e3293a1ac30 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts @@ -25,8 +25,14 @@ import { 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'); /** @@ -63,6 +69,7 @@ export class DocumentProcessorServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; documentProcessorServiceStub?: Promise<{[name: string]: Function}>; @@ -139,6 +146,8 @@ export class DocumentProcessorServiceClient { // Set defaultServicePath on the auth object. this.auth.defaultServicePath = staticMembers.servicePath; + 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) { @@ -164,9 +173,42 @@ export class DocumentProcessorServiceClient { humanReviewConfigPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig' ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), processorPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/processors/{processor}' ), + processorTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/processorTypes/{processor_type}' + ), + processorVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + }; + + // 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 = { + listProcessorTypes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'processorTypes' + ), + listProcessors: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'processors' + ), + listProcessorVersions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'processorVersions' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -229,6 +271,48 @@ export class DocumentProcessorServiceClient { const batchProcessDocumentsMetadata = protoFilesRoot.lookup( '.google.cloud.documentai.v1.BatchProcessMetadata' ) as gax.protobuf.Type; + const deleteProcessorVersionResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const deleteProcessorVersionMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.DeleteProcessorVersionMetadata' + ) as gax.protobuf.Type; + const deployProcessorVersionResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.DeployProcessorVersionResponse' + ) as gax.protobuf.Type; + const deployProcessorVersionMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.DeployProcessorVersionMetadata' + ) as gax.protobuf.Type; + const undeployProcessorVersionResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.UndeployProcessorVersionResponse' + ) as gax.protobuf.Type; + const undeployProcessorVersionMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.UndeployProcessorVersionMetadata' + ) as gax.protobuf.Type; + const deleteProcessorResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const deleteProcessorMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.DeleteProcessorMetadata' + ) as gax.protobuf.Type; + const enableProcessorResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.EnableProcessorResponse' + ) as gax.protobuf.Type; + const enableProcessorMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.EnableProcessorMetadata' + ) as gax.protobuf.Type; + const disableProcessorResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.DisableProcessorResponse' + ) as gax.protobuf.Type; + const disableProcessorMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.DisableProcessorMetadata' + ) as gax.protobuf.Type; + const setDefaultProcessorVersionResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.SetDefaultProcessorVersionResponse' + ) as gax.protobuf.Type; + const setDefaultProcessorVersionMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata' + ) as gax.protobuf.Type; const reviewDocumentResponse = protoFilesRoot.lookup( '.google.cloud.documentai.v1.ReviewDocumentResponse' ) as gax.protobuf.Type; @@ -244,6 +328,57 @@ export class DocumentProcessorServiceClient { ), batchProcessDocumentsMetadata.decode.bind(batchProcessDocumentsMetadata) ), + deleteProcessorVersion: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteProcessorVersionResponse.decode.bind( + deleteProcessorVersionResponse + ), + deleteProcessorVersionMetadata.decode.bind( + deleteProcessorVersionMetadata + ) + ), + deployProcessorVersion: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deployProcessorVersionResponse.decode.bind( + deployProcessorVersionResponse + ), + deployProcessorVersionMetadata.decode.bind( + deployProcessorVersionMetadata + ) + ), + undeployProcessorVersion: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + undeployProcessorVersionResponse.decode.bind( + undeployProcessorVersionResponse + ), + undeployProcessorVersionMetadata.decode.bind( + undeployProcessorVersionMetadata + ) + ), + deleteProcessor: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteProcessorResponse.decode.bind(deleteProcessorResponse), + deleteProcessorMetadata.decode.bind(deleteProcessorMetadata) + ), + enableProcessor: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + enableProcessorResponse.decode.bind(enableProcessorResponse), + enableProcessorMetadata.decode.bind(enableProcessorMetadata) + ), + disableProcessor: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + disableProcessorResponse.decode.bind(disableProcessorResponse), + disableProcessorMetadata.decode.bind(disableProcessorMetadata) + ), + setDefaultProcessorVersion: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + setDefaultProcessorVersionResponse.decode.bind( + setDefaultProcessorVersionResponse + ), + setDefaultProcessorVersionMetadata.decode.bind( + setDefaultProcessorVersionMetadata + ) + ), reviewDocument: new this._gaxModule.LongrunningDescriptor( this.operationsClient, reviewDocumentResponse.decode.bind(reviewDocumentResponse), @@ -304,6 +439,20 @@ export class DocumentProcessorServiceClient { const documentProcessorServiceStubMethods = [ 'processDocument', 'batchProcessDocuments', + 'fetchProcessorTypes', + 'listProcessorTypes', + 'listProcessors', + 'getProcessor', + 'getProcessorVersion', + 'listProcessorVersions', + 'deleteProcessorVersion', + 'deployProcessorVersion', + 'undeployProcessorVersion', + 'createProcessor', + 'deleteProcessor', + 'enableProcessor', + 'disableProcessor', + 'setDefaultProcessorVersion', 'reviewDocument', ]; for (const methodName of documentProcessorServiceStubMethods) { @@ -321,7 +470,10 @@ export class DocumentProcessorServiceClient { } ); - 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], @@ -397,10 +549,17 @@ export class DocumentProcessorServiceClient { * @param {google.cloud.documentai.v1.RawDocument} request.rawDocument * A raw document content (bytes). * @param {string} request.name - * Required. The processor resource name. + * Required. The resource name of the {@link google.cloud.documentai.v1.Processor|Processor} or + * {@link google.cloud.documentai.v1.ProcessorVersion|ProcessorVersion} + * to use for processing. If a {@link google.cloud.documentai.v1.Processor|Processor} is specified, the server will use + * its {@link google.cloud.documentai.v1.Processor.default_processor_version|default version}. Format: + * `projects/{project}/locations/{location}/processors/{processor}`, or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` * @param {boolean} request.skipHumanReview * Whether Human Review feature should be skipped for this request. Default to * false. + * @param {google.protobuf.FieldMask} request.fieldMask + * Specifies which fields to include in ProcessResponse's document. * @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. @@ -477,97 +636,79 @@ export class DocumentProcessorServiceClient { this.initialize(); return this.innerApiCalls.processDocument(request, options, callback); } - /** - * LRO endpoint to batch process many documents. The output is written - * to Cloud Storage as JSON in the [Document] format. + * Fetches processor types. Note that we do not use ListProcessorTypes here + * because it is not paginated. * * @param {Object} request * The request object that will be sent. - * @param {string} request.name - * Required. The processor resource name. - * @param {google.cloud.documentai.v1.BatchDocumentsInputConfig} request.inputDocuments - * The input documents for batch process. - * @param {google.cloud.documentai.v1.DocumentOutputConfig} request.documentOutputConfig - * The overall output config for batch process. - * @param {boolean} request.skipHumanReview - * Whether Human Review feature should be skipped for this request. Default to - * false. + * @param {string} request.parent + * Required. The project of processor type to list. + * The available processor types may depend on the allow-listing on projects. + * Format: `projects/{project}/locations/{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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. + * The first element of the array is an object representing [FetchProcessorTypesResponse]{@link google.cloud.documentai.v1.FetchProcessorTypesResponse}. * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example include:samples/generated/v1/document_processor_service.batch_process_documents.js - * region_tag:documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_async + * @example include:samples/generated/v1/document_processor_service.fetch_processor_types.js + * region_tag:documentai_v1_generated_DocumentProcessorService_FetchProcessorTypes_async */ - batchProcessDocuments( - request?: protos.google.cloud.documentai.v1.IBatchProcessRequest, + fetchProcessorTypes( + request?: protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest, options?: CallOptions ): Promise< [ - LROperation< - protos.google.cloud.documentai.v1.IBatchProcessResponse, - protos.google.cloud.documentai.v1.IBatchProcessMetadata - >, - protos.google.longrunning.IOperation | undefined, + protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse, + protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest | undefined, {} | undefined ] >; - batchProcessDocuments( - request: protos.google.cloud.documentai.v1.IBatchProcessRequest, + fetchProcessorTypes( + request: protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest, options: CallOptions, callback: Callback< - LROperation< - protos.google.cloud.documentai.v1.IBatchProcessResponse, - protos.google.cloud.documentai.v1.IBatchProcessMetadata - >, - protos.google.longrunning.IOperation | null | undefined, + protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse, + | protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest + | null + | undefined, {} | null | undefined > ): void; - batchProcessDocuments( - request: protos.google.cloud.documentai.v1.IBatchProcessRequest, + fetchProcessorTypes( + request: protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest, callback: Callback< - LROperation< - protos.google.cloud.documentai.v1.IBatchProcessResponse, - protos.google.cloud.documentai.v1.IBatchProcessMetadata - >, - protos.google.longrunning.IOperation | null | undefined, + protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse, + | protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest + | null + | undefined, {} | null | undefined > ): void; - batchProcessDocuments( - request?: protos.google.cloud.documentai.v1.IBatchProcessRequest, + fetchProcessorTypes( + request?: protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest, optionsOrCallback?: | CallOptions | Callback< - LROperation< - protos.google.cloud.documentai.v1.IBatchProcessResponse, - protos.google.cloud.documentai.v1.IBatchProcessMetadata - >, - protos.google.longrunning.IOperation | null | undefined, + protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse, + | protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest + | null + | undefined, {} | null | undefined >, callback?: Callback< - LROperation< - protos.google.cloud.documentai.v1.IBatchProcessResponse, - protos.google.cloud.documentai.v1.IBatchProcessMetadata - >, - protos.google.longrunning.IOperation | null | undefined, + protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse, + | protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest + | null + | undefined, {} | null | undefined > ): Promise< [ - LROperation< - protos.google.cloud.documentai.v1.IBatchProcessResponse, - protos.google.cloud.documentai.v1.IBatchProcessMetadata - >, - protos.google.longrunning.IOperation | undefined, + protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse, + protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest | undefined, {} | undefined ] > | void { @@ -584,135 +725,166 @@ export class DocumentProcessorServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ - name: request.name || '', + parent: request.parent || '', }); this.initialize(); - return this.innerApiCalls.batchProcessDocuments(request, options, callback); + return this.innerApiCalls.fetchProcessorTypes(request, options, callback); } /** - * Check the status of the long running operation returned by `batchProcessDocuments()`. - * @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. + * Gets a processor detail. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name. + * @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 [Processor]{@link google.cloud.documentai.v1.Processor}. * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example include:samples/generated/v1/document_processor_service.batch_process_documents.js - * region_tag:documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_async + * @example include:samples/generated/v1/document_processor_service.get_processor.js + * region_tag:documentai_v1_generated_DocumentProcessorService_GetProcessor_async */ - async checkBatchProcessDocumentsProgress( - name: string + getProcessor( + request?: protos.google.cloud.documentai.v1.IGetProcessorRequest, + options?: CallOptions ): Promise< - LROperation< - protos.google.cloud.documentai.v1.BatchProcessResponse, - protos.google.cloud.documentai.v1.BatchProcessMetadata + [ + protos.google.cloud.documentai.v1.IProcessor, + protos.google.cloud.documentai.v1.IGetProcessorRequest | undefined, + {} | undefined + ] + >; + getProcessor( + request: protos.google.cloud.documentai.v1.IGetProcessorRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.documentai.v1.IProcessor, + protos.google.cloud.documentai.v1.IGetProcessorRequest | null | undefined, + {} | null | undefined > - > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( - operation, - this.descriptors.longrunning.batchProcessDocuments, - gax.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.cloud.documentai.v1.BatchProcessResponse, - protos.google.cloud.documentai.v1.BatchProcessMetadata - >; + ): void; + getProcessor( + request: protos.google.cloud.documentai.v1.IGetProcessorRequest, + callback: Callback< + protos.google.cloud.documentai.v1.IProcessor, + protos.google.cloud.documentai.v1.IGetProcessorRequest | null | undefined, + {} | null | undefined + > + ): void; + getProcessor( + request?: protos.google.cloud.documentai.v1.IGetProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.documentai.v1.IProcessor, + | protos.google.cloud.documentai.v1.IGetProcessorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.documentai.v1.IProcessor, + protos.google.cloud.documentai.v1.IGetProcessorRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessor, + protos.google.cloud.documentai.v1.IGetProcessorRequest | 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.getProcessor(request, options, callback); } /** - * Send a document for Human Review. The input document should be processed by - * the specified processor. + * Gets a processor version detail. * * @param {Object} request * The request object that will be sent. - * @param {google.cloud.documentai.v1.Document} request.inlineDocument - * An inline document proto. - * @param {string} request.humanReviewConfig - * Required. The resource name of the HumanReviewConfig that the document will be - * reviewed with. - * @param {boolean} request.enableSchemaValidation - * Whether the validation should be performed on the ad-hoc review request. - * @param {google.cloud.documentai.v1.ReviewDocumentRequest.Priority} request.priority - * The priority of the human review task. + * @param {string} request.name + * Required. The processor resource name. * @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. + * The first element of the array is an object representing [ProcessorVersion]{@link google.cloud.documentai.v1.ProcessorVersion}. * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example include:samples/generated/v1/document_processor_service.review_document.js - * region_tag:documentai_v1_generated_DocumentProcessorService_ReviewDocument_async + * @example include:samples/generated/v1/document_processor_service.get_processor_version.js + * region_tag:documentai_v1_generated_DocumentProcessorService_GetProcessorVersion_async */ - reviewDocument( - request?: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + getProcessorVersion( + request?: protos.google.cloud.documentai.v1.IGetProcessorVersionRequest, options?: CallOptions ): Promise< [ - LROperation< - protos.google.cloud.documentai.v1.IReviewDocumentResponse, - protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, + protos.google.cloud.documentai.v1.IProcessorVersion, + protos.google.cloud.documentai.v1.IGetProcessorVersionRequest | undefined, {} | undefined ] >; - reviewDocument( - request: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + getProcessorVersion( + request: protos.google.cloud.documentai.v1.IGetProcessorVersionRequest, options: CallOptions, callback: Callback< - LROperation< - protos.google.cloud.documentai.v1.IReviewDocumentResponse, - protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, + protos.google.cloud.documentai.v1.IProcessorVersion, + | protos.google.cloud.documentai.v1.IGetProcessorVersionRequest + | null + | undefined, {} | null | undefined > ): void; - reviewDocument( - request: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + getProcessorVersion( + request: protos.google.cloud.documentai.v1.IGetProcessorVersionRequest, callback: Callback< - LROperation< - protos.google.cloud.documentai.v1.IReviewDocumentResponse, - protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, + protos.google.cloud.documentai.v1.IProcessorVersion, + | protos.google.cloud.documentai.v1.IGetProcessorVersionRequest + | null + | undefined, {} | null | undefined > ): void; - reviewDocument( - request?: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + getProcessorVersion( + request?: protos.google.cloud.documentai.v1.IGetProcessorVersionRequest, optionsOrCallback?: | CallOptions | Callback< - LROperation< - protos.google.cloud.documentai.v1.IReviewDocumentResponse, - protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, + protos.google.cloud.documentai.v1.IProcessorVersion, + | protos.google.cloud.documentai.v1.IGetProcessorVersionRequest + | null + | undefined, {} | null | undefined >, callback?: Callback< - LROperation< - protos.google.cloud.documentai.v1.IReviewDocumentResponse, - protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, + protos.google.cloud.documentai.v1.IProcessorVersion, + | protos.google.cloud.documentai.v1.IGetProcessorVersionRequest + | null + | undefined, {} | null | undefined > ): Promise< [ - LROperation< - protos.google.cloud.documentai.v1.IReviewDocumentResponse, - protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, + protos.google.cloud.documentai.v1.IProcessorVersion, + protos.google.cloud.documentai.v1.IGetProcessorVersionRequest | undefined, {} | undefined ] > | void { @@ -729,22 +901,1364 @@ export class DocumentProcessorServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ - human_review_config: request.humanReviewConfig || '', + name: request.name || '', }); this.initialize(); - return this.innerApiCalls.reviewDocument(request, options, callback); + return this.innerApiCalls.getProcessorVersion(request, options, callback); } /** - * Check the status of the long running operation returned by `reviewDocument()`. - * @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. + * Creates a processor from the type processor that the user chose. + * The processor will be at "ENABLED" state by default after its creation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) under which to create the processor. + * Format: `projects/{project}/locations/{location}` + * @param {google.cloud.documentai.v1.Processor} request.processor + * Required. The processor to be created, requires [processor_type] and [display_name] + * to be set. Also, the processor is under CMEK if CMEK fields are set. + * @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 [Processor]{@link google.cloud.documentai.v1.Processor}. * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example include:samples/generated/v1/document_processor_service.review_document.js - * region_tag:documentai_v1_generated_DocumentProcessorService_ReviewDocument_async + * @example include:samples/generated/v1/document_processor_service.create_processor.js + * region_tag:documentai_v1_generated_DocumentProcessorService_CreateProcessor_async + */ + createProcessor( + request?: protos.google.cloud.documentai.v1.ICreateProcessorRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessor, + protos.google.cloud.documentai.v1.ICreateProcessorRequest | undefined, + {} | undefined + ] + >; + createProcessor( + request: protos.google.cloud.documentai.v1.ICreateProcessorRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.documentai.v1.IProcessor, + | protos.google.cloud.documentai.v1.ICreateProcessorRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createProcessor( + request: protos.google.cloud.documentai.v1.ICreateProcessorRequest, + callback: Callback< + protos.google.cloud.documentai.v1.IProcessor, + | protos.google.cloud.documentai.v1.ICreateProcessorRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createProcessor( + request?: protos.google.cloud.documentai.v1.ICreateProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.documentai.v1.IProcessor, + | protos.google.cloud.documentai.v1.ICreateProcessorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.documentai.v1.IProcessor, + | protos.google.cloud.documentai.v1.ICreateProcessorRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessor, + protos.google.cloud.documentai.v1.ICreateProcessorRequest | 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.createProcessor(request, options, callback); + } + + /** + * LRO endpoint to batch process many documents. The output is written + * to Cloud Storage as JSON in the [Document] format. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of {@link google.cloud.documentai.v1.Processor|Processor} or + * {@link google.cloud.documentai.v1.ProcessorVersion|ProcessorVersion}. + * Format: `projects/{project}/locations/{location}/processors/{processor}`, + * or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * @param {google.cloud.documentai.v1.BatchDocumentsInputConfig} request.inputDocuments + * The input documents for batch process. + * @param {google.cloud.documentai.v1.DocumentOutputConfig} request.documentOutputConfig + * The overall output config for batch process. + * @param {boolean} request.skipHumanReview + * Whether Human Review feature should be skipped for this request. Default to + * false. + * @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/v1/document_processor_service.batch_process_documents.js + * region_tag:documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_async + */ + batchProcessDocuments( + request?: protos.google.cloud.documentai.v1.IBatchProcessRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchProcessDocuments( + request: protos.google.cloud.documentai.v1.IBatchProcessRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchProcessDocuments( + request: protos.google.cloud.documentai.v1.IBatchProcessRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchProcessDocuments( + request?: protos.google.cloud.documentai.v1.IBatchProcessRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >, + 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.batchProcessDocuments(request, options, callback); + } + /** + * Check the status of the long running operation returned by `batchProcessDocuments()`. + * @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/v1/document_processor_service.batch_process_documents.js + * region_tag:documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_async + */ + async checkBatchProcessDocumentsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1.BatchProcessResponse, + protos.google.cloud.documentai.v1.BatchProcessMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.batchProcessDocuments, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1.BatchProcessResponse, + protos.google.cloud.documentai.v1.BatchProcessMetadata + >; + } + /** + * Deletes the processor version, all artifacts under the processor version + * will be deleted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor version resource name to 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. + * 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/v1/document_processor_service.delete_processor_version.js + * region_tag:documentai_v1_generated_DocumentProcessorService_DeleteProcessorVersion_async + */ + deleteProcessorVersion( + request?: protos.google.cloud.documentai.v1.IDeleteProcessorVersionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteProcessorVersion( + request: protos.google.cloud.documentai.v1.IDeleteProcessorVersionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteProcessorVersion( + request: protos.google.cloud.documentai.v1.IDeleteProcessorVersionRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteProcessorVersion( + request?: protos.google.cloud.documentai.v1.IDeleteProcessorVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorVersionMetadata + >, + 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.deleteProcessorVersion( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `deleteProcessorVersion()`. + * @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/v1/document_processor_service.delete_processor_version.js + * region_tag:documentai_v1_generated_DocumentProcessorService_DeleteProcessorVersion_async + */ + async checkDeleteProcessorVersionProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.documentai.v1.DeleteProcessorVersionMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.deleteProcessorVersion, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.documentai.v1.DeleteProcessorVersionMetadata + >; + } + /** + * Deploys the processor version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor version resource name to be deployed. + * @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/v1/document_processor_service.deploy_processor_version.js + * region_tag:documentai_v1_generated_DocumentProcessorService_DeployProcessorVersion_async + */ + deployProcessorVersion( + request?: protos.google.cloud.documentai.v1.IDeployProcessorVersionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IDeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deployProcessorVersion( + request: protos.google.cloud.documentai.v1.IDeployProcessorVersionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IDeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deployProcessorVersion( + request: protos.google.cloud.documentai.v1.IDeployProcessorVersionRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IDeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deployProcessorVersion( + request?: protos.google.cloud.documentai.v1.IDeployProcessorVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IDeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IDeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IDeployProcessorVersionMetadata + >, + 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.deployProcessorVersion( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `deployProcessorVersion()`. + * @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/v1/document_processor_service.deploy_processor_version.js + * region_tag:documentai_v1_generated_DocumentProcessorService_DeployProcessorVersion_async + */ + async checkDeployProcessorVersionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1.DeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.DeployProcessorVersionMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.deployProcessorVersion, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1.DeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.DeployProcessorVersionMetadata + >; + } + /** + * Undeploys the processor version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor version resource name to be undeployed. + * @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/v1/document_processor_service.undeploy_processor_version.js + * region_tag:documentai_v1_generated_DocumentProcessorService_UndeployProcessorVersion_async + */ + undeployProcessorVersion( + request?: protos.google.cloud.documentai.v1.IUndeployProcessorVersionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IUndeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + undeployProcessorVersion( + request: protos.google.cloud.documentai.v1.IUndeployProcessorVersionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IUndeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + undeployProcessorVersion( + request: protos.google.cloud.documentai.v1.IUndeployProcessorVersionRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IUndeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + undeployProcessorVersion( + request?: protos.google.cloud.documentai.v1.IUndeployProcessorVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IUndeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IUndeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IUndeployProcessorVersionMetadata + >, + 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.undeployProcessorVersion( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `undeployProcessorVersion()`. + * @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/v1/document_processor_service.undeploy_processor_version.js + * region_tag:documentai_v1_generated_DocumentProcessorService_UndeployProcessorVersion_async + */ + async checkUndeployProcessorVersionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1.UndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.UndeployProcessorVersionMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.undeployProcessorVersion, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1.UndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.UndeployProcessorVersionMetadata + >; + } + /** + * Deletes the processor, unloads all deployed model artifacts if it was + * enabled and then deletes all artifacts associated with this processor. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name to 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. + * 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/v1/document_processor_service.delete_processor.js + * region_tag:documentai_v1_generated_DocumentProcessorService_DeleteProcessor_async + */ + deleteProcessor( + request?: protos.google.cloud.documentai.v1.IDeleteProcessorRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteProcessor( + request: protos.google.cloud.documentai.v1.IDeleteProcessorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteProcessor( + request: protos.google.cloud.documentai.v1.IDeleteProcessorRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteProcessor( + request?: protos.google.cloud.documentai.v1.IDeleteProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorMetadata + >, + 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.deleteProcessor(request, options, callback); + } + /** + * Check the status of the long running operation returned by `deleteProcessor()`. + * @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/v1/document_processor_service.delete_processor.js + * region_tag:documentai_v1_generated_DocumentProcessorService_DeleteProcessor_async + */ + async checkDeleteProcessorProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.documentai.v1.DeleteProcessorMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.deleteProcessor, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.documentai.v1.DeleteProcessorMetadata + >; + } + /** + * Enables a processor + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name to be enabled. + * @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/v1/document_processor_service.enable_processor.js + * region_tag:documentai_v1_generated_DocumentProcessorService_EnableProcessor_async + */ + enableProcessor( + request?: protos.google.cloud.documentai.v1.IEnableProcessorRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IEnableProcessorResponse, + protos.google.cloud.documentai.v1.IEnableProcessorMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + enableProcessor( + request: protos.google.cloud.documentai.v1.IEnableProcessorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IEnableProcessorResponse, + protos.google.cloud.documentai.v1.IEnableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + enableProcessor( + request: protos.google.cloud.documentai.v1.IEnableProcessorRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IEnableProcessorResponse, + protos.google.cloud.documentai.v1.IEnableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + enableProcessor( + request?: protos.google.cloud.documentai.v1.IEnableProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1.IEnableProcessorResponse, + protos.google.cloud.documentai.v1.IEnableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1.IEnableProcessorResponse, + protos.google.cloud.documentai.v1.IEnableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IEnableProcessorResponse, + protos.google.cloud.documentai.v1.IEnableProcessorMetadata + >, + 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.enableProcessor(request, options, callback); + } + /** + * Check the status of the long running operation returned by `enableProcessor()`. + * @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/v1/document_processor_service.enable_processor.js + * region_tag:documentai_v1_generated_DocumentProcessorService_EnableProcessor_async + */ + async checkEnableProcessorProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1.EnableProcessorResponse, + protos.google.cloud.documentai.v1.EnableProcessorMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.enableProcessor, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1.EnableProcessorResponse, + protos.google.cloud.documentai.v1.EnableProcessorMetadata + >; + } + /** + * Disables a processor + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name to be disabled. + * @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/v1/document_processor_service.disable_processor.js + * region_tag:documentai_v1_generated_DocumentProcessorService_DisableProcessor_async + */ + disableProcessor( + request?: protos.google.cloud.documentai.v1.IDisableProcessorRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IDisableProcessorResponse, + protos.google.cloud.documentai.v1.IDisableProcessorMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + disableProcessor( + request: protos.google.cloud.documentai.v1.IDisableProcessorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IDisableProcessorResponse, + protos.google.cloud.documentai.v1.IDisableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + disableProcessor( + request: protos.google.cloud.documentai.v1.IDisableProcessorRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IDisableProcessorResponse, + protos.google.cloud.documentai.v1.IDisableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + disableProcessor( + request?: protos.google.cloud.documentai.v1.IDisableProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1.IDisableProcessorResponse, + protos.google.cloud.documentai.v1.IDisableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1.IDisableProcessorResponse, + protos.google.cloud.documentai.v1.IDisableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IDisableProcessorResponse, + protos.google.cloud.documentai.v1.IDisableProcessorMetadata + >, + 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.disableProcessor(request, options, callback); + } + /** + * Check the status of the long running operation returned by `disableProcessor()`. + * @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/v1/document_processor_service.disable_processor.js + * region_tag:documentai_v1_generated_DocumentProcessorService_DisableProcessor_async + */ + async checkDisableProcessorProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1.DisableProcessorResponse, + protos.google.cloud.documentai.v1.DisableProcessorMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.disableProcessor, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1.DisableProcessorResponse, + protos.google.cloud.documentai.v1.DisableProcessorMetadata + >; + } + /** + * Set the default (active) version of a {@link google.cloud.documentai.v1.Processor|Processor} that will be used in + * {@link google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument|ProcessDocument} and + * {@link google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments|BatchProcessDocuments}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.processor + * Required. The resource name of the {@link google.cloud.documentai.v1.Processor|Processor} to change default version. + * @param {string} request.defaultProcessorVersion + * Required. The resource name of child {@link google.cloud.documentai.v1.ProcessorVersion|ProcessorVersion} to use as default. + * Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}` + * @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/v1/document_processor_service.set_default_processor_version.js + * region_tag:documentai_v1_generated_DocumentProcessorService_SetDefaultProcessorVersion_async + */ + setDefaultProcessorVersion( + request?: protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + setDefaultProcessorVersion( + request: protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + setDefaultProcessorVersion( + request: protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + setDefaultProcessorVersion( + request?: protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata + >, + 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({ + processor: request.processor || '', + }); + this.initialize(); + return this.innerApiCalls.setDefaultProcessorVersion( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `setDefaultProcessorVersion()`. + * @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/v1/document_processor_service.set_default_processor_version.js + * region_tag:documentai_v1_generated_DocumentProcessorService_SetDefaultProcessorVersion_async + */ + async checkSetDefaultProcessorVersionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1.SetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.setDefaultProcessorVersion, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1.SetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + >; + } + /** + * Send a document for Human Review. The input document should be processed by + * the specified processor. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.documentai.v1.Document} request.inlineDocument + * An inline document proto. + * @param {string} request.humanReviewConfig + * Required. The resource name of the HumanReviewConfig that the document will be + * reviewed with. + * @param {boolean} request.enableSchemaValidation + * Whether the validation should be performed on the ad-hoc review request. + * @param {google.cloud.documentai.v1.ReviewDocumentRequest.Priority} request.priority + * The priority of the human review task. + * @param {google.cloud.documentai.v1.DocumentSchema} request.documentSchema + * The document schema of the human review task. + * @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/v1/document_processor_service.review_document.js + * region_tag:documentai_v1_generated_DocumentProcessorService_ReviewDocument_async + */ + reviewDocument( + request?: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + reviewDocument( + request: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + reviewDocument( + request: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + reviewDocument( + request?: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >, + 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({ + human_review_config: request.humanReviewConfig || '', + }); + this.initialize(); + return this.innerApiCalls.reviewDocument(request, options, callback); + } + /** + * Check the status of the long running operation returned by `reviewDocument()`. + * @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/v1/document_processor_service.review_document.js + * region_tag:documentai_v1_generated_DocumentProcessorService_ReviewDocument_async */ async checkReviewDocumentProgress( name: string @@ -753,21 +2267,881 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1.ReviewDocumentResponse, protos.google.cloud.documentai.v1.ReviewDocumentOperationMetadata > - > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( - operation, - this.descriptors.longrunning.reviewDocument, - gax.createDefaultBackoffSettings() + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.reviewDocument, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1.ReviewDocumentResponse, + protos.google.cloud.documentai.v1.ReviewDocumentOperationMetadata + >; + } + /** + * Lists the processor types that exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location of processor type to list. + * The available processor types may depend on the allow-listing on projects. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of processor types to return. + * If unspecified, at most 100 processor types will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + * @param {string} request.pageToken + * Used to retrieve the next page of results, empty if at the end of the list. + * @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 [ProcessorType]{@link google.cloud.documentai.v1.ProcessorType}. + * 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 `listProcessorTypesAsync()` + * 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. + */ + listProcessorTypes( + request?: protos.google.cloud.documentai.v1.IListProcessorTypesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessorType[], + protos.google.cloud.documentai.v1.IListProcessorTypesRequest | null, + protos.google.cloud.documentai.v1.IListProcessorTypesResponse + ] + >; + listProcessorTypes( + request: protos.google.cloud.documentai.v1.IListProcessorTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorTypesRequest, + | protos.google.cloud.documentai.v1.IListProcessorTypesResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessorType + > + ): void; + listProcessorTypes( + request: protos.google.cloud.documentai.v1.IListProcessorTypesRequest, + callback: PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorTypesRequest, + | protos.google.cloud.documentai.v1.IListProcessorTypesResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessorType + > + ): void; + listProcessorTypes( + request?: protos.google.cloud.documentai.v1.IListProcessorTypesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorTypesRequest, + | protos.google.cloud.documentai.v1.IListProcessorTypesResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessorType + >, + callback?: PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorTypesRequest, + | protos.google.cloud.documentai.v1.IListProcessorTypesResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessorType + > + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessorType[], + protos.google.cloud.documentai.v1.IListProcessorTypesRequest | null, + protos.google.cloud.documentai.v1.IListProcessorTypesResponse + ] + > | 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.listProcessorTypes(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 location of processor type to list. + * The available processor types may depend on the allow-listing on projects. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of processor types to return. + * If unspecified, at most 100 processor types will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + * @param {string} request.pageToken + * Used to retrieve the next page of results, empty if at the end of the list. + * @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 [ProcessorType]{@link google.cloud.documentai.v1.ProcessorType} 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 `listProcessorTypesAsync()` + * 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. + */ + listProcessorTypesStream( + request?: protos.google.cloud.documentai.v1.IListProcessorTypesRequest, + 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['listProcessorTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listProcessorTypes.createStream( + this.innerApiCalls.listProcessorTypes as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listProcessorTypes`, 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 location of processor type to list. + * The available processor types may depend on the allow-listing on projects. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of processor types to return. + * If unspecified, at most 100 processor types will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + * @param {string} request.pageToken + * Used to retrieve the next page of results, empty if at the end of the list. + * @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 + * [ProcessorType]{@link google.cloud.documentai.v1.ProcessorType}. 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/v1/document_processor_service.list_processor_types.js + * region_tag:documentai_v1_generated_DocumentProcessorService_ListProcessorTypes_async + */ + listProcessorTypesAsync( + request?: protos.google.cloud.documentai.v1.IListProcessorTypesRequest, + 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['listProcessorTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listProcessorTypes.asyncIterate( + this.innerApiCalls['listProcessorTypes'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists all processors which belong to this project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) which owns this collection of Processors. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of processors to return. + * If unspecified, at most 50 processors will be returned. + * The maximum value is 100; values above 100 will be coerced to 100. + * @param {string} request.pageToken + * We will return the processors sorted by creation time. The page token + * will point to the next processor. + * @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 [Processor]{@link google.cloud.documentai.v1.Processor}. + * 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 `listProcessorsAsync()` + * 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. + */ + listProcessors( + request?: protos.google.cloud.documentai.v1.IListProcessorsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessor[], + protos.google.cloud.documentai.v1.IListProcessorsRequest | null, + protos.google.cloud.documentai.v1.IListProcessorsResponse + ] + >; + listProcessors( + request: protos.google.cloud.documentai.v1.IListProcessorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorsRequest, + | protos.google.cloud.documentai.v1.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessor + > + ): void; + listProcessors( + request: protos.google.cloud.documentai.v1.IListProcessorsRequest, + callback: PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorsRequest, + | protos.google.cloud.documentai.v1.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessor + > + ): void; + listProcessors( + request?: protos.google.cloud.documentai.v1.IListProcessorsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorsRequest, + | protos.google.cloud.documentai.v1.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessor + >, + callback?: PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorsRequest, + | protos.google.cloud.documentai.v1.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessor + > + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessor[], + protos.google.cloud.documentai.v1.IListProcessorsRequest | null, + protos.google.cloud.documentai.v1.IListProcessorsResponse + ] + > | 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.listProcessors(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 (project and location) which owns this collection of Processors. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of processors to return. + * If unspecified, at most 50 processors will be returned. + * The maximum value is 100; values above 100 will be coerced to 100. + * @param {string} request.pageToken + * We will return the processors sorted by creation time. The page token + * will point to the next processor. + * @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 [Processor]{@link google.cloud.documentai.v1.Processor} 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 `listProcessorsAsync()` + * 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. + */ + listProcessorsStream( + request?: protos.google.cloud.documentai.v1.IListProcessorsRequest, + 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['listProcessors']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listProcessors.createStream( + this.innerApiCalls.listProcessors as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listProcessors`, 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 (project and location) which owns this collection of Processors. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of processors to return. + * If unspecified, at most 50 processors will be returned. + * The maximum value is 100; values above 100 will be coerced to 100. + * @param {string} request.pageToken + * We will return the processors sorted by creation time. The page token + * will point to the next processor. + * @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 + * [Processor]{@link google.cloud.documentai.v1.Processor}. 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/v1/document_processor_service.list_processors.js + * region_tag:documentai_v1_generated_DocumentProcessorService_ListProcessors_async + */ + listProcessorsAsync( + request?: protos.google.cloud.documentai.v1.IListProcessorsRequest, + 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['listProcessors']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listProcessors.asyncIterate( + this.innerApiCalls['listProcessors'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists all versions of a processor. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project, location and processor) to list all versions. + * Format: `projects/{project}/locations/{location}/processors/{processor}` + * @param {number} request.pageSize + * The maximum number of processor versions to return. + * If unspecified, at most 10 processor versions will be returned. + * The maximum value is 20; values above 20 will be coerced to 20. + * @param {string} request.pageToken + * We will return the processor versions sorted by creation time. The page + * token will point to the next processor version. + * @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 [ProcessorVersion]{@link google.cloud.documentai.v1.ProcessorVersion}. + * 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 `listProcessorVersionsAsync()` + * 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. + */ + listProcessorVersions( + request?: protos.google.cloud.documentai.v1.IListProcessorVersionsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessorVersion[], + protos.google.cloud.documentai.v1.IListProcessorVersionsRequest | null, + protos.google.cloud.documentai.v1.IListProcessorVersionsResponse + ] + >; + listProcessorVersions( + request: protos.google.cloud.documentai.v1.IListProcessorVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorVersionsRequest, + | protos.google.cloud.documentai.v1.IListProcessorVersionsResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessorVersion + > + ): void; + listProcessorVersions( + request: protos.google.cloud.documentai.v1.IListProcessorVersionsRequest, + callback: PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorVersionsRequest, + | protos.google.cloud.documentai.v1.IListProcessorVersionsResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessorVersion + > + ): void; + listProcessorVersions( + request?: protos.google.cloud.documentai.v1.IListProcessorVersionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorVersionsRequest, + | protos.google.cloud.documentai.v1.IListProcessorVersionsResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessorVersion + >, + callback?: PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorVersionsRequest, + | protos.google.cloud.documentai.v1.IListProcessorVersionsResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessorVersion + > + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessorVersion[], + protos.google.cloud.documentai.v1.IListProcessorVersionsRequest | null, + protos.google.cloud.documentai.v1.IListProcessorVersionsResponse + ] + > | 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.listProcessorVersions(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 (project, location and processor) to list all versions. + * Format: `projects/{project}/locations/{location}/processors/{processor}` + * @param {number} request.pageSize + * The maximum number of processor versions to return. + * If unspecified, at most 10 processor versions will be returned. + * The maximum value is 20; values above 20 will be coerced to 20. + * @param {string} request.pageToken + * We will return the processor versions sorted by creation time. The page + * token will point to the next processor version. + * @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 [ProcessorVersion]{@link google.cloud.documentai.v1.ProcessorVersion} 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 `listProcessorVersionsAsync()` + * 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. + */ + listProcessorVersionsStream( + request?: protos.google.cloud.documentai.v1.IListProcessorVersionsRequest, + 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['listProcessorVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listProcessorVersions.createStream( + this.innerApiCalls.listProcessorVersions as gax.GaxCall, + request, + callSettings ); - return decodeOperation as LROperation< - protos.google.cloud.documentai.v1.ReviewDocumentResponse, - protos.google.cloud.documentai.v1.ReviewDocumentOperationMetadata - >; } + + /** + * Equivalent to `listProcessorVersions`, 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 (project, location and processor) to list all versions. + * Format: `projects/{project}/locations/{location}/processors/{processor}` + * @param {number} request.pageSize + * The maximum number of processor versions to return. + * If unspecified, at most 10 processor versions will be returned. + * The maximum value is 20; values above 20 will be coerced to 20. + * @param {string} request.pageToken + * We will return the processor versions sorted by creation time. The page + * token will point to the next processor version. + * @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 + * [ProcessorVersion]{@link google.cloud.documentai.v1.ProcessorVersion}. 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/v1/document_processor_service.list_processor_versions.js + * region_tag:documentai_v1_generated_DocumentProcessorService_ListProcessorVersions_async + */ + listProcessorVersionsAsync( + request?: protos.google.cloud.documentai.v1.IListProcessorVersionsRequest, + 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['listProcessorVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listProcessorVersions.asyncIterate( + this.innerApiCalls['listProcessorVersions'] 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 -- // -------------------- @@ -827,6 +3201,42 @@ export class DocumentProcessorServiceClient { ).processor; } + /** + * 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 processor resource name string. * @@ -879,6 +3289,156 @@ export class DocumentProcessorServiceClient { .processor; } + /** + * Return a fully-qualified processorType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} processor_type + * @returns {string} Resource name string. + */ + processorTypePath(project: string, location: string, processorType: string) { + return this.pathTemplates.processorTypePathTemplate.render({ + project: project, + location: location, + processor_type: processorType, + }); + } + + /** + * Parse the project from ProcessorType resource. + * + * @param {string} processorTypeName + * A fully-qualified path representing ProcessorType resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProcessorTypeName(processorTypeName: string) { + return this.pathTemplates.processorTypePathTemplate.match(processorTypeName) + .project; + } + + /** + * Parse the location from ProcessorType resource. + * + * @param {string} processorTypeName + * A fully-qualified path representing ProcessorType resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProcessorTypeName(processorTypeName: string) { + return this.pathTemplates.processorTypePathTemplate.match(processorTypeName) + .location; + } + + /** + * Parse the processor_type from ProcessorType resource. + * + * @param {string} processorTypeName + * A fully-qualified path representing ProcessorType resource. + * @returns {string} A string representing the processor_type. + */ + matchProcessorTypeFromProcessorTypeName(processorTypeName: string) { + return this.pathTemplates.processorTypePathTemplate.match(processorTypeName) + .processor_type; + } + + /** + * Return a fully-qualified processorVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} processor + * @param {string} processor_version + * @returns {string} Resource name string. + */ + processorVersionPath( + project: string, + location: string, + processor: string, + processorVersion: string + ) { + return this.pathTemplates.processorVersionPathTemplate.render({ + project: project, + location: location, + processor: processor, + processor_version: processorVersion, + }); + } + + /** + * Parse the project from ProcessorVersion resource. + * + * @param {string} processorVersionName + * A fully-qualified path representing ProcessorVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProcessorVersionName(processorVersionName: string) { + return this.pathTemplates.processorVersionPathTemplate.match( + processorVersionName + ).project; + } + + /** + * Parse the location from ProcessorVersion resource. + * + * @param {string} processorVersionName + * A fully-qualified path representing ProcessorVersion resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProcessorVersionName(processorVersionName: string) { + return this.pathTemplates.processorVersionPathTemplate.match( + processorVersionName + ).location; + } + + /** + * Parse the processor from ProcessorVersion resource. + * + * @param {string} processorVersionName + * A fully-qualified path representing ProcessorVersion resource. + * @returns {string} A string representing the processor. + */ + matchProcessorFromProcessorVersionName(processorVersionName: string) { + return this.pathTemplates.processorVersionPathTemplate.match( + processorVersionName + ).processor; + } + + /** + * Parse the processor_version from ProcessorVersion resource. + * + * @param {string} processorVersionName + * A fully-qualified path representing ProcessorVersion resource. + * @returns {string} A string representing the processor_version. + */ + matchProcessorVersionFromProcessorVersionName(processorVersionName: string) { + return this.pathTemplates.processorVersionPathTemplate.match( + processorVersionName + ).processor_version; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + /** * Terminate the gRPC channel and close the client. * @@ -890,6 +3450,7 @@ export class DocumentProcessorServiceClient { return this.documentProcessorServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); this.operationsClient.close(); }); } diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client_config.json b/packages/google-cloud-documentai/src/v1/document_processor_service_client_config.json index 0ded43290cc..d5b952a9834 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client_config.json +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client_config.json @@ -30,6 +30,62 @@ "retry_codes_name": "idempotent", "retry_params_name": "default" }, + "FetchProcessorTypes": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListProcessorTypes": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListProcessors": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetProcessor": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetProcessorVersion": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListProcessorVersions": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteProcessorVersion": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeployProcessorVersion": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UndeployProcessorVersion": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateProcessor": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteProcessor": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "EnableProcessor": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DisableProcessor": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetDefaultProcessorVersion": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "ReviewDocument": { "timeout_millis": 120000, "retry_codes_name": "idempotent", diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_proto_list.json b/packages/google-cloud-documentai/src/v1/document_processor_service_proto_list.json index 49fea13a704..a19f0a8b0ca 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_proto_list.json +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_proto_list.json @@ -1,7 +1,11 @@ [ + "../../protos/google/cloud/documentai/v1/barcode.proto", "../../protos/google/cloud/documentai/v1/document.proto", "../../protos/google/cloud/documentai/v1/document_io.proto", "../../protos/google/cloud/documentai/v1/document_processor_service.proto", + "../../protos/google/cloud/documentai/v1/document_schema.proto", "../../protos/google/cloud/documentai/v1/geometry.proto", - "../../protos/google/cloud/documentai/v1/operation_metadata.proto" + "../../protos/google/cloud/documentai/v1/operation_metadata.proto", + "../../protos/google/cloud/documentai/v1/processor.proto", + "../../protos/google/cloud/documentai/v1/processor_type.proto" ] diff --git a/packages/google-cloud-documentai/src/v1/gapic_metadata.json b/packages/google-cloud-documentai/src/v1/gapic_metadata.json index 05ebff671a8..0c0e9a859b2 100644 --- a/packages/google-cloud-documentai/src/v1/gapic_metadata.json +++ b/packages/google-cloud-documentai/src/v1/gapic_metadata.json @@ -15,15 +15,91 @@ "processDocument" ] }, + "FetchProcessorTypes": { + "methods": [ + "fetchProcessorTypes" + ] + }, + "GetProcessor": { + "methods": [ + "getProcessor" + ] + }, + "GetProcessorVersion": { + "methods": [ + "getProcessorVersion" + ] + }, + "CreateProcessor": { + "methods": [ + "createProcessor" + ] + }, "BatchProcessDocuments": { "methods": [ "batchProcessDocuments" ] }, + "DeleteProcessorVersion": { + "methods": [ + "deleteProcessorVersion" + ] + }, + "DeployProcessorVersion": { + "methods": [ + "deployProcessorVersion" + ] + }, + "UndeployProcessorVersion": { + "methods": [ + "undeployProcessorVersion" + ] + }, + "DeleteProcessor": { + "methods": [ + "deleteProcessor" + ] + }, + "EnableProcessor": { + "methods": [ + "enableProcessor" + ] + }, + "DisableProcessor": { + "methods": [ + "disableProcessor" + ] + }, + "SetDefaultProcessorVersion": { + "methods": [ + "setDefaultProcessorVersion" + ] + }, "ReviewDocument": { "methods": [ "reviewDocument" ] + }, + "ListProcessorTypes": { + "methods": [ + "listProcessorTypes", + "listProcessorTypesStream", + "listProcessorTypesAsync" + ] + }, + "ListProcessors": { + "methods": [ + "listProcessors", + "listProcessorsStream", + "listProcessorsAsync" + ] + }, + "ListProcessorVersions": { + "methods": [ + "listProcessorVersions", + "listProcessorVersionsStream", + "listProcessorVersionsAsync" + ] } } }, @@ -35,15 +111,91 @@ "processDocument" ] }, + "FetchProcessorTypes": { + "methods": [ + "fetchProcessorTypes" + ] + }, + "GetProcessor": { + "methods": [ + "getProcessor" + ] + }, + "GetProcessorVersion": { + "methods": [ + "getProcessorVersion" + ] + }, + "CreateProcessor": { + "methods": [ + "createProcessor" + ] + }, "BatchProcessDocuments": { "methods": [ "batchProcessDocuments" ] }, + "DeleteProcessorVersion": { + "methods": [ + "deleteProcessorVersion" + ] + }, + "DeployProcessorVersion": { + "methods": [ + "deployProcessorVersion" + ] + }, + "UndeployProcessorVersion": { + "methods": [ + "undeployProcessorVersion" + ] + }, + "DeleteProcessor": { + "methods": [ + "deleteProcessor" + ] + }, + "EnableProcessor": { + "methods": [ + "enableProcessor" + ] + }, + "DisableProcessor": { + "methods": [ + "disableProcessor" + ] + }, + "SetDefaultProcessorVersion": { + "methods": [ + "setDefaultProcessorVersion" + ] + }, "ReviewDocument": { "methods": [ "reviewDocument" ] + }, + "ListProcessorTypes": { + "methods": [ + "listProcessorTypes", + "listProcessorTypesStream", + "listProcessorTypesAsync" + ] + }, + "ListProcessors": { + "methods": [ + "listProcessors", + "listProcessorsStream", + "listProcessorsAsync" + ] + }, + "ListProcessorVersions": { + "methods": [ + "listProcessorVersions", + "listProcessorVersionsStream", + "listProcessorVersionsAsync" + ] } } } diff --git a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts index de45bc4c5cc..83450a64348 100644 --- a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts @@ -23,7 +23,14 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as documentprocessorserviceModule from '../src'; -import {protobuf, LROperation, operationsProtos} from 'google-gax'; +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -81,6 +88,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('v1.DocumentProcessorServiceClient', () => { it('has servicePath', () => { const servicePath = @@ -319,8 +387,8 @@ describe('v1.DocumentProcessorServiceClient', () => { }); }); - describe('batchProcessDocuments', () => { - it('invokes batchProcessDocuments without error', async () => { + describe('fetchProcessorTypes', () => { + it('invokes fetchProcessorTypes without error', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -328,10 +396,10 @@ describe('v1.DocumentProcessorServiceClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1.BatchProcessRequest() + new protos.google.cloud.documentai.v1.FetchProcessorTypesRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; const expectedOptions = { otherArgs: { headers: { @@ -340,21 +408,20 @@ describe('v1.DocumentProcessorServiceClient', () => { }, }; const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() + new protos.google.cloud.documentai.v1.FetchProcessorTypesResponse() ); - client.innerApiCalls.batchProcessDocuments = - stubLongRunningCall(expectedResponse); - const [operation] = await client.batchProcessDocuments(request); - const [response] = await operation.promise(); + client.innerApiCalls.fetchProcessorTypes = + stubSimpleCall(expectedResponse); + const [response] = await client.fetchProcessorTypes(request); assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) + (client.innerApiCalls.fetchProcessorTypes as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes batchProcessDocuments without error using callback', async () => { + it('invokes fetchProcessorTypes without error using callback', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -362,10 +429,10 @@ describe('v1.DocumentProcessorServiceClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1.BatchProcessRequest() + new protos.google.cloud.documentai.v1.FetchProcessorTypesRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; const expectedOptions = { otherArgs: { headers: { @@ -374,19 +441,16 @@ describe('v1.DocumentProcessorServiceClient', () => { }, }; const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() + new protos.google.cloud.documentai.v1.FetchProcessorTypesResponse() ); - client.innerApiCalls.batchProcessDocuments = - stubLongRunningCallWithCallback(expectedResponse); + client.innerApiCalls.fetchProcessorTypes = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.batchProcessDocuments( + client.fetchProcessorTypes( request, ( err?: Error | null, - result?: LROperation< - protos.google.cloud.documentai.v1.IBatchProcessResponse, - protos.google.cloud.documentai.v1.IBatchProcessMetadata - > | null + result?: protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse | null ) => { if (err) { reject(err); @@ -396,20 +460,16 @@ describe('v1.DocumentProcessorServiceClient', () => { } ); }); - const operation = (await promise) as LROperation< - protos.google.cloud.documentai.v1.IBatchProcessResponse, - protos.google.cloud.documentai.v1.IBatchProcessMetadata - >; - const [response] = await operation.promise(); + const response = await promise; assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) + (client.innerApiCalls.fetchProcessorTypes as SinonStub) .getCall(0) .calledWith(request, expectedOptions /*, callback defined above */) ); }); - it('invokes batchProcessDocuments with call error', async () => { + it('invokes fetchProcessorTypes with error', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -417,10 +477,10 @@ describe('v1.DocumentProcessorServiceClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1.BatchProcessRequest() + new protos.google.cloud.documentai.v1.FetchProcessorTypesRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; const expectedOptions = { otherArgs: { headers: { @@ -429,22 +489,19 @@ describe('v1.DocumentProcessorServiceClient', () => { }, }; const expectedError = new Error('expected'); - client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( + client.innerApiCalls.fetchProcessorTypes = stubSimpleCall( undefined, expectedError ); - await assert.rejects( - client.batchProcessDocuments(request), - expectedError - ); + await assert.rejects(client.fetchProcessorTypes(request), expectedError); assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) + (client.innerApiCalls.fetchProcessorTypes as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes batchProcessDocuments with LRO error', async () => { + it('invokes fetchProcessorTypes with closed client', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -452,7 +509,25 @@ describe('v1.DocumentProcessorServiceClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1.BatchProcessRequest() + new protos.google.cloud.documentai.v1.FetchProcessorTypesRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.fetchProcessorTypes(request), expectedError); + }); + }); + + describe('getProcessor', () => { + it('invokes getProcessor without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.GetProcessorRequest() ); request.name = ''; const expectedHeaderRequestParams = 'name='; @@ -463,67 +538,118 @@ describe('v1.DocumentProcessorServiceClient', () => { }, }, }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( - undefined, - undefined, - expectedError + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() ); - const [operation] = await client.batchProcessDocuments(request); - await assert.rejects(operation.promise(), expectedError); + client.innerApiCalls.getProcessor = stubSimpleCall(expectedResponse); + const [response] = await client.getProcessor(request); + assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) + (client.innerApiCalls.getProcessor as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes checkBatchProcessDocumentsProgress without error', async () => { + it('invokes getProcessor without error using callback', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.GetProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() + new protos.google.cloud.documentai.v1.Processor() ); - 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.checkBatchProcessDocumentsProgress( - expectedResponse.name + client.innerApiCalls.getProcessor = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getProcessor( + request, + ( + err?: Error | null, + result?: protos.google.cloud.documentai.v1.IProcessor | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - it('invokes checkBatchProcessDocumentsProgress with error', async () => { + it('invokes getProcessor with error', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.GetProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( + client.innerApiCalls.getProcessor = stubSimpleCall( undefined, expectedError ); - await assert.rejects( - client.checkBatchProcessDocumentsProgress(''), - expectedError + await assert.rejects(client.getProcessor(request), expectedError); + assert( + (client.innerApiCalls.getProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes getProcessor with closed client', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.GetProcessorRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getProcessor(request), expectedError); }); }); - describe('reviewDocument', () => { - it('invokes reviewDocument without error', async () => { + describe('getProcessorVersion', () => { + it('invokes getProcessorVersion without error', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -531,10 +657,10 @@ describe('v1.DocumentProcessorServiceClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1.ReviewDocumentRequest() + new protos.google.cloud.documentai.v1.GetProcessorVersionRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; + request.name = ''; + const expectedHeaderRequestParams = 'name='; const expectedOptions = { otherArgs: { headers: { @@ -543,21 +669,20 @@ describe('v1.DocumentProcessorServiceClient', () => { }, }; const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() + new protos.google.cloud.documentai.v1.ProcessorVersion() ); - client.innerApiCalls.reviewDocument = - stubLongRunningCall(expectedResponse); - const [operation] = await client.reviewDocument(request); - const [response] = await operation.promise(); + client.innerApiCalls.getProcessorVersion = + stubSimpleCall(expectedResponse); + const [response] = await client.getProcessorVersion(request); assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.reviewDocument as SinonStub) + (client.innerApiCalls.getProcessorVersion as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes reviewDocument without error using callback', async () => { + it('invokes getProcessorVersion without error using callback', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -565,10 +690,10 @@ describe('v1.DocumentProcessorServiceClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1.ReviewDocumentRequest() + new protos.google.cloud.documentai.v1.GetProcessorVersionRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; + request.name = ''; + const expectedHeaderRequestParams = 'name='; const expectedOptions = { otherArgs: { headers: { @@ -577,19 +702,16 @@ describe('v1.DocumentProcessorServiceClient', () => { }, }; const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() + new protos.google.cloud.documentai.v1.ProcessorVersion() ); - client.innerApiCalls.reviewDocument = - stubLongRunningCallWithCallback(expectedResponse); + client.innerApiCalls.getProcessorVersion = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.reviewDocument( + client.getProcessorVersion( request, ( err?: Error | null, - result?: LROperation< - protos.google.cloud.documentai.v1.IReviewDocumentResponse, - protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata - > | null + result?: protos.google.cloud.documentai.v1.IProcessorVersion | null ) => { if (err) { reject(err); @@ -599,20 +721,16 @@ describe('v1.DocumentProcessorServiceClient', () => { } ); }); - const operation = (await promise) as LROperation< - protos.google.cloud.documentai.v1.IReviewDocumentResponse, - protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata - >; - const [response] = await operation.promise(); + const response = await promise; assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.reviewDocument as SinonStub) + (client.innerApiCalls.getProcessorVersion as SinonStub) .getCall(0) .calledWith(request, expectedOptions /*, callback defined above */) ); }); - it('invokes reviewDocument with call error', async () => { + it('invokes getProcessorVersion with error', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -620,10 +738,10 @@ describe('v1.DocumentProcessorServiceClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1.ReviewDocumentRequest() + new protos.google.cloud.documentai.v1.GetProcessorVersionRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; + request.name = ''; + const expectedHeaderRequestParams = 'name='; const expectedOptions = { otherArgs: { headers: { @@ -632,19 +750,19 @@ describe('v1.DocumentProcessorServiceClient', () => { }, }; const expectedError = new Error('expected'); - client.innerApiCalls.reviewDocument = stubLongRunningCall( + client.innerApiCalls.getProcessorVersion = stubSimpleCall( undefined, expectedError ); - await assert.rejects(client.reviewDocument(request), expectedError); + await assert.rejects(client.getProcessorVersion(request), expectedError); assert( - (client.innerApiCalls.reviewDocument as SinonStub) + (client.innerApiCalls.getProcessorVersion as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes reviewDocument with LRO error', async () => { + it('invokes getProcessorVersion with closed client', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -652,10 +770,28 @@ describe('v1.DocumentProcessorServiceClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1.ReviewDocumentRequest() + new protos.google.cloud.documentai.v1.GetProcessorVersionRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getProcessorVersion(request), expectedError); + }); + }); + + describe('createProcessor', () => { + it('invokes createProcessor without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.CreateProcessorRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; const expectedOptions = { otherArgs: { headers: { @@ -663,62 +799,3403 @@ describe('v1.DocumentProcessorServiceClient', () => { }, }, }; - const expectedError = new Error('expected'); - client.innerApiCalls.reviewDocument = stubLongRunningCall( - undefined, - undefined, - expectedError + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() ); - const [operation] = await client.reviewDocument(request); - await assert.rejects(operation.promise(), expectedError); + client.innerApiCalls.createProcessor = stubSimpleCall(expectedResponse); + const [response] = await client.createProcessor(request); + assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.reviewDocument as SinonStub) + (client.innerApiCalls.createProcessor as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes checkReviewDocumentProgress without error', async () => { + it('invokes createProcessor without error using callback', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.CreateProcessorRequest() ); - 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.checkReviewDocumentProgress( - expectedResponse.name + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ); + client.innerApiCalls.createProcessor = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createProcessor( + request, + ( + err?: Error | null, + result?: protos.google.cloud.documentai.v1.IProcessor | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createProcessor with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.CreateProcessorRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createProcessor = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createProcessor(request), expectedError); + assert( + (client.innerApiCalls.createProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createProcessor with closed client', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.CreateProcessorRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createProcessor(request), expectedError); + }); + }); + + describe('batchProcessDocuments', () => { + it('invokes batchProcessDocuments without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.BatchProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchProcessDocuments = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchProcessDocuments(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes batchProcessDocuments without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.BatchProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchProcessDocuments = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchProcessDocuments( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes batchProcessDocuments with call error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.BatchProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.batchProcessDocuments(request), + expectedError + ); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes batchProcessDocuments with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.BatchProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchProcessDocuments(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkBatchProcessDocumentsProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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.checkBatchProcessDocumentsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchProcessDocumentsProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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.checkBatchProcessDocumentsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteProcessorVersion', () => { + it('invokes deleteProcessorVersion without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeleteProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteProcessorVersion = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteProcessorVersion(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteProcessorVersion without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeleteProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteProcessorVersion = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteProcessorVersion( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorVersionMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorVersionMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteProcessorVersion with call error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeleteProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteProcessorVersion = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.deleteProcessorVersion(request), + expectedError + ); + assert( + (client.innerApiCalls.deleteProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteProcessorVersion with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeleteProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteProcessorVersion = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteProcessorVersion(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.deleteProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkDeleteProcessorVersionProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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.checkDeleteProcessorVersionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteProcessorVersionProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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.checkDeleteProcessorVersionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deployProcessorVersion', () => { + it('invokes deployProcessorVersion without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeployProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deployProcessorVersion = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deployProcessorVersion(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deployProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deployProcessorVersion without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeployProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deployProcessorVersion = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deployProcessorVersion( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IDeployProcessorVersionMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IDeployProcessorVersionMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deployProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deployProcessorVersion with call error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeployProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deployProcessorVersion = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.deployProcessorVersion(request), + expectedError + ); + assert( + (client.innerApiCalls.deployProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deployProcessorVersion with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeployProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deployProcessorVersion = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deployProcessorVersion(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.deployProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkDeployProcessorVersionProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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.checkDeployProcessorVersionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeployProcessorVersionProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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.checkDeployProcessorVersionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('undeployProcessorVersion', () => { + it('invokes undeployProcessorVersion without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.UndeployProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.undeployProcessorVersion = + stubLongRunningCall(expectedResponse); + const [operation] = await client.undeployProcessorVersion(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.undeployProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes undeployProcessorVersion without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.UndeployProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.undeployProcessorVersion = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.undeployProcessorVersion( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IUndeployProcessorVersionMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IUndeployProcessorVersionMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.undeployProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes undeployProcessorVersion with call error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.UndeployProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.undeployProcessorVersion = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.undeployProcessorVersion(request), + expectedError + ); + assert( + (client.innerApiCalls.undeployProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes undeployProcessorVersion with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.UndeployProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.undeployProcessorVersion = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.undeployProcessorVersion(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.undeployProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkUndeployProcessorVersionProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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.checkUndeployProcessorVersionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUndeployProcessorVersionProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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.checkUndeployProcessorVersionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteProcessor', () => { + it('invokes deleteProcessor without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeleteProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteProcessor = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteProcessor(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteProcessor without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeleteProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteProcessor = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteProcessor( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteProcessor with call error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeleteProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteProcessor = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteProcessor(request), expectedError); + assert( + (client.innerApiCalls.deleteProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteProcessor with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeleteProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteProcessor = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteProcessor(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.deleteProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkDeleteProcessorProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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.checkDeleteProcessorProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteProcessorProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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.checkDeleteProcessorProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('enableProcessor', () => { + it('invokes enableProcessor without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.EnableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.enableProcessor = + stubLongRunningCall(expectedResponse); + const [operation] = await client.enableProcessor(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.enableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes enableProcessor without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.EnableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.enableProcessor = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.enableProcessor( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1.IEnableProcessorResponse, + protos.google.cloud.documentai.v1.IEnableProcessorMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1.IEnableProcessorResponse, + protos.google.cloud.documentai.v1.IEnableProcessorMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.enableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes enableProcessor with call error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.EnableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.enableProcessor = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.enableProcessor(request), expectedError); + assert( + (client.innerApiCalls.enableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes enableProcessor with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.EnableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.enableProcessor = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.enableProcessor(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.enableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkEnableProcessorProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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.checkEnableProcessorProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkEnableProcessorProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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.checkEnableProcessorProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('disableProcessor', () => { + it('invokes disableProcessor without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DisableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.disableProcessor = + stubLongRunningCall(expectedResponse); + const [operation] = await client.disableProcessor(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.disableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes disableProcessor without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DisableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.disableProcessor = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.disableProcessor( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1.IDisableProcessorResponse, + protos.google.cloud.documentai.v1.IDisableProcessorMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1.IDisableProcessorResponse, + protos.google.cloud.documentai.v1.IDisableProcessorMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.disableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes disableProcessor with call error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DisableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.disableProcessor = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.disableProcessor(request), expectedError); + assert( + (client.innerApiCalls.disableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes disableProcessor with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DisableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.disableProcessor = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.disableProcessor(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.disableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkDisableProcessorProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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.checkDisableProcessorProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDisableProcessorProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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.checkDisableProcessorProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('setDefaultProcessorVersion', () => { + it('invokes setDefaultProcessorVersion without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest() + ); + request.processor = ''; + const expectedHeaderRequestParams = 'processor='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.setDefaultProcessorVersion = + stubLongRunningCall(expectedResponse); + const [operation] = await client.setDefaultProcessorVersion(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setDefaultProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes setDefaultProcessorVersion without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest() + ); + request.processor = ''; + const expectedHeaderRequestParams = 'processor='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.setDefaultProcessorVersion = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setDefaultProcessorVersion( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setDefaultProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes setDefaultProcessorVersion with call error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest() + ); + request.processor = ''; + const expectedHeaderRequestParams = 'processor='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setDefaultProcessorVersion = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.setDefaultProcessorVersion(request), + expectedError + ); + assert( + (client.innerApiCalls.setDefaultProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes setDefaultProcessorVersion with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest() + ); + request.processor = ''; + const expectedHeaderRequestParams = 'processor='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setDefaultProcessorVersion = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.setDefaultProcessorVersion(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.setDefaultProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkSetDefaultProcessorVersionProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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.checkSetDefaultProcessorVersionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkSetDefaultProcessorVersionProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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.checkSetDefaultProcessorVersionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('reviewDocument', () => { + it('invokes reviewDocument without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reviewDocument = + stubLongRunningCall(expectedResponse); + const [operation] = await client.reviewDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes reviewDocument without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reviewDocument = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.reviewDocument( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes reviewDocument with call error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.reviewDocument = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.reviewDocument(request), expectedError); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes reviewDocument with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.reviewDocument = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.reviewDocument(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkReviewDocumentProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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.checkReviewDocumentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkReviewDocumentProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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.checkReviewDocumentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listProcessorTypes', () => { + it('invokes listProcessorTypes without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + ]; + client.innerApiCalls.listProcessorTypes = + stubSimpleCall(expectedResponse); + const [response] = await client.listProcessorTypes(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProcessorTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProcessorTypes without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + ]; + client.innerApiCalls.listProcessorTypes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listProcessorTypes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.documentai.v1.IProcessorType[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProcessorTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listProcessorTypes with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listProcessorTypes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listProcessorTypes(request), expectedError); + assert( + (client.innerApiCalls.listProcessorTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProcessorTypesStream without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + ]; + client.descriptors.page.listProcessorTypes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listProcessorTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.documentai.v1.ProcessorType[] = []; + stream.on( + 'data', + (response: protos.google.cloud.documentai.v1.ProcessorType) => { + 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.listProcessorTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessorTypes, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorTypes.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listProcessorTypesStream with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessorTypes.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listProcessorTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.documentai.v1.ProcessorType[] = []; + stream.on( + 'data', + (response: protos.google.cloud.documentai.v1.ProcessorType) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listProcessorTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessorTypes, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorTypes.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProcessorTypes without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + ]; + client.descriptors.page.listProcessorTypes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.documentai.v1.IProcessorType[] = []; + const iterable = client.listProcessorTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProcessorTypes with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessorTypes.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listProcessorTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.documentai.v1.IProcessorType[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listProcessors', () => { + it('invokes listProcessors without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + ]; + client.innerApiCalls.listProcessors = stubSimpleCall(expectedResponse); + const [response] = await client.listProcessors(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProcessors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProcessors without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + ]; + client.innerApiCalls.listProcessors = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listProcessors( + request, + ( + err?: Error | null, + result?: protos.google.cloud.documentai.v1.IProcessor[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProcessors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listProcessors with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listProcessors = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listProcessors(request), expectedError); + assert( + (client.innerApiCalls.listProcessors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProcessorsStream without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + ]; + client.descriptors.page.listProcessors.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listProcessorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.documentai.v1.Processor[] = []; + stream.on( + 'data', + (response: protos.google.cloud.documentai.v1.Processor) => { + 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.listProcessors.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessors, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessors.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listProcessorsStream with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessors.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listProcessorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.documentai.v1.Processor[] = []; + stream.on( + 'data', + (response: protos.google.cloud.documentai.v1.Processor) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listProcessors.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessors, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessors.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProcessors without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + ]; + client.descriptors.page.listProcessors.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.documentai.v1.IProcessor[] = []; + const iterable = client.listProcessorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessors.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessors.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProcessors with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessors.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listProcessorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.documentai.v1.IProcessor[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessors.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessors.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listProcessorVersions', () => { + it('invokes listProcessorVersions without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + ]; + client.innerApiCalls.listProcessorVersions = + stubSimpleCall(expectedResponse); + const [response] = await client.listProcessorVersions(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProcessorVersions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProcessorVersions without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + ]; + client.innerApiCalls.listProcessorVersions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listProcessorVersions( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.documentai.v1.IProcessorVersion[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProcessorVersions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listProcessorVersions with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listProcessorVersions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listProcessorVersions(request), + expectedError + ); + assert( + (client.innerApiCalls.listProcessorVersions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProcessorVersionsStream without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + ]; + client.descriptors.page.listProcessorVersions.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listProcessorVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.documentai.v1.ProcessorVersion[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.documentai.v1.ProcessorVersion) => { + 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.listProcessorVersions + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessorVersions, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorVersions + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listProcessorVersionsStream with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessorVersions.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listProcessorVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.documentai.v1.ProcessorVersion[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.documentai.v1.ProcessorVersion) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listProcessorVersions + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessorVersions, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorVersions + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProcessorVersions without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + ]; + client.descriptors.page.listProcessorVersions.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.documentai.v1.IProcessorVersion[] = + []; + const iterable = client.listProcessorVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessorVersions + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorVersions + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProcessorVersions with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessorVersions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listProcessorVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.documentai.v1.IProcessorVersion[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessorVersions + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorVersions + .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 documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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 documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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 documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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 documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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 documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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 documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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 documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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 documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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 documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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 documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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 documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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) ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - - it('invokes checkReviewDocumentProgress with error', async () => { + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ 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 documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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 documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( + client.operationsClient.deleteOperation = stubSimpleCall( undefined, expectedError ); - await assert.rejects( - client.checkReviewDocumentProgress(''), - 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 documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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 documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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 ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); @@ -800,6 +4277,56 @@ describe('v1.DocumentProcessorServiceClient', () => { }); }); + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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('processor', () => { const fakePath = '/rendered/path/processor'; const expectedParameters = { @@ -864,5 +4391,190 @@ describe('v1.DocumentProcessorServiceClient', () => { ); }); }); + + describe('processorType', () => { + const fakePath = '/rendered/path/processorType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + processor_type: 'processorTypeValue', + }; + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.processorTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.processorTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('processorTypePath', () => { + const result = client.processorTypePath( + 'projectValue', + 'locationValue', + 'processorTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.processorTypePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProcessorTypeName', () => { + const result = client.matchProjectFromProcessorTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.processorTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProcessorTypeName', () => { + const result = client.matchLocationFromProcessorTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.processorTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProcessorTypeFromProcessorTypeName', () => { + const result = client.matchProcessorTypeFromProcessorTypeName(fakePath); + assert.strictEqual(result, 'processorTypeValue'); + assert( + (client.pathTemplates.processorTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('processorVersion', () => { + const fakePath = '/rendered/path/processorVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + processor: 'processorValue', + processor_version: 'processorVersionValue', + }; + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.processorVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.processorVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('processorVersionPath', () => { + const result = client.processorVersionPath( + 'projectValue', + 'locationValue', + 'processorValue', + 'processorVersionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.processorVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProcessorVersionName', () => { + const result = client.matchProjectFromProcessorVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.processorVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProcessorVersionName', () => { + const result = client.matchLocationFromProcessorVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.processorVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProcessorFromProcessorVersionName', () => { + const result = client.matchProcessorFromProcessorVersionName(fakePath); + assert.strictEqual(result, 'processorValue'); + assert( + (client.pathTemplates.processorVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProcessorVersionFromProcessorVersionName', () => { + const result = + client.matchProcessorVersionFromProcessorVersionName(fakePath); + assert.strictEqual(result, 'processorVersionValue'); + assert( + (client.pathTemplates.processorVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); From 5de71abed18a695df376aed35af7efbbf892e9ba Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 17 Aug 2022 11:34:55 -0700 Subject: [PATCH 195/213] chore(main): release 5.0.0 (#344) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 5.0.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-documentai/CHANGELOG.md | 11 +++++++++++ packages/google-cloud-documentai/package.json | 2 +- .../snippet_metadata.google.cloud.documentai.v1.json | 2 +- ...ppet_metadata.google.cloud.documentai.v1beta1.json | 2 +- ...ppet_metadata.google.cloud.documentai.v1beta2.json | 2 +- ...ppet_metadata.google.cloud.documentai.v1beta3.json | 2 +- packages/google-cloud-documentai/samples/package.json | 2 +- 7 files changed, 17 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index 04c9a978dab..2ef0a0fb09f 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [5.0.0](https://github.com/googleapis/nodejs-document-ai/compare/v4.1.0...v5.0.0) (2022-08-12) + + +### ⚠ BREAKING CHANGES + +* Changed the name field for ProcessRequest and BatchProcessorRequest to accept * so the name field can accept Processor and ProcessorVersion. + +### Documentation + +* fix minor docstring formatting ([#343](https://github.com/googleapis/nodejs-document-ai/issues/343)) ([fc3eb0c](https://github.com/googleapis/nodejs-document-ai/commit/fc3eb0c24bd6a9618cb404b77a4f22e57f603060)) + ## [4.1.0](https://github.com/googleapis/nodejs-document-ai/compare/v4.0.0...v4.1.0) (2022-07-01) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 0117c3e3846..15f81f95dc3 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "4.1.0", + "version": "5.0.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json index 8c98d8e34a3..3075521f863 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json +++ b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-documentai", - "version": "4.1.0", + "version": "5.0.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json b/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json index a999e3fff3a..72bcd115a7d 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-documentai", - "version": "4.1.0", + "version": "5.0.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json b/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json index 49186ec5287..8461a1e05c3 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-documentai", - "version": "4.1.0", + "version": "5.0.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json index 60a583dc17d..0fb2f7802d8 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-documentai", - "version": "4.1.0", + "version": "5.0.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 19f58f5b3f3..30974c46656 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^4.1.0", + "@google-cloud/documentai": "^5.0.0", "@google-cloud/storage": "^6.0.0", "p-queue": "^6.6.2", "uuid": "^8.3.1" From 900ee7b818dd2d617cdf24821bb3eb7a2ac69ee1 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 13:12:40 -0700 Subject: [PATCH 196/213] chore: remove unused proto imports (#345) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Added field_mask to ProcessRequest object in document_processor_service.proto feat: Added parent_ids to Revision object in document.proto feat: Added integer_values, float_values and non_present to Entity object in document.proto feat: Added corrected_key_text, correct_value_text to FormField object in document.proto feat: Added OperationMetadata resource feat: Added Barcode support feat!: Added Processor Management and Processor Version support to v1 library BREAKING CHANGE: Changed the name field for ProcessRequest and BatchProcessorRequest to accept * so the name field can accept Processor and ProcessorVersion. PiperOrigin-RevId: 468022354 Source-Link: https://github.com/googleapis/googleapis/commit/d0237ea8f87d7bc3b6b74786d21ca1c2718c1e6d Source-Link: https://github.com/googleapis/googleapis-gen/commit/22d54f2d8eddd616149c5691d8056ef1290bacfa Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjJkNTRmMmQ4ZWRkZDYxNjE0OWM1NjkxZDgwNTZlZjEyOTBiYWNmYSJ9 * 🦉 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 * chore: remove unused proto imports 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 * 🦉 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 Co-authored-by: Gal Zahavi <38544478+galz10@users.noreply.github.com> --- .../cloud/documentai/v1beta1/document.proto | 1 - .../cloud/documentai/v1beta1/geometry.proto | 1 - .../cloud/documentai/v1beta2/document.proto | 1 - .../cloud/documentai/v1beta2/geometry.proto | 1 - .../cloud/documentai/v1beta3/barcode.proto | 67 + .../cloud/documentai/v1beta3/document.proto | 259 +- .../documentai/v1beta3/document_io.proto | 4 +- .../v1beta3/document_processor_service.proto | 349 +- .../documentai/v1beta3/document_schema.proto | 140 + .../cloud/documentai/v1beta3/geometry.proto | 4 +- .../v1beta3/operation_metadata.proto | 6 +- .../cloud/documentai/v1beta3/processor.proto | 108 +- .../documentai/v1beta3/processor_type.proto | 19 +- .../protos/protos.d.ts | 3964 ++++++- .../google-cloud-documentai/protos/protos.js | 9527 ++++++++++++++--- .../protos/protos.json | 683 +- ...ocessor_service.batch_process_documents.js | 6 +- ...ment_processor_service.create_processor.js | 2 +- ...cessor_service.delete_processor_version.js | 59 + ...cessor_service.deploy_processor_version.js | 59 + ...processor_service.fetch_processor_types.js | 3 +- ...ocument_processor_service.get_processor.js | 58 + ...processor_service.get_processor_version.js | 58 + ..._processor_service.list_processor_types.js | 72 + ...ocessor_service.list_processor_versions.js | 72 + ...ument_processor_service.list_processors.js | 2 +- ...ment_processor_service.process_document.js | 11 +- ...ument_processor_service.review_document.js | 4 + ...r_service.set_default_processor_version.js | 66 + ...ssor_service.undeploy_processor_version.js | 59 + ...adata.google.cloud.documentai.v1beta3.json | 358 +- .../document_processor_service_client.ts | 2129 +++- ...ument_processor_service_client_config.json | 32 + ...document_processor_service_proto_list.json | 2 + .../src/v1beta3/gapic_metadata.json | 88 + ...apic_document_processor_service_v1beta3.ts | 3007 +++++- 36 files changed, 18400 insertions(+), 2881 deletions(-) create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/barcode.proto create mode 100644 packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_schema.proto create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor_version.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.deploy_processor_version.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor_version.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_types.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_versions.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.set_default_processor_version.js create mode 100644 packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.undeploy_processor_version.js diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document.proto index 0ac64a57f5f..aa95ecc2995 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document.proto @@ -17,7 +17,6 @@ syntax = "proto3"; package google.cloud.documentai.v1beta1; -import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/cloud/documentai/v1beta1/geometry.proto"; import "google/rpc/status.proto"; diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/geometry.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/geometry.proto index 631c179c34c..5772db74511 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/geometry.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/geometry.proto @@ -17,7 +17,6 @@ syntax = "proto3"; package google.cloud.documentai.v1beta1; -import "google/api/annotations.proto"; option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta1"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta1;documentai"; diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto index 846fcd26578..a7255d7c1b9 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto @@ -20,7 +20,6 @@ import "google/api/field_behavior.proto"; import "google/cloud/documentai/v1beta2/geometry.proto"; import "google/rpc/status.proto"; import "google/type/color.proto"; -import "google/api/annotations.proto"; option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta2"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta2;documentai"; diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/geometry.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/geometry.proto index 6aff4db8ce0..8c97cb995cf 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/geometry.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/geometry.proto @@ -16,7 +16,6 @@ syntax = "proto3"; package google.cloud.documentai.v1beta2; -import "google/api/annotations.proto"; option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta2"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta2;documentai"; diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/barcode.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/barcode.proto new file mode 100644 index 00000000000..7c7050a868b --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/barcode.proto @@ -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 +// +// 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.documentai.v1beta3; + +option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; +option java_multiple_files = true; +option java_outer_classname = "BarcodeProto"; +option java_package = "com.google.cloud.documentai.v1beta3"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta3"; +option ruby_package = "Google::Cloud::DocumentAI::V1beta3"; + +// Encodes the detailed information of a barcode. +message Barcode { + // Format of a barcode. + // The supported formats are: + // CODE_128: Code 128 type. + // CODE_39: Code 39 type. + // CODE_93: Code 93 type. + // CODABAR: Codabar type. + // DATA_MATRIX: 2D Data Matrix type. + // ITF: ITF type. + // EAN_13: EAN-13 type. + // EAN_8: EAN-8 type. + // QR_CODE: 2D QR code type. + // UPC_A: UPC-A type. + // UPC_E: UPC-E type. + // PDF417: PDF417 type. + // AZTEC: 2D Aztec code type. + // DATABAR: GS1 DataBar code type. + string format = 1; + + // Value format describes the format of the value that a barcode + // encodes. + // The supported formats are: + // CONTACT_INFO: Contact information. + // EMAIL: Email address. + // ISBN: ISBN identifier. + // PHONE: Phone number. + // PRODUCT: Product. + // SMS: SMS message. + // TEXT: Text string. + // URL: URL address. + // WIFI: Wifi information. + // GEO: Geo-localization. + // CALENDAR_EVENT: Calendar event. + // DRIVER_LICENSE: Driver's license. + string value_format = 2; + + // Raw value encoded in the barcode. + // For example, 'MEBKM:TITLE:Google;URL:https://www.google.com;;'. + string raw_value = 3; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto index f9bec08b90b..809a64ea4c7 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto @@ -16,8 +16,8 @@ syntax = "proto3"; package google.cloud.documentai.v1beta3; -import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; +import "google/cloud/documentai/v1beta3/barcode.proto"; import "google/cloud/documentai/v1beta3/geometry.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/status.proto"; @@ -35,11 +35,10 @@ option java_package = "com.google.cloud.documentai.v1beta3"; option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta3"; option ruby_package = "Google::Cloud::DocumentAI::V1beta3"; -// Document represents the canonical document resource in Document Understanding -// AI. -// It is an interchange format that provides insights into documents and allows -// for collaboration between users and Document Understanding AI to iterate and -// optimize for quality. +// Document represents the canonical document resource in Document AI. It is an +// interchange format that provides insights into documents and allows for +// collaboration between users and Document AI to iterate and optimize for +// quality. message Document { // For a large document, sharding may be performed to produce several // document shards. Each document shard contains this field to detail which @@ -51,9 +50,8 @@ message Document { // Total number of shards. int64 shard_count = 2; - // The index of the first character in - // [Document.text][google.cloud.documentai.v1beta3.Document.text] in the - // overall document global text. + // The index of the first character in [Document.text][google.cloud.documentai.v1beta3.Document.text] in the overall + // document global text. int64 text_offset = 3; } @@ -69,8 +67,7 @@ message Document { string unit = 2; } - // Text anchor indexing into the - // [Document.text][google.cloud.documentai.v1beta3.Document.text]. + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. TextAnchor text_anchor = 1; // Text color. @@ -167,31 +164,25 @@ message Document { PAGE_LEFT = 4; } - // Text anchor indexing into the - // [Document.text][google.cloud.documentai.v1beta3.Document.text]. + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. TextAnchor text_anchor = 1; - // Confidence of the current - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] within - // context of the object this layout is for. e.g. confidence can be for a - // single token, a table, a visual element, etc. depending on context. - // Range [0, 1]. + // Confidence of the current [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] within context of the object this + // layout is for. e.g. confidence can be for a single token, a table, + // a visual element, etc. depending on context. Range [0, 1]. float confidence = 2; - // The bounding polygon for the - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout]. + // The bounding polygon for the [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout]. BoundingPoly bounding_poly = 3; - // Detected orientation for the - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout]. + // Detected orientation for the [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout]. Orientation orientation = 4; } // A block has a set of lines (collected into paragraphs) that have a // common line-spacing and orientation. message Block { - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for - // [Block][google.cloud.documentai.v1beta3.Document.Page.Block]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Block][google.cloud.documentai.v1beta3.Document.Page.Block]. Layout layout = 1; // A list of detected languages together with confidence. @@ -203,8 +194,7 @@ message Document { // A collection of lines that a human would perceive as a paragraph. message Paragraph { - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for - // [Paragraph][google.cloud.documentai.v1beta3.Document.Page.Paragraph]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Paragraph][google.cloud.documentai.v1beta3.Document.Page.Paragraph]. Layout layout = 1; // A list of detected languages together with confidence. @@ -217,8 +207,7 @@ message Document { // A collection of tokens that a human would perceive as a line. // Does not cross column boundaries, can be horizontal, vertical, etc. message Line { - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for - // [Line][google.cloud.documentai.v1beta3.Document.Page.Line]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Line][google.cloud.documentai.v1beta3.Document.Page.Line]. Layout layout = 1; // A list of detected languages together with confidence. @@ -230,8 +219,7 @@ message Document { // A detected token. message Token { - // Detected break at the end of a - // [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. + // Detected break at the end of a [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. message DetectedBreak { // Enum to denote the type of break found. enum Type { @@ -252,12 +240,10 @@ message Document { Type type = 1; } - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for - // [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. Layout layout = 1; - // Detected break at the end of a - // [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. + // Detected break at the end of a [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. DetectedBreak detected_break = 2; // A list of detected languages together with confidence. @@ -269,8 +255,7 @@ message Document { // A detected symbol. message Symbol { - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for - // [Symbol][google.cloud.documentai.v1beta3.Document.Page.Symbol]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Symbol][google.cloud.documentai.v1beta3.Document.Page.Symbol]. Layout layout = 1; // A list of detected languages together with confidence. @@ -280,12 +265,10 @@ message Document { // Detected non-text visual elements e.g. checkbox, signature etc. on the // page. message VisualElement { - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for - // [VisualElement][google.cloud.documentai.v1beta3.Document.Page.VisualElement]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [VisualElement][google.cloud.documentai.v1beta3.Document.Page.VisualElement]. Layout layout = 1; - // Type of the - // [VisualElement][google.cloud.documentai.v1beta3.Document.Page.VisualElement]. + // Type of the [VisualElement][google.cloud.documentai.v1beta3.Document.Page.VisualElement]. string type = 2; // A list of detected languages together with confidence. @@ -302,8 +285,7 @@ message Document { // A cell representation inside the table. message TableCell { - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for - // [TableCell][google.cloud.documentai.v1beta3.Document.Page.Table.TableCell]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [TableCell][google.cloud.documentai.v1beta3.Document.Page.Table.TableCell]. Layout layout = 1; // How many rows this cell spans. @@ -316,8 +298,7 @@ message Document { repeated DetectedLanguage detected_languages = 4; } - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for - // [Table][google.cloud.documentai.v1beta3.Document.Page.Table]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Table][google.cloud.documentai.v1beta3.Document.Page.Table]. Layout layout = 1; // Header rows of the table. @@ -332,14 +313,11 @@ message Document { // A form field detected on the page. message FormField { - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the - // [FormField][google.cloud.documentai.v1beta3.Document.Page.FormField] - // name. e.g. `Address`, `Email`, `Grand total`, `Phone number`, etc. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the [FormField][google.cloud.documentai.v1beta3.Document.Page.FormField] name. e.g. `Address`, `Email`, + // `Grand total`, `Phone number`, etc. Layout field_name = 1; - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the - // [FormField][google.cloud.documentai.v1beta3.Document.Page.FormField] - // value. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the [FormField][google.cloud.documentai.v1beta3.Document.Page.FormField] value. Layout field_value = 2; // A list of detected languages for name together with confidence. @@ -355,10 +333,29 @@ message Document { // - "filled_checkbox" string value_type = 5; + // Created for Labeling UI to export key text. + // If corrections were made to the text identified by the + // `field_name.text_anchor`, this field will contain the correction. + string corrected_key_text = 6; + + // Created for Labeling UI to export value text. + // If corrections were made to the text identified by the + // `field_value.text_anchor`, this field will contain the correction. + string corrected_value_text = 7; + // The history of this annotation. Provenance provenance = 8; } + // A detected barcode. + message DetectedBarcode { + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [DetectedBarcode][google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode]. + Layout layout = 1; + + // Detailed barcode information of the [DetectedBarcode][google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode]. + Barcode barcode = 2; + } + // Detected language for a structural component. message DetectedLanguage { // The BCP-47 language code, such as "en-US" or "sr-Latn". For more @@ -370,11 +367,9 @@ message Document { float confidence = 2; } - // 1-based index for current - // [Page][google.cloud.documentai.v1beta3.Document.Page] in a parent - // [Document][google.cloud.documentai.v1beta3.Document]. Useful when a page - // is taken out of a [Document][google.cloud.documentai.v1beta3.Document] - // for individual processing. + // 1-based index for current [Page][google.cloud.documentai.v1beta3.Document.Page] in a parent [Document][google.cloud.documentai.v1beta3.Document]. + // Useful when a page is taken out of a [Document][google.cloud.documentai.v1beta3.Document] for individual + // processing. int32 page_number = 1; // Rendered image for this page. This image is preprocessed to remove any @@ -383,15 +378,13 @@ message Document { Image image = 13; // Transformation matrices that were applied to the original document image - // to produce - // [Page.image][google.cloud.documentai.v1beta3.Document.Page.image]. + // to produce [Page.image][google.cloud.documentai.v1beta3.Document.Page.image]. repeated Matrix transforms = 14; // Physical dimension of the page. Dimension dimension = 2; - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the - // page. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the page. Layout layout = 3; // A list of detected languages together with confidence. @@ -426,6 +419,9 @@ message Document { // A list of visually detected symbols on the page. repeated Symbol symbols = 12; + // A list of detected barcodes. + repeated DetectedBarcode detected_barcodes = 15; + // The history of this page. Provenance provenance = 16; } @@ -460,6 +456,12 @@ message Document { // Boolean value. Can be used for entities with binary values, or for // checkboxes. bool boolean_value = 6; + + // Integer value. + int32 integer_value = 7; + + // Float value. + float float_value = 8; } // Optional. An optional field to store a normalized string. @@ -476,15 +478,14 @@ message Document { } // Optional. Provenance of the entity. - // Text anchor indexing into the - // [Document.text][google.cloud.documentai.v1beta3.Document.text]. + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. TextAnchor text_anchor = 1 [(google.api.field_behavior) = OPTIONAL]; // Required. Entity type from a schema e.g. `Address`. string type = 2 [(google.api.field_behavior) = REQUIRED]; - // Optional. Text value in the document e.g. `1600 Amphitheatre Pkwy`. If - // the entity is not present in the document, this field will be empty. + // Optional. Text value in the document e.g. `1600 Amphitheatre Pkwy`. If the entity + // is not present in the document, this field will be empty. string mention_text = 3 [(google.api.field_behavior) = OPTIONAL]; // Optional. Deprecated. Use `id` field instead. @@ -493,35 +494,32 @@ message Document { // Optional. Confidence of detected Schema entity. Range [0, 1]. float confidence = 5 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Represents the provenance of this entity wrt. the location on - // the page where it was found. + // Optional. Represents the provenance of this entity wrt. the location on the + // page where it was found. PageAnchor page_anchor = 6 [(google.api.field_behavior) = OPTIONAL]; // Optional. Canonical id. This will be a unique value in the entity list // for this document. string id = 7 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Normalized entity value. Absent if the extracted value could - // not be converted or the type (e.g. address) is not supported for certain + // Optional. Normalized entity value. Absent if the extracted value could not be + // converted or the type (e.g. address) is not supported for certain // parsers. This field is also only populated for certain supported document // types. - NormalizedValue normalized_value = 9 - [(google.api.field_behavior) = OPTIONAL]; + NormalizedValue normalized_value = 9 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Entities can be nested to form a hierarchical data structure - // representing the content in the document. + // Optional. Entities can be nested to form a hierarchical data structure representing + // the content in the document. repeated Entity properties = 10 [(google.api.field_behavior) = OPTIONAL]; // Optional. The history of this annotation. Provenance provenance = 11 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Whether the entity will be redacted for de-identification - // purposes. + // Optional. Whether the entity will be redacted for de-identification purposes. bool redacted = 12 [(google.api.field_behavior) = OPTIONAL]; } - // Relationship between - // [Entities][google.cloud.documentai.v1beta3.Document.Entity]. + // Relationship between [Entities][google.cloud.documentai.v1beta3.Document.Entity]. message EntityRelation { // Subject entity id. string subject_id = 1; @@ -533,28 +531,21 @@ message Document { string relation = 3; } - // Text reference indexing into the - // [Document.text][google.cloud.documentai.v1beta3.Document.text]. + // Text reference indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. message TextAnchor { - // A text segment in the - // [Document.text][google.cloud.documentai.v1beta3.Document.text]. The - // indices may be out of bounds which indicate that the text extends into - // another document shard for large sharded documents. See - // [ShardInfo.text_offset][google.cloud.documentai.v1beta3.Document.ShardInfo.text_offset] + // A text segment in the [Document.text][google.cloud.documentai.v1beta3.Document.text]. The indices may be out of bounds + // which indicate that the text extends into another document shard for + // large sharded documents. See [ShardInfo.text_offset][google.cloud.documentai.v1beta3.Document.ShardInfo.text_offset] message TextSegment { - // [TextSegment][google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment] - // start UTF-8 char index in the - // [Document.text][google.cloud.documentai.v1beta3.Document.text]. + // [TextSegment][google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment] start UTF-8 char index in the [Document.text][google.cloud.documentai.v1beta3.Document.text]. int64 start_index = 1; - // [TextSegment][google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment] - // half open end UTF-8 char index in the + // [TextSegment][google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment] half open end UTF-8 char index in the // [Document.text][google.cloud.documentai.v1beta3.Document.text]. int64 end_index = 2; } - // The text segments from the - // [Document.text][google.cloud.documentai.v1beta3.Document.text]. + // The text segments from the [Document.text][google.cloud.documentai.v1beta3.Document.text]. repeated TextSegment text_segments = 1; // Contains the content of the text span so that users do @@ -563,9 +554,8 @@ message Document { string content = 2; } - // Referencing the visual context of the entity in the - // [Document.pages][google.cloud.documentai.v1beta3.Document.pages]. Page - // anchors can be cross-page, consist of multiple bounding polygons and + // Referencing the visual context of the entity in the [Document.pages][google.cloud.documentai.v1beta3.Document.pages]. + // Page anchors can be cross-page, consist of multiple bounding polygons and // optionally reference specific layout element types. message PageAnchor { // Represents a weak reference to a page element within a document. @@ -575,66 +565,47 @@ message Document { // Layout Unspecified. LAYOUT_TYPE_UNSPECIFIED = 0; - // References a - // [Page.blocks][google.cloud.documentai.v1beta3.Document.Page.blocks] - // element. + // References a [Page.blocks][google.cloud.documentai.v1beta3.Document.Page.blocks] element. BLOCK = 1; - // References a - // [Page.paragraphs][google.cloud.documentai.v1beta3.Document.Page.paragraphs] - // element. + // References a [Page.paragraphs][google.cloud.documentai.v1beta3.Document.Page.paragraphs] element. PARAGRAPH = 2; - // References a - // [Page.lines][google.cloud.documentai.v1beta3.Document.Page.lines] - // element. + // References a [Page.lines][google.cloud.documentai.v1beta3.Document.Page.lines] element. LINE = 3; - // References a - // [Page.tokens][google.cloud.documentai.v1beta3.Document.Page.tokens] - // element. + // References a [Page.tokens][google.cloud.documentai.v1beta3.Document.Page.tokens] element. TOKEN = 4; - // References a - // [Page.visual_elements][google.cloud.documentai.v1beta3.Document.Page.visual_elements] - // element. + // References a [Page.visual_elements][google.cloud.documentai.v1beta3.Document.Page.visual_elements] element. VISUAL_ELEMENT = 5; - // Refrrences a - // [Page.tables][google.cloud.documentai.v1beta3.Document.Page.tables] - // element. + // Refrrences a [Page.tables][google.cloud.documentai.v1beta3.Document.Page.tables] element. TABLE = 6; - // References a - // [Page.form_fields][google.cloud.documentai.v1beta3.Document.Page.form_fields] - // element. + // References a [Page.form_fields][google.cloud.documentai.v1beta3.Document.Page.form_fields] element. FORM_FIELD = 7; } - // Required. Index into the - // [Document.pages][google.cloud.documentai.v1beta3.Document.pages] - // element, for example using [Document.pages][page_refs.page] to locate - // the related page element. This field is skipped when its value is the - // default 0. See + // Required. Index into the [Document.pages][google.cloud.documentai.v1beta3.Document.pages] element, for example using + // [Document.pages][page_refs.page] to locate the related page element. + // This field is skipped when its value is the default 0. See // https://developers.google.com/protocol-buffers/docs/proto3#json. int64 page = 1 [(google.api.field_behavior) = REQUIRED]; - // Optional. The type of the layout element that is being referenced if - // any. + // Optional. The type of the layout element that is being referenced if any. LayoutType layout_type = 2 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Deprecated. Use - // [PageRef.bounding_poly][google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.bounding_poly] - // instead. - string layout_id = 3 - [deprecated = true, (google.api.field_behavior) = OPTIONAL]; + // Optional. Deprecated. Use [PageRef.bounding_poly][google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.bounding_poly] instead. + string layout_id = 3 [ + deprecated = true, + (google.api.field_behavior) = OPTIONAL + ]; - // Optional. Identifies the bounding polygon of a layout element on the - // page. + // Optional. Identifies the bounding polygon of a layout element on the page. BoundingPoly bounding_poly = 4 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Confidence of detected page element, if applicable. Range [0, - // 1]. + // Optional. Confidence of detected page element, if applicable. Range [0, 1]. float confidence = 5 [(google.api.field_behavior) = OPTIONAL]; } @@ -728,7 +699,12 @@ message Document { // The revisions that this revision is based on. This can include one or // more parent (when documents are merged.) This field represents the // index into the `revisions` field. - repeated int32 parent = 2; + repeated int32 parent = 2 [deprecated = true]; + + // The revisions that this revision is based on. Must include all the ids + // that have anything to do with this revision - eg. there are + // `provenance.parent.revision` fields that index into this field. + repeated string parent_ids = 7; // The time that the revision was created. google.protobuf.Timestamp create_time = 3; @@ -740,11 +716,10 @@ message Document { // This message is used for text changes aka. OCR corrections. message TextChange { // Provenance of the correction. - // Text anchor indexing into the - // [Document.text][google.cloud.documentai.v1beta3.Document.text]. There - // can only be a single `TextAnchor.text_segments` element. If the start - // and end index of the text segment are the same, the text change is - // inserted before that index. + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. There can only be a + // single `TextAnchor.text_segments` element. If the start and + // end index of the text segment are the same, the text change is inserted + // before that index. TextAnchor text_anchor = 1; // The text that replaces the text identified in the `text_anchor`. @@ -777,21 +752,17 @@ message Document { // Optional. UTF-8 encoded text in reading order from the document. string text = 4 [(google.api.field_behavior) = OPTIONAL]; - // Placeholder. Styles for the - // [Document.text][google.cloud.documentai.v1beta3.Document.text]. + // Placeholder. Styles for the [Document.text][google.cloud.documentai.v1beta3.Document.text]. repeated Style text_styles = 5; - // Visual page layout for the - // [Document][google.cloud.documentai.v1beta3.Document]. + // Visual page layout for the [Document][google.cloud.documentai.v1beta3.Document]. repeated Page pages = 6; - // A list of entities detected on - // [Document.text][google.cloud.documentai.v1beta3.Document.text]. For - // document shards, entities in this list may cross shard boundaries. + // A list of entities detected on [Document.text][google.cloud.documentai.v1beta3.Document.text]. For document shards, + // entities in this list may cross shard boundaries. repeated Entity entities = 7; - // Placeholder. Relationship among - // [Document.entities][google.cloud.documentai.v1beta3.Document.entities]. + // Placeholder. Relationship among [Document.entities][google.cloud.documentai.v1beta3.Document.entities]. repeated EntityRelation entity_relations = 8; // Placeholder. A list of text corrections made to [Document.text]. This is diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.proto index d364d4aba76..a0d410c8cb4 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.proto @@ -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. @@ -16,8 +16,6 @@ syntax = "proto3"; package google.cloud.documentai.v1beta3; -import "google/api/annotations.proto"; - option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; option java_multiple_files = true; diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto index ae589642dc4..952db5904d5 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto @@ -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. @@ -22,6 +22,7 @@ import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/documentai/v1beta3/document.proto"; import "google/cloud/documentai/v1beta3/document_io.proto"; +import "google/cloud/documentai/v1beta3/document_schema.proto"; import "google/cloud/documentai/v1beta3/operation_metadata.proto"; import "google/cloud/documentai/v1beta3/processor.proto"; import "google/cloud/documentai/v1beta3/processor_type.proto"; @@ -37,19 +38,14 @@ option java_outer_classname = "DocumentAiProcessorService"; option java_package = "com.google.cloud.documentai.v1beta3"; option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta3"; option ruby_package = "Google::Cloud::DocumentAI::V1beta3"; - -// (-- aip.dev/not-precedent: This is needed because we have references to -// these resources in our public API, but the resource management is not -// part of the public API (UI access only). So we have to define -// these resource here to avoid any "unable to find resources" error. --) -option (google.api.resource_definition) = { - type: "documentai.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; option (google.api.resource_definition) = { type: "documentai.googleapis.com/HumanReviewConfig" pattern: "projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig" }; +option (google.api.resource_definition) = { + type: "documentai.googleapis.com/Location" + pattern: "projects/{project}/locations/{location}" +}; // Service to call Cloud DocumentAI to process documents according to the // processor's definition. Processors are built using state-of-the-art Google @@ -64,6 +60,10 @@ service DocumentProcessorService { option (google.api.http) = { post: "/v1beta3/{name=projects/*/locations/*/processors/*}:process" body: "*" + additional_bindings { + post: "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}:process" + body: "*" + } }; option (google.api.method_signature) = "name"; } @@ -74,6 +74,10 @@ service DocumentProcessorService { option (google.api.http) = { post: "/v1beta3/{name=projects/*/locations/*/processors/*}:batchProcess" body: "*" + additional_bindings { + post: "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}:batchProcess" + body: "*" + } }; option (google.api.method_signature) = "name"; option (google.longrunning.operation_info) = { @@ -82,7 +86,8 @@ service DocumentProcessorService { }; } - // Fetches processor types. + // Fetches processor types. Note that we do not use ListProcessorTypes here + // because it is not paginated. rpc FetchProcessorTypes(FetchProcessorTypesRequest) returns (FetchProcessorTypesResponse) { option (google.api.http) = { get: "/v1beta3/{parent=projects/*/locations/*}:fetchProcessorTypes" @@ -90,6 +95,14 @@ service DocumentProcessorService { option (google.api.method_signature) = "parent"; } + // Lists the processor types that exist. + rpc ListProcessorTypes(ListProcessorTypesRequest) returns (ListProcessorTypesResponse) { + option (google.api.http) = { + get: "/v1beta3/{parent=projects/*/locations/*}/processorTypes" + }; + option (google.api.method_signature) = "parent"; + } + // Lists all processors which belong to this project. rpc ListProcessors(ListProcessorsRequest) returns (ListProcessorsResponse) { option (google.api.http) = { @@ -98,6 +111,69 @@ service DocumentProcessorService { option (google.api.method_signature) = "parent"; } + // Gets a processor detail. + rpc GetProcessor(GetProcessorRequest) returns (Processor) { + option (google.api.http) = { + get: "/v1beta3/{name=projects/*/locations/*/processors/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a processor version detail. + rpc GetProcessorVersion(GetProcessorVersionRequest) returns (ProcessorVersion) { + option (google.api.http) = { + get: "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all versions of a processor. + rpc ListProcessorVersions(ListProcessorVersionsRequest) returns (ListProcessorVersionsResponse) { + option (google.api.http) = { + get: "/v1beta3/{parent=projects/*/locations/*/processors/*}/processorVersions" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes the processor version, all artifacts under the processor version + // will be deleted. + rpc DeleteProcessorVersion(DeleteProcessorVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "DeleteProcessorVersionMetadata" + }; + } + + // Deploys the processor version. + rpc DeployProcessorVersion(DeployProcessorVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}:deploy" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "DeployProcessorVersionResponse" + metadata_type: "DeployProcessorVersionMetadata" + }; + } + + // Undeploys the processor version. + rpc UndeployProcessorVersion(UndeployProcessorVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}:undeploy" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "UndeployProcessorVersionResponse" + metadata_type: "UndeployProcessorVersionMetadata" + }; + } + // Creates a processor from the type processor that the user chose. // The processor will be at "ENABLED" state by default after its creation. rpc CreateProcessor(CreateProcessorRequest) returns (Processor) { @@ -145,6 +221,20 @@ service DocumentProcessorService { }; } + // Set the default (active) version of a [Processor][google.cloud.documentai.v1beta3.Processor] that will be used in + // [ProcessDocument][google.cloud.documentai.v1beta3.DocumentProcessorService.ProcessDocument] and + // [BatchProcessDocuments][google.cloud.documentai.v1beta3.DocumentProcessorService.BatchProcessDocuments]. + rpc SetDefaultProcessorVersion(SetDefaultProcessorVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta3/{processor=projects/*/locations/*/processors/*}:setDefaultProcessorVersion" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "SetDefaultProcessorVersionResponse" + metadata_type: "SetDefaultProcessorVersionMetadata" + }; + } + // Send a document for Human Review. The input document should be processed by // the specified processor. rpc ReviewDocument(ReviewDocumentRequest) returns (google.longrunning.Operation) { @@ -171,11 +261,16 @@ message ProcessRequest { RawDocument raw_document = 5; } - // Required. The processor resource name. + // Required. The resource name of the [Processor][google.cloud.documentai.v1beta3.Processor] or + // [ProcessorVersion][google.cloud.documentai.v1beta3.ProcessorVersion] + // to use for processing. If a [Processor][google.cloud.documentai.v1beta3.Processor] is specified, the server will use + // its [default version][google.cloud.documentai.v1beta3.Processor.default_processor_version]. Format: + // `projects/{project}/locations/{location}/processors/{processor}`, or + // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { - type: "documentai.googleapis.com/Processor" + type: "*" } ]; @@ -185,6 +280,9 @@ message ProcessRequest { // Whether Human Review feature should be skipped for this request. Default to // false. bool skip_human_review = 3; + + // Specifies which fields to include in ProcessResponse's document. + google.protobuf.FieldMask field_mask = 6; } // The status of human review on a processed document. @@ -262,11 +360,15 @@ message BatchProcessRequest { string gcs_destination = 1; } - // Required. The processor resource name. + // Required. The resource name of [Processor][google.cloud.documentai.v1beta3.Processor] or + // [ProcessorVersion][google.cloud.documentai.v1beta3.ProcessorVersion]. + // Format: `projects/{project}/locations/{location}/processors/{processor}`, + // or + // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { - type: "documentai.googleapis.com/Processor" + type: "*" } ]; @@ -302,10 +404,10 @@ message BatchProcessMetadata { // document during the process. string input_gcs_source = 1; - // The status of the processing of the document. + // The status processing the document. google.rpc.Status status = 2; - // The output_gcs_destination (in the request as 'output_gcs_destination') + // The output_gcs_destination (in the request as `output_gcs_destination`) // of the processed document if it was successful, otherwise empty. string output_gcs_destination = 3; @@ -363,7 +465,8 @@ message BatchProcessMetadata { // Request message for fetch processor types. message FetchProcessorTypesRequest { // Required. The project of processor type to list. - // Format: projects/{project}/locations/{location} + // The available processor types may depend on the allow-listing on projects. + // Format: `projects/{project}/locations/{location}` string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -378,10 +481,40 @@ message FetchProcessorTypesResponse { repeated ProcessorType processor_types = 1; } +// Request message for list processor types. +message ListProcessorTypesRequest { + // Required. The location of processor type to list. + // The available processor types may depend on the allow-listing on projects. + // Format: `projects/{project}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "documentai.googleapis.com/ProcessorType" + } + ]; + + // The maximum number of processor types to return. + // If unspecified, at most 100 processor types will be returned. + // The maximum value is 500; values above 500 will be coerced to 500. + int32 page_size = 2; + + // Used to retrieve the next page of results, empty if at the end of the list. + string page_token = 3; +} + +// Response message for list processor types. +message ListProcessorTypesResponse { + // The processor types. + repeated ProcessorType processor_types = 1; + + // Points to the next page, otherwise empty. + string next_page_token = 2; +} + // Request message for list all processors belongs to a project. message ListProcessorsRequest { // Required. The parent (project and location) which owns this collection of Processors. - // Format: projects/{project}/locations/{location} + // Format: `projects/{project}/locations/{location}` string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -408,12 +541,126 @@ message ListProcessorsResponse { string next_page_token = 2; } +// Request message for get processor. +message GetProcessorRequest { + // Required. The processor resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/Processor" + } + ]; +} + +// Request message for get processor version. +message GetProcessorVersionRequest { + // Required. The processor resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + } + ]; +} + +// Request message for list all processor versions belongs to a processor. +message ListProcessorVersionsRequest { + // Required. The parent (project, location and processor) to list all versions. + // Format: `projects/{project}/locations/{location}/processors/{processor}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "documentai.googleapis.com/ProcessorVersion" + } + ]; + + // The maximum number of processor versions to return. + // If unspecified, at most 10 processor versions will be returned. + // The maximum value is 20; values above 20 will be coerced to 20. + int32 page_size = 2; + + // We will return the processor versions sorted by creation time. The page + // token will point to the next processor version. + string page_token = 3; +} + +// Response message for list processors. +message ListProcessorVersionsResponse { + // The list of processors. + repeated ProcessorVersion processor_versions = 1; + + // Points to the next processor, otherwise empty. + string next_page_token = 2; +} + +// Request message for the delete processor version method. +message DeleteProcessorVersionRequest { + // Required. The processor version resource name to be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + } + ]; +} + +// The long running operation metadata for delete processor version method. +message DeleteProcessorVersionMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 1; +} + +// Request message for the deploy processor version method. +message DeployProcessorVersionRequest { + // Required. The processor version resource name to be deployed. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + } + ]; +} + +// Response message for the deploy processor version method. +message DeployProcessorVersionResponse { + +} + +// The long running operation metadata for deploy processor version method. +message DeployProcessorVersionMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 1; +} + +// Request message for the undeploy processor version method. +message UndeployProcessorVersionRequest { + // Required. The processor version resource name to be undeployed. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + } + ]; +} + +// Response message for the undeploy processor version method. +message UndeployProcessorVersionResponse { + +} + +// The long running operation metadata for the undeploy processor version +// method. +message UndeployProcessorVersionMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 1; +} + // Request message for create a processor. Notice this request is sent to // a regionalized backend service, and if the processor type is not available // on that region, the creation will fail. message CreateProcessorRequest { // Required. The parent (project and location) under which to create the processor. - // Format: projects/{project}/locations/{location} + // Format: `projects/{project}/locations/{location}` string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -455,6 +702,7 @@ message EnableProcessorRequest { } // Response message for the enable processor method. +// Intentionally empty proto for adding fields in future. message EnableProcessorResponse { } @@ -477,6 +725,7 @@ message DisableProcessorRequest { } // Response message for the disable processor method. +// Intentionally empty proto for adding fields in future. message DisableProcessorResponse { } @@ -487,8 +736,40 @@ message DisableProcessorMetadata { CommonOperationMetadata common_metadata = 5; } +// Request message for the set default processor version method. +message SetDefaultProcessorVersionRequest { + // Required. The resource name of the [Processor][google.cloud.documentai.v1beta3.Processor] to change default version. + string processor = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/Processor" + } + ]; + + // Required. The resource name of child [ProcessorVersion][google.cloud.documentai.v1beta3.ProcessorVersion] to use as default. + // Format: + // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}` + string default_processor_version = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + } + ]; +} + +// Response message for set default processor version method. +message SetDefaultProcessorVersionResponse { + +} + +// The long running operation metadata for set default processor version +// method. +message SetDefaultProcessorVersionMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 1; +} + // Request message for review document method. -// Next Id: 6. message ReviewDocumentRequest { // The priority level of the human review task. enum Priority { @@ -523,12 +804,34 @@ message ReviewDocumentRequest { // The priority of the human review task. Priority priority = 5; + + // The document schema of the human review task. + DocumentSchema document_schema = 6; } // Response message for review document method. message ReviewDocumentResponse { - // The Cloud Storage uri for the human reviewed document. + // Possible states of the review operation. + enum State { + // The default value. This value is used if the state is omitted. + STATE_UNSPECIFIED = 0; + + // The review operation is rejected by the reviewer. + REJECTED = 1; + + // The review operation is succeeded. + SUCCEEDED = 2; + } + + // The Cloud Storage uri for the human reviewed document if the review is + // succeeded. string gcs_destination = 1; + + // The state of the review operation. + State state = 2; + + // The reason why the review is rejected by reviewer. + string rejection_reason = 3; } // The long running operation metadata for review document method. @@ -570,6 +873,6 @@ message ReviewDocumentOperationMetadata { // The basic metadata of the long running operation. CommonOperationMetadata common_metadata = 5; - // The question ID. + // The Crowd Compute question ID. string question_id = 6; } diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_schema.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_schema.proto new file mode 100644 index 00000000000..214e56864de --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_schema.proto @@ -0,0 +1,140 @@ +// 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.documentai.v1beta3; + +option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; +option java_multiple_files = true; +option java_outer_classname = "DocumentAiDocumentSchema"; +option java_package = "com.google.cloud.documentai.v1beta3"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta3"; +option ruby_package = "Google::Cloud::DocumentAI::V1beta3"; + +// The schema defines the output of the processed document by a processor. +message DocumentSchema { + // EntityType is the wrapper of a label of the corresponding model with + // detailed attributes and limitations for entity-based processors. Multiple + // types can also compose a dependency tree to represent nested types. + message EntityType { + // Defines the a list of enum values. + message EnumValues { + // The individual values that this enum values type can include. + repeated string values = 1; + } + + // Defines properties that can be part of the entity type. + message Property { + // Types of occurrences of the entity type in the document. Note: this + // represents the number of instances of an entity types, not number of + // mentions of a given entity instance. + enum OccurrenceType { + // Unspecified occurrence type. + OCCURRENCE_TYPE_UNSPECIFIED = 0; + + // There will be zero or one instance of this entity type. + OPTIONAL_ONCE = 1; + + // The entity type will appear zero or multiple times. + OPTIONAL_MULTIPLE = 2; + + // The entity type will only appear exactly once. + REQUIRED_ONCE = 3; + + // The entity type will appear once or more times. + REQUIRED_MULTIPLE = 4; + } + + // The name of the property. Follows the same guidelines as the + // EntityType name. + string name = 1; + + // A reference to the value type of the property. This type is subject + // to the same conventions as the `Entity.base_types` field. + string value_type = 2; + + // Occurrence type limits the number of instances an entity type appears + // in the document. + OccurrenceType occurrence_type = 3; + } + + oneof value_source { + // If specified, lists all the possible values for this entity. This + // should not be more than a handful of values. If the number of values + // is >10 or could change frequently use the `EntityType.value_ontology` + // field and specify a list of all possible values in a value ontology + // file. + EnumValues enum_values = 14; + } + + // User defined name for the type. + string display_name = 13; + + // Name of the type. It must be unique within the schema file and + // cannot be a 'Common Type'. Besides that we use the following naming + // conventions: + // - *use snake_casing* + // - name matching is case-insensitive + // - Maximum 64 characters. + // - Must start with a letter. + // - Allowed characters: ASCII letters `[a-z0-9_-]`. (For backward + // compatibility internal infrastructure and tooling can handle any ascii + // character) + // - The '/' is sometimes used to denote a property of a type. For example + // line_item/amount. This convention is deprecated, but will still be + // honored for backward compatibility. + string name = 1; + + // The entity type that this type is derived from. For now, one and only + // one should be set. + repeated string base_types = 2; + + // Describing the nested structure, or composition of an entity. + repeated Property properties = 6; + } + + // Metadata for global schema behavior. + message Metadata { + // If true, a `document` entity type can be applied to subdocument ( + // splitting). Otherwise, it can only be applied to the entire document + // (classification). + bool document_splitter = 1; + + // If true, on a given page, there can be multiple `document` annotations + // covering it. + bool document_allow_multiple_labels = 2; + + // If set, all the nested entities must be prefixed with the parents. + bool prefixed_naming_on_properties = 6; + + // If set, we will skip the naming format validation in the schema. So the + // string values in `DocumentSchema.EntityType.name` and + // `DocumentSchema.EntityType.Property.name` will not be checked. + bool skip_naming_validation = 7; + } + + // Display name to show to users. + string display_name = 1; + + // Description of the schema. + string description = 2; + + // Entity types of the schema. + repeated EntityType entity_types = 3; + + // Metadata of the schema. + Metadata metadata = 4; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/geometry.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/geometry.proto index 91cd956ea98..c42e0cb7a07 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/geometry.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/geometry.proto @@ -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. @@ -16,8 +16,6 @@ syntax = "proto3"; package google.cloud.documentai.v1beta3; -import "google/api/annotations.proto"; - option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; option java_multiple_files = true; diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/operation_metadata.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/operation_metadata.proto index 1d8624e8f79..cd573a823c4 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/operation_metadata.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/operation_metadata.proto @@ -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. @@ -17,7 +17,6 @@ syntax = "proto3"; package google.cloud.documentai.v1beta3; import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; @@ -56,6 +55,9 @@ message CommonOperationMetadata { // A message providing more details about the current state of processing. string state_message = 2; + // A related resource to this operation. + string resource = 5; + // The creation time of the operation. google.protobuf.Timestamp create_time = 3; diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor.proto index 61cd14a26e6..b7019bf4d12 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor.proto @@ -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. @@ -18,9 +18,7 @@ package google.cloud.documentai.v1beta3; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; -import "google/cloud/documentai/v1beta3/document_io.proto"; import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; @@ -30,8 +28,84 @@ option java_package = "com.google.cloud.documentai.v1beta3"; option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta3"; option ruby_package = "Google::Cloud::DocumentAI::V1beta3"; -// The first-class citizen for DocumentAI. Each processor defines how to extract -// structural information from a document. +// A processor version is an implementation of a processor. Each processor +// can have multiple versions, pre-trained by Google internally or up-trained +// by the customer. At a time, a processor can only have one default version +// version. So the processor's behavior (when processing documents) is defined +// by a default version +message ProcessorVersion { + option (google.api.resource) = { + type: "documentai.googleapis.com/ProcessorVersion" + pattern: "projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}" + }; + + // Information about the upcoming deprecation of this processor version. + message DeprecationInfo { + // The time at which this processor version will be deprecated. + google.protobuf.Timestamp deprecation_time = 1; + + // If set, the processor version that will be used as a replacement. + string replacement_processor_version = 2 [(google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + }]; + } + + // The possible states of the processor version. + enum State { + // The processor version is in an unspecified state. + STATE_UNSPECIFIED = 0; + + // The processor version is deployed and can be used for processing. + DEPLOYED = 1; + + // The processor version is being deployed. + DEPLOYING = 2; + + // The processor version is not deployed and cannot be used for processing. + UNDEPLOYED = 3; + + // The processor version is being undeployed. + UNDEPLOYING = 4; + + // The processor version is being created. + CREATING = 5; + + // The processor version is being deleted. + DELETING = 6; + + // The processor version failed and is in an indeterminate state. + FAILED = 7; + } + + // The resource name of the processor version. + // Format: + // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}` + string name = 1; + + // The display name of the processor version. + string display_name = 2; + + // The state of the processor version. + State state = 6; + + // The time the processor version was created. + google.protobuf.Timestamp create_time = 7; + + // The KMS key name used for encryption. + string kms_key_name = 9; + + // The KMS key version with which data is encrypted. + string kms_key_version_name = 10; + + // Denotes that this ProcessorVersion is managed by google. + bool google_managed = 11; + + // If set, information about the eventual deprecation of this version. + DeprecationInfo deprecation_info = 13; +} + +// The first-class citizen for Document AI. Each processor defines how to +// extract structural information from a document. message Processor { option (google.api.resource) = { type: "documentai.googleapis.com/Processor" @@ -43,7 +117,9 @@ message Processor { // The processor is in an unspecified state. STATE_UNSPECIFIED = 0; - // The processor is enabled. + // The processor is enabled, i.e., has an enabled version which can + // currently serve processing requests and all the feature dependencies have + // been successfully initialized. ENABLED = 1; // The processor is disabled. @@ -55,10 +131,16 @@ message Processor { // The processor is being disabled, will become DISABLED if successful. DISABLING = 4; - // The processor is being created. + // The processor is being created, will become either ENABLED (for + // successful creation) or FAILED (for failed ones). + // Once a processor is in this state, it can then be used for document + // processing, but the feature dependencies of the processor might not be + // fully created yet. CREATING = 5; - // The processor failed during creation. + // The processor failed during creation or initialization of feature + // dependencies. The user should delete the processor and recreate one as + // all the functionalities of the processor are disabled. FAILED = 6; // The processor is being deleted, will be removed if successful. @@ -66,13 +148,15 @@ message Processor { } // Output only. Immutable. The resource name of the processor. - // Format: projects/{project}/locations/{location}/processors/{processor} + // Format: `projects/{project}/locations/{location}/processors/{processor}` string name = 1 [ (google.api.field_behavior) = IMMUTABLE, (google.api.field_behavior) = OUTPUT_ONLY ]; - // The processor type. + // The processor type, e.g., OCR_PROCESSOR, INVOICE_PROCESSOR, etc. + // To get a list of processors types, see + // [FetchProcessorTypes][google.cloud.documentai.v1beta3.DocumentProcessorService.FetchProcessorTypes]. string type = 2; // The display name of the processor. @@ -82,7 +166,9 @@ message Processor { State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; // The default processor version. - string default_processor_version = 9; + string default_processor_version = 9 [(google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + }]; // Output only. Immutable. The http endpoint that can be called to invoke processing. string process_endpoint = 6 [ diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor_type.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor_type.proto index 4bd4c16ab05..a2799e301a9 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor_type.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor_type.proto @@ -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. @@ -16,8 +16,8 @@ syntax = "proto3"; package google.cloud.documentai.v1beta3; +import "google/api/launch_stage.proto"; import "google/api/resource.proto"; -import "google/api/annotations.proto"; option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; @@ -37,24 +37,27 @@ message ProcessorType { // The location information about where the processor is available. message LocationInfo { - // The location id. + // The location id, currently must be one of [us, eu]. string location_id = 1; } // The resource name of the processor type. + // Format: projects/{project}/processorTypes/{processor_type} string name = 1; - // The type of the processor. + // The type of the processor, e.g., "invoice_parsing". string type = 2; - // The processor category. + // The processor category, used by UI to group processor types. string category = 3; // The locations in which this processor is available. repeated LocationInfo available_locations = 4; - // Whether the processor type allows creation. If yes, user can create a - // processor of this processor type. Otherwise, user needs to require for - // whitelisting. + // Whether the processor type allows creation. If true, users can create a + // processor of this processor type. Otherwise, users need to request access. bool allow_creation = 6; + + // Launch stage of the processor type + google.api.LaunchStage launch_stage = 8; } diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 7ecdc12c436..e157c94e56c 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -19260,6 +19260,108 @@ export namespace google { /** Namespace v1beta3. */ namespace v1beta3 { + /** Properties of a Barcode. */ + interface IBarcode { + + /** Barcode format */ + format?: (string|null); + + /** Barcode valueFormat */ + valueFormat?: (string|null); + + /** Barcode rawValue */ + rawValue?: (string|null); + } + + /** Represents a Barcode. */ + class Barcode implements IBarcode { + + /** + * Constructs a new Barcode. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IBarcode); + + /** Barcode format. */ + public format: string; + + /** Barcode valueFormat. */ + public valueFormat: string; + + /** Barcode rawValue. */ + public rawValue: string; + + /** + * Creates a new Barcode instance using the specified properties. + * @param [properties] Properties to set + * @returns Barcode instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IBarcode): google.cloud.documentai.v1beta3.Barcode; + + /** + * Encodes the specified Barcode message. Does not implicitly {@link google.cloud.documentai.v1beta3.Barcode.verify|verify} messages. + * @param message Barcode message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IBarcode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Barcode message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Barcode.verify|verify} messages. + * @param message Barcode message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IBarcode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Barcode message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Barcode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Barcode; + + /** + * Decodes a Barcode message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Barcode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Barcode; + + /** + * Verifies a Barcode message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Barcode message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Barcode + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Barcode; + + /** + * Creates a plain object from a Barcode message. Also converts values to other types if specified. + * @param message Barcode + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Barcode, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Barcode to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a Document. */ interface IDocument { @@ -19793,6 +19895,9 @@ export namespace google { /** Page symbols */ symbols?: (google.cloud.documentai.v1beta3.Document.Page.ISymbol[]|null); + /** Page detectedBarcodes */ + detectedBarcodes?: (google.cloud.documentai.v1beta3.Document.Page.IDetectedBarcode[]|null); + /** Page provenance */ provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); } @@ -19848,6 +19953,9 @@ export namespace google { /** Page symbols. */ public symbols: google.cloud.documentai.v1beta3.Document.Page.ISymbol[]; + /** Page detectedBarcodes. */ + public detectedBarcodes: google.cloud.documentai.v1beta3.Document.Page.IDetectedBarcode[]; + /** Page provenance. */ public provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); @@ -21405,6 +21513,12 @@ export namespace google { /** FormField valueType */ valueType?: (string|null); + /** FormField correctedKeyText */ + correctedKeyText?: (string|null); + + /** FormField correctedValueText */ + correctedValueText?: (string|null); + /** FormField provenance */ provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); } @@ -21433,6 +21547,12 @@ export namespace google { /** FormField valueType. */ public valueType: string; + /** FormField correctedKeyText. */ + public correctedKeyText: string; + + /** FormField correctedValueText. */ + public correctedValueText: string; + /** FormField provenance. */ public provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); @@ -21507,6 +21627,102 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of a DetectedBarcode. */ + interface IDetectedBarcode { + + /** DetectedBarcode layout */ + layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** DetectedBarcode barcode */ + barcode?: (google.cloud.documentai.v1beta3.IBarcode|null); + } + + /** Represents a DetectedBarcode. */ + class DetectedBarcode implements IDetectedBarcode { + + /** + * Constructs a new DetectedBarcode. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Page.IDetectedBarcode); + + /** DetectedBarcode layout. */ + public layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** DetectedBarcode barcode. */ + public barcode?: (google.cloud.documentai.v1beta3.IBarcode|null); + + /** + * Creates a new DetectedBarcode instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectedBarcode instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Page.IDetectedBarcode): google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode; + + /** + * Encodes the specified DetectedBarcode message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode.verify|verify} messages. + * @param message DetectedBarcode message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Page.IDetectedBarcode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectedBarcode message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode.verify|verify} messages. + * @param message DetectedBarcode message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Page.IDetectedBarcode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectedBarcode message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectedBarcode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode; + + /** + * Decodes a DetectedBarcode message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectedBarcode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode; + + /** + * Verifies a DetectedBarcode message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DetectedBarcode message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectedBarcode + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode; + + /** + * Creates a plain object from a DetectedBarcode message. Also converts values to other types if specified. + * @param message DetectedBarcode + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectedBarcode to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a DetectedLanguage. */ interface IDetectedLanguage { @@ -21774,6 +21990,12 @@ export namespace google { /** NormalizedValue booleanValue */ booleanValue?: (boolean|null); + /** NormalizedValue integerValue */ + integerValue?: (number|null); + + /** NormalizedValue floatValue */ + floatValue?: (number|null); + /** NormalizedValue text */ text?: (string|null); } @@ -21802,11 +22024,17 @@ export namespace google { /** NormalizedValue booleanValue. */ public booleanValue?: (boolean|null); + /** NormalizedValue integerValue. */ + public integerValue?: (number|null); + + /** NormalizedValue floatValue. */ + public floatValue?: (number|null); + /** NormalizedValue text. */ public text: string; /** NormalizedValue structuredValue. */ - public structuredValue?: ("moneyValue"|"dateValue"|"datetimeValue"|"addressValue"|"booleanValue"); + public structuredValue?: ("moneyValue"|"dateValue"|"datetimeValue"|"addressValue"|"booleanValue"|"integerValue"|"floatValue"); /** * Creates a new NormalizedValue instance using the specified properties. @@ -22638,6 +22866,9 @@ export namespace google { /** Revision parent */ parent?: (number[]|null); + /** Revision parentIds */ + parentIds?: (string[]|null); + /** Revision createTime */ createTime?: (google.protobuf.ITimestamp|null); @@ -22666,6 +22897,9 @@ export namespace google { /** Revision parent. */ public parent: number[]; + /** Revision parentIds. */ + public parentIds: string[]; + /** Revision createTime. */ public createTime?: (google.protobuf.ITimestamp|null); @@ -23955,6 +24189,20 @@ export namespace google { */ public fetchProcessorTypes(request: google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest): Promise; + /** + * Calls ListProcessorTypes. + * @param request ListProcessorTypesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListProcessorTypesResponse + */ + public listProcessorTypes(request: google.cloud.documentai.v1beta3.IListProcessorTypesRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessorTypesCallback): void; + + /** + * Calls ListProcessorTypes. + * @param request ListProcessorTypesRequest message or plain object + * @returns Promise + */ + public listProcessorTypes(request: google.cloud.documentai.v1beta3.IListProcessorTypesRequest): Promise; + /** * Calls ListProcessors. * @param request ListProcessorsRequest message or plain object @@ -23970,43 +24218,127 @@ export namespace google { public listProcessors(request: google.cloud.documentai.v1beta3.IListProcessorsRequest): Promise; /** - * Calls CreateProcessor. - * @param request CreateProcessorRequest message or plain object + * Calls GetProcessor. + * @param request GetProcessorRequest message or plain object * @param callback Node-style callback called with the error, if any, and Processor */ - public createProcessor(request: google.cloud.documentai.v1beta3.ICreateProcessorRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.CreateProcessorCallback): void; + public getProcessor(request: google.cloud.documentai.v1beta3.IGetProcessorRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.GetProcessorCallback): void; /** - * Calls CreateProcessor. - * @param request CreateProcessorRequest message or plain object + * Calls GetProcessor. + * @param request GetProcessorRequest message or plain object * @returns Promise */ - public createProcessor(request: google.cloud.documentai.v1beta3.ICreateProcessorRequest): Promise; + public getProcessor(request: google.cloud.documentai.v1beta3.IGetProcessorRequest): Promise; /** - * Calls DeleteProcessor. - * @param request DeleteProcessorRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Calls GetProcessorVersion. + * @param request GetProcessorVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ProcessorVersion */ - public deleteProcessor(request: google.cloud.documentai.v1beta3.IDeleteProcessorRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.DeleteProcessorCallback): void; + public getProcessorVersion(request: google.cloud.documentai.v1beta3.IGetProcessorVersionRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.GetProcessorVersionCallback): void; /** - * Calls DeleteProcessor. - * @param request DeleteProcessorRequest message or plain object + * Calls GetProcessorVersion. + * @param request GetProcessorVersionRequest message or plain object * @returns Promise */ - public deleteProcessor(request: google.cloud.documentai.v1beta3.IDeleteProcessorRequest): Promise; + public getProcessorVersion(request: google.cloud.documentai.v1beta3.IGetProcessorVersionRequest): Promise; /** - * Calls EnableProcessor. - * @param request EnableProcessorRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Calls ListProcessorVersions. + * @param request ListProcessorVersionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListProcessorVersionsResponse */ - public enableProcessor(request: google.cloud.documentai.v1beta3.IEnableProcessorRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.EnableProcessorCallback): void; + public listProcessorVersions(request: google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessorVersionsCallback): void; /** - * Calls EnableProcessor. - * @param request EnableProcessorRequest message or plain object + * Calls ListProcessorVersions. + * @param request ListProcessorVersionsRequest message or plain object + * @returns Promise + */ + public listProcessorVersions(request: google.cloud.documentai.v1beta3.IListProcessorVersionsRequest): Promise; + + /** + * Calls DeleteProcessorVersion. + * @param request DeleteProcessorVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteProcessorVersion(request: google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.DeleteProcessorVersionCallback): void; + + /** + * Calls DeleteProcessorVersion. + * @param request DeleteProcessorVersionRequest message or plain object + * @returns Promise + */ + public deleteProcessorVersion(request: google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest): Promise; + + /** + * Calls DeployProcessorVersion. + * @param request DeployProcessorVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deployProcessorVersion(request: google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.DeployProcessorVersionCallback): void; + + /** + * Calls DeployProcessorVersion. + * @param request DeployProcessorVersionRequest message or plain object + * @returns Promise + */ + public deployProcessorVersion(request: google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest): Promise; + + /** + * Calls UndeployProcessorVersion. + * @param request UndeployProcessorVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public undeployProcessorVersion(request: google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.UndeployProcessorVersionCallback): void; + + /** + * Calls UndeployProcessorVersion. + * @param request UndeployProcessorVersionRequest message or plain object + * @returns Promise + */ + public undeployProcessorVersion(request: google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest): Promise; + + /** + * Calls CreateProcessor. + * @param request CreateProcessorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Processor + */ + public createProcessor(request: google.cloud.documentai.v1beta3.ICreateProcessorRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.CreateProcessorCallback): void; + + /** + * Calls CreateProcessor. + * @param request CreateProcessorRequest message or plain object + * @returns Promise + */ + public createProcessor(request: google.cloud.documentai.v1beta3.ICreateProcessorRequest): Promise; + + /** + * Calls DeleteProcessor. + * @param request DeleteProcessorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteProcessor(request: google.cloud.documentai.v1beta3.IDeleteProcessorRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.DeleteProcessorCallback): void; + + /** + * Calls DeleteProcessor. + * @param request DeleteProcessorRequest message or plain object + * @returns Promise + */ + public deleteProcessor(request: google.cloud.documentai.v1beta3.IDeleteProcessorRequest): Promise; + + /** + * Calls EnableProcessor. + * @param request EnableProcessorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public enableProcessor(request: google.cloud.documentai.v1beta3.IEnableProcessorRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.EnableProcessorCallback): void; + + /** + * Calls EnableProcessor. + * @param request EnableProcessorRequest message or plain object * @returns Promise */ public enableProcessor(request: google.cloud.documentai.v1beta3.IEnableProcessorRequest): Promise; @@ -24025,6 +24357,20 @@ export namespace google { */ public disableProcessor(request: google.cloud.documentai.v1beta3.IDisableProcessorRequest): Promise; + /** + * Calls SetDefaultProcessorVersion. + * @param request SetDefaultProcessorVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public setDefaultProcessorVersion(request: google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.SetDefaultProcessorVersionCallback): void; + + /** + * Calls SetDefaultProcessorVersion. + * @param request SetDefaultProcessorVersionRequest message or plain object + * @returns Promise + */ + public setDefaultProcessorVersion(request: google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionRequest): Promise; + /** * Calls ReviewDocument. * @param request ReviewDocumentRequest message or plain object @@ -24063,6 +24409,13 @@ export namespace google { */ type FetchProcessorTypesCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.FetchProcessorTypesResponse) => void; + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#listProcessorTypes}. + * @param error Error, if any + * @param [response] ListProcessorTypesResponse + */ + type ListProcessorTypesCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.ListProcessorTypesResponse) => void; + /** * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#listProcessors}. * @param error Error, if any @@ -24070,6 +24423,48 @@ export namespace google { */ type ListProcessorsCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.ListProcessorsResponse) => void; + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#getProcessor}. + * @param error Error, if any + * @param [response] Processor + */ + type GetProcessorCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.Processor) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#getProcessorVersion}. + * @param error Error, if any + * @param [response] ProcessorVersion + */ + type GetProcessorVersionCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.ProcessorVersion) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#listProcessorVersions}. + * @param error Error, if any + * @param [response] ListProcessorVersionsResponse + */ + type ListProcessorVersionsCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.ListProcessorVersionsResponse) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#deleteProcessorVersion}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#deployProcessorVersion}. + * @param error Error, if any + * @param [response] Operation + */ + type DeployProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#undeployProcessorVersion}. + * @param error Error, if any + * @param [response] Operation + */ + type UndeployProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#createProcessor}. * @param error Error, if any @@ -24098,6 +24493,13 @@ export namespace google { */ type DisableProcessorCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#setDefaultProcessorVersion}. + * @param error Error, if any + * @param [response] Operation + */ + type SetDefaultProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#reviewDocument}. * @param error Error, if any @@ -24123,6 +24525,9 @@ export namespace google { /** ProcessRequest skipHumanReview */ skipHumanReview?: (boolean|null); + + /** ProcessRequest fieldMask */ + fieldMask?: (google.protobuf.IFieldMask|null); } /** Represents a ProcessRequest. */ @@ -24149,6 +24554,9 @@ export namespace google { /** ProcessRequest skipHumanReview. */ public skipHumanReview: boolean; + /** ProcessRequest fieldMask. */ + public fieldMask?: (google.protobuf.IFieldMask|null); + /** ProcessRequest source. */ public source?: ("inlineDocument"|"rawDocument"); @@ -25254,1345 +25662,3597 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** Properties of a ListProcessorsRequest. */ - interface IListProcessorsRequest { + /** Properties of a ListProcessorTypesRequest. */ + interface IListProcessorTypesRequest { - /** ListProcessorsRequest parent */ + /** ListProcessorTypesRequest parent */ parent?: (string|null); - /** ListProcessorsRequest pageSize */ + /** ListProcessorTypesRequest pageSize */ pageSize?: (number|null); - /** ListProcessorsRequest pageToken */ + /** ListProcessorTypesRequest pageToken */ pageToken?: (string|null); } - /** Represents a ListProcessorsRequest. */ - class ListProcessorsRequest implements IListProcessorsRequest { + /** Represents a ListProcessorTypesRequest. */ + class ListProcessorTypesRequest implements IListProcessorTypesRequest { /** - * Constructs a new ListProcessorsRequest. + * Constructs a new ListProcessorTypesRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.IListProcessorsRequest); + constructor(properties?: google.cloud.documentai.v1beta3.IListProcessorTypesRequest); - /** ListProcessorsRequest parent. */ + /** ListProcessorTypesRequest parent. */ public parent: string; - /** ListProcessorsRequest pageSize. */ + /** ListProcessorTypesRequest pageSize. */ public pageSize: number; - /** ListProcessorsRequest pageToken. */ + /** ListProcessorTypesRequest pageToken. */ public pageToken: string; /** - * Creates a new ListProcessorsRequest instance using the specified properties. + * Creates a new ListProcessorTypesRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ListProcessorsRequest instance + * @returns ListProcessorTypesRequest instance */ - public static create(properties?: google.cloud.documentai.v1beta3.IListProcessorsRequest): google.cloud.documentai.v1beta3.ListProcessorsRequest; + public static create(properties?: google.cloud.documentai.v1beta3.IListProcessorTypesRequest): google.cloud.documentai.v1beta3.ListProcessorTypesRequest; /** - * Encodes the specified ListProcessorsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsRequest.verify|verify} messages. - * @param message ListProcessorsRequest message or plain object to encode + * Encodes the specified ListProcessorTypesRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorTypesRequest.verify|verify} messages. + * @param message ListProcessorTypesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.IListProcessorsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.IListProcessorTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListProcessorsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsRequest.verify|verify} messages. - * @param message ListProcessorsRequest message or plain object to encode + * Encodes the specified ListProcessorTypesRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorTypesRequest.verify|verify} messages. + * @param message ListProcessorTypesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.IListProcessorsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IListProcessorTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListProcessorsRequest message from the specified reader or buffer. + * Decodes a ListProcessorTypesRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListProcessorsRequest + * @returns ListProcessorTypesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ListProcessorsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ListProcessorTypesRequest; /** - * Decodes a ListProcessorsRequest message from the specified reader or buffer, length delimited. + * Decodes a ListProcessorTypesRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListProcessorsRequest + * @returns ListProcessorTypesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ListProcessorsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ListProcessorTypesRequest; /** - * Verifies a ListProcessorsRequest message. + * Verifies a ListProcessorTypesRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListProcessorsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListProcessorTypesRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListProcessorsRequest + * @returns ListProcessorTypesRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ListProcessorsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ListProcessorTypesRequest; /** - * Creates a plain object from a ListProcessorsRequest message. Also converts values to other types if specified. - * @param message ListProcessorsRequest + * Creates a plain object from a ListProcessorTypesRequest message. Also converts values to other types if specified. + * @param message ListProcessorTypesRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.ListProcessorsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.ListProcessorTypesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListProcessorsRequest to JSON. + * Converts this ListProcessorTypesRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ListProcessorsResponse. */ - interface IListProcessorsResponse { + /** Properties of a ListProcessorTypesResponse. */ + interface IListProcessorTypesResponse { - /** ListProcessorsResponse processors */ - processors?: (google.cloud.documentai.v1beta3.IProcessor[]|null); + /** ListProcessorTypesResponse processorTypes */ + processorTypes?: (google.cloud.documentai.v1beta3.IProcessorType[]|null); - /** ListProcessorsResponse nextPageToken */ + /** ListProcessorTypesResponse nextPageToken */ nextPageToken?: (string|null); } - /** Represents a ListProcessorsResponse. */ - class ListProcessorsResponse implements IListProcessorsResponse { + /** Represents a ListProcessorTypesResponse. */ + class ListProcessorTypesResponse implements IListProcessorTypesResponse { /** - * Constructs a new ListProcessorsResponse. + * Constructs a new ListProcessorTypesResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.IListProcessorsResponse); + constructor(properties?: google.cloud.documentai.v1beta3.IListProcessorTypesResponse); - /** ListProcessorsResponse processors. */ - public processors: google.cloud.documentai.v1beta3.IProcessor[]; + /** ListProcessorTypesResponse processorTypes. */ + public processorTypes: google.cloud.documentai.v1beta3.IProcessorType[]; - /** ListProcessorsResponse nextPageToken. */ + /** ListProcessorTypesResponse nextPageToken. */ public nextPageToken: string; /** - * Creates a new ListProcessorsResponse instance using the specified properties. + * Creates a new ListProcessorTypesResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ListProcessorsResponse instance + * @returns ListProcessorTypesResponse instance */ - public static create(properties?: google.cloud.documentai.v1beta3.IListProcessorsResponse): google.cloud.documentai.v1beta3.ListProcessorsResponse; + public static create(properties?: google.cloud.documentai.v1beta3.IListProcessorTypesResponse): google.cloud.documentai.v1beta3.ListProcessorTypesResponse; /** - * Encodes the specified ListProcessorsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsResponse.verify|verify} messages. - * @param message ListProcessorsResponse message or plain object to encode + * Encodes the specified ListProcessorTypesResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorTypesResponse.verify|verify} messages. + * @param message ListProcessorTypesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.IListProcessorsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.IListProcessorTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListProcessorsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsResponse.verify|verify} messages. - * @param message ListProcessorsResponse message or plain object to encode + * Encodes the specified ListProcessorTypesResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorTypesResponse.verify|verify} messages. + * @param message ListProcessorTypesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.IListProcessorsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IListProcessorTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListProcessorsResponse message from the specified reader or buffer. + * Decodes a ListProcessorTypesResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListProcessorsResponse + * @returns ListProcessorTypesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ListProcessorsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ListProcessorTypesResponse; /** - * Decodes a ListProcessorsResponse message from the specified reader or buffer, length delimited. + * Decodes a ListProcessorTypesResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListProcessorsResponse + * @returns ListProcessorTypesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ListProcessorsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ListProcessorTypesResponse; /** - * Verifies a ListProcessorsResponse message. + * Verifies a ListProcessorTypesResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListProcessorsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListProcessorTypesResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListProcessorsResponse + * @returns ListProcessorTypesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ListProcessorsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ListProcessorTypesResponse; /** - * Creates a plain object from a ListProcessorsResponse message. Also converts values to other types if specified. - * @param message ListProcessorsResponse + * Creates a plain object from a ListProcessorTypesResponse message. Also converts values to other types if specified. + * @param message ListProcessorTypesResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.ListProcessorsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.ListProcessorTypesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListProcessorsResponse to JSON. + * Converts this ListProcessorTypesResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CreateProcessorRequest. */ - interface ICreateProcessorRequest { + /** Properties of a ListProcessorsRequest. */ + interface IListProcessorsRequest { - /** CreateProcessorRequest parent */ + /** ListProcessorsRequest parent */ parent?: (string|null); - /** CreateProcessorRequest processor */ - processor?: (google.cloud.documentai.v1beta3.IProcessor|null); + /** ListProcessorsRequest pageSize */ + pageSize?: (number|null); + + /** ListProcessorsRequest pageToken */ + pageToken?: (string|null); } - /** Represents a CreateProcessorRequest. */ - class CreateProcessorRequest implements ICreateProcessorRequest { + /** Represents a ListProcessorsRequest. */ + class ListProcessorsRequest implements IListProcessorsRequest { /** - * Constructs a new CreateProcessorRequest. + * Constructs a new ListProcessorsRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.ICreateProcessorRequest); + constructor(properties?: google.cloud.documentai.v1beta3.IListProcessorsRequest); - /** CreateProcessorRequest parent. */ + /** ListProcessorsRequest parent. */ public parent: string; - /** CreateProcessorRequest processor. */ - public processor?: (google.cloud.documentai.v1beta3.IProcessor|null); + /** ListProcessorsRequest pageSize. */ + public pageSize: number; + + /** ListProcessorsRequest pageToken. */ + public pageToken: string; /** - * Creates a new CreateProcessorRequest instance using the specified properties. + * Creates a new ListProcessorsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns CreateProcessorRequest instance + * @returns ListProcessorsRequest instance */ - public static create(properties?: google.cloud.documentai.v1beta3.ICreateProcessorRequest): google.cloud.documentai.v1beta3.CreateProcessorRequest; + public static create(properties?: google.cloud.documentai.v1beta3.IListProcessorsRequest): google.cloud.documentai.v1beta3.ListProcessorsRequest; /** - * Encodes the specified CreateProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.CreateProcessorRequest.verify|verify} messages. - * @param message CreateProcessorRequest message or plain object to encode + * Encodes the specified ListProcessorsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsRequest.verify|verify} messages. + * @param message ListProcessorsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.ICreateProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.IListProcessorsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CreateProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.CreateProcessorRequest.verify|verify} messages. - * @param message CreateProcessorRequest message or plain object to encode + * Encodes the specified ListProcessorsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsRequest.verify|verify} messages. + * @param message ListProcessorsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.ICreateProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IListProcessorsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CreateProcessorRequest message from the specified reader or buffer. + * Decodes a ListProcessorsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CreateProcessorRequest + * @returns ListProcessorsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.CreateProcessorRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ListProcessorsRequest; /** - * Decodes a CreateProcessorRequest message from the specified reader or buffer, length delimited. + * Decodes a ListProcessorsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CreateProcessorRequest + * @returns ListProcessorsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.CreateProcessorRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ListProcessorsRequest; /** - * Verifies a CreateProcessorRequest message. + * Verifies a ListProcessorsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CreateProcessorRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListProcessorsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CreateProcessorRequest + * @returns ListProcessorsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.CreateProcessorRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ListProcessorsRequest; /** - * Creates a plain object from a CreateProcessorRequest message. Also converts values to other types if specified. - * @param message CreateProcessorRequest + * Creates a plain object from a ListProcessorsRequest message. Also converts values to other types if specified. + * @param message ListProcessorsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.CreateProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.ListProcessorsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CreateProcessorRequest to JSON. + * Converts this ListProcessorsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a DeleteProcessorRequest. */ - interface IDeleteProcessorRequest { + /** Properties of a ListProcessorsResponse. */ + interface IListProcessorsResponse { - /** DeleteProcessorRequest name */ - name?: (string|null); + /** ListProcessorsResponse processors */ + processors?: (google.cloud.documentai.v1beta3.IProcessor[]|null); + + /** ListProcessorsResponse nextPageToken */ + nextPageToken?: (string|null); } - /** Represents a DeleteProcessorRequest. */ - class DeleteProcessorRequest implements IDeleteProcessorRequest { + /** Represents a ListProcessorsResponse. */ + class ListProcessorsResponse implements IListProcessorsResponse { /** - * Constructs a new DeleteProcessorRequest. + * Constructs a new ListProcessorsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.IDeleteProcessorRequest); + constructor(properties?: google.cloud.documentai.v1beta3.IListProcessorsResponse); - /** DeleteProcessorRequest name. */ - public name: string; + /** ListProcessorsResponse processors. */ + public processors: google.cloud.documentai.v1beta3.IProcessor[]; + + /** ListProcessorsResponse nextPageToken. */ + public nextPageToken: string; /** - * Creates a new DeleteProcessorRequest instance using the specified properties. + * Creates a new ListProcessorsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns DeleteProcessorRequest instance + * @returns ListProcessorsResponse instance */ - public static create(properties?: google.cloud.documentai.v1beta3.IDeleteProcessorRequest): google.cloud.documentai.v1beta3.DeleteProcessorRequest; + public static create(properties?: google.cloud.documentai.v1beta3.IListProcessorsResponse): google.cloud.documentai.v1beta3.ListProcessorsResponse; /** - * Encodes the specified DeleteProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorRequest.verify|verify} messages. - * @param message DeleteProcessorRequest message or plain object to encode + * Encodes the specified ListProcessorsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsResponse.verify|verify} messages. + * @param message ListProcessorsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.IDeleteProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.IListProcessorsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified DeleteProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorRequest.verify|verify} messages. - * @param message DeleteProcessorRequest message or plain object to encode + * Encodes the specified ListProcessorsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsResponse.verify|verify} messages. + * @param message ListProcessorsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDeleteProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IListProcessorsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a DeleteProcessorRequest message from the specified reader or buffer. + * Decodes a ListProcessorsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns DeleteProcessorRequest + * @returns ListProcessorsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DeleteProcessorRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ListProcessorsResponse; /** - * Decodes a DeleteProcessorRequest message from the specified reader or buffer, length delimited. + * Decodes a ListProcessorsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns DeleteProcessorRequest + * @returns ListProcessorsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DeleteProcessorRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ListProcessorsResponse; /** - * Verifies a DeleteProcessorRequest message. + * Verifies a ListProcessorsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a DeleteProcessorRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListProcessorsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns DeleteProcessorRequest + * @returns ListProcessorsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DeleteProcessorRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ListProcessorsResponse; /** - * Creates a plain object from a DeleteProcessorRequest message. Also converts values to other types if specified. - * @param message DeleteProcessorRequest + * Creates a plain object from a ListProcessorsResponse message. Also converts values to other types if specified. + * @param message ListProcessorsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.DeleteProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.ListProcessorsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this DeleteProcessorRequest to JSON. + * Converts this ListProcessorsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a DeleteProcessorMetadata. */ - interface IDeleteProcessorMetadata { + /** Properties of a GetProcessorRequest. */ + interface IGetProcessorRequest { - /** DeleteProcessorMetadata commonMetadata */ - commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + /** GetProcessorRequest name */ + name?: (string|null); } - /** Represents a DeleteProcessorMetadata. */ - class DeleteProcessorMetadata implements IDeleteProcessorMetadata { + /** Represents a GetProcessorRequest. */ + class GetProcessorRequest implements IGetProcessorRequest { /** - * Constructs a new DeleteProcessorMetadata. + * Constructs a new GetProcessorRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.IDeleteProcessorMetadata); + constructor(properties?: google.cloud.documentai.v1beta3.IGetProcessorRequest); - /** DeleteProcessorMetadata commonMetadata. */ - public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + /** GetProcessorRequest name. */ + public name: string; /** - * Creates a new DeleteProcessorMetadata instance using the specified properties. + * Creates a new GetProcessorRequest instance using the specified properties. * @param [properties] Properties to set - * @returns DeleteProcessorMetadata instance + * @returns GetProcessorRequest instance */ - public static create(properties?: google.cloud.documentai.v1beta3.IDeleteProcessorMetadata): google.cloud.documentai.v1beta3.DeleteProcessorMetadata; + public static create(properties?: google.cloud.documentai.v1beta3.IGetProcessorRequest): google.cloud.documentai.v1beta3.GetProcessorRequest; /** - * Encodes the specified DeleteProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorMetadata.verify|verify} messages. - * @param message DeleteProcessorMetadata message or plain object to encode + * Encodes the specified GetProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.GetProcessorRequest.verify|verify} messages. + * @param message GetProcessorRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.IDeleteProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.IGetProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified DeleteProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorMetadata.verify|verify} messages. - * @param message DeleteProcessorMetadata message or plain object to encode + * Encodes the specified GetProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.GetProcessorRequest.verify|verify} messages. + * @param message GetProcessorRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDeleteProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IGetProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a DeleteProcessorMetadata message from the specified reader or buffer. + * Decodes a GetProcessorRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns DeleteProcessorMetadata + * @returns GetProcessorRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DeleteProcessorMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.GetProcessorRequest; /** - * Decodes a DeleteProcessorMetadata message from the specified reader or buffer, length delimited. + * Decodes a GetProcessorRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns DeleteProcessorMetadata + * @returns GetProcessorRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DeleteProcessorMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.GetProcessorRequest; /** - * Verifies a DeleteProcessorMetadata message. + * Verifies a GetProcessorRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a DeleteProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a GetProcessorRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns DeleteProcessorMetadata + * @returns GetProcessorRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DeleteProcessorMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.GetProcessorRequest; /** - * Creates a plain object from a DeleteProcessorMetadata message. Also converts values to other types if specified. - * @param message DeleteProcessorMetadata + * Creates a plain object from a GetProcessorRequest message. Also converts values to other types if specified. + * @param message GetProcessorRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.DeleteProcessorMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.GetProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this DeleteProcessorMetadata to JSON. + * Converts this GetProcessorRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an EnableProcessorRequest. */ - interface IEnableProcessorRequest { + /** Properties of a GetProcessorVersionRequest. */ + interface IGetProcessorVersionRequest { - /** EnableProcessorRequest name */ + /** GetProcessorVersionRequest name */ name?: (string|null); } - /** Represents an EnableProcessorRequest. */ - class EnableProcessorRequest implements IEnableProcessorRequest { + /** Represents a GetProcessorVersionRequest. */ + class GetProcessorVersionRequest implements IGetProcessorVersionRequest { /** - * Constructs a new EnableProcessorRequest. + * Constructs a new GetProcessorVersionRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.IEnableProcessorRequest); + constructor(properties?: google.cloud.documentai.v1beta3.IGetProcessorVersionRequest); - /** EnableProcessorRequest name. */ + /** GetProcessorVersionRequest name. */ public name: string; /** - * Creates a new EnableProcessorRequest instance using the specified properties. + * Creates a new GetProcessorVersionRequest instance using the specified properties. * @param [properties] Properties to set - * @returns EnableProcessorRequest instance + * @returns GetProcessorVersionRequest instance */ - public static create(properties?: google.cloud.documentai.v1beta3.IEnableProcessorRequest): google.cloud.documentai.v1beta3.EnableProcessorRequest; + public static create(properties?: google.cloud.documentai.v1beta3.IGetProcessorVersionRequest): google.cloud.documentai.v1beta3.GetProcessorVersionRequest; /** - * Encodes the specified EnableProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorRequest.verify|verify} messages. - * @param message EnableProcessorRequest message or plain object to encode + * Encodes the specified GetProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.GetProcessorVersionRequest.verify|verify} messages. + * @param message GetProcessorVersionRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.IEnableProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.IGetProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified EnableProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorRequest.verify|verify} messages. - * @param message EnableProcessorRequest message or plain object to encode + * Encodes the specified GetProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.GetProcessorVersionRequest.verify|verify} messages. + * @param message GetProcessorVersionRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.IEnableProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IGetProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an EnableProcessorRequest message from the specified reader or buffer. + * Decodes a GetProcessorVersionRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns EnableProcessorRequest + * @returns GetProcessorVersionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.EnableProcessorRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.GetProcessorVersionRequest; /** - * Decodes an EnableProcessorRequest message from the specified reader or buffer, length delimited. + * Decodes a GetProcessorVersionRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns EnableProcessorRequest + * @returns GetProcessorVersionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.EnableProcessorRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.GetProcessorVersionRequest; /** - * Verifies an EnableProcessorRequest message. + * Verifies a GetProcessorVersionRequest message. * @param message Plain 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 EnableProcessorRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns EnableProcessorRequest + * @returns GetProcessorVersionRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.EnableProcessorRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.GetProcessorVersionRequest; /** - * Creates a plain object from an EnableProcessorRequest message. Also converts values to other types if specified. - * @param message EnableProcessorRequest + * Creates a plain object from a GetProcessorVersionRequest message. Also converts values to other types if specified. + * @param message GetProcessorVersionRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.EnableProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.GetProcessorVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this EnableProcessorRequest to JSON. + * Converts this GetProcessorVersionRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an EnableProcessorResponse. */ - interface IEnableProcessorResponse { + /** Properties of a ListProcessorVersionsRequest. */ + interface IListProcessorVersionsRequest { + + /** ListProcessorVersionsRequest parent */ + parent?: (string|null); + + /** ListProcessorVersionsRequest pageSize */ + pageSize?: (number|null); + + /** ListProcessorVersionsRequest pageToken */ + pageToken?: (string|null); } - /** Represents an EnableProcessorResponse. */ - class EnableProcessorResponse implements IEnableProcessorResponse { + /** Represents a ListProcessorVersionsRequest. */ + class ListProcessorVersionsRequest implements IListProcessorVersionsRequest { /** - * Constructs a new EnableProcessorResponse. + * Constructs a new ListProcessorVersionsRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.IEnableProcessorResponse); + constructor(properties?: google.cloud.documentai.v1beta3.IListProcessorVersionsRequest); + + /** ListProcessorVersionsRequest parent. */ + public parent: string; + + /** ListProcessorVersionsRequest pageSize. */ + public pageSize: number; + + /** ListProcessorVersionsRequest pageToken. */ + public pageToken: string; /** - * Creates a new EnableProcessorResponse instance using the specified properties. + * Creates a new ListProcessorVersionsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns EnableProcessorResponse instance + * @returns ListProcessorVersionsRequest instance */ - public static create(properties?: google.cloud.documentai.v1beta3.IEnableProcessorResponse): google.cloud.documentai.v1beta3.EnableProcessorResponse; + public static create(properties?: google.cloud.documentai.v1beta3.IListProcessorVersionsRequest): google.cloud.documentai.v1beta3.ListProcessorVersionsRequest; /** - * Encodes the specified EnableProcessorResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorResponse.verify|verify} messages. - * @param message EnableProcessorResponse message or plain object to encode + * Encodes the specified ListProcessorVersionsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorVersionsRequest.verify|verify} messages. + * @param message ListProcessorVersionsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.IEnableProcessorResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified EnableProcessorResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorResponse.verify|verify} messages. - * @param message EnableProcessorResponse message or plain object to encode + * Encodes the specified ListProcessorVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorVersionsRequest.verify|verify} messages. + * @param message ListProcessorVersionsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.IEnableProcessorResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an EnableProcessorResponse message from the specified reader or buffer. + * Decodes a ListProcessorVersionsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns EnableProcessorResponse + * @returns ListProcessorVersionsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.EnableProcessorResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ListProcessorVersionsRequest; /** - * Decodes an EnableProcessorResponse message from the specified reader or buffer, length delimited. + * Decodes a ListProcessorVersionsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns EnableProcessorResponse + * @returns ListProcessorVersionsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.EnableProcessorResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ListProcessorVersionsRequest; /** - * Verifies an EnableProcessorResponse message. + * Verifies a ListProcessorVersionsRequest message. * @param message Plain 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 EnableProcessorResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListProcessorVersionsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns EnableProcessorResponse + * @returns ListProcessorVersionsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.EnableProcessorResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ListProcessorVersionsRequest; /** - * Creates a plain object from an EnableProcessorResponse message. Also converts values to other types if specified. - * @param message EnableProcessorResponse + * Creates a plain object from a ListProcessorVersionsRequest message. Also converts values to other types if specified. + * @param message ListProcessorVersionsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.EnableProcessorResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.ListProcessorVersionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this EnableProcessorResponse to JSON. + * Converts this ListProcessorVersionsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an EnableProcessorMetadata. */ - interface IEnableProcessorMetadata { + /** Properties of a ListProcessorVersionsResponse. */ + interface IListProcessorVersionsResponse { - /** EnableProcessorMetadata commonMetadata */ - commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + /** ListProcessorVersionsResponse processorVersions */ + processorVersions?: (google.cloud.documentai.v1beta3.IProcessorVersion[]|null); + + /** ListProcessorVersionsResponse nextPageToken */ + nextPageToken?: (string|null); } - /** Represents an EnableProcessorMetadata. */ - class EnableProcessorMetadata implements IEnableProcessorMetadata { + /** Represents a ListProcessorVersionsResponse. */ + class ListProcessorVersionsResponse implements IListProcessorVersionsResponse { /** - * Constructs a new EnableProcessorMetadata. + * Constructs a new ListProcessorVersionsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.IEnableProcessorMetadata); + constructor(properties?: google.cloud.documentai.v1beta3.IListProcessorVersionsResponse); - /** EnableProcessorMetadata commonMetadata. */ - public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + /** ListProcessorVersionsResponse processorVersions. */ + public processorVersions: google.cloud.documentai.v1beta3.IProcessorVersion[]; + + /** ListProcessorVersionsResponse nextPageToken. */ + public nextPageToken: string; /** - * Creates a new EnableProcessorMetadata instance using the specified properties. + * Creates a new ListProcessorVersionsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns EnableProcessorMetadata instance + * @returns ListProcessorVersionsResponse instance */ - public static create(properties?: google.cloud.documentai.v1beta3.IEnableProcessorMetadata): google.cloud.documentai.v1beta3.EnableProcessorMetadata; + public static create(properties?: google.cloud.documentai.v1beta3.IListProcessorVersionsResponse): google.cloud.documentai.v1beta3.ListProcessorVersionsResponse; /** - * Encodes the specified EnableProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorMetadata.verify|verify} messages. - * @param message EnableProcessorMetadata message or plain object to encode + * Encodes the specified ListProcessorVersionsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorVersionsResponse.verify|verify} messages. + * @param message ListProcessorVersionsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.IEnableProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.IListProcessorVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified EnableProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorMetadata.verify|verify} messages. - * @param message EnableProcessorMetadata message or plain object to encode + * Encodes the specified ListProcessorVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorVersionsResponse.verify|verify} messages. + * @param message ListProcessorVersionsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.IEnableProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IListProcessorVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an EnableProcessorMetadata message from the specified reader or buffer. + * Decodes a ListProcessorVersionsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns EnableProcessorMetadata + * @returns ListProcessorVersionsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.EnableProcessorMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ListProcessorVersionsResponse; /** - * Decodes an EnableProcessorMetadata message from the specified reader or buffer, length delimited. + * Decodes a ListProcessorVersionsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns EnableProcessorMetadata + * @returns ListProcessorVersionsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.EnableProcessorMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ListProcessorVersionsResponse; /** - * Verifies an EnableProcessorMetadata message. + * Verifies a ListProcessorVersionsResponse message. * @param message Plain 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 EnableProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a ListProcessorVersionsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns EnableProcessorMetadata + * @returns ListProcessorVersionsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.EnableProcessorMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ListProcessorVersionsResponse; /** - * Creates a plain object from an EnableProcessorMetadata message. Also converts values to other types if specified. - * @param message EnableProcessorMetadata + * Creates a plain object from a ListProcessorVersionsResponse message. Also converts values to other types if specified. + * @param message ListProcessorVersionsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.EnableProcessorMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.ListProcessorVersionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this EnableProcessorMetadata to JSON. + * Converts this ListProcessorVersionsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a DisableProcessorRequest. */ - interface IDisableProcessorRequest { + /** Properties of a DeleteProcessorVersionRequest. */ + interface IDeleteProcessorVersionRequest { - /** DisableProcessorRequest name */ + /** DeleteProcessorVersionRequest name */ name?: (string|null); } - /** Represents a DisableProcessorRequest. */ - class DisableProcessorRequest implements IDisableProcessorRequest { + /** Represents a DeleteProcessorVersionRequest. */ + class DeleteProcessorVersionRequest implements IDeleteProcessorVersionRequest { /** - * Constructs a new DisableProcessorRequest. + * Constructs a new DeleteProcessorVersionRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.IDisableProcessorRequest); + constructor(properties?: google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest); - /** DisableProcessorRequest name. */ + /** DeleteProcessorVersionRequest name. */ public name: string; /** - * Creates a new DisableProcessorRequest instance using the specified properties. + * Creates a new DeleteProcessorVersionRequest instance using the specified properties. * @param [properties] Properties to set - * @returns DisableProcessorRequest instance + * @returns DeleteProcessorVersionRequest instance */ - public static create(properties?: google.cloud.documentai.v1beta3.IDisableProcessorRequest): google.cloud.documentai.v1beta3.DisableProcessorRequest; + public static create(properties?: google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest): google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest; /** - * Encodes the specified DisableProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorRequest.verify|verify} messages. - * @param message DisableProcessorRequest message or plain object to encode + * Encodes the specified DeleteProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest.verify|verify} messages. + * @param message DeleteProcessorVersionRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.IDisableProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified DisableProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorRequest.verify|verify} messages. - * @param message DisableProcessorRequest message or plain object to encode + * Encodes the specified DeleteProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest.verify|verify} messages. + * @param message DeleteProcessorVersionRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDisableProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a DisableProcessorRequest message from the specified reader or buffer. + * Decodes a DeleteProcessorVersionRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns DisableProcessorRequest + * @returns DeleteProcessorVersionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DisableProcessorRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest; /** - * Decodes a DisableProcessorRequest message from the specified reader or buffer, length delimited. + * Decodes a DeleteProcessorVersionRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns DisableProcessorRequest + * @returns DeleteProcessorVersionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DisableProcessorRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest; /** - * Verifies a DisableProcessorRequest message. + * Verifies a DeleteProcessorVersionRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a DisableProcessorRequest message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns DisableProcessorRequest + * @returns DeleteProcessorVersionRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DisableProcessorRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest; /** - * Creates a plain object from a DisableProcessorRequest message. Also converts values to other types if specified. - * @param message DisableProcessorRequest + * Creates a plain object from a DeleteProcessorVersionRequest message. Also converts values to other types if specified. + * @param message DeleteProcessorVersionRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.DisableProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this DisableProcessorRequest to JSON. + * Converts this DeleteProcessorVersionRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a DisableProcessorResponse. */ - interface IDisableProcessorResponse { + /** Properties of a DeleteProcessorVersionMetadata. */ + interface IDeleteProcessorVersionMetadata { + + /** DeleteProcessorVersionMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); } - /** Represents a DisableProcessorResponse. */ - class DisableProcessorResponse implements IDisableProcessorResponse { + /** Represents a DeleteProcessorVersionMetadata. */ + class DeleteProcessorVersionMetadata implements IDeleteProcessorVersionMetadata { /** - * Constructs a new DisableProcessorResponse. + * Constructs a new DeleteProcessorVersionMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.IDisableProcessorResponse); + constructor(properties?: google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata); + + /** DeleteProcessorVersionMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); /** - * Creates a new DisableProcessorResponse instance using the specified properties. + * Creates a new DeleteProcessorVersionMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns DisableProcessorResponse instance + * @returns DeleteProcessorVersionMetadata instance */ - public static create(properties?: google.cloud.documentai.v1beta3.IDisableProcessorResponse): google.cloud.documentai.v1beta3.DisableProcessorResponse; + public static create(properties?: google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata): google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata; /** - * Encodes the specified DisableProcessorResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorResponse.verify|verify} messages. - * @param message DisableProcessorResponse message or plain object to encode + * Encodes the specified DeleteProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata.verify|verify} messages. + * @param message DeleteProcessorVersionMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.IDisableProcessorResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified DisableProcessorResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorResponse.verify|verify} messages. - * @param message DisableProcessorResponse message or plain object to encode + * Encodes the specified DeleteProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata.verify|verify} messages. + * @param message DeleteProcessorVersionMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDisableProcessorResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a DisableProcessorResponse message from the specified reader or buffer. + * Decodes a DeleteProcessorVersionMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns DisableProcessorResponse + * @returns DeleteProcessorVersionMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DisableProcessorResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata; /** - * Decodes a DisableProcessorResponse message from the specified reader or buffer, length delimited. + * Decodes a DeleteProcessorVersionMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns DisableProcessorResponse + * @returns DeleteProcessorVersionMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DisableProcessorResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata; /** - * Verifies a DisableProcessorResponse message. + * Verifies a DeleteProcessorVersionMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a DisableProcessorResponse message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns DisableProcessorResponse + * @returns DeleteProcessorVersionMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DisableProcessorResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata; /** - * Creates a plain object from a DisableProcessorResponse message. Also converts values to other types if specified. - * @param message DisableProcessorResponse + * Creates a plain object from a DeleteProcessorVersionMetadata message. Also converts values to other types if specified. + * @param message DeleteProcessorVersionMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.DisableProcessorResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this DisableProcessorResponse to JSON. + * Converts this DeleteProcessorVersionMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a DisableProcessorMetadata. */ - interface IDisableProcessorMetadata { + /** Properties of a DeployProcessorVersionRequest. */ + interface IDeployProcessorVersionRequest { - /** DisableProcessorMetadata commonMetadata */ - commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + /** DeployProcessorVersionRequest name */ + name?: (string|null); } - /** Represents a DisableProcessorMetadata. */ - class DisableProcessorMetadata implements IDisableProcessorMetadata { + /** Represents a DeployProcessorVersionRequest. */ + class DeployProcessorVersionRequest implements IDeployProcessorVersionRequest { /** - * Constructs a new DisableProcessorMetadata. + * Constructs a new DeployProcessorVersionRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.IDisableProcessorMetadata); + constructor(properties?: google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest); - /** DisableProcessorMetadata commonMetadata. */ - public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + /** DeployProcessorVersionRequest name. */ + public name: string; /** - * Creates a new DisableProcessorMetadata instance using the specified properties. + * Creates a new DeployProcessorVersionRequest instance using the specified properties. * @param [properties] Properties to set - * @returns DisableProcessorMetadata instance + * @returns DeployProcessorVersionRequest instance */ - public static create(properties?: google.cloud.documentai.v1beta3.IDisableProcessorMetadata): google.cloud.documentai.v1beta3.DisableProcessorMetadata; + public static create(properties?: google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest): google.cloud.documentai.v1beta3.DeployProcessorVersionRequest; /** - * Encodes the specified DisableProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorMetadata.verify|verify} messages. - * @param message DisableProcessorMetadata message or plain object to encode + * Encodes the specified DeployProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeployProcessorVersionRequest.verify|verify} messages. + * @param message DeployProcessorVersionRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.IDisableProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified DisableProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorMetadata.verify|verify} messages. - * @param message DisableProcessorMetadata message or plain object to encode + * Encodes the specified DeployProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeployProcessorVersionRequest.verify|verify} messages. + * @param message DeployProcessorVersionRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDisableProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a DisableProcessorMetadata message from the specified reader or buffer. + * Decodes a DeployProcessorVersionRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns DisableProcessorMetadata + * @returns DeployProcessorVersionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DisableProcessorMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DeployProcessorVersionRequest; /** - * Decodes a DisableProcessorMetadata message from the specified reader or buffer, length delimited. + * Decodes a DeployProcessorVersionRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns DisableProcessorMetadata + * @returns DeployProcessorVersionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DisableProcessorMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DeployProcessorVersionRequest; /** - * Verifies a DisableProcessorMetadata message. + * Verifies a DeployProcessorVersionRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a DisableProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a DeployProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns DisableProcessorMetadata + * @returns DeployProcessorVersionRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DisableProcessorMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DeployProcessorVersionRequest; /** - * Creates a plain object from a DisableProcessorMetadata message. Also converts values to other types if specified. - * @param message DisableProcessorMetadata + * Creates a plain object from a DeployProcessorVersionRequest message. Also converts values to other types if specified. + * @param message DeployProcessorVersionRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.DisableProcessorMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.DeployProcessorVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this DisableProcessorMetadata to JSON. + * Converts this DeployProcessorVersionRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ReviewDocumentRequest. */ - interface IReviewDocumentRequest { - - /** ReviewDocumentRequest inlineDocument */ - inlineDocument?: (google.cloud.documentai.v1beta3.IDocument|null); - - /** ReviewDocumentRequest humanReviewConfig */ - humanReviewConfig?: (string|null); - - /** ReviewDocumentRequest document */ - document?: (google.cloud.documentai.v1beta3.IDocument|null); - - /** ReviewDocumentRequest enableSchemaValidation */ - enableSchemaValidation?: (boolean|null); - - /** ReviewDocumentRequest priority */ - priority?: (google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority|null); + /** Properties of a DeployProcessorVersionResponse. */ + interface IDeployProcessorVersionResponse { } - /** Represents a ReviewDocumentRequest. */ - class ReviewDocumentRequest implements IReviewDocumentRequest { + /** Represents a DeployProcessorVersionResponse. */ + class DeployProcessorVersionResponse implements IDeployProcessorVersionResponse { /** - * Constructs a new ReviewDocumentRequest. + * Constructs a new DeployProcessorVersionResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentRequest); - - /** ReviewDocumentRequest inlineDocument. */ - public inlineDocument?: (google.cloud.documentai.v1beta3.IDocument|null); - - /** ReviewDocumentRequest humanReviewConfig. */ - public humanReviewConfig: string; - - /** ReviewDocumentRequest document. */ - public document?: (google.cloud.documentai.v1beta3.IDocument|null); - - /** ReviewDocumentRequest enableSchemaValidation. */ - public enableSchemaValidation: boolean; - - /** ReviewDocumentRequest priority. */ - public priority: (google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority); - - /** ReviewDocumentRequest source. */ - public source?: "inlineDocument"; + constructor(properties?: google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse); /** - * Creates a new ReviewDocumentRequest instance using the specified properties. + * Creates a new DeployProcessorVersionResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ReviewDocumentRequest instance + * @returns DeployProcessorVersionResponse instance */ - public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentRequest): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + public static create(properties?: google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse): google.cloud.documentai.v1beta3.DeployProcessorVersionResponse; /** - * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. - * @param message ReviewDocumentRequest message or plain object to encode + * Encodes the specified DeployProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeployProcessorVersionResponse.verify|verify} messages. + * @param message DeployProcessorVersionResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. - * @param message ReviewDocumentRequest message or plain object to encode + * Encodes the specified DeployProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeployProcessorVersionResponse.verify|verify} messages. + * @param message DeployProcessorVersionResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * Decodes a DeployProcessorVersionResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ReviewDocumentRequest + * @returns DeployProcessorVersionResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DeployProcessorVersionResponse; /** - * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * Decodes a DeployProcessorVersionResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ReviewDocumentRequest + * @returns DeployProcessorVersionResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DeployProcessorVersionResponse; /** - * Verifies a ReviewDocumentRequest message. + * Verifies a DeployProcessorVersionResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. + * Creates a DeployProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ReviewDocumentRequest + * @returns DeployProcessorVersionResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DeployProcessorVersionResponse; /** - * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. - * @param message ReviewDocumentRequest + * Creates a plain object from a DeployProcessorVersionResponse message. Also converts values to other types if specified. + * @param message DeployProcessorVersionResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.DeployProcessorVersionResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ReviewDocumentRequest to JSON. + * Converts this DeployProcessorVersionResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace ReviewDocumentRequest { - - /** Priority enum. */ - enum Priority { - DEFAULT = 0, - URGENT = 1 - } - } - - /** Properties of a ReviewDocumentResponse. */ - interface IReviewDocumentResponse { + /** Properties of a DeployProcessorVersionMetadata. */ + interface IDeployProcessorVersionMetadata { - /** ReviewDocumentResponse gcsDestination */ - gcsDestination?: (string|null); + /** DeployProcessorVersionMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); } - /** Represents a ReviewDocumentResponse. */ - class ReviewDocumentResponse implements IReviewDocumentResponse { + /** Represents a DeployProcessorVersionMetadata. */ + class DeployProcessorVersionMetadata implements IDeployProcessorVersionMetadata { /** - * Constructs a new ReviewDocumentResponse. + * Constructs a new DeployProcessorVersionMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentResponse); + constructor(properties?: google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata); - /** ReviewDocumentResponse gcsDestination. */ - public gcsDestination: string; + /** DeployProcessorVersionMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); /** - * Creates a new ReviewDocumentResponse instance using the specified properties. + * Creates a new DeployProcessorVersionMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns ReviewDocumentResponse instance + * @returns DeployProcessorVersionMetadata instance */ - public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentResponse): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + public static create(properties?: google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata): google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata; /** - * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. - * @param message ReviewDocumentResponse message or plain object to encode + * Encodes the specified DeployProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata.verify|verify} messages. + * @param message DeployProcessorVersionMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. - * @param message ReviewDocumentResponse message or plain object to encode + * Encodes the specified DeployProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata.verify|verify} messages. + * @param message DeployProcessorVersionMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * Decodes a DeployProcessorVersionMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ReviewDocumentResponse + * @returns DeployProcessorVersionMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * Decodes a DeployProcessorVersionMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ReviewDocumentResponse + * @returns DeployProcessorVersionMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata; /** - * Verifies a ReviewDocumentResponse message. + * Verifies a DeployProcessorVersionMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * Creates a DeployProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ReviewDocumentResponse + * @returns DeployProcessorVersionMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata; /** - * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. - * @param message ReviewDocumentResponse + * Creates a plain object from a DeployProcessorVersionMetadata message. Also converts values to other types if specified. + * @param message DeployProcessorVersionMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ReviewDocumentResponse to JSON. + * Converts this DeployProcessorVersionMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ReviewDocumentOperationMetadata. */ - interface IReviewDocumentOperationMetadata { - - /** ReviewDocumentOperationMetadata state */ - state?: (google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|null); - - /** ReviewDocumentOperationMetadata stateMessage */ - stateMessage?: (string|null); - - /** ReviewDocumentOperationMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); + /** Properties of an UndeployProcessorVersionRequest. */ + interface IUndeployProcessorVersionRequest { - /** ReviewDocumentOperationMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); + /** UndeployProcessorVersionRequest name */ + name?: (string|null); + } - /** ReviewDocumentOperationMetadata commonMetadata */ - commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + /** Represents an UndeployProcessorVersionRequest. */ + class UndeployProcessorVersionRequest implements IUndeployProcessorVersionRequest { - /** ReviewDocumentOperationMetadata questionId */ - questionId?: (string|null); - } + /** + * Constructs a new UndeployProcessorVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest); - /** Represents a ReviewDocumentOperationMetadata. */ - class ReviewDocumentOperationMetadata implements IReviewDocumentOperationMetadata { + /** UndeployProcessorVersionRequest name. */ + public name: string; /** - * Constructs a new ReviewDocumentOperationMetadata. + * Creates a new UndeployProcessorVersionRequest instance using the specified properties. * @param [properties] Properties to set + * @returns UndeployProcessorVersionRequest instance */ - constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata); + public static create(properties?: google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest): google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest; - /** ReviewDocumentOperationMetadata state. */ - public state: (google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State); + /** + * Encodes the specified UndeployProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest.verify|verify} messages. + * @param message UndeployProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** ReviewDocumentOperationMetadata stateMessage. */ - public stateMessage: string; + /** + * Encodes the specified UndeployProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest.verify|verify} messages. + * @param message UndeployProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** ReviewDocumentOperationMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); + /** + * Decodes an UndeployProcessorVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UndeployProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest; - /** ReviewDocumentOperationMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); + /** + * Decodes an UndeployProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UndeployProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest; - /** ReviewDocumentOperationMetadata commonMetadata. */ - public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + /** + * Verifies an UndeployProcessorVersionRequest message. + * @param message Plain 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 UndeployProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UndeployProcessorVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest; + + /** + * Creates a plain object from an UndeployProcessorVersionRequest message. Also converts values to other types if specified. + * @param message UndeployProcessorVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UndeployProcessorVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UndeployProcessorVersionResponse. */ + interface IUndeployProcessorVersionResponse { + } + + /** Represents an UndeployProcessorVersionResponse. */ + class UndeployProcessorVersionResponse implements IUndeployProcessorVersionResponse { + + /** + * Constructs a new UndeployProcessorVersionResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse); + + /** + * Creates a new UndeployProcessorVersionResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns UndeployProcessorVersionResponse instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse): google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse; + + /** + * Encodes the specified UndeployProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse.verify|verify} messages. + * @param message UndeployProcessorVersionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UndeployProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse.verify|verify} messages. + * @param message UndeployProcessorVersionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UndeployProcessorVersionResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UndeployProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse; + + /** + * Decodes an UndeployProcessorVersionResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UndeployProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse; + + /** + * Verifies an UndeployProcessorVersionResponse message. + * @param message Plain 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 UndeployProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UndeployProcessorVersionResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse; + + /** + * Creates a plain object from an UndeployProcessorVersionResponse message. Also converts values to other types if specified. + * @param message UndeployProcessorVersionResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UndeployProcessorVersionResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UndeployProcessorVersionMetadata. */ + interface IUndeployProcessorVersionMetadata { + + /** UndeployProcessorVersionMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + } + + /** Represents an UndeployProcessorVersionMetadata. */ + class UndeployProcessorVersionMetadata implements IUndeployProcessorVersionMetadata { + + /** + * Constructs a new UndeployProcessorVersionMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata); + + /** UndeployProcessorVersionMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + + /** + * Creates a new UndeployProcessorVersionMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns UndeployProcessorVersionMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata): google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata; + + /** + * Encodes the specified UndeployProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata.verify|verify} messages. + * @param message UndeployProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UndeployProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata.verify|verify} messages. + * @param message UndeployProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UndeployProcessorVersionMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UndeployProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata; + + /** + * Decodes an UndeployProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UndeployProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata; + + /** + * Verifies an UndeployProcessorVersionMetadata message. + * @param message Plain 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 UndeployProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UndeployProcessorVersionMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata; + + /** + * Creates a plain object from an UndeployProcessorVersionMetadata message. Also converts values to other types if specified. + * @param message UndeployProcessorVersionMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UndeployProcessorVersionMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateProcessorRequest. */ + interface ICreateProcessorRequest { + + /** CreateProcessorRequest parent */ + parent?: (string|null); + + /** CreateProcessorRequest processor */ + processor?: (google.cloud.documentai.v1beta3.IProcessor|null); + } + + /** Represents a CreateProcessorRequest. */ + class CreateProcessorRequest implements ICreateProcessorRequest { + + /** + * Constructs a new CreateProcessorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.ICreateProcessorRequest); + + /** CreateProcessorRequest parent. */ + public parent: string; + + /** CreateProcessorRequest processor. */ + public processor?: (google.cloud.documentai.v1beta3.IProcessor|null); + + /** + * Creates a new CreateProcessorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateProcessorRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.ICreateProcessorRequest): google.cloud.documentai.v1beta3.CreateProcessorRequest; + + /** + * Encodes the specified CreateProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.CreateProcessorRequest.verify|verify} messages. + * @param message CreateProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.ICreateProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.CreateProcessorRequest.verify|verify} messages. + * @param message CreateProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.ICreateProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateProcessorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.CreateProcessorRequest; + + /** + * Decodes a CreateProcessorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.CreateProcessorRequest; + + /** + * Verifies a CreateProcessorRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateProcessorRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.CreateProcessorRequest; + + /** + * Creates a plain object from a CreateProcessorRequest message. Also converts values to other types if specified. + * @param message CreateProcessorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.CreateProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateProcessorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteProcessorRequest. */ + interface IDeleteProcessorRequest { + + /** DeleteProcessorRequest name */ + name?: (string|null); + } + + /** Represents a DeleteProcessorRequest. */ + class DeleteProcessorRequest implements IDeleteProcessorRequest { + + /** + * Constructs a new DeleteProcessorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IDeleteProcessorRequest); + + /** DeleteProcessorRequest name. */ + public name: string; + + /** + * Creates a new DeleteProcessorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteProcessorRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IDeleteProcessorRequest): google.cloud.documentai.v1beta3.DeleteProcessorRequest; + + /** + * Encodes the specified DeleteProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorRequest.verify|verify} messages. + * @param message DeleteProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IDeleteProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorRequest.verify|verify} messages. + * @param message DeleteProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDeleteProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteProcessorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DeleteProcessorRequest; + + /** + * Decodes a DeleteProcessorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DeleteProcessorRequest; + + /** + * Verifies a DeleteProcessorRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteProcessorRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DeleteProcessorRequest; + + /** + * Creates a plain object from a DeleteProcessorRequest message. Also converts values to other types if specified. + * @param message DeleteProcessorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DeleteProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteProcessorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteProcessorMetadata. */ + interface IDeleteProcessorMetadata { + + /** DeleteProcessorMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + } + + /** Represents a DeleteProcessorMetadata. */ + class DeleteProcessorMetadata implements IDeleteProcessorMetadata { + + /** + * Constructs a new DeleteProcessorMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IDeleteProcessorMetadata); + + /** DeleteProcessorMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + + /** + * Creates a new DeleteProcessorMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteProcessorMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IDeleteProcessorMetadata): google.cloud.documentai.v1beta3.DeleteProcessorMetadata; + + /** + * Encodes the specified DeleteProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorMetadata.verify|verify} messages. + * @param message DeleteProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IDeleteProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorMetadata.verify|verify} messages. + * @param message DeleteProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDeleteProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteProcessorMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DeleteProcessorMetadata; + + /** + * Decodes a DeleteProcessorMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DeleteProcessorMetadata; + + /** + * Verifies a DeleteProcessorMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteProcessorMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DeleteProcessorMetadata; + + /** + * Creates a plain object from a DeleteProcessorMetadata message. Also converts values to other types if specified. + * @param message DeleteProcessorMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DeleteProcessorMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteProcessorMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnableProcessorRequest. */ + interface IEnableProcessorRequest { + + /** EnableProcessorRequest name */ + name?: (string|null); + } + + /** Represents an EnableProcessorRequest. */ + class EnableProcessorRequest implements IEnableProcessorRequest { + + /** + * Constructs a new EnableProcessorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IEnableProcessorRequest); + + /** EnableProcessorRequest name. */ + public name: string; + + /** + * Creates a new EnableProcessorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns EnableProcessorRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IEnableProcessorRequest): google.cloud.documentai.v1beta3.EnableProcessorRequest; + + /** + * Encodes the specified EnableProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorRequest.verify|verify} messages. + * @param message EnableProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IEnableProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnableProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorRequest.verify|verify} messages. + * @param message EnableProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IEnableProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnableProcessorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.EnableProcessorRequest; + + /** + * Decodes an EnableProcessorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.EnableProcessorRequest; + + /** + * Verifies an EnableProcessorRequest message. + * @param message Plain 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 EnableProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnableProcessorRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.EnableProcessorRequest; + + /** + * Creates a plain object from an EnableProcessorRequest message. Also converts values to other types if specified. + * @param message EnableProcessorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.EnableProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnableProcessorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnableProcessorResponse. */ + interface IEnableProcessorResponse { + } + + /** Represents an EnableProcessorResponse. */ + class EnableProcessorResponse implements IEnableProcessorResponse { + + /** + * Constructs a new EnableProcessorResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IEnableProcessorResponse); + + /** + * Creates a new EnableProcessorResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns EnableProcessorResponse instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IEnableProcessorResponse): google.cloud.documentai.v1beta3.EnableProcessorResponse; + + /** + * Encodes the specified EnableProcessorResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorResponse.verify|verify} messages. + * @param message EnableProcessorResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IEnableProcessorResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnableProcessorResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorResponse.verify|verify} messages. + * @param message EnableProcessorResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IEnableProcessorResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnableProcessorResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.EnableProcessorResponse; + + /** + * Decodes an EnableProcessorResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.EnableProcessorResponse; + + /** + * Verifies an EnableProcessorResponse message. + * @param message Plain 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 EnableProcessorResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnableProcessorResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.EnableProcessorResponse; + + /** + * Creates a plain object from an EnableProcessorResponse message. Also converts values to other types if specified. + * @param message EnableProcessorResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.EnableProcessorResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnableProcessorResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnableProcessorMetadata. */ + interface IEnableProcessorMetadata { + + /** EnableProcessorMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + } + + /** Represents an EnableProcessorMetadata. */ + class EnableProcessorMetadata implements IEnableProcessorMetadata { + + /** + * Constructs a new EnableProcessorMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IEnableProcessorMetadata); + + /** EnableProcessorMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + + /** + * Creates a new EnableProcessorMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns EnableProcessorMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IEnableProcessorMetadata): google.cloud.documentai.v1beta3.EnableProcessorMetadata; + + /** + * Encodes the specified EnableProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorMetadata.verify|verify} messages. + * @param message EnableProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IEnableProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnableProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorMetadata.verify|verify} messages. + * @param message EnableProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IEnableProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnableProcessorMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.EnableProcessorMetadata; + + /** + * Decodes an EnableProcessorMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.EnableProcessorMetadata; + + /** + * Verifies an EnableProcessorMetadata message. + * @param message Plain 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 EnableProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnableProcessorMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.EnableProcessorMetadata; + + /** + * Creates a plain object from an EnableProcessorMetadata message. Also converts values to other types if specified. + * @param message EnableProcessorMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.EnableProcessorMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnableProcessorMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DisableProcessorRequest. */ + interface IDisableProcessorRequest { + + /** DisableProcessorRequest name */ + name?: (string|null); + } + + /** Represents a DisableProcessorRequest. */ + class DisableProcessorRequest implements IDisableProcessorRequest { + + /** + * Constructs a new DisableProcessorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IDisableProcessorRequest); + + /** DisableProcessorRequest name. */ + public name: string; + + /** + * Creates a new DisableProcessorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DisableProcessorRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IDisableProcessorRequest): google.cloud.documentai.v1beta3.DisableProcessorRequest; + + /** + * Encodes the specified DisableProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorRequest.verify|verify} messages. + * @param message DisableProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IDisableProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DisableProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorRequest.verify|verify} messages. + * @param message DisableProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDisableProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DisableProcessorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DisableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DisableProcessorRequest; + + /** + * Decodes a DisableProcessorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DisableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DisableProcessorRequest; + + /** + * Verifies a DisableProcessorRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DisableProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DisableProcessorRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DisableProcessorRequest; + + /** + * Creates a plain object from a DisableProcessorRequest message. Also converts values to other types if specified. + * @param message DisableProcessorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DisableProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DisableProcessorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DisableProcessorResponse. */ + interface IDisableProcessorResponse { + } + + /** Represents a DisableProcessorResponse. */ + class DisableProcessorResponse implements IDisableProcessorResponse { + + /** + * Constructs a new DisableProcessorResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IDisableProcessorResponse); + + /** + * Creates a new DisableProcessorResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DisableProcessorResponse instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IDisableProcessorResponse): google.cloud.documentai.v1beta3.DisableProcessorResponse; + + /** + * Encodes the specified DisableProcessorResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorResponse.verify|verify} messages. + * @param message DisableProcessorResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IDisableProcessorResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DisableProcessorResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorResponse.verify|verify} messages. + * @param message DisableProcessorResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDisableProcessorResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DisableProcessorResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DisableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DisableProcessorResponse; + + /** + * Decodes a DisableProcessorResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DisableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DisableProcessorResponse; + + /** + * Verifies a DisableProcessorResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DisableProcessorResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DisableProcessorResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DisableProcessorResponse; + + /** + * Creates a plain object from a DisableProcessorResponse message. Also converts values to other types if specified. + * @param message DisableProcessorResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DisableProcessorResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DisableProcessorResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DisableProcessorMetadata. */ + interface IDisableProcessorMetadata { + + /** DisableProcessorMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + } + + /** Represents a DisableProcessorMetadata. */ + class DisableProcessorMetadata implements IDisableProcessorMetadata { + + /** + * Constructs a new DisableProcessorMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IDisableProcessorMetadata); + + /** DisableProcessorMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + + /** + * Creates a new DisableProcessorMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DisableProcessorMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IDisableProcessorMetadata): google.cloud.documentai.v1beta3.DisableProcessorMetadata; + + /** + * Encodes the specified DisableProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorMetadata.verify|verify} messages. + * @param message DisableProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IDisableProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DisableProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorMetadata.verify|verify} messages. + * @param message DisableProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDisableProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DisableProcessorMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DisableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DisableProcessorMetadata; + + /** + * Decodes a DisableProcessorMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DisableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DisableProcessorMetadata; + + /** + * Verifies a DisableProcessorMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DisableProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DisableProcessorMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DisableProcessorMetadata; + + /** + * Creates a plain object from a DisableProcessorMetadata message. Also converts values to other types if specified. + * @param message DisableProcessorMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DisableProcessorMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DisableProcessorMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SetDefaultProcessorVersionRequest. */ + interface ISetDefaultProcessorVersionRequest { + + /** SetDefaultProcessorVersionRequest processor */ + processor?: (string|null); + + /** SetDefaultProcessorVersionRequest defaultProcessorVersion */ + defaultProcessorVersion?: (string|null); + } + + /** Represents a SetDefaultProcessorVersionRequest. */ + class SetDefaultProcessorVersionRequest implements ISetDefaultProcessorVersionRequest { + + /** + * Constructs a new SetDefaultProcessorVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionRequest); + + /** SetDefaultProcessorVersionRequest processor. */ + public processor: string; + + /** SetDefaultProcessorVersionRequest defaultProcessorVersion. */ + public defaultProcessorVersion: string; + + /** + * Creates a new SetDefaultProcessorVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SetDefaultProcessorVersionRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionRequest): google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest; + + /** + * Encodes the specified SetDefaultProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest.verify|verify} messages. + * @param message SetDefaultProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetDefaultProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest.verify|verify} messages. + * @param message SetDefaultProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetDefaultProcessorVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetDefaultProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest; + + /** + * Decodes a SetDefaultProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetDefaultProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest; + + /** + * Verifies a SetDefaultProcessorVersionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetDefaultProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetDefaultProcessorVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest; + + /** + * Creates a plain object from a SetDefaultProcessorVersionRequest message. Also converts values to other types if specified. + * @param message SetDefaultProcessorVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetDefaultProcessorVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SetDefaultProcessorVersionResponse. */ + interface ISetDefaultProcessorVersionResponse { + } + + /** Represents a SetDefaultProcessorVersionResponse. */ + class SetDefaultProcessorVersionResponse implements ISetDefaultProcessorVersionResponse { + + /** + * Constructs a new SetDefaultProcessorVersionResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionResponse); + + /** + * Creates a new SetDefaultProcessorVersionResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SetDefaultProcessorVersionResponse instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionResponse): google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse; + + /** + * Encodes the specified SetDefaultProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse.verify|verify} messages. + * @param message SetDefaultProcessorVersionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetDefaultProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse.verify|verify} messages. + * @param message SetDefaultProcessorVersionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetDefaultProcessorVersionResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetDefaultProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse; + + /** + * Decodes a SetDefaultProcessorVersionResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetDefaultProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse; + + /** + * Verifies a SetDefaultProcessorVersionResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetDefaultProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetDefaultProcessorVersionResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse; + + /** + * Creates a plain object from a SetDefaultProcessorVersionResponse message. Also converts values to other types if specified. + * @param message SetDefaultProcessorVersionResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetDefaultProcessorVersionResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SetDefaultProcessorVersionMetadata. */ + interface ISetDefaultProcessorVersionMetadata { + + /** SetDefaultProcessorVersionMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + } + + /** Represents a SetDefaultProcessorVersionMetadata. */ + class SetDefaultProcessorVersionMetadata implements ISetDefaultProcessorVersionMetadata { + + /** + * Constructs a new SetDefaultProcessorVersionMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionMetadata); + + /** SetDefaultProcessorVersionMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + + /** + * Creates a new SetDefaultProcessorVersionMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns SetDefaultProcessorVersionMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionMetadata): google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata; + + /** + * Encodes the specified SetDefaultProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata.verify|verify} messages. + * @param message SetDefaultProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetDefaultProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata.verify|verify} messages. + * @param message SetDefaultProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetDefaultProcessorVersionMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetDefaultProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata; + + /** + * Decodes a SetDefaultProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetDefaultProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata; + + /** + * Verifies a SetDefaultProcessorVersionMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetDefaultProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetDefaultProcessorVersionMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata; + + /** + * Creates a plain object from a SetDefaultProcessorVersionMetadata message. Also converts values to other types if specified. + * @param message SetDefaultProcessorVersionMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetDefaultProcessorVersionMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ReviewDocumentRequest. */ + interface IReviewDocumentRequest { + + /** ReviewDocumentRequest inlineDocument */ + inlineDocument?: (google.cloud.documentai.v1beta3.IDocument|null); + + /** ReviewDocumentRequest humanReviewConfig */ + humanReviewConfig?: (string|null); + + /** ReviewDocumentRequest document */ + document?: (google.cloud.documentai.v1beta3.IDocument|null); + + /** ReviewDocumentRequest enableSchemaValidation */ + enableSchemaValidation?: (boolean|null); + + /** ReviewDocumentRequest priority */ + priority?: (google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority|null); + + /** ReviewDocumentRequest documentSchema */ + documentSchema?: (google.cloud.documentai.v1beta3.IDocumentSchema|null); + } + + /** Represents a ReviewDocumentRequest. */ + class ReviewDocumentRequest implements IReviewDocumentRequest { + + /** + * Constructs a new ReviewDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentRequest); + + /** ReviewDocumentRequest inlineDocument. */ + public inlineDocument?: (google.cloud.documentai.v1beta3.IDocument|null); + + /** ReviewDocumentRequest humanReviewConfig. */ + public humanReviewConfig: string; + + /** ReviewDocumentRequest document. */ + public document?: (google.cloud.documentai.v1beta3.IDocument|null); + + /** ReviewDocumentRequest enableSchemaValidation. */ + public enableSchemaValidation: boolean; + + /** ReviewDocumentRequest priority. */ + public priority: (google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority); + + /** ReviewDocumentRequest documentSchema. */ + public documentSchema?: (google.cloud.documentai.v1beta3.IDocumentSchema|null); + + /** ReviewDocumentRequest source. */ + public source?: "inlineDocument"; + + /** + * Creates a new ReviewDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ReviewDocumentRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentRequest): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + + /** + * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * @param message ReviewDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * @param message ReviewDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + + /** + * Verifies a ReviewDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReviewDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + + /** + * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. + * @param message ReviewDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReviewDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ReviewDocumentRequest { + + /** Priority enum. */ + enum Priority { + DEFAULT = 0, + URGENT = 1 + } + } + + /** Properties of a ReviewDocumentResponse. */ + interface IReviewDocumentResponse { + + /** ReviewDocumentResponse gcsDestination */ + gcsDestination?: (string|null); + + /** ReviewDocumentResponse state */ + state?: (google.cloud.documentai.v1beta3.ReviewDocumentResponse.State|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentResponse.State|null); + + /** ReviewDocumentResponse rejectionReason */ + rejectionReason?: (string|null); + } + + /** Represents a ReviewDocumentResponse. */ + class ReviewDocumentResponse implements IReviewDocumentResponse { + + /** + * Constructs a new ReviewDocumentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentResponse); + + /** ReviewDocumentResponse gcsDestination. */ + public gcsDestination: string; + + /** ReviewDocumentResponse state. */ + public state: (google.cloud.documentai.v1beta3.ReviewDocumentResponse.State|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentResponse.State); + + /** ReviewDocumentResponse rejectionReason. */ + public rejectionReason: string; + + /** + * Creates a new ReviewDocumentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ReviewDocumentResponse instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentResponse): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + + /** + * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * @param message ReviewDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * @param message ReviewDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + + /** + * Verifies a ReviewDocumentResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReviewDocumentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + + /** + * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. + * @param message ReviewDocumentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReviewDocumentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ReviewDocumentResponse { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + REJECTED = 1, + SUCCEEDED = 2 + } + } + + /** Properties of a ReviewDocumentOperationMetadata. */ + interface IReviewDocumentOperationMetadata { + + /** ReviewDocumentOperationMetadata state */ + state?: (google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|null); + + /** ReviewDocumentOperationMetadata stateMessage */ + stateMessage?: (string|null); + + /** ReviewDocumentOperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ReviewDocumentOperationMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** ReviewDocumentOperationMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + + /** ReviewDocumentOperationMetadata questionId */ + questionId?: (string|null); + } + + /** Represents a ReviewDocumentOperationMetadata. */ + class ReviewDocumentOperationMetadata implements IReviewDocumentOperationMetadata { + + /** + * Constructs a new ReviewDocumentOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata); + + /** ReviewDocumentOperationMetadata state. */ + public state: (google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State); + + /** ReviewDocumentOperationMetadata stateMessage. */ + public stateMessage: string; + + /** ReviewDocumentOperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ReviewDocumentOperationMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** ReviewDocumentOperationMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + + /** ReviewDocumentOperationMetadata questionId. */ + public questionId: string; + + /** + * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ReviewDocumentOperationMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * @param message ReviewDocumentOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * @param message ReviewDocumentOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + + /** + * Verifies a ReviewDocumentOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReviewDocumentOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + + /** + * Creates a plain object from a ReviewDocumentOperationMetadata message. Also converts values to other types if specified. + * @param message ReviewDocumentOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReviewDocumentOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ReviewDocumentOperationMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + CANCELLING = 2, + SUCCEEDED = 3, + FAILED = 4, + CANCELLED = 5 + } + } + + /** Properties of a DocumentSchema. */ + interface IDocumentSchema { + + /** DocumentSchema displayName */ + displayName?: (string|null); + + /** DocumentSchema description */ + description?: (string|null); + + /** DocumentSchema entityTypes */ + entityTypes?: (google.cloud.documentai.v1beta3.DocumentSchema.IEntityType[]|null); + + /** DocumentSchema metadata */ + metadata?: (google.cloud.documentai.v1beta3.DocumentSchema.IMetadata|null); + } + + /** Represents a DocumentSchema. */ + class DocumentSchema implements IDocumentSchema { + + /** + * Constructs a new DocumentSchema. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IDocumentSchema); + + /** DocumentSchema displayName. */ + public displayName: string; + + /** DocumentSchema description. */ + public description: string; + + /** DocumentSchema entityTypes. */ + public entityTypes: google.cloud.documentai.v1beta3.DocumentSchema.IEntityType[]; + + /** DocumentSchema metadata. */ + public metadata?: (google.cloud.documentai.v1beta3.DocumentSchema.IMetadata|null); + + /** + * Creates a new DocumentSchema instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentSchema instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IDocumentSchema): google.cloud.documentai.v1beta3.DocumentSchema; + + /** + * Encodes the specified DocumentSchema message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.verify|verify} messages. + * @param message DocumentSchema message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IDocumentSchema, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentSchema message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.verify|verify} messages. + * @param message DocumentSchema message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDocumentSchema, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentSchema message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentSchema + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DocumentSchema; + + /** + * Decodes a DocumentSchema message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentSchema + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DocumentSchema; + + /** + * Verifies a DocumentSchema message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentSchema message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentSchema + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DocumentSchema; + + /** + * Creates a plain object from a DocumentSchema message. Also converts values to other types if specified. + * @param message DocumentSchema + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DocumentSchema, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentSchema to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace DocumentSchema { + + /** Properties of an EntityType. */ + interface IEntityType { + + /** EntityType enumValues */ + enumValues?: (google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues|null); + + /** EntityType displayName */ + displayName?: (string|null); + + /** EntityType name */ + name?: (string|null); + + /** EntityType baseTypes */ + baseTypes?: (string[]|null); + + /** EntityType properties */ + properties?: (google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty[]|null); + } + + /** Represents an EntityType. */ + class EntityType implements IEntityType { + + /** + * Constructs a new EntityType. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.DocumentSchema.IEntityType); + + /** EntityType enumValues. */ + public enumValues?: (google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues|null); + + /** EntityType displayName. */ + public displayName: string; + + /** EntityType name. */ + public name: string; + + /** EntityType baseTypes. */ + public baseTypes: string[]; + + /** EntityType properties. */ + public properties: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty[]; + + /** EntityType valueSource. */ + public valueSource?: "enumValues"; + + /** + * Creates a new EntityType instance using the specified properties. + * @param [properties] Properties to set + * @returns EntityType instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.DocumentSchema.IEntityType): google.cloud.documentai.v1beta3.DocumentSchema.EntityType; + + /** + * Encodes the specified EntityType message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.verify|verify} messages. + * @param message EntityType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.DocumentSchema.IEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EntityType message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.verify|verify} messages. + * @param message EntityType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.DocumentSchema.IEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EntityType message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DocumentSchema.EntityType; + + /** + * Decodes an EntityType message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DocumentSchema.EntityType; + + /** + * Verifies an EntityType message. + * @param message Plain 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 EntityType message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EntityType + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DocumentSchema.EntityType; + + /** + * Creates a plain object from an EntityType message. Also converts values to other types if specified. + * @param message EntityType + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EntityType to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace EntityType { + + /** Properties of an EnumValues. */ + interface IEnumValues { + + /** EnumValues values */ + values?: (string[]|null); + } + + /** Represents an EnumValues. */ + class EnumValues implements IEnumValues { + + /** + * Constructs a new EnumValues. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues); + + /** EnumValues values. */ + public values: string[]; + + /** + * Creates a new EnumValues instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumValues instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues; + + /** + * Encodes the specified EnumValues message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.verify|verify} messages. + * @param message EnumValues message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumValues message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.verify|verify} messages. + * @param message EnumValues message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumValues message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumValues + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues; + + /** + * Decodes an EnumValues message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumValues + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues; + + /** + * Verifies an EnumValues message. + * @param message Plain 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 EnumValues message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumValues + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues; + + /** + * Creates a plain object from an EnumValues message. Also converts values to other types if specified. + * @param message EnumValues + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumValues to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Property. */ + interface IProperty { + + /** Property name */ + name?: (string|null); + + /** Property valueType */ + valueType?: (string|null); + + /** Property occurrenceType */ + occurrenceType?: (google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType|keyof typeof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType|null); + } + + /** Represents a Property. */ + class Property implements IProperty { + + /** + * Constructs a new Property. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty); + + /** Property name. */ + public name: string; + + /** Property valueType. */ + public valueType: string; + + /** Property occurrenceType. */ + public occurrenceType: (google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType|keyof typeof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType); + + /** + * Creates a new Property instance using the specified properties. + * @param [properties] Properties to set + * @returns Property instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property; + + /** + * Encodes the specified Property message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.verify|verify} messages. + * @param message Property message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.verify|verify} messages. + * @param message Property message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Property message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Property + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property; + + /** + * Decodes a Property message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Property + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property; + + /** + * Verifies a Property message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Property message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Property + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property; + + /** + * Creates a plain object from a Property message. Also converts values to other types if specified. + * @param message Property + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Property to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Property { + + /** OccurrenceType enum. */ + enum OccurrenceType { + OCCURRENCE_TYPE_UNSPECIFIED = 0, + OPTIONAL_ONCE = 1, + OPTIONAL_MULTIPLE = 2, + REQUIRED_ONCE = 3, + REQUIRED_MULTIPLE = 4 + } + } + } + + /** Properties of a Metadata. */ + interface IMetadata { + + /** Metadata documentSplitter */ + documentSplitter?: (boolean|null); + + /** Metadata documentAllowMultipleLabels */ + documentAllowMultipleLabels?: (boolean|null); + + /** Metadata prefixedNamingOnProperties */ + prefixedNamingOnProperties?: (boolean|null); + + /** Metadata skipNamingValidation */ + skipNamingValidation?: (boolean|null); + } + + /** Represents a Metadata. */ + class Metadata implements IMetadata { + + /** + * Constructs a new Metadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.DocumentSchema.IMetadata); + + /** Metadata documentSplitter. */ + public documentSplitter: boolean; + + /** Metadata documentAllowMultipleLabels. */ + public documentAllowMultipleLabels: boolean; + + /** Metadata prefixedNamingOnProperties. */ + public prefixedNamingOnProperties: boolean; + + /** Metadata skipNamingValidation. */ + public skipNamingValidation: boolean; + + /** + * Creates a new Metadata instance using the specified properties. + * @param [properties] Properties to set + * @returns Metadata instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.DocumentSchema.IMetadata): google.cloud.documentai.v1beta3.DocumentSchema.Metadata; + + /** + * Encodes the specified Metadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.Metadata.verify|verify} messages. + * @param message Metadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.DocumentSchema.IMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Metadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.Metadata.verify|verify} messages. + * @param message Metadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.DocumentSchema.IMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Metadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DocumentSchema.Metadata; + + /** + * Decodes a Metadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DocumentSchema.Metadata; + + /** + * Verifies a Metadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Metadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Metadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DocumentSchema.Metadata; + + /** + * Creates a plain object from a Metadata message. Also converts values to other types if specified. + * @param message Metadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DocumentSchema.Metadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Metadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a CommonOperationMetadata. */ + interface ICommonOperationMetadata { + + /** CommonOperationMetadata state */ + state?: (google.cloud.documentai.v1beta3.CommonOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.CommonOperationMetadata.State|null); + + /** CommonOperationMetadata stateMessage */ + stateMessage?: (string|null); + + /** CommonOperationMetadata resource */ + resource?: (string|null); + + /** CommonOperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** CommonOperationMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a CommonOperationMetadata. */ + class CommonOperationMetadata implements ICommonOperationMetadata { + + /** + * Constructs a new CommonOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.ICommonOperationMetadata); + + /** CommonOperationMetadata state. */ + public state: (google.cloud.documentai.v1beta3.CommonOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.CommonOperationMetadata.State); + + /** CommonOperationMetadata stateMessage. */ + public stateMessage: string; + + /** CommonOperationMetadata resource. */ + public resource: string; + + /** CommonOperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); - /** ReviewDocumentOperationMetadata questionId. */ - public questionId: string; + /** CommonOperationMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); /** - * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * Creates a new CommonOperationMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns ReviewDocumentOperationMetadata instance + * @returns CommonOperationMetadata instance */ - public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + public static create(properties?: google.cloud.documentai.v1beta3.ICommonOperationMetadata): google.cloud.documentai.v1beta3.CommonOperationMetadata; /** - * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. - * @param message ReviewDocumentOperationMetadata message or plain object to encode + * Encodes the specified CommonOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.CommonOperationMetadata.verify|verify} messages. + * @param message CommonOperationMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.ICommonOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. - * @param message ReviewDocumentOperationMetadata message or plain object to encode + * Encodes the specified CommonOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.CommonOperationMetadata.verify|verify} messages. + * @param message CommonOperationMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.ICommonOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * Decodes a CommonOperationMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ReviewDocumentOperationMetadata + * @returns CommonOperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.CommonOperationMetadata; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * Decodes a CommonOperationMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ReviewDocumentOperationMetadata + * @returns CommonOperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.CommonOperationMetadata; /** - * Verifies a ReviewDocumentOperationMetadata message. + * Verifies a CommonOperationMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a CommonOperationMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ReviewDocumentOperationMetadata + * @returns CommonOperationMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.CommonOperationMetadata; /** - * Creates a plain object from a ReviewDocumentOperationMetadata message. Also converts values to other types if specified. - * @param message ReviewDocumentOperationMetadata + * Creates a plain object from a CommonOperationMetadata message. Also converts values to other types if specified. + * @param message CommonOperationMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.CommonOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ReviewDocumentOperationMetadata to JSON. + * Converts this CommonOperationMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace ReviewDocumentOperationMetadata { + namespace CommonOperationMetadata { /** State enum. */ enum State { @@ -26605,124 +29265,246 @@ export namespace google { } } - /** Properties of a CommonOperationMetadata. */ - interface ICommonOperationMetadata { + /** Properties of a ProcessorVersion. */ + interface IProcessorVersion { - /** CommonOperationMetadata state */ - state?: (google.cloud.documentai.v1beta3.CommonOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.CommonOperationMetadata.State|null); + /** ProcessorVersion name */ + name?: (string|null); - /** CommonOperationMetadata stateMessage */ - stateMessage?: (string|null); + /** ProcessorVersion displayName */ + displayName?: (string|null); - /** CommonOperationMetadata createTime */ + /** ProcessorVersion state */ + state?: (google.cloud.documentai.v1beta3.ProcessorVersion.State|keyof typeof google.cloud.documentai.v1beta3.ProcessorVersion.State|null); + + /** ProcessorVersion createTime */ createTime?: (google.protobuf.ITimestamp|null); - /** CommonOperationMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); + /** ProcessorVersion kmsKeyName */ + kmsKeyName?: (string|null); + + /** ProcessorVersion kmsKeyVersionName */ + kmsKeyVersionName?: (string|null); + + /** ProcessorVersion googleManaged */ + googleManaged?: (boolean|null); + + /** ProcessorVersion deprecationInfo */ + deprecationInfo?: (google.cloud.documentai.v1beta3.ProcessorVersion.IDeprecationInfo|null); } - /** Represents a CommonOperationMetadata. */ - class CommonOperationMetadata implements ICommonOperationMetadata { + /** Represents a ProcessorVersion. */ + class ProcessorVersion implements IProcessorVersion { /** - * Constructs a new CommonOperationMetadata. + * Constructs a new ProcessorVersion. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.ICommonOperationMetadata); + constructor(properties?: google.cloud.documentai.v1beta3.IProcessorVersion); - /** CommonOperationMetadata state. */ - public state: (google.cloud.documentai.v1beta3.CommonOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.CommonOperationMetadata.State); + /** ProcessorVersion name. */ + public name: string; - /** CommonOperationMetadata stateMessage. */ - public stateMessage: string; + /** ProcessorVersion displayName. */ + public displayName: string; - /** CommonOperationMetadata createTime. */ + /** ProcessorVersion state. */ + public state: (google.cloud.documentai.v1beta3.ProcessorVersion.State|keyof typeof google.cloud.documentai.v1beta3.ProcessorVersion.State); + + /** ProcessorVersion createTime. */ public createTime?: (google.protobuf.ITimestamp|null); - /** CommonOperationMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); + /** ProcessorVersion kmsKeyName. */ + public kmsKeyName: string; + + /** ProcessorVersion kmsKeyVersionName. */ + public kmsKeyVersionName: string; + + /** ProcessorVersion googleManaged. */ + public googleManaged: boolean; + + /** ProcessorVersion deprecationInfo. */ + public deprecationInfo?: (google.cloud.documentai.v1beta3.ProcessorVersion.IDeprecationInfo|null); /** - * Creates a new CommonOperationMetadata instance using the specified properties. + * Creates a new ProcessorVersion instance using the specified properties. * @param [properties] Properties to set - * @returns CommonOperationMetadata instance + * @returns ProcessorVersion instance */ - public static create(properties?: google.cloud.documentai.v1beta3.ICommonOperationMetadata): google.cloud.documentai.v1beta3.CommonOperationMetadata; + public static create(properties?: google.cloud.documentai.v1beta3.IProcessorVersion): google.cloud.documentai.v1beta3.ProcessorVersion; /** - * Encodes the specified CommonOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.CommonOperationMetadata.verify|verify} messages. - * @param message CommonOperationMetadata message or plain object to encode + * Encodes the specified ProcessorVersion message. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessorVersion.verify|verify} messages. + * @param message ProcessorVersion message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.ICommonOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.IProcessorVersion, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CommonOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.CommonOperationMetadata.verify|verify} messages. - * @param message CommonOperationMetadata message or plain object to encode + * Encodes the specified ProcessorVersion message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessorVersion.verify|verify} messages. + * @param message ProcessorVersion message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.ICommonOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IProcessorVersion, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CommonOperationMetadata message from the specified reader or buffer. + * Decodes a ProcessorVersion message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CommonOperationMetadata + * @returns ProcessorVersion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.CommonOperationMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ProcessorVersion; /** - * Decodes a CommonOperationMetadata message from the specified reader or buffer, length delimited. + * Decodes a ProcessorVersion message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CommonOperationMetadata + * @returns ProcessorVersion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.CommonOperationMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ProcessorVersion; /** - * Verifies a CommonOperationMetadata message. + * Verifies a ProcessorVersion message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CommonOperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a ProcessorVersion message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CommonOperationMetadata + * @returns ProcessorVersion */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.CommonOperationMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ProcessorVersion; /** - * Creates a plain object from a CommonOperationMetadata message. Also converts values to other types if specified. - * @param message CommonOperationMetadata + * Creates a plain object from a ProcessorVersion message. Also converts values to other types if specified. + * @param message ProcessorVersion * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.CommonOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.ProcessorVersion, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CommonOperationMetadata to JSON. + * Converts this ProcessorVersion to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace CommonOperationMetadata { + namespace ProcessorVersion { + + /** Properties of a DeprecationInfo. */ + interface IDeprecationInfo { + + /** DeprecationInfo deprecationTime */ + deprecationTime?: (google.protobuf.ITimestamp|null); + + /** DeprecationInfo replacementProcessorVersion */ + replacementProcessorVersion?: (string|null); + } + + /** Represents a DeprecationInfo. */ + class DeprecationInfo implements IDeprecationInfo { + + /** + * Constructs a new DeprecationInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.ProcessorVersion.IDeprecationInfo); + + /** DeprecationInfo deprecationTime. */ + public deprecationTime?: (google.protobuf.ITimestamp|null); + + /** DeprecationInfo replacementProcessorVersion. */ + public replacementProcessorVersion: string; + + /** + * Creates a new DeprecationInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns DeprecationInfo instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.ProcessorVersion.IDeprecationInfo): google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo; + + /** + * Encodes the specified DeprecationInfo message. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo.verify|verify} messages. + * @param message DeprecationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.ProcessorVersion.IDeprecationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeprecationInfo message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo.verify|verify} messages. + * @param message DeprecationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.ProcessorVersion.IDeprecationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeprecationInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeprecationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo; + + /** + * Decodes a DeprecationInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeprecationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo; + + /** + * Verifies a DeprecationInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeprecationInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeprecationInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo; + + /** + * Creates a plain object from a DeprecationInfo message. Also converts values to other types if specified. + * @param message DeprecationInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeprecationInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } /** State enum. */ enum State { STATE_UNSPECIFIED = 0, - RUNNING = 1, - CANCELLING = 2, - SUCCEEDED = 3, - FAILED = 4, - CANCELLED = 5 + DEPLOYED = 1, + DEPLOYING = 2, + UNDEPLOYED = 3, + UNDEPLOYING = 4, + CREATING = 5, + DELETING = 6, + FAILED = 7 } } @@ -26890,6 +29672,9 @@ export namespace google { /** ProcessorType allowCreation */ allowCreation?: (boolean|null); + + /** ProcessorType launchStage */ + launchStage?: (google.api.LaunchStage|keyof typeof google.api.LaunchStage|null); } /** Represents a ProcessorType. */ @@ -26916,6 +29701,9 @@ export namespace google { /** ProcessorType allowCreation. */ public allowCreation: boolean; + /** ProcessorType launchStage. */ + public launchStage: (google.api.LaunchStage|keyof typeof google.api.LaunchStage); + /** * Creates a new ProcessorType instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 0b85aec5689..d8ebf58dcc6 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -47517,6 +47517,238 @@ */ var v1beta3 = {}; + v1beta3.Barcode = (function() { + + /** + * Properties of a Barcode. + * @memberof google.cloud.documentai.v1beta3 + * @interface IBarcode + * @property {string|null} [format] Barcode format + * @property {string|null} [valueFormat] Barcode valueFormat + * @property {string|null} [rawValue] Barcode rawValue + */ + + /** + * Constructs a new Barcode. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a Barcode. + * @implements IBarcode + * @constructor + * @param {google.cloud.documentai.v1beta3.IBarcode=} [properties] Properties to set + */ + function Barcode(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Barcode format. + * @member {string} format + * @memberof google.cloud.documentai.v1beta3.Barcode + * @instance + */ + Barcode.prototype.format = ""; + + /** + * Barcode valueFormat. + * @member {string} valueFormat + * @memberof google.cloud.documentai.v1beta3.Barcode + * @instance + */ + Barcode.prototype.valueFormat = ""; + + /** + * Barcode rawValue. + * @member {string} rawValue + * @memberof google.cloud.documentai.v1beta3.Barcode + * @instance + */ + Barcode.prototype.rawValue = ""; + + /** + * Creates a new Barcode instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Barcode + * @static + * @param {google.cloud.documentai.v1beta3.IBarcode=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Barcode} Barcode instance + */ + Barcode.create = function create(properties) { + return new Barcode(properties); + }; + + /** + * Encodes the specified Barcode message. Does not implicitly {@link google.cloud.documentai.v1beta3.Barcode.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Barcode + * @static + * @param {google.cloud.documentai.v1beta3.IBarcode} message Barcode message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Barcode.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.format != null && Object.hasOwnProperty.call(message, "format")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.format); + if (message.valueFormat != null && Object.hasOwnProperty.call(message, "valueFormat")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.valueFormat); + if (message.rawValue != null && Object.hasOwnProperty.call(message, "rawValue")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.rawValue); + return writer; + }; + + /** + * Encodes the specified Barcode message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Barcode.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Barcode + * @static + * @param {google.cloud.documentai.v1beta3.IBarcode} message Barcode message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Barcode.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Barcode message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Barcode + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Barcode} Barcode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Barcode.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Barcode(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.format = reader.string(); + break; + case 2: + message.valueFormat = reader.string(); + break; + case 3: + message.rawValue = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Barcode message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Barcode + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Barcode} Barcode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Barcode.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Barcode message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Barcode + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Barcode.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.format != null && message.hasOwnProperty("format")) + if (!$util.isString(message.format)) + return "format: string expected"; + if (message.valueFormat != null && message.hasOwnProperty("valueFormat")) + if (!$util.isString(message.valueFormat)) + return "valueFormat: string expected"; + if (message.rawValue != null && message.hasOwnProperty("rawValue")) + if (!$util.isString(message.rawValue)) + return "rawValue: string expected"; + return null; + }; + + /** + * Creates a Barcode message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Barcode + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Barcode} Barcode + */ + Barcode.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Barcode) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Barcode(); + if (object.format != null) + message.format = String(object.format); + if (object.valueFormat != null) + message.valueFormat = String(object.valueFormat); + if (object.rawValue != null) + message.rawValue = String(object.rawValue); + return message; + }; + + /** + * Creates a plain object from a Barcode message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Barcode + * @static + * @param {google.cloud.documentai.v1beta3.Barcode} message Barcode + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Barcode.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.format = ""; + object.valueFormat = ""; + object.rawValue = ""; + } + if (message.format != null && message.hasOwnProperty("format")) + object.format = message.format; + if (message.valueFormat != null && message.hasOwnProperty("valueFormat")) + object.valueFormat = message.valueFormat; + if (message.rawValue != null && message.hasOwnProperty("rawValue")) + object.rawValue = message.rawValue; + return object; + }; + + /** + * Converts this Barcode to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Barcode + * @instance + * @returns {Object.} JSON object + */ + Barcode.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Barcode; + })(); + v1beta3.Document = (function() { /** @@ -48954,6 +49186,7 @@ * @property {Array.|null} [tables] Page tables * @property {Array.|null} [formFields] Page formFields * @property {Array.|null} [symbols] Page symbols + * @property {Array.|null} [detectedBarcodes] Page detectedBarcodes * @property {google.cloud.documentai.v1beta3.Document.IProvenance|null} [provenance] Page provenance */ @@ -48976,6 +49209,7 @@ this.tables = []; this.formFields = []; this.symbols = []; + this.detectedBarcodes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -49094,6 +49328,14 @@ */ Page.prototype.symbols = $util.emptyArray; + /** + * Page detectedBarcodes. + * @member {Array.} detectedBarcodes + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + */ + Page.prototype.detectedBarcodes = $util.emptyArray; + /** * Page provenance. * @member {google.cloud.documentai.v1beta3.Document.IProvenance|null|undefined} provenance @@ -49164,6 +49406,9 @@ if (message.transforms != null && message.transforms.length) for (var i = 0; i < message.transforms.length; ++i) $root.google.cloud.documentai.v1beta3.Document.Page.Matrix.encode(message.transforms[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.detectedBarcodes != null && message.detectedBarcodes.length) + for (var i = 0; i < message.detectedBarcodes.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode.encode(message.detectedBarcodes[i], writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) $root.google.cloud.documentai.v1beta3.Document.Provenance.encode(message.provenance, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); return writer; @@ -49262,6 +49507,11 @@ message.symbols = []; message.symbols.push($root.google.cloud.documentai.v1beta3.Document.Page.Symbol.decode(reader, reader.uint32())); break; + case 15: + if (!(message.detectedBarcodes && message.detectedBarcodes.length)) + message.detectedBarcodes = []; + message.detectedBarcodes.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode.decode(reader, reader.uint32())); + break; case 16: message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); break; @@ -49408,6 +49658,15 @@ return "symbols." + error; } } + if (message.detectedBarcodes != null && message.hasOwnProperty("detectedBarcodes")) { + if (!Array.isArray(message.detectedBarcodes)) + return "detectedBarcodes: array expected"; + for (var i = 0; i < message.detectedBarcodes.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode.verify(message.detectedBarcodes[i]); + if (error) + return "detectedBarcodes." + error; + } + } if (message.provenance != null && message.hasOwnProperty("provenance")) { var error = $root.google.cloud.documentai.v1beta3.Document.Provenance.verify(message.provenance); if (error) @@ -49545,6 +49804,16 @@ message.symbols[i] = $root.google.cloud.documentai.v1beta3.Document.Page.Symbol.fromObject(object.symbols[i]); } } + if (object.detectedBarcodes) { + if (!Array.isArray(object.detectedBarcodes)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.detectedBarcodes: array expected"); + message.detectedBarcodes = []; + for (var i = 0; i < object.detectedBarcodes.length; ++i) { + if (typeof object.detectedBarcodes[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.detectedBarcodes: object expected"); + message.detectedBarcodes[i] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode.fromObject(object.detectedBarcodes[i]); + } + } if (object.provenance != null) { if (typeof object.provenance !== "object") throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.provenance: object expected"); @@ -49577,6 +49846,7 @@ object.formFields = []; object.symbols = []; object.transforms = []; + object.detectedBarcodes = []; } if (options.defaults) { object.pageNumber = 0; @@ -49643,6 +49913,11 @@ for (var j = 0; j < message.transforms.length; ++j) object.transforms[j] = $root.google.cloud.documentai.v1beta3.Document.Page.Matrix.toObject(message.transforms[j], options); } + if (message.detectedBarcodes && message.detectedBarcodes.length) { + object.detectedBarcodes = []; + for (var j = 0; j < message.detectedBarcodes.length; ++j) + object.detectedBarcodes[j] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode.toObject(message.detectedBarcodes[j], options); + } if (message.provenance != null && message.hasOwnProperty("provenance")) object.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.toObject(message.provenance, options); return object; @@ -53358,6 +53633,8 @@ * @property {Array.|null} [nameDetectedLanguages] FormField nameDetectedLanguages * @property {Array.|null} [valueDetectedLanguages] FormField valueDetectedLanguages * @property {string|null} [valueType] FormField valueType + * @property {string|null} [correctedKeyText] FormField correctedKeyText + * @property {string|null} [correctedValueText] FormField correctedValueText * @property {google.cloud.documentai.v1beta3.Document.IProvenance|null} [provenance] FormField provenance */ @@ -53419,22 +53696,38 @@ FormField.prototype.valueType = ""; /** - * FormField provenance. - * @member {google.cloud.documentai.v1beta3.Document.IProvenance|null|undefined} provenance + * FormField correctedKeyText. + * @member {string} correctedKeyText * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField * @instance */ - FormField.prototype.provenance = null; + FormField.prototype.correctedKeyText = ""; /** - * Creates a new FormField instance using the specified properties. - * @function create + * FormField correctedValueText. + * @member {string} correctedValueText * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField - * @static - * @param {google.cloud.documentai.v1beta3.Document.Page.IFormField=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.Document.Page.FormField} FormField instance + * @instance */ - FormField.create = function create(properties) { + FormField.prototype.correctedValueText = ""; + + /** + * FormField provenance. + * @member {google.cloud.documentai.v1beta3.Document.IProvenance|null|undefined} provenance + * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField + * @instance + */ + FormField.prototype.provenance = null; + + /** + * Creates a new FormField instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IFormField=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.FormField} FormField instance + */ + FormField.create = function create(properties) { return new FormField(properties); }; @@ -53462,6 +53755,10 @@ $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.encode(message.valueDetectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.valueType != null && Object.hasOwnProperty.call(message, "valueType")) writer.uint32(/* id 5, wireType 2 =*/42).string(message.valueType); + if (message.correctedKeyText != null && Object.hasOwnProperty.call(message, "correctedKeyText")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.correctedKeyText); + if (message.correctedValueText != null && Object.hasOwnProperty.call(message, "correctedValueText")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.correctedValueText); if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) $root.google.cloud.documentai.v1beta3.Document.Provenance.encode(message.provenance, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); return writer; @@ -53517,6 +53814,12 @@ case 5: message.valueType = reader.string(); break; + case 6: + message.correctedKeyText = reader.string(); + break; + case 7: + message.correctedValueText = reader.string(); + break; case 8: message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); break; @@ -53586,6 +53889,12 @@ if (message.valueType != null && message.hasOwnProperty("valueType")) if (!$util.isString(message.valueType)) return "valueType: string expected"; + if (message.correctedKeyText != null && message.hasOwnProperty("correctedKeyText")) + if (!$util.isString(message.correctedKeyText)) + return "correctedKeyText: string expected"; + if (message.correctedValueText != null && message.hasOwnProperty("correctedValueText")) + if (!$util.isString(message.correctedValueText)) + return "correctedValueText: string expected"; if (message.provenance != null && message.hasOwnProperty("provenance")) { var error = $root.google.cloud.documentai.v1beta3.Document.Provenance.verify(message.provenance); if (error) @@ -53638,6 +53947,10 @@ } if (object.valueType != null) message.valueType = String(object.valueType); + if (object.correctedKeyText != null) + message.correctedKeyText = String(object.correctedKeyText); + if (object.correctedValueText != null) + message.correctedValueText = String(object.correctedValueText); if (object.provenance != null) { if (typeof object.provenance !== "object") throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.FormField.provenance: object expected"); @@ -53667,6 +53980,8 @@ object.fieldName = null; object.fieldValue = null; object.valueType = ""; + object.correctedKeyText = ""; + object.correctedValueText = ""; object.provenance = null; } if (message.fieldName != null && message.hasOwnProperty("fieldName")) @@ -53685,6 +54000,10 @@ } if (message.valueType != null && message.hasOwnProperty("valueType")) object.valueType = message.valueType; + if (message.correctedKeyText != null && message.hasOwnProperty("correctedKeyText")) + object.correctedKeyText = message.correctedKeyText; + if (message.correctedValueText != null && message.hasOwnProperty("correctedValueText")) + object.correctedValueText = message.correctedValueText; if (message.provenance != null && message.hasOwnProperty("provenance")) object.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.toObject(message.provenance, options); return object; @@ -53704,6 +54023,226 @@ return FormField; })(); + Page.DetectedBarcode = (function() { + + /** + * Properties of a DetectedBarcode. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @interface IDetectedBarcode + * @property {google.cloud.documentai.v1beta3.Document.Page.ILayout|null} [layout] DetectedBarcode layout + * @property {google.cloud.documentai.v1beta3.IBarcode|null} [barcode] DetectedBarcode barcode + */ + + /** + * Constructs a new DetectedBarcode. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @classdesc Represents a DetectedBarcode. + * @implements IDetectedBarcode + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Page.IDetectedBarcode=} [properties] Properties to set + */ + function DetectedBarcode(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DetectedBarcode layout. + * @member {google.cloud.documentai.v1beta3.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode + * @instance + */ + DetectedBarcode.prototype.layout = null; + + /** + * DetectedBarcode barcode. + * @member {google.cloud.documentai.v1beta3.IBarcode|null|undefined} barcode + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode + * @instance + */ + DetectedBarcode.prototype.barcode = null; + + /** + * Creates a new DetectedBarcode instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IDetectedBarcode=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode} DetectedBarcode instance + */ + DetectedBarcode.create = function create(properties) { + return new DetectedBarcode(properties); + }; + + /** + * Encodes the specified DetectedBarcode message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IDetectedBarcode} message DetectedBarcode message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedBarcode.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1beta3.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.barcode != null && Object.hasOwnProperty.call(message, "barcode")) + $root.google.cloud.documentai.v1beta3.Barcode.encode(message.barcode, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DetectedBarcode message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IDetectedBarcode} message DetectedBarcode message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedBarcode.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectedBarcode message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode} DetectedBarcode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedBarcode.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + message.barcode = $root.google.cloud.documentai.v1beta3.Barcode.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectedBarcode message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode} DetectedBarcode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedBarcode.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectedBarcode message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectedBarcode.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.barcode != null && message.hasOwnProperty("barcode")) { + var error = $root.google.cloud.documentai.v1beta3.Barcode.verify(message.barcode); + if (error) + return "barcode." + error; + } + return null; + }; + + /** + * Creates a DetectedBarcode message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode} DetectedBarcode + */ + DetectedBarcode.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.fromObject(object.layout); + } + if (object.barcode != null) { + if (typeof object.barcode !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode.barcode: object expected"); + message.barcode = $root.google.cloud.documentai.v1beta3.Barcode.fromObject(object.barcode); + } + return message; + }; + + /** + * Creates a plain object from a DetectedBarcode message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode} message DetectedBarcode + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectedBarcode.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.layout = null; + object.barcode = null; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.toObject(message.layout, options); + if (message.barcode != null && message.hasOwnProperty("barcode")) + object.barcode = $root.google.cloud.documentai.v1beta3.Barcode.toObject(message.barcode, options); + return object; + }; + + /** + * Converts this DetectedBarcode to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode + * @instance + * @returns {Object.} JSON object + */ + DetectedBarcode.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DetectedBarcode; + })(); + Page.DetectedLanguage = (function() { /** @@ -54375,6 +54914,8 @@ * @property {google.type.IDateTime|null} [datetimeValue] NormalizedValue datetimeValue * @property {google.type.IPostalAddress|null} [addressValue] NormalizedValue addressValue * @property {boolean|null} [booleanValue] NormalizedValue booleanValue + * @property {number|null} [integerValue] NormalizedValue integerValue + * @property {number|null} [floatValue] NormalizedValue floatValue * @property {string|null} [text] NormalizedValue text */ @@ -54433,6 +54974,22 @@ */ NormalizedValue.prototype.booleanValue = null; + /** + * NormalizedValue integerValue. + * @member {number|null|undefined} integerValue + * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue + * @instance + */ + NormalizedValue.prototype.integerValue = null; + + /** + * NormalizedValue floatValue. + * @member {number|null|undefined} floatValue + * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue + * @instance + */ + NormalizedValue.prototype.floatValue = null; + /** * NormalizedValue text. * @member {string} text @@ -54446,12 +55003,12 @@ /** * NormalizedValue structuredValue. - * @member {"moneyValue"|"dateValue"|"datetimeValue"|"addressValue"|"booleanValue"|undefined} structuredValue + * @member {"moneyValue"|"dateValue"|"datetimeValue"|"addressValue"|"booleanValue"|"integerValue"|"floatValue"|undefined} structuredValue * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue * @instance */ Object.defineProperty(NormalizedValue.prototype, "structuredValue", { - get: $util.oneOfGetter($oneOfFields = ["moneyValue", "dateValue", "datetimeValue", "addressValue", "booleanValue"]), + get: $util.oneOfGetter($oneOfFields = ["moneyValue", "dateValue", "datetimeValue", "addressValue", "booleanValue", "integerValue", "floatValue"]), set: $util.oneOfSetter($oneOfFields) }); @@ -54491,6 +55048,10 @@ $root.google.type.PostalAddress.encode(message.addressValue, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); if (message.booleanValue != null && Object.hasOwnProperty.call(message, "booleanValue")) writer.uint32(/* id 6, wireType 0 =*/48).bool(message.booleanValue); + if (message.integerValue != null && Object.hasOwnProperty.call(message, "integerValue")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.integerValue); + if (message.floatValue != null && Object.hasOwnProperty.call(message, "floatValue")) + writer.uint32(/* id 8, wireType 5 =*/69).float(message.floatValue); return writer; }; @@ -54540,8 +55101,14 @@ case 6: message.booleanValue = reader.bool(); break; - case 1: - message.text = reader.string(); + case 7: + message.integerValue = reader.int32(); + break; + case 8: + message.floatValue = reader.float(); + break; + case 1: + message.text = reader.string(); break; default: reader.skipType(tag & 7); @@ -54624,6 +55191,20 @@ if (typeof message.booleanValue !== "boolean") return "booleanValue: boolean expected"; } + if (message.integerValue != null && message.hasOwnProperty("integerValue")) { + if (properties.structuredValue === 1) + return "structuredValue: multiple values"; + properties.structuredValue = 1; + if (!$util.isInteger(message.integerValue)) + return "integerValue: integer expected"; + } + if (message.floatValue != null && message.hasOwnProperty("floatValue")) { + if (properties.structuredValue === 1) + return "structuredValue: multiple values"; + properties.structuredValue = 1; + if (typeof message.floatValue !== "number") + return "floatValue: number expected"; + } if (message.text != null && message.hasOwnProperty("text")) if (!$util.isString(message.text)) return "text: string expected"; @@ -54664,6 +55245,10 @@ } if (object.booleanValue != null) message.booleanValue = Boolean(object.booleanValue); + if (object.integerValue != null) + message.integerValue = object.integerValue | 0; + if (object.floatValue != null) + message.floatValue = Number(object.floatValue); if (object.text != null) message.text = String(object.text); return message; @@ -54711,6 +55296,16 @@ if (options.oneofs) object.structuredValue = "booleanValue"; } + if (message.integerValue != null && message.hasOwnProperty("integerValue")) { + object.integerValue = message.integerValue; + if (options.oneofs) + object.structuredValue = "integerValue"; + } + if (message.floatValue != null && message.hasOwnProperty("floatValue")) { + object.floatValue = options.json && !isFinite(message.floatValue) ? String(message.floatValue) : message.floatValue; + if (options.oneofs) + object.structuredValue = "floatValue"; + } return object; }; @@ -56584,6 +57179,7 @@ * @property {string|null} [processor] Revision processor * @property {string|null} [id] Revision id * @property {Array.|null} [parent] Revision parent + * @property {Array.|null} [parentIds] Revision parentIds * @property {google.protobuf.ITimestamp|null} [createTime] Revision createTime * @property {google.cloud.documentai.v1beta3.Document.Revision.IHumanReview|null} [humanReview] Revision humanReview */ @@ -56598,6 +57194,7 @@ */ function Revision(properties) { this.parent = []; + this.parentIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -56636,6 +57233,14 @@ */ Revision.prototype.parent = $util.emptyArray; + /** + * Revision parentIds. + * @member {Array.} parentIds + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @instance + */ + Revision.prototype.parentIds = $util.emptyArray; + /** * Revision createTime. * @member {google.protobuf.ITimestamp|null|undefined} createTime @@ -56706,6 +57311,9 @@ writer.uint32(/* id 5, wireType 2 =*/42).string(message.processor); if (message.humanReview != null && Object.hasOwnProperty.call(message, "humanReview")) $root.google.cloud.documentai.v1beta3.Document.Revision.HumanReview.encode(message.humanReview, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.parentIds != null && message.parentIds.length) + for (var i = 0; i < message.parentIds.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.parentIds[i]); return writer; }; @@ -56759,6 +57367,11 @@ } else message.parent.push(reader.int32()); break; + case 7: + if (!(message.parentIds && message.parentIds.length)) + message.parentIds = []; + message.parentIds.push(reader.string()); + break; case 3: message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; @@ -56823,6 +57436,13 @@ if (!$util.isInteger(message.parent[i])) return "parent: integer[] expected"; } + if (message.parentIds != null && message.hasOwnProperty("parentIds")) { + if (!Array.isArray(message.parentIds)) + return "parentIds: array expected"; + for (var i = 0; i < message.parentIds.length; ++i) + if (!$util.isString(message.parentIds[i])) + return "parentIds: string[] expected"; + } if (message.createTime != null && message.hasOwnProperty("createTime")) { var error = $root.google.protobuf.Timestamp.verify(message.createTime); if (error) @@ -56861,6 +57481,13 @@ for (var i = 0; i < object.parent.length; ++i) message.parent[i] = object.parent[i] | 0; } + if (object.parentIds) { + if (!Array.isArray(object.parentIds)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Revision.parentIds: array expected"); + message.parentIds = []; + for (var i = 0; i < object.parentIds.length; ++i) + message.parentIds[i] = String(object.parentIds[i]); + } if (object.createTime != null) { if (typeof object.createTime !== "object") throw TypeError(".google.cloud.documentai.v1beta3.Document.Revision.createTime: object expected"); @@ -56887,8 +57514,10 @@ if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) + if (options.arrays || options.defaults) { object.parent = []; + object.parentIds = []; + } if (options.defaults) { object.id = ""; object.createTime = null; @@ -56915,6 +57544,11 @@ } if (message.humanReview != null && message.hasOwnProperty("humanReview")) object.humanReview = $root.google.cloud.documentai.v1beta3.Document.Revision.HumanReview.toObject(message.humanReview, options); + if (message.parentIds && message.parentIds.length) { + object.parentIds = []; + for (var j = 0; j < message.parentIds.length; ++j) + object.parentIds[j] = message.parentIds[j]; + } return object; }; @@ -59674,6 +60308,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#listProcessorTypes}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef ListProcessorTypesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1beta3.ListProcessorTypesResponse} [response] ListProcessorTypesResponse + */ + + /** + * Calls ListProcessorTypes. + * @function listProcessorTypes + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IListProcessorTypesRequest} request ListProcessorTypesRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessorTypesCallback} callback Node-style callback called with the error, if any, and ListProcessorTypesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.listProcessorTypes = function listProcessorTypes(request, callback) { + return this.rpcCall(listProcessorTypes, $root.google.cloud.documentai.v1beta3.ListProcessorTypesRequest, $root.google.cloud.documentai.v1beta3.ListProcessorTypesResponse, request, callback); + }, "name", { value: "ListProcessorTypes" }); + + /** + * Calls ListProcessorTypes. + * @function listProcessorTypes + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IListProcessorTypesRequest} request ListProcessorTypesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#listProcessors}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService @@ -59708,220 +60375,452 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#createProcessor}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#getProcessor}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService - * @typedef CreateProcessorCallback + * @typedef GetProcessorCallback * @type {function} * @param {Error|null} error Error, if any * @param {google.cloud.documentai.v1beta3.Processor} [response] Processor */ /** - * Calls CreateProcessor. - * @function createProcessor + * Calls GetProcessor. + * @function getProcessor * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @instance - * @param {google.cloud.documentai.v1beta3.ICreateProcessorRequest} request CreateProcessorRequest message or plain object - * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.CreateProcessorCallback} callback Node-style callback called with the error, if any, and Processor + * @param {google.cloud.documentai.v1beta3.IGetProcessorRequest} request GetProcessorRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.GetProcessorCallback} callback Node-style callback called with the error, if any, and Processor * @returns {undefined} * @variation 1 */ - Object.defineProperty(DocumentProcessorService.prototype.createProcessor = function createProcessor(request, callback) { - return this.rpcCall(createProcessor, $root.google.cloud.documentai.v1beta3.CreateProcessorRequest, $root.google.cloud.documentai.v1beta3.Processor, request, callback); - }, "name", { value: "CreateProcessor" }); + Object.defineProperty(DocumentProcessorService.prototype.getProcessor = function getProcessor(request, callback) { + return this.rpcCall(getProcessor, $root.google.cloud.documentai.v1beta3.GetProcessorRequest, $root.google.cloud.documentai.v1beta3.Processor, request, callback); + }, "name", { value: "GetProcessor" }); /** - * Calls CreateProcessor. - * @function createProcessor + * Calls GetProcessor. + * @function getProcessor * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @instance - * @param {google.cloud.documentai.v1beta3.ICreateProcessorRequest} request CreateProcessorRequest message or plain object + * @param {google.cloud.documentai.v1beta3.IGetProcessorRequest} request GetProcessorRequest message or plain object * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#deleteProcessor}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#getProcessorVersion}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService - * @typedef DeleteProcessorCallback + * @typedef GetProcessorVersionCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * @param {google.cloud.documentai.v1beta3.ProcessorVersion} [response] ProcessorVersion */ /** - * Calls DeleteProcessor. - * @function deleteProcessor + * Calls GetProcessorVersion. + * @function getProcessorVersion * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @instance - * @param {google.cloud.documentai.v1beta3.IDeleteProcessorRequest} request DeleteProcessorRequest message or plain object - * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.DeleteProcessorCallback} callback Node-style callback called with the error, if any, and Operation + * @param {google.cloud.documentai.v1beta3.IGetProcessorVersionRequest} request GetProcessorVersionRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.GetProcessorVersionCallback} callback Node-style callback called with the error, if any, and ProcessorVersion * @returns {undefined} * @variation 1 */ - Object.defineProperty(DocumentProcessorService.prototype.deleteProcessor = function deleteProcessor(request, callback) { - return this.rpcCall(deleteProcessor, $root.google.cloud.documentai.v1beta3.DeleteProcessorRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "DeleteProcessor" }); + Object.defineProperty(DocumentProcessorService.prototype.getProcessorVersion = function getProcessorVersion(request, callback) { + return this.rpcCall(getProcessorVersion, $root.google.cloud.documentai.v1beta3.GetProcessorVersionRequest, $root.google.cloud.documentai.v1beta3.ProcessorVersion, request, callback); + }, "name", { value: "GetProcessorVersion" }); /** - * Calls DeleteProcessor. - * @function deleteProcessor + * Calls GetProcessorVersion. + * @function getProcessorVersion * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @instance - * @param {google.cloud.documentai.v1beta3.IDeleteProcessorRequest} request DeleteProcessorRequest message or plain object - * @returns {Promise} Promise + * @param {google.cloud.documentai.v1beta3.IGetProcessorVersionRequest} request GetProcessorVersionRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#enableProcessor}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#listProcessorVersions}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService - * @typedef EnableProcessorCallback + * @typedef ListProcessorVersionsCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * @param {google.cloud.documentai.v1beta3.ListProcessorVersionsResponse} [response] ListProcessorVersionsResponse */ /** - * Calls EnableProcessor. - * @function enableProcessor + * Calls ListProcessorVersions. + * @function listProcessorVersions * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @instance - * @param {google.cloud.documentai.v1beta3.IEnableProcessorRequest} request EnableProcessorRequest message or plain object - * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.EnableProcessorCallback} callback Node-style callback called with the error, if any, and Operation + * @param {google.cloud.documentai.v1beta3.IListProcessorVersionsRequest} request ListProcessorVersionsRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessorVersionsCallback} callback Node-style callback called with the error, if any, and ListProcessorVersionsResponse * @returns {undefined} * @variation 1 */ - Object.defineProperty(DocumentProcessorService.prototype.enableProcessor = function enableProcessor(request, callback) { - return this.rpcCall(enableProcessor, $root.google.cloud.documentai.v1beta3.EnableProcessorRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "EnableProcessor" }); + Object.defineProperty(DocumentProcessorService.prototype.listProcessorVersions = function listProcessorVersions(request, callback) { + return this.rpcCall(listProcessorVersions, $root.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest, $root.google.cloud.documentai.v1beta3.ListProcessorVersionsResponse, request, callback); + }, "name", { value: "ListProcessorVersions" }); /** - * Calls EnableProcessor. - * @function enableProcessor + * Calls ListProcessorVersions. + * @function listProcessorVersions * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @instance - * @param {google.cloud.documentai.v1beta3.IEnableProcessorRequest} request EnableProcessorRequest message or plain object - * @returns {Promise} Promise + * @param {google.cloud.documentai.v1beta3.IListProcessorVersionsRequest} request ListProcessorVersionsRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#disableProcessor}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#deleteProcessorVersion}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService - * @typedef DisableProcessorCallback + * @typedef DeleteProcessorVersionCallback * @type {function} * @param {Error|null} error Error, if any * @param {google.longrunning.Operation} [response] Operation */ /** - * Calls DisableProcessor. - * @function disableProcessor + * Calls DeleteProcessorVersion. + * @function deleteProcessorVersion * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @instance - * @param {google.cloud.documentai.v1beta3.IDisableProcessorRequest} request DisableProcessorRequest message or plain object - * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.DisableProcessorCallback} callback Node-style callback called with the error, if any, and Operation + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest} request DeleteProcessorVersionRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.DeleteProcessorVersionCallback} callback Node-style callback called with the error, if any, and Operation * @returns {undefined} * @variation 1 */ - Object.defineProperty(DocumentProcessorService.prototype.disableProcessor = function disableProcessor(request, callback) { - return this.rpcCall(disableProcessor, $root.google.cloud.documentai.v1beta3.DisableProcessorRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "DisableProcessor" }); + Object.defineProperty(DocumentProcessorService.prototype.deleteProcessorVersion = function deleteProcessorVersion(request, callback) { + return this.rpcCall(deleteProcessorVersion, $root.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteProcessorVersion" }); /** - * Calls DisableProcessor. - * @function disableProcessor + * Calls DeleteProcessorVersion. + * @function deleteProcessorVersion * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @instance - * @param {google.cloud.documentai.v1beta3.IDisableProcessorRequest} request DisableProcessorRequest message or plain object + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest} request DeleteProcessorVersionRequest message or plain object * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#reviewDocument}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#deployProcessorVersion}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService - * @typedef ReviewDocumentCallback + * @typedef DeployProcessorVersionCallback * @type {function} * @param {Error|null} error Error, if any * @param {google.longrunning.Operation} [response] Operation */ /** - * Calls ReviewDocument. - * @function reviewDocument + * Calls DeployProcessorVersion. + * @function deployProcessorVersion * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @instance - * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} request ReviewDocumentRequest message or plain object - * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.ReviewDocumentCallback} callback Node-style callback called with the error, if any, and Operation + * @param {google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest} request DeployProcessorVersionRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.DeployProcessorVersionCallback} callback Node-style callback called with the error, if any, and Operation * @returns {undefined} * @variation 1 */ - Object.defineProperty(DocumentProcessorService.prototype.reviewDocument = function reviewDocument(request, callback) { - return this.rpcCall(reviewDocument, $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ReviewDocument" }); + Object.defineProperty(DocumentProcessorService.prototype.deployProcessorVersion = function deployProcessorVersion(request, callback) { + return this.rpcCall(deployProcessorVersion, $root.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeployProcessorVersion" }); /** - * Calls ReviewDocument. - * @function reviewDocument + * Calls DeployProcessorVersion. + * @function deployProcessorVersion * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @instance - * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} request ReviewDocumentRequest message or plain object + * @param {google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest} request DeployProcessorVersionRequest message or plain object * @returns {Promise} Promise * @variation 2 */ - return DocumentProcessorService; - })(); - - v1beta3.ProcessRequest = (function() { - - /** - * Properties of a ProcessRequest. - * @memberof google.cloud.documentai.v1beta3 - * @interface IProcessRequest - * @property {google.cloud.documentai.v1beta3.IDocument|null} [inlineDocument] ProcessRequest inlineDocument - * @property {google.cloud.documentai.v1beta3.IRawDocument|null} [rawDocument] ProcessRequest rawDocument - * @property {string|null} [name] ProcessRequest name - * @property {google.cloud.documentai.v1beta3.IDocument|null} [document] ProcessRequest document - * @property {boolean|null} [skipHumanReview] ProcessRequest skipHumanReview - */ - /** - * Constructs a new ProcessRequest. - * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a ProcessRequest. - * @implements IProcessRequest - * @constructor - * @param {google.cloud.documentai.v1beta3.IProcessRequest=} [properties] Properties to set + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#undeployProcessorVersion}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef UndeployProcessorVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation */ - function ProcessRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } /** - * ProcessRequest inlineDocument. - * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} inlineDocument - * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * Calls UndeployProcessorVersion. + * @function undeployProcessorVersion + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @instance + * @param {google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest} request UndeployProcessorVersionRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.UndeployProcessorVersionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 */ - ProcessRequest.prototype.inlineDocument = null; + Object.defineProperty(DocumentProcessorService.prototype.undeployProcessorVersion = function undeployProcessorVersion(request, callback) { + return this.rpcCall(undeployProcessorVersion, $root.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UndeployProcessorVersion" }); /** - * ProcessRequest rawDocument. - * @member {google.cloud.documentai.v1beta3.IRawDocument|null|undefined} rawDocument - * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * Calls UndeployProcessorVersion. + * @function undeployProcessorVersion + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @instance + * @param {google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest} request UndeployProcessorVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - ProcessRequest.prototype.rawDocument = null; /** - * ProcessRequest name. - * @member {string} name + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#createProcessor}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef CreateProcessorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1beta3.Processor} [response] Processor + */ + + /** + * Calls CreateProcessor. + * @function createProcessor + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.ICreateProcessorRequest} request CreateProcessorRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.CreateProcessorCallback} callback Node-style callback called with the error, if any, and Processor + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.createProcessor = function createProcessor(request, callback) { + return this.rpcCall(createProcessor, $root.google.cloud.documentai.v1beta3.CreateProcessorRequest, $root.google.cloud.documentai.v1beta3.Processor, request, callback); + }, "name", { value: "CreateProcessor" }); + + /** + * Calls CreateProcessor. + * @function createProcessor + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.ICreateProcessorRequest} request CreateProcessorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#deleteProcessor}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef DeleteProcessorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteProcessor. + * @function deleteProcessor + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorRequest} request DeleteProcessorRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.DeleteProcessorCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.deleteProcessor = function deleteProcessor(request, callback) { + return this.rpcCall(deleteProcessor, $root.google.cloud.documentai.v1beta3.DeleteProcessorRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteProcessor" }); + + /** + * Calls DeleteProcessor. + * @function deleteProcessor + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorRequest} request DeleteProcessorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#enableProcessor}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef EnableProcessorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls EnableProcessor. + * @function enableProcessor + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IEnableProcessorRequest} request EnableProcessorRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.EnableProcessorCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.enableProcessor = function enableProcessor(request, callback) { + return this.rpcCall(enableProcessor, $root.google.cloud.documentai.v1beta3.EnableProcessorRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "EnableProcessor" }); + + /** + * Calls EnableProcessor. + * @function enableProcessor + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IEnableProcessorRequest} request EnableProcessorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#disableProcessor}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef DisableProcessorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DisableProcessor. + * @function disableProcessor + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IDisableProcessorRequest} request DisableProcessorRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.DisableProcessorCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.disableProcessor = function disableProcessor(request, callback) { + return this.rpcCall(disableProcessor, $root.google.cloud.documentai.v1beta3.DisableProcessorRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DisableProcessor" }); + + /** + * Calls DisableProcessor. + * @function disableProcessor + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IDisableProcessorRequest} request DisableProcessorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#setDefaultProcessorVersion}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef SetDefaultProcessorVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls SetDefaultProcessorVersion. + * @function setDefaultProcessorVersion + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionRequest} request SetDefaultProcessorVersionRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.SetDefaultProcessorVersionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.setDefaultProcessorVersion = function setDefaultProcessorVersion(request, callback) { + return this.rpcCall(setDefaultProcessorVersion, $root.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "SetDefaultProcessorVersion" }); + + /** + * Calls SetDefaultProcessorVersion. + * @function setDefaultProcessorVersion + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionRequest} request SetDefaultProcessorVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#reviewDocument}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef ReviewDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ReviewDocument. + * @function reviewDocument + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} request ReviewDocumentRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.ReviewDocumentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.reviewDocument = function reviewDocument(request, callback) { + return this.rpcCall(reviewDocument, $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ReviewDocument" }); + + /** + * Calls ReviewDocument. + * @function reviewDocument + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} request ReviewDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return DocumentProcessorService; + })(); + + v1beta3.ProcessRequest = (function() { + + /** + * Properties of a ProcessRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IProcessRequest + * @property {google.cloud.documentai.v1beta3.IDocument|null} [inlineDocument] ProcessRequest inlineDocument + * @property {google.cloud.documentai.v1beta3.IRawDocument|null} [rawDocument] ProcessRequest rawDocument + * @property {string|null} [name] ProcessRequest name + * @property {google.cloud.documentai.v1beta3.IDocument|null} [document] ProcessRequest document + * @property {boolean|null} [skipHumanReview] ProcessRequest skipHumanReview + * @property {google.protobuf.IFieldMask|null} [fieldMask] ProcessRequest fieldMask + */ + + /** + * Constructs a new ProcessRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ProcessRequest. + * @implements IProcessRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.IProcessRequest=} [properties] Properties to set + */ + function ProcessRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProcessRequest inlineDocument. + * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} inlineDocument + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @instance + */ + ProcessRequest.prototype.inlineDocument = null; + + /** + * ProcessRequest rawDocument. + * @member {google.cloud.documentai.v1beta3.IRawDocument|null|undefined} rawDocument + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @instance + */ + ProcessRequest.prototype.rawDocument = null; + + /** + * ProcessRequest name. + * @member {string} name * @memberof google.cloud.documentai.v1beta3.ProcessRequest * @instance */ @@ -59943,6 +60842,14 @@ */ ProcessRequest.prototype.skipHumanReview = false; + /** + * ProcessRequest fieldMask. + * @member {google.protobuf.IFieldMask|null|undefined} fieldMask + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @instance + */ + ProcessRequest.prototype.fieldMask = null; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -59991,6 +60898,8 @@ $root.google.cloud.documentai.v1beta3.Document.encode(message.inlineDocument, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.rawDocument != null && Object.hasOwnProperty.call(message, "rawDocument")) $root.google.cloud.documentai.v1beta3.RawDocument.encode(message.rawDocument, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.fieldMask != null && Object.hasOwnProperty.call(message, "fieldMask")) + $root.google.protobuf.FieldMask.encode(message.fieldMask, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; @@ -60040,6 +60949,9 @@ case 3: message.skipHumanReview = reader.bool(); break; + case 6: + message.fieldMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -60105,6 +61017,11 @@ if (message.skipHumanReview != null && message.hasOwnProperty("skipHumanReview")) if (typeof message.skipHumanReview !== "boolean") return "skipHumanReview: boolean expected"; + if (message.fieldMask != null && message.hasOwnProperty("fieldMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.fieldMask); + if (error) + return "fieldMask." + error; + } return null; }; @@ -60139,6 +61056,11 @@ } if (object.skipHumanReview != null) message.skipHumanReview = Boolean(object.skipHumanReview); + if (object.fieldMask != null) { + if (typeof object.fieldMask !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ProcessRequest.fieldMask: object expected"); + message.fieldMask = $root.google.protobuf.FieldMask.fromObject(object.fieldMask); + } return message; }; @@ -60159,6 +61081,7 @@ object.name = ""; object.document = null; object.skipHumanReview = false; + object.fieldMask = null; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -60176,6 +61099,8 @@ if (options.oneofs) object.source = "rawDocument"; } + if (message.fieldMask != null && message.hasOwnProperty("fieldMask")) + object.fieldMask = $root.google.protobuf.FieldMask.toObject(message.fieldMask, options); return object; }; @@ -62658,26 +63583,26 @@ return FetchProcessorTypesResponse; })(); - v1beta3.ListProcessorsRequest = (function() { + v1beta3.ListProcessorTypesRequest = (function() { /** - * Properties of a ListProcessorsRequest. + * Properties of a ListProcessorTypesRequest. * @memberof google.cloud.documentai.v1beta3 - * @interface IListProcessorsRequest - * @property {string|null} [parent] ListProcessorsRequest parent - * @property {number|null} [pageSize] ListProcessorsRequest pageSize - * @property {string|null} [pageToken] ListProcessorsRequest pageToken + * @interface IListProcessorTypesRequest + * @property {string|null} [parent] ListProcessorTypesRequest parent + * @property {number|null} [pageSize] ListProcessorTypesRequest pageSize + * @property {string|null} [pageToken] ListProcessorTypesRequest pageToken */ /** - * Constructs a new ListProcessorsRequest. + * Constructs a new ListProcessorTypesRequest. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a ListProcessorsRequest. - * @implements IListProcessorsRequest + * @classdesc Represents a ListProcessorTypesRequest. + * @implements IListProcessorTypesRequest * @constructor - * @param {google.cloud.documentai.v1beta3.IListProcessorsRequest=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IListProcessorTypesRequest=} [properties] Properties to set */ - function ListProcessorsRequest(properties) { + function ListProcessorTypesRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -62685,51 +63610,51 @@ } /** - * ListProcessorsRequest parent. + * ListProcessorTypesRequest parent. * @member {string} parent - * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest * @instance */ - ListProcessorsRequest.prototype.parent = ""; + ListProcessorTypesRequest.prototype.parent = ""; /** - * ListProcessorsRequest pageSize. + * ListProcessorTypesRequest pageSize. * @member {number} pageSize - * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest * @instance */ - ListProcessorsRequest.prototype.pageSize = 0; + ListProcessorTypesRequest.prototype.pageSize = 0; /** - * ListProcessorsRequest pageToken. + * ListProcessorTypesRequest pageToken. * @member {string} pageToken - * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest * @instance */ - ListProcessorsRequest.prototype.pageToken = ""; + ListProcessorTypesRequest.prototype.pageToken = ""; /** - * Creates a new ListProcessorsRequest instance using the specified properties. + * Creates a new ListProcessorTypesRequest instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1beta3.IListProcessorsRequest=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.ListProcessorsRequest} ListProcessorsRequest instance + * @param {google.cloud.documentai.v1beta3.IListProcessorTypesRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ListProcessorTypesRequest} ListProcessorTypesRequest instance */ - ListProcessorsRequest.create = function create(properties) { - return new ListProcessorsRequest(properties); + ListProcessorTypesRequest.create = function create(properties) { + return new ListProcessorTypesRequest(properties); }; /** - * Encodes the specified ListProcessorsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsRequest.verify|verify} messages. + * Encodes the specified ListProcessorTypesRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorTypesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1beta3.IListProcessorsRequest} message ListProcessorsRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IListProcessorTypesRequest} message ListProcessorTypesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListProcessorsRequest.encode = function encode(message, writer) { + ListProcessorTypesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) @@ -62742,33 +63667,33 @@ }; /** - * Encodes the specified ListProcessorsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsRequest.verify|verify} messages. + * Encodes the specified ListProcessorTypesRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorTypesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1beta3.IListProcessorsRequest} message ListProcessorsRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IListProcessorTypesRequest} message ListProcessorTypesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListProcessorsRequest.encodeDelimited = function encodeDelimited(message, writer) { + ListProcessorTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListProcessorsRequest message from the specified reader or buffer. + * Decodes a ListProcessorTypesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.ListProcessorsRequest} ListProcessorsRequest + * @returns {google.cloud.documentai.v1beta3.ListProcessorTypesRequest} ListProcessorTypesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListProcessorsRequest.decode = function decode(reader, length) { + ListProcessorTypesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ListProcessorsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ListProcessorTypesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -62790,30 +63715,30 @@ }; /** - * Decodes a ListProcessorsRequest message from the specified reader or buffer, length delimited. + * Decodes a ListProcessorTypesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.ListProcessorsRequest} ListProcessorsRequest + * @returns {google.cloud.documentai.v1beta3.ListProcessorTypesRequest} ListProcessorTypesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListProcessorsRequest.decodeDelimited = function decodeDelimited(reader) { + ListProcessorTypesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListProcessorsRequest message. + * Verifies a ListProcessorTypesRequest message. * @function verify - * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListProcessorsRequest.verify = function verify(message) { + ListProcessorTypesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.parent != null && message.hasOwnProperty("parent")) @@ -62829,17 +63754,17 @@ }; /** - * Creates a ListProcessorsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListProcessorTypesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.ListProcessorsRequest} ListProcessorsRequest + * @returns {google.cloud.documentai.v1beta3.ListProcessorTypesRequest} ListProcessorTypesRequest */ - ListProcessorsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.ListProcessorsRequest) + ListProcessorTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ListProcessorTypesRequest) return object; - var message = new $root.google.cloud.documentai.v1beta3.ListProcessorsRequest(); + var message = new $root.google.cloud.documentai.v1beta3.ListProcessorTypesRequest(); if (object.parent != null) message.parent = String(object.parent); if (object.pageSize != null) @@ -62850,15 +63775,15 @@ }; /** - * Creates a plain object from a ListProcessorsRequest message. Also converts values to other types if specified. + * Creates a plain object from a ListProcessorTypesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1beta3.ListProcessorsRequest} message ListProcessorsRequest + * @param {google.cloud.documentai.v1beta3.ListProcessorTypesRequest} message ListProcessorTypesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListProcessorsRequest.toObject = function toObject(message, options) { + ListProcessorTypesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -62877,39 +63802,39 @@ }; /** - * Converts this ListProcessorsRequest to JSON. + * Converts this ListProcessorTypesRequest to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest * @instance * @returns {Object.} JSON object */ - ListProcessorsRequest.prototype.toJSON = function toJSON() { + ListProcessorTypesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListProcessorsRequest; + return ListProcessorTypesRequest; })(); - v1beta3.ListProcessorsResponse = (function() { + v1beta3.ListProcessorTypesResponse = (function() { /** - * Properties of a ListProcessorsResponse. + * Properties of a ListProcessorTypesResponse. * @memberof google.cloud.documentai.v1beta3 - * @interface IListProcessorsResponse - * @property {Array.|null} [processors] ListProcessorsResponse processors - * @property {string|null} [nextPageToken] ListProcessorsResponse nextPageToken + * @interface IListProcessorTypesResponse + * @property {Array.|null} [processorTypes] ListProcessorTypesResponse processorTypes + * @property {string|null} [nextPageToken] ListProcessorTypesResponse nextPageToken */ /** - * Constructs a new ListProcessorsResponse. + * Constructs a new ListProcessorTypesResponse. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a ListProcessorsResponse. - * @implements IListProcessorsResponse + * @classdesc Represents a ListProcessorTypesResponse. + * @implements IListProcessorTypesResponse * @constructor - * @param {google.cloud.documentai.v1beta3.IListProcessorsResponse=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IListProcessorTypesResponse=} [properties] Properties to set */ - function ListProcessorsResponse(properties) { - this.processors = []; + function ListProcessorTypesResponse(properties) { + this.processorTypes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -62917,88 +63842,88 @@ } /** - * ListProcessorsResponse processors. - * @member {Array.} processors - * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse + * ListProcessorTypesResponse processorTypes. + * @member {Array.} processorTypes + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesResponse * @instance */ - ListProcessorsResponse.prototype.processors = $util.emptyArray; + ListProcessorTypesResponse.prototype.processorTypes = $util.emptyArray; /** - * ListProcessorsResponse nextPageToken. + * ListProcessorTypesResponse nextPageToken. * @member {string} nextPageToken - * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesResponse * @instance */ - ListProcessorsResponse.prototype.nextPageToken = ""; + ListProcessorTypesResponse.prototype.nextPageToken = ""; /** - * Creates a new ListProcessorsResponse instance using the specified properties. + * Creates a new ListProcessorTypesResponse instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesResponse * @static - * @param {google.cloud.documentai.v1beta3.IListProcessorsResponse=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.ListProcessorsResponse} ListProcessorsResponse instance + * @param {google.cloud.documentai.v1beta3.IListProcessorTypesResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ListProcessorTypesResponse} ListProcessorTypesResponse instance */ - ListProcessorsResponse.create = function create(properties) { - return new ListProcessorsResponse(properties); + ListProcessorTypesResponse.create = function create(properties) { + return new ListProcessorTypesResponse(properties); }; /** - * Encodes the specified ListProcessorsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsResponse.verify|verify} messages. + * Encodes the specified ListProcessorTypesResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorTypesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesResponse * @static - * @param {google.cloud.documentai.v1beta3.IListProcessorsResponse} message ListProcessorsResponse message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IListProcessorTypesResponse} message ListProcessorTypesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListProcessorsResponse.encode = function encode(message, writer) { + ListProcessorTypesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.processors != null && message.processors.length) - for (var i = 0; i < message.processors.length; ++i) - $root.google.cloud.documentai.v1beta3.Processor.encode(message.processors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.processorTypes != null && message.processorTypes.length) + for (var i = 0; i < message.processorTypes.length; ++i) + $root.google.cloud.documentai.v1beta3.ProcessorType.encode(message.processorTypes[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 ListProcessorsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsResponse.verify|verify} messages. + * Encodes the specified ListProcessorTypesResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorTypesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesResponse * @static - * @param {google.cloud.documentai.v1beta3.IListProcessorsResponse} message ListProcessorsResponse message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IListProcessorTypesResponse} message ListProcessorTypesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListProcessorsResponse.encodeDelimited = function encodeDelimited(message, writer) { + ListProcessorTypesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListProcessorsResponse message from the specified reader or buffer. + * Decodes a ListProcessorTypesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.ListProcessorsResponse} ListProcessorsResponse + * @returns {google.cloud.documentai.v1beta3.ListProcessorTypesResponse} ListProcessorTypesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListProcessorsResponse.decode = function decode(reader, length) { + ListProcessorTypesResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ListProcessorsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ListProcessorTypesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.processors && message.processors.length)) - message.processors = []; - message.processors.push($root.google.cloud.documentai.v1beta3.Processor.decode(reader, reader.uint32())); + if (!(message.processorTypes && message.processorTypes.length)) + message.processorTypes = []; + message.processorTypes.push($root.google.cloud.documentai.v1beta3.ProcessorType.decode(reader, reader.uint32())); break; case 2: message.nextPageToken = reader.string(); @@ -63012,39 +63937,39 @@ }; /** - * Decodes a ListProcessorsResponse message from the specified reader or buffer, length delimited. + * Decodes a ListProcessorTypesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.ListProcessorsResponse} ListProcessorsResponse + * @returns {google.cloud.documentai.v1beta3.ListProcessorTypesResponse} ListProcessorTypesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListProcessorsResponse.decodeDelimited = function decodeDelimited(reader) { + ListProcessorTypesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListProcessorsResponse message. + * Verifies a ListProcessorTypesResponse message. * @function verify - * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListProcessorsResponse.verify = function verify(message) { + ListProcessorTypesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.processors != null && message.hasOwnProperty("processors")) { - if (!Array.isArray(message.processors)) - return "processors: array expected"; - for (var i = 0; i < message.processors.length; ++i) { - var error = $root.google.cloud.documentai.v1beta3.Processor.verify(message.processors[i]); + if (message.processorTypes != null && message.hasOwnProperty("processorTypes")) { + if (!Array.isArray(message.processorTypes)) + return "processorTypes: array expected"; + for (var i = 0; i < message.processorTypes.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.ProcessorType.verify(message.processorTypes[i]); if (error) - return "processors." + error; + return "processorTypes." + error; } } if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) @@ -63054,25 +63979,25 @@ }; /** - * Creates a ListProcessorsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListProcessorTypesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.ListProcessorsResponse} ListProcessorsResponse + * @returns {google.cloud.documentai.v1beta3.ListProcessorTypesResponse} ListProcessorTypesResponse */ - ListProcessorsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.ListProcessorsResponse) + ListProcessorTypesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ListProcessorTypesResponse) return object; - var message = new $root.google.cloud.documentai.v1beta3.ListProcessorsResponse(); - if (object.processors) { - if (!Array.isArray(object.processors)) - throw TypeError(".google.cloud.documentai.v1beta3.ListProcessorsResponse.processors: array expected"); - message.processors = []; - for (var i = 0; i < object.processors.length; ++i) { - if (typeof object.processors[i] !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.ListProcessorsResponse.processors: object expected"); - message.processors[i] = $root.google.cloud.documentai.v1beta3.Processor.fromObject(object.processors[i]); + var message = new $root.google.cloud.documentai.v1beta3.ListProcessorTypesResponse(); + if (object.processorTypes) { + if (!Array.isArray(object.processorTypes)) + throw TypeError(".google.cloud.documentai.v1beta3.ListProcessorTypesResponse.processorTypes: array expected"); + message.processorTypes = []; + for (var i = 0; i < object.processorTypes.length; ++i) { + if (typeof object.processorTypes[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ListProcessorTypesResponse.processorTypes: object expected"); + message.processorTypes[i] = $root.google.cloud.documentai.v1beta3.ProcessorType.fromObject(object.processorTypes[i]); } } if (object.nextPageToken != null) @@ -63081,26 +64006,26 @@ }; /** - * Creates a plain object from a ListProcessorsResponse message. Also converts values to other types if specified. + * Creates a plain object from a ListProcessorTypesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesResponse * @static - * @param {google.cloud.documentai.v1beta3.ListProcessorsResponse} message ListProcessorsResponse + * @param {google.cloud.documentai.v1beta3.ListProcessorTypesResponse} message ListProcessorTypesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListProcessorsResponse.toObject = function toObject(message, options) { + ListProcessorTypesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.processors = []; + object.processorTypes = []; if (options.defaults) object.nextPageToken = ""; - if (message.processors && message.processors.length) { - object.processors = []; - for (var j = 0; j < message.processors.length; ++j) - object.processors[j] = $root.google.cloud.documentai.v1beta3.Processor.toObject(message.processors[j], options); + if (message.processorTypes && message.processorTypes.length) { + object.processorTypes = []; + for (var j = 0; j < message.processorTypes.length; ++j) + object.processorTypes[j] = $root.google.cloud.documentai.v1beta3.ProcessorType.toObject(message.processorTypes[j], options); } if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) object.nextPageToken = message.nextPageToken; @@ -63108,38 +64033,39 @@ }; /** - * Converts this ListProcessorsResponse to JSON. + * Converts this ListProcessorTypesResponse to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesResponse * @instance * @returns {Object.} JSON object */ - ListProcessorsResponse.prototype.toJSON = function toJSON() { + ListProcessorTypesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListProcessorsResponse; + return ListProcessorTypesResponse; })(); - v1beta3.CreateProcessorRequest = (function() { + v1beta3.ListProcessorsRequest = (function() { /** - * Properties of a CreateProcessorRequest. + * Properties of a ListProcessorsRequest. * @memberof google.cloud.documentai.v1beta3 - * @interface ICreateProcessorRequest - * @property {string|null} [parent] CreateProcessorRequest parent - * @property {google.cloud.documentai.v1beta3.IProcessor|null} [processor] CreateProcessorRequest processor + * @interface IListProcessorsRequest + * @property {string|null} [parent] ListProcessorsRequest parent + * @property {number|null} [pageSize] ListProcessorsRequest pageSize + * @property {string|null} [pageToken] ListProcessorsRequest pageToken */ /** - * Constructs a new CreateProcessorRequest. + * Constructs a new ListProcessorsRequest. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a CreateProcessorRequest. - * @implements ICreateProcessorRequest + * @classdesc Represents a ListProcessorsRequest. + * @implements IListProcessorsRequest * @constructor - * @param {google.cloud.documentai.v1beta3.ICreateProcessorRequest=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IListProcessorsRequest=} [properties] Properties to set */ - function CreateProcessorRequest(properties) { + function ListProcessorsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -63147,80 +64073,90 @@ } /** - * CreateProcessorRequest parent. + * ListProcessorsRequest parent. * @member {string} parent - * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @instance */ - CreateProcessorRequest.prototype.parent = ""; + ListProcessorsRequest.prototype.parent = ""; /** - * CreateProcessorRequest processor. - * @member {google.cloud.documentai.v1beta3.IProcessor|null|undefined} processor - * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * ListProcessorsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @instance */ - CreateProcessorRequest.prototype.processor = null; + ListProcessorsRequest.prototype.pageSize = 0; /** - * Creates a new CreateProcessorRequest instance using the specified properties. + * ListProcessorsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest + * @instance + */ + ListProcessorsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListProcessorsRequest instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @static - * @param {google.cloud.documentai.v1beta3.ICreateProcessorRequest=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.CreateProcessorRequest} CreateProcessorRequest instance + * @param {google.cloud.documentai.v1beta3.IListProcessorsRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ListProcessorsRequest} ListProcessorsRequest instance */ - CreateProcessorRequest.create = function create(properties) { - return new CreateProcessorRequest(properties); + ListProcessorsRequest.create = function create(properties) { + return new ListProcessorsRequest(properties); }; /** - * Encodes the specified CreateProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.CreateProcessorRequest.verify|verify} messages. + * Encodes the specified ListProcessorsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @static - * @param {google.cloud.documentai.v1beta3.ICreateProcessorRequest} message CreateProcessorRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IListProcessorsRequest} message ListProcessorsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateProcessorRequest.encode = function encode(message, writer) { + ListProcessorsRequest.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.processor != null && Object.hasOwnProperty.call(message, "processor")) - $root.google.cloud.documentai.v1beta3.Processor.encode(message.processor, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + 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 CreateProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.CreateProcessorRequest.verify|verify} messages. + * Encodes the specified ListProcessorsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @static - * @param {google.cloud.documentai.v1beta3.ICreateProcessorRequest} message CreateProcessorRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IListProcessorsRequest} message ListProcessorsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + ListProcessorsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CreateProcessorRequest message from the specified reader or buffer. + * Decodes a ListProcessorsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.CreateProcessorRequest} CreateProcessorRequest + * @returns {google.cloud.documentai.v1beta3.ListProcessorsRequest} ListProcessorsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateProcessorRequest.decode = function decode(reader, length) { + ListProcessorsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.CreateProcessorRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ListProcessorsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -63228,7 +64164,10 @@ message.parent = reader.string(); break; case 2: - message.processor = $root.google.cloud.documentai.v1beta3.Processor.decode(reader, reader.uint32()); + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -63239,121 +64178,126 @@ }; /** - * Decodes a CreateProcessorRequest message from the specified reader or buffer, length delimited. + * Decodes a ListProcessorsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.CreateProcessorRequest} CreateProcessorRequest + * @returns {google.cloud.documentai.v1beta3.ListProcessorsRequest} ListProcessorsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + ListProcessorsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CreateProcessorRequest message. + * Verifies a ListProcessorsRequest message. * @function verify - * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateProcessorRequest.verify = function verify(message) { + ListProcessorsRequest.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.processor != null && message.hasOwnProperty("processor")) { - var error = $root.google.cloud.documentai.v1beta3.Processor.verify(message.processor); - if (error) - return "processor." + 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"; return null; }; /** - * Creates a CreateProcessorRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListProcessorsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.CreateProcessorRequest} CreateProcessorRequest + * @returns {google.cloud.documentai.v1beta3.ListProcessorsRequest} ListProcessorsRequest */ - CreateProcessorRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.CreateProcessorRequest) + ListProcessorsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ListProcessorsRequest) return object; - var message = new $root.google.cloud.documentai.v1beta3.CreateProcessorRequest(); + var message = new $root.google.cloud.documentai.v1beta3.ListProcessorsRequest(); if (object.parent != null) message.parent = String(object.parent); - if (object.processor != null) { - if (typeof object.processor !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.CreateProcessorRequest.processor: object expected"); - message.processor = $root.google.cloud.documentai.v1beta3.Processor.fromObject(object.processor); - } + 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 CreateProcessorRequest message. Also converts values to other types if specified. + * Creates a plain object from a ListProcessorsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @static - * @param {google.cloud.documentai.v1beta3.CreateProcessorRequest} message CreateProcessorRequest + * @param {google.cloud.documentai.v1beta3.ListProcessorsRequest} message ListProcessorsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CreateProcessorRequest.toObject = function toObject(message, options) { + ListProcessorsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.parent = ""; - object.processor = null; + object.pageSize = 0; + object.pageToken = ""; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; - if (message.processor != null && message.hasOwnProperty("processor")) - object.processor = $root.google.cloud.documentai.v1beta3.Processor.toObject(message.processor, options); + 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 CreateProcessorRequest to JSON. + * Converts this ListProcessorsRequest to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest * @instance * @returns {Object.} JSON object */ - CreateProcessorRequest.prototype.toJSON = function toJSON() { + ListProcessorsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CreateProcessorRequest; + return ListProcessorsRequest; })(); - v1beta3.DeleteProcessorRequest = (function() { + v1beta3.ListProcessorsResponse = (function() { /** - * Properties of a DeleteProcessorRequest. + * Properties of a ListProcessorsResponse. * @memberof google.cloud.documentai.v1beta3 - * @interface IDeleteProcessorRequest - * @property {string|null} [name] DeleteProcessorRequest name + * @interface IListProcessorsResponse + * @property {Array.|null} [processors] ListProcessorsResponse processors + * @property {string|null} [nextPageToken] ListProcessorsResponse nextPageToken */ /** - * Constructs a new DeleteProcessorRequest. + * Constructs a new ListProcessorsResponse. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a DeleteProcessorRequest. - * @implements IDeleteProcessorRequest + * @classdesc Represents a ListProcessorsResponse. + * @implements IListProcessorsResponse * @constructor - * @param {google.cloud.documentai.v1beta3.IDeleteProcessorRequest=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IListProcessorsResponse=} [properties] Properties to set */ - function DeleteProcessorRequest(properties) { + function ListProcessorsResponse(properties) { + this.processors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -63361,75 +64305,91 @@ } /** - * DeleteProcessorRequest name. - * @member {string} name - * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * ListProcessorsResponse processors. + * @member {Array.} processors + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @instance */ - DeleteProcessorRequest.prototype.name = ""; + ListProcessorsResponse.prototype.processors = $util.emptyArray; /** - * Creates a new DeleteProcessorRequest instance using the specified properties. + * ListProcessorsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse + * @instance + */ + ListProcessorsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListProcessorsResponse instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @static - * @param {google.cloud.documentai.v1beta3.IDeleteProcessorRequest=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.DeleteProcessorRequest} DeleteProcessorRequest instance + * @param {google.cloud.documentai.v1beta3.IListProcessorsResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ListProcessorsResponse} ListProcessorsResponse instance */ - DeleteProcessorRequest.create = function create(properties) { - return new DeleteProcessorRequest(properties); + ListProcessorsResponse.create = function create(properties) { + return new ListProcessorsResponse(properties); }; /** - * Encodes the specified DeleteProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorRequest.verify|verify} messages. + * Encodes the specified ListProcessorsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @static - * @param {google.cloud.documentai.v1beta3.IDeleteProcessorRequest} message DeleteProcessorRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IListProcessorsResponse} message ListProcessorsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteProcessorRequest.encode = function encode(message, writer) { + ListProcessorsResponse.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.processors != null && message.processors.length) + for (var i = 0; i < message.processors.length; ++i) + $root.google.cloud.documentai.v1beta3.Processor.encode(message.processors[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 DeleteProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorRequest.verify|verify} messages. + * Encodes the specified ListProcessorsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @static - * @param {google.cloud.documentai.v1beta3.IDeleteProcessorRequest} message DeleteProcessorRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IListProcessorsResponse} message ListProcessorsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + ListProcessorsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DeleteProcessorRequest message from the specified reader or buffer. + * Decodes a ListProcessorsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.DeleteProcessorRequest} DeleteProcessorRequest + * @returns {google.cloud.documentai.v1beta3.ListProcessorsResponse} ListProcessorsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteProcessorRequest.decode = function decode(reader, length) { + ListProcessorsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DeleteProcessorRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ListProcessorsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + if (!(message.processors && message.processors.length)) + message.processors = []; + message.processors.push($root.google.cloud.documentai.v1beta3.Processor.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -63440,107 +64400,133 @@ }; /** - * Decodes a DeleteProcessorRequest message from the specified reader or buffer, length delimited. + * Decodes a ListProcessorsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.DeleteProcessorRequest} DeleteProcessorRequest + * @returns {google.cloud.documentai.v1beta3.ListProcessorsResponse} ListProcessorsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + ListProcessorsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DeleteProcessorRequest message. + * Verifies a ListProcessorsResponse message. * @function verify - * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DeleteProcessorRequest.verify = function verify(message) { + ListProcessorsResponse.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 (message.processors != null && message.hasOwnProperty("processors")) { + if (!Array.isArray(message.processors)) + return "processors: array expected"; + for (var i = 0; i < message.processors.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Processor.verify(message.processors[i]); + if (error) + return "processors." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; /** - * Creates a DeleteProcessorRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListProcessorsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.DeleteProcessorRequest} DeleteProcessorRequest + * @returns {google.cloud.documentai.v1beta3.ListProcessorsResponse} ListProcessorsResponse */ - DeleteProcessorRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.DeleteProcessorRequest) + ListProcessorsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ListProcessorsResponse) return object; - var message = new $root.google.cloud.documentai.v1beta3.DeleteProcessorRequest(); - if (object.name != null) - message.name = String(object.name); + var message = new $root.google.cloud.documentai.v1beta3.ListProcessorsResponse(); + if (object.processors) { + if (!Array.isArray(object.processors)) + throw TypeError(".google.cloud.documentai.v1beta3.ListProcessorsResponse.processors: array expected"); + message.processors = []; + for (var i = 0; i < object.processors.length; ++i) { + if (typeof object.processors[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ListProcessorsResponse.processors: object expected"); + message.processors[i] = $root.google.cloud.documentai.v1beta3.Processor.fromObject(object.processors[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); return message; }; /** - * Creates a plain object from a DeleteProcessorRequest message. Also converts values to other types if specified. + * Creates a plain object from a ListProcessorsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @static - * @param {google.cloud.documentai.v1beta3.DeleteProcessorRequest} message DeleteProcessorRequest + * @param {google.cloud.documentai.v1beta3.ListProcessorsResponse} message ListProcessorsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DeleteProcessorRequest.toObject = function toObject(message, options) { + ListProcessorsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.processors = []; if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; + object.nextPageToken = ""; + if (message.processors && message.processors.length) { + object.processors = []; + for (var j = 0; j < message.processors.length; ++j) + object.processors[j] = $root.google.cloud.documentai.v1beta3.Processor.toObject(message.processors[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; return object; }; /** - * Converts this DeleteProcessorRequest to JSON. + * Converts this ListProcessorsResponse to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse * @instance * @returns {Object.} JSON object */ - DeleteProcessorRequest.prototype.toJSON = function toJSON() { + ListProcessorsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DeleteProcessorRequest; + return ListProcessorsResponse; })(); - v1beta3.DeleteProcessorMetadata = (function() { + v1beta3.GetProcessorRequest = (function() { /** - * Properties of a DeleteProcessorMetadata. + * Properties of a GetProcessorRequest. * @memberof google.cloud.documentai.v1beta3 - * @interface IDeleteProcessorMetadata - * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] DeleteProcessorMetadata commonMetadata + * @interface IGetProcessorRequest + * @property {string|null} [name] GetProcessorRequest name */ /** - * Constructs a new DeleteProcessorMetadata. + * Constructs a new GetProcessorRequest. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a DeleteProcessorMetadata. - * @implements IDeleteProcessorMetadata + * @classdesc Represents a GetProcessorRequest. + * @implements IGetProcessorRequest * @constructor - * @param {google.cloud.documentai.v1beta3.IDeleteProcessorMetadata=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IGetProcessorRequest=} [properties] Properties to set */ - function DeleteProcessorMetadata(properties) { + function GetProcessorRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -63548,75 +64534,75 @@ } /** - * DeleteProcessorMetadata commonMetadata. - * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata - * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * GetProcessorRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.GetProcessorRequest * @instance */ - DeleteProcessorMetadata.prototype.commonMetadata = null; + GetProcessorRequest.prototype.name = ""; /** - * Creates a new DeleteProcessorMetadata instance using the specified properties. + * Creates a new GetProcessorRequest instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.GetProcessorRequest * @static - * @param {google.cloud.documentai.v1beta3.IDeleteProcessorMetadata=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.DeleteProcessorMetadata} DeleteProcessorMetadata instance + * @param {google.cloud.documentai.v1beta3.IGetProcessorRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.GetProcessorRequest} GetProcessorRequest instance */ - DeleteProcessorMetadata.create = function create(properties) { - return new DeleteProcessorMetadata(properties); + GetProcessorRequest.create = function create(properties) { + return new GetProcessorRequest(properties); }; /** - * Encodes the specified DeleteProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorMetadata.verify|verify} messages. + * Encodes the specified GetProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.GetProcessorRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.GetProcessorRequest * @static - * @param {google.cloud.documentai.v1beta3.IDeleteProcessorMetadata} message DeleteProcessorMetadata message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IGetProcessorRequest} message GetProcessorRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteProcessorMetadata.encode = function encode(message, writer) { + GetProcessorRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) - $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, 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 DeleteProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorMetadata.verify|verify} messages. + * Encodes the specified GetProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.GetProcessorRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.GetProcessorRequest * @static - * @param {google.cloud.documentai.v1beta3.IDeleteProcessorMetadata} message DeleteProcessorMetadata message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IGetProcessorRequest} message GetProcessorRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteProcessorMetadata.encodeDelimited = function encodeDelimited(message, writer) { + GetProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DeleteProcessorMetadata message from the specified reader or buffer. + * Decodes a GetProcessorRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.GetProcessorRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.DeleteProcessorMetadata} DeleteProcessorMetadata + * @returns {google.cloud.documentai.v1beta3.GetProcessorRequest} GetProcessorRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteProcessorMetadata.decode = function decode(reader, length) { + GetProcessorRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DeleteProcessorMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.GetProcessorRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 5: - message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + case 1: + message.name = reader.string(); break; default: reader.skipType(tag & 7); @@ -63627,112 +64613,107 @@ }; /** - * Decodes a DeleteProcessorMetadata message from the specified reader or buffer, length delimited. + * Decodes a GetProcessorRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.GetProcessorRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.DeleteProcessorMetadata} DeleteProcessorMetadata + * @returns {google.cloud.documentai.v1beta3.GetProcessorRequest} GetProcessorRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteProcessorMetadata.decodeDelimited = function decodeDelimited(reader) { + GetProcessorRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DeleteProcessorMetadata message. + * Verifies a GetProcessorRequest message. * @function verify - * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.GetProcessorRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DeleteProcessorMetadata.verify = function verify(message) { + GetProcessorRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { - var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); - if (error) - return "commonMetadata." + error; - } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates a DeleteProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a GetProcessorRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.GetProcessorRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.DeleteProcessorMetadata} DeleteProcessorMetadata + * @returns {google.cloud.documentai.v1beta3.GetProcessorRequest} GetProcessorRequest */ - DeleteProcessorMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.DeleteProcessorMetadata) + GetProcessorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.GetProcessorRequest) return object; - var message = new $root.google.cloud.documentai.v1beta3.DeleteProcessorMetadata(); - if (object.commonMetadata != null) { - if (typeof object.commonMetadata !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.DeleteProcessorMetadata.commonMetadata: object expected"); - message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); - } + var message = new $root.google.cloud.documentai.v1beta3.GetProcessorRequest(); + if (object.name != null) + message.name = String(object.name); return message; }; /** - * Creates a plain object from a DeleteProcessorMetadata message. Also converts values to other types if specified. + * Creates a plain object from a GetProcessorRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.GetProcessorRequest * @static - * @param {google.cloud.documentai.v1beta3.DeleteProcessorMetadata} message DeleteProcessorMetadata + * @param {google.cloud.documentai.v1beta3.GetProcessorRequest} message GetProcessorRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DeleteProcessorMetadata.toObject = function toObject(message, options) { + GetProcessorRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) - object.commonMetadata = null; - if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) - object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; return object; }; /** - * Converts this DeleteProcessorMetadata to JSON. + * Converts this GetProcessorRequest to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.GetProcessorRequest * @instance * @returns {Object.} JSON object */ - DeleteProcessorMetadata.prototype.toJSON = function toJSON() { + GetProcessorRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DeleteProcessorMetadata; + return GetProcessorRequest; })(); - v1beta3.EnableProcessorRequest = (function() { + v1beta3.GetProcessorVersionRequest = (function() { /** - * Properties of an EnableProcessorRequest. + * Properties of a GetProcessorVersionRequest. * @memberof google.cloud.documentai.v1beta3 - * @interface IEnableProcessorRequest - * @property {string|null} [name] EnableProcessorRequest name + * @interface IGetProcessorVersionRequest + * @property {string|null} [name] GetProcessorVersionRequest name */ /** - * Constructs a new EnableProcessorRequest. + * Constructs a new GetProcessorVersionRequest. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents an EnableProcessorRequest. - * @implements IEnableProcessorRequest + * @classdesc Represents a GetProcessorVersionRequest. + * @implements IGetProcessorVersionRequest * @constructor - * @param {google.cloud.documentai.v1beta3.IEnableProcessorRequest=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IGetProcessorVersionRequest=} [properties] Properties to set */ - function EnableProcessorRequest(properties) { + function GetProcessorVersionRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -63740,35 +64721,35 @@ } /** - * EnableProcessorRequest name. + * GetProcessorVersionRequest name. * @member {string} name - * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @memberof google.cloud.documentai.v1beta3.GetProcessorVersionRequest * @instance */ - EnableProcessorRequest.prototype.name = ""; + GetProcessorVersionRequest.prototype.name = ""; /** - * Creates a new EnableProcessorRequest instance using the specified properties. + * Creates a new GetProcessorVersionRequest instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @memberof google.cloud.documentai.v1beta3.GetProcessorVersionRequest * @static - * @param {google.cloud.documentai.v1beta3.IEnableProcessorRequest=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.EnableProcessorRequest} EnableProcessorRequest instance + * @param {google.cloud.documentai.v1beta3.IGetProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.GetProcessorVersionRequest} GetProcessorVersionRequest instance */ - EnableProcessorRequest.create = function create(properties) { - return new EnableProcessorRequest(properties); + GetProcessorVersionRequest.create = function create(properties) { + return new GetProcessorVersionRequest(properties); }; /** - * Encodes the specified EnableProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorRequest.verify|verify} messages. + * Encodes the specified GetProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.GetProcessorVersionRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @memberof google.cloud.documentai.v1beta3.GetProcessorVersionRequest * @static - * @param {google.cloud.documentai.v1beta3.IEnableProcessorRequest} message EnableProcessorRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IGetProcessorVersionRequest} message GetProcessorVersionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnableProcessorRequest.encode = function encode(message, writer) { + GetProcessorVersionRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.name != null && Object.hasOwnProperty.call(message, "name")) @@ -63777,33 +64758,33 @@ }; /** - * Encodes the specified EnableProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorRequest.verify|verify} messages. + * Encodes the specified GetProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.GetProcessorVersionRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @memberof google.cloud.documentai.v1beta3.GetProcessorVersionRequest * @static - * @param {google.cloud.documentai.v1beta3.IEnableProcessorRequest} message EnableProcessorRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IGetProcessorVersionRequest} message GetProcessorVersionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnableProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetProcessorVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EnableProcessorRequest message from the specified reader or buffer. + * Decodes a GetProcessorVersionRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @memberof google.cloud.documentai.v1beta3.GetProcessorVersionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.EnableProcessorRequest} EnableProcessorRequest + * @returns {google.cloud.documentai.v1beta3.GetProcessorVersionRequest} GetProcessorVersionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EnableProcessorRequest.decode = function decode(reader, length) { + GetProcessorVersionRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.EnableProcessorRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.GetProcessorVersionRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -63819,30 +64800,30 @@ }; /** - * Decodes an EnableProcessorRequest message from the specified reader or buffer, length delimited. + * Decodes a GetProcessorVersionRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @memberof google.cloud.documentai.v1beta3.GetProcessorVersionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.EnableProcessorRequest} EnableProcessorRequest + * @returns {google.cloud.documentai.v1beta3.GetProcessorVersionRequest} GetProcessorVersionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EnableProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + GetProcessorVersionRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EnableProcessorRequest message. + * Verifies a GetProcessorVersionRequest message. * @function verify - * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @memberof google.cloud.documentai.v1beta3.GetProcessorVersionRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EnableProcessorRequest.verify = function verify(message) { + GetProcessorVersionRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.name != null && message.hasOwnProperty("name")) @@ -63852,32 +64833,32 @@ }; /** - * Creates an EnableProcessorRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @memberof google.cloud.documentai.v1beta3.GetProcessorVersionRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.EnableProcessorRequest} EnableProcessorRequest + * @returns {google.cloud.documentai.v1beta3.GetProcessorVersionRequest} GetProcessorVersionRequest */ - EnableProcessorRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.EnableProcessorRequest) + GetProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.GetProcessorVersionRequest) return object; - var message = new $root.google.cloud.documentai.v1beta3.EnableProcessorRequest(); + var message = new $root.google.cloud.documentai.v1beta3.GetProcessorVersionRequest(); if (object.name != null) message.name = String(object.name); return message; }; /** - * Creates a plain object from an EnableProcessorRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetProcessorVersionRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @memberof google.cloud.documentai.v1beta3.GetProcessorVersionRequest * @static - * @param {google.cloud.documentai.v1beta3.EnableProcessorRequest} message EnableProcessorRequest + * @param {google.cloud.documentai.v1beta3.GetProcessorVersionRequest} message GetProcessorVersionRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EnableProcessorRequest.toObject = function toObject(message, options) { + GetProcessorVersionRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -63889,36 +64870,39 @@ }; /** - * Converts this EnableProcessorRequest to JSON. + * Converts this GetProcessorVersionRequest to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @memberof google.cloud.documentai.v1beta3.GetProcessorVersionRequest * @instance * @returns {Object.} JSON object */ - EnableProcessorRequest.prototype.toJSON = function toJSON() { + GetProcessorVersionRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return EnableProcessorRequest; + return GetProcessorVersionRequest; })(); - v1beta3.EnableProcessorResponse = (function() { + v1beta3.ListProcessorVersionsRequest = (function() { /** - * Properties of an EnableProcessorResponse. + * Properties of a ListProcessorVersionsRequest. * @memberof google.cloud.documentai.v1beta3 - * @interface IEnableProcessorResponse + * @interface IListProcessorVersionsRequest + * @property {string|null} [parent] ListProcessorVersionsRequest parent + * @property {number|null} [pageSize] ListProcessorVersionsRequest pageSize + * @property {string|null} [pageToken] ListProcessorVersionsRequest pageToken */ /** - * Constructs a new EnableProcessorResponse. + * Constructs a new ListProcessorVersionsRequest. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents an EnableProcessorResponse. - * @implements IEnableProcessorResponse + * @classdesc Represents a ListProcessorVersionsRequest. + * @implements IListProcessorVersionsRequest * @constructor - * @param {google.cloud.documentai.v1beta3.IEnableProcessorResponse=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IListProcessorVersionsRequest=} [properties] Properties to set */ - function EnableProcessorResponse(properties) { + function ListProcessorVersionsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -63926,63 +64910,102 @@ } /** - * Creates a new EnableProcessorResponse instance using the specified properties. + * ListProcessorVersionsRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsRequest + * @instance + */ + ListProcessorVersionsRequest.prototype.parent = ""; + + /** + * ListProcessorVersionsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsRequest + * @instance + */ + ListProcessorVersionsRequest.prototype.pageSize = 0; + + /** + * ListProcessorVersionsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsRequest + * @instance + */ + ListProcessorVersionsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListProcessorVersionsRequest instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsRequest * @static - * @param {google.cloud.documentai.v1beta3.IEnableProcessorResponse=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.EnableProcessorResponse} EnableProcessorResponse instance + * @param {google.cloud.documentai.v1beta3.IListProcessorVersionsRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ListProcessorVersionsRequest} ListProcessorVersionsRequest instance */ - EnableProcessorResponse.create = function create(properties) { - return new EnableProcessorResponse(properties); + ListProcessorVersionsRequest.create = function create(properties) { + return new ListProcessorVersionsRequest(properties); }; /** - * Encodes the specified EnableProcessorResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorResponse.verify|verify} messages. + * Encodes the specified ListProcessorVersionsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorVersionsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsRequest * @static - * @param {google.cloud.documentai.v1beta3.IEnableProcessorResponse} message EnableProcessorResponse message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IListProcessorVersionsRequest} message ListProcessorVersionsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnableProcessorResponse.encode = function encode(message, writer) { + ListProcessorVersionsRequest.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 EnableProcessorResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorResponse.verify|verify} messages. + * Encodes the specified ListProcessorVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorVersionsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsRequest * @static - * @param {google.cloud.documentai.v1beta3.IEnableProcessorResponse} message EnableProcessorResponse message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IListProcessorVersionsRequest} message ListProcessorVersionsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnableProcessorResponse.encodeDelimited = function encodeDelimited(message, writer) { + ListProcessorVersionsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EnableProcessorResponse message from the specified reader or buffer. + * Decodes a ListProcessorVersionsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.EnableProcessorResponse} EnableProcessorResponse + * @returns {google.cloud.documentai.v1beta3.ListProcessorVersionsRequest} ListProcessorVersionsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EnableProcessorResponse.decode = function decode(reader, length) { + ListProcessorVersionsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.EnableProcessorResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest(); 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; @@ -63992,94 +65015,126 @@ }; /** - * Decodes an EnableProcessorResponse message from the specified reader or buffer, length delimited. + * Decodes a ListProcessorVersionsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.EnableProcessorResponse} EnableProcessorResponse + * @returns {google.cloud.documentai.v1beta3.ListProcessorVersionsRequest} ListProcessorVersionsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EnableProcessorResponse.decodeDelimited = function decodeDelimited(reader) { + ListProcessorVersionsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EnableProcessorResponse message. + * Verifies a ListProcessorVersionsRequest message. * @function verify - * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EnableProcessorResponse.verify = function verify(message) { + ListProcessorVersionsRequest.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 an EnableProcessorResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListProcessorVersionsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.EnableProcessorResponse} EnableProcessorResponse + * @returns {google.cloud.documentai.v1beta3.ListProcessorVersionsRequest} ListProcessorVersionsRequest */ - EnableProcessorResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.EnableProcessorResponse) + ListProcessorVersionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest) return object; - return new $root.google.cloud.documentai.v1beta3.EnableProcessorResponse(); + var message = new $root.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest(); + 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 EnableProcessorResponse message. Also converts values to other types if specified. + * Creates a plain object from a ListProcessorVersionsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsRequest * @static - * @param {google.cloud.documentai.v1beta3.EnableProcessorResponse} message EnableProcessorResponse + * @param {google.cloud.documentai.v1beta3.ListProcessorVersionsRequest} message ListProcessorVersionsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EnableProcessorResponse.toObject = function toObject() { - return {}; + ListProcessorVersionsRequest.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 EnableProcessorResponse to JSON. + * Converts this ListProcessorVersionsRequest to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsRequest * @instance * @returns {Object.} JSON object */ - EnableProcessorResponse.prototype.toJSON = function toJSON() { + ListProcessorVersionsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return EnableProcessorResponse; + return ListProcessorVersionsRequest; })(); - v1beta3.EnableProcessorMetadata = (function() { + v1beta3.ListProcessorVersionsResponse = (function() { /** - * Properties of an EnableProcessorMetadata. + * Properties of a ListProcessorVersionsResponse. * @memberof google.cloud.documentai.v1beta3 - * @interface IEnableProcessorMetadata - * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] EnableProcessorMetadata commonMetadata + * @interface IListProcessorVersionsResponse + * @property {Array.|null} [processorVersions] ListProcessorVersionsResponse processorVersions + * @property {string|null} [nextPageToken] ListProcessorVersionsResponse nextPageToken */ /** - * Constructs a new EnableProcessorMetadata. + * Constructs a new ListProcessorVersionsResponse. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents an EnableProcessorMetadata. - * @implements IEnableProcessorMetadata + * @classdesc Represents a ListProcessorVersionsResponse. + * @implements IListProcessorVersionsResponse * @constructor - * @param {google.cloud.documentai.v1beta3.IEnableProcessorMetadata=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IListProcessorVersionsResponse=} [properties] Properties to set */ - function EnableProcessorMetadata(properties) { + function ListProcessorVersionsResponse(properties) { + this.processorVersions = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -64087,75 +65142,91 @@ } /** - * EnableProcessorMetadata commonMetadata. - * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata - * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * ListProcessorVersionsResponse processorVersions. + * @member {Array.} processorVersions + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsResponse * @instance */ - EnableProcessorMetadata.prototype.commonMetadata = null; + ListProcessorVersionsResponse.prototype.processorVersions = $util.emptyArray; /** - * Creates a new EnableProcessorMetadata instance using the specified properties. + * ListProcessorVersionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsResponse + * @instance + */ + ListProcessorVersionsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListProcessorVersionsResponse instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsResponse * @static - * @param {google.cloud.documentai.v1beta3.IEnableProcessorMetadata=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.EnableProcessorMetadata} EnableProcessorMetadata instance + * @param {google.cloud.documentai.v1beta3.IListProcessorVersionsResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ListProcessorVersionsResponse} ListProcessorVersionsResponse instance */ - EnableProcessorMetadata.create = function create(properties) { - return new EnableProcessorMetadata(properties); + ListProcessorVersionsResponse.create = function create(properties) { + return new ListProcessorVersionsResponse(properties); }; /** - * Encodes the specified EnableProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorMetadata.verify|verify} messages. + * Encodes the specified ListProcessorVersionsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorVersionsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsResponse * @static - * @param {google.cloud.documentai.v1beta3.IEnableProcessorMetadata} message EnableProcessorMetadata message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IListProcessorVersionsResponse} message ListProcessorVersionsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnableProcessorMetadata.encode = function encode(message, writer) { + ListProcessorVersionsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) - $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.processorVersions != null && message.processorVersions.length) + for (var i = 0; i < message.processorVersions.length; ++i) + $root.google.cloud.documentai.v1beta3.ProcessorVersion.encode(message.processorVersions[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 EnableProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorMetadata.verify|verify} messages. + * Encodes the specified ListProcessorVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorVersionsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsResponse * @static - * @param {google.cloud.documentai.v1beta3.IEnableProcessorMetadata} message EnableProcessorMetadata message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IListProcessorVersionsResponse} message ListProcessorVersionsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnableProcessorMetadata.encodeDelimited = function encodeDelimited(message, writer) { + ListProcessorVersionsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EnableProcessorMetadata message from the specified reader or buffer. + * Decodes a ListProcessorVersionsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.EnableProcessorMetadata} EnableProcessorMetadata + * @returns {google.cloud.documentai.v1beta3.ListProcessorVersionsResponse} ListProcessorVersionsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EnableProcessorMetadata.decode = function decode(reader, length) { + ListProcessorVersionsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.EnableProcessorMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ListProcessorVersionsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 5: - message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + case 1: + if (!(message.processorVersions && message.processorVersions.length)) + message.processorVersions = []; + message.processorVersions.push($root.google.cloud.documentai.v1beta3.ProcessorVersion.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -64166,112 +65237,133 @@ }; /** - * Decodes an EnableProcessorMetadata message from the specified reader or buffer, length delimited. + * Decodes a ListProcessorVersionsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.EnableProcessorMetadata} EnableProcessorMetadata + * @returns {google.cloud.documentai.v1beta3.ListProcessorVersionsResponse} ListProcessorVersionsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EnableProcessorMetadata.decodeDelimited = function decodeDelimited(reader) { + ListProcessorVersionsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EnableProcessorMetadata message. + * Verifies a ListProcessorVersionsResponse message. * @function verify - * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EnableProcessorMetadata.verify = function verify(message) { + ListProcessorVersionsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { - var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); - if (error) - return "commonMetadata." + error; + if (message.processorVersions != null && message.hasOwnProperty("processorVersions")) { + if (!Array.isArray(message.processorVersions)) + return "processorVersions: array expected"; + for (var i = 0; i < message.processorVersions.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.ProcessorVersion.verify(message.processorVersions[i]); + if (error) + return "processorVersions." + error; + } } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; return null; }; /** - * Creates an EnableProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a ListProcessorVersionsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.EnableProcessorMetadata} EnableProcessorMetadata + * @returns {google.cloud.documentai.v1beta3.ListProcessorVersionsResponse} ListProcessorVersionsResponse */ - EnableProcessorMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.EnableProcessorMetadata) + ListProcessorVersionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ListProcessorVersionsResponse) return object; - var message = new $root.google.cloud.documentai.v1beta3.EnableProcessorMetadata(); - if (object.commonMetadata != null) { - if (typeof object.commonMetadata !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.EnableProcessorMetadata.commonMetadata: object expected"); - message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); - } - return message; - }; - + var message = new $root.google.cloud.documentai.v1beta3.ListProcessorVersionsResponse(); + if (object.processorVersions) { + if (!Array.isArray(object.processorVersions)) + throw TypeError(".google.cloud.documentai.v1beta3.ListProcessorVersionsResponse.processorVersions: array expected"); + message.processorVersions = []; + for (var i = 0; i < object.processorVersions.length; ++i) { + if (typeof object.processorVersions[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ListProcessorVersionsResponse.processorVersions: object expected"); + message.processorVersions[i] = $root.google.cloud.documentai.v1beta3.ProcessorVersion.fromObject(object.processorVersions[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + /** - * Creates a plain object from an EnableProcessorMetadata message. Also converts values to other types if specified. + * Creates a plain object from a ListProcessorVersionsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsResponse * @static - * @param {google.cloud.documentai.v1beta3.EnableProcessorMetadata} message EnableProcessorMetadata + * @param {google.cloud.documentai.v1beta3.ListProcessorVersionsResponse} message ListProcessorVersionsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EnableProcessorMetadata.toObject = function toObject(message, options) { + ListProcessorVersionsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.processorVersions = []; if (options.defaults) - object.commonMetadata = null; - if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) - object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); + object.nextPageToken = ""; + if (message.processorVersions && message.processorVersions.length) { + object.processorVersions = []; + for (var j = 0; j < message.processorVersions.length; ++j) + object.processorVersions[j] = $root.google.cloud.documentai.v1beta3.ProcessorVersion.toObject(message.processorVersions[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; return object; }; /** - * Converts this EnableProcessorMetadata to JSON. + * Converts this ListProcessorVersionsResponse to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsResponse * @instance * @returns {Object.} JSON object */ - EnableProcessorMetadata.prototype.toJSON = function toJSON() { + ListProcessorVersionsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return EnableProcessorMetadata; + return ListProcessorVersionsResponse; })(); - v1beta3.DisableProcessorRequest = (function() { + v1beta3.DeleteProcessorVersionRequest = (function() { /** - * Properties of a DisableProcessorRequest. + * Properties of a DeleteProcessorVersionRequest. * @memberof google.cloud.documentai.v1beta3 - * @interface IDisableProcessorRequest - * @property {string|null} [name] DisableProcessorRequest name + * @interface IDeleteProcessorVersionRequest + * @property {string|null} [name] DeleteProcessorVersionRequest name */ /** - * Constructs a new DisableProcessorRequest. + * Constructs a new DeleteProcessorVersionRequest. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a DisableProcessorRequest. - * @implements IDisableProcessorRequest + * @classdesc Represents a DeleteProcessorVersionRequest. + * @implements IDeleteProcessorVersionRequest * @constructor - * @param {google.cloud.documentai.v1beta3.IDisableProcessorRequest=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest=} [properties] Properties to set */ - function DisableProcessorRequest(properties) { + function DeleteProcessorVersionRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -64279,35 +65371,35 @@ } /** - * DisableProcessorRequest name. + * DeleteProcessorVersionRequest name. * @member {string} name - * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest * @instance */ - DisableProcessorRequest.prototype.name = ""; + DeleteProcessorVersionRequest.prototype.name = ""; /** - * Creates a new DisableProcessorRequest instance using the specified properties. + * Creates a new DeleteProcessorVersionRequest instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest * @static - * @param {google.cloud.documentai.v1beta3.IDisableProcessorRequest=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.DisableProcessorRequest} DisableProcessorRequest instance + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest} DeleteProcessorVersionRequest instance */ - DisableProcessorRequest.create = function create(properties) { - return new DisableProcessorRequest(properties); + DeleteProcessorVersionRequest.create = function create(properties) { + return new DeleteProcessorVersionRequest(properties); }; /** - * Encodes the specified DisableProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorRequest.verify|verify} messages. + * Encodes the specified DeleteProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest * @static - * @param {google.cloud.documentai.v1beta3.IDisableProcessorRequest} message DisableProcessorRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest} message DeleteProcessorVersionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DisableProcessorRequest.encode = function encode(message, writer) { + DeleteProcessorVersionRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.name != null && Object.hasOwnProperty.call(message, "name")) @@ -64316,33 +65408,33 @@ }; /** - * Encodes the specified DisableProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorRequest.verify|verify} messages. + * Encodes the specified DeleteProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest * @static - * @param {google.cloud.documentai.v1beta3.IDisableProcessorRequest} message DisableProcessorRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest} message DeleteProcessorVersionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DisableProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + DeleteProcessorVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DisableProcessorRequest message from the specified reader or buffer. + * Decodes a DeleteProcessorVersionRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.DisableProcessorRequest} DisableProcessorRequest + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest} DeleteProcessorVersionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DisableProcessorRequest.decode = function decode(reader, length) { + DeleteProcessorVersionRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DisableProcessorRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -64358,30 +65450,30 @@ }; /** - * Decodes a DisableProcessorRequest message from the specified reader or buffer, length delimited. + * Decodes a DeleteProcessorVersionRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.DisableProcessorRequest} DisableProcessorRequest + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest} DeleteProcessorVersionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DisableProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + DeleteProcessorVersionRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DisableProcessorRequest message. + * Verifies a DeleteProcessorVersionRequest message. * @function verify - * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DisableProcessorRequest.verify = function verify(message) { + DeleteProcessorVersionRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.name != null && message.hasOwnProperty("name")) @@ -64391,32 +65483,32 @@ }; /** - * Creates a DisableProcessorRequest message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.DisableProcessorRequest} DisableProcessorRequest + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest} DeleteProcessorVersionRequest */ - DisableProcessorRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.DisableProcessorRequest) + DeleteProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest) return object; - var message = new $root.google.cloud.documentai.v1beta3.DisableProcessorRequest(); + var message = new $root.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest(); if (object.name != null) message.name = String(object.name); return message; }; /** - * Creates a plain object from a DisableProcessorRequest message. Also converts values to other types if specified. + * Creates a plain object from a DeleteProcessorVersionRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest * @static - * @param {google.cloud.documentai.v1beta3.DisableProcessorRequest} message DisableProcessorRequest + * @param {google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest} message DeleteProcessorVersionRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DisableProcessorRequest.toObject = function toObject(message, options) { + DeleteProcessorVersionRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -64428,36 +65520,37 @@ }; /** - * Converts this DisableProcessorRequest to JSON. + * Converts this DeleteProcessorVersionRequest to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest * @instance * @returns {Object.} JSON object */ - DisableProcessorRequest.prototype.toJSON = function toJSON() { + DeleteProcessorVersionRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DisableProcessorRequest; + return DeleteProcessorVersionRequest; })(); - v1beta3.DisableProcessorResponse = (function() { + v1beta3.DeleteProcessorVersionMetadata = (function() { /** - * Properties of a DisableProcessorResponse. + * Properties of a DeleteProcessorVersionMetadata. * @memberof google.cloud.documentai.v1beta3 - * @interface IDisableProcessorResponse + * @interface IDeleteProcessorVersionMetadata + * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] DeleteProcessorVersionMetadata commonMetadata */ /** - * Constructs a new DisableProcessorResponse. + * Constructs a new DeleteProcessorVersionMetadata. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a DisableProcessorResponse. - * @implements IDisableProcessorResponse + * @classdesc Represents a DeleteProcessorVersionMetadata. + * @implements IDeleteProcessorVersionMetadata * @constructor - * @param {google.cloud.documentai.v1beta3.IDisableProcessorResponse=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata=} [properties] Properties to set */ - function DisableProcessorResponse(properties) { + function DeleteProcessorVersionMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -64465,63 +65558,76 @@ } /** - * Creates a new DisableProcessorResponse instance using the specified properties. + * DeleteProcessorVersionMetadata commonMetadata. + * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata + * @instance + */ + DeleteProcessorVersionMetadata.prototype.commonMetadata = null; + + /** + * Creates a new DeleteProcessorVersionMetadata instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata * @static - * @param {google.cloud.documentai.v1beta3.IDisableProcessorResponse=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.DisableProcessorResponse} DisableProcessorResponse instance + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata} DeleteProcessorVersionMetadata instance */ - DisableProcessorResponse.create = function create(properties) { - return new DisableProcessorResponse(properties); + DeleteProcessorVersionMetadata.create = function create(properties) { + return new DeleteProcessorVersionMetadata(properties); }; /** - * Encodes the specified DisableProcessorResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorResponse.verify|verify} messages. + * Encodes the specified DeleteProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata * @static - * @param {google.cloud.documentai.v1beta3.IDisableProcessorResponse} message DisableProcessorResponse message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata} message DeleteProcessorVersionMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DisableProcessorResponse.encode = function encode(message, writer) { + DeleteProcessorVersionMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified DisableProcessorResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorResponse.verify|verify} messages. + * Encodes the specified DeleteProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata * @static - * @param {google.cloud.documentai.v1beta3.IDisableProcessorResponse} message DisableProcessorResponse message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata} message DeleteProcessorVersionMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DisableProcessorResponse.encodeDelimited = function encodeDelimited(message, writer) { + DeleteProcessorVersionMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DisableProcessorResponse message from the specified reader or buffer. + * Decodes a DeleteProcessorVersionMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.DisableProcessorResponse} DisableProcessorResponse + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata} DeleteProcessorVersionMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DisableProcessorResponse.decode = function decode(reader, length) { + DeleteProcessorVersionMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DisableProcessorResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -64531,94 +65637,112 @@ }; /** - * Decodes a DisableProcessorResponse message from the specified reader or buffer, length delimited. + * Decodes a DeleteProcessorVersionMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.DisableProcessorResponse} DisableProcessorResponse + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata} DeleteProcessorVersionMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DisableProcessorResponse.decodeDelimited = function decodeDelimited(reader) { + DeleteProcessorVersionMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DisableProcessorResponse message. + * Verifies a DeleteProcessorVersionMetadata message. * @function verify - * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DisableProcessorResponse.verify = function verify(message) { + DeleteProcessorVersionMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } return null; }; /** - * Creates a DisableProcessorResponse message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.DisableProcessorResponse} DisableProcessorResponse + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata} DeleteProcessorVersionMetadata */ - DisableProcessorResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.DisableProcessorResponse) + DeleteProcessorVersionMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata) return object; - return new $root.google.cloud.documentai.v1beta3.DisableProcessorResponse(); + var message = new $root.google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; }; /** - * Creates a plain object from a DisableProcessorResponse message. Also converts values to other types if specified. + * Creates a plain object from a DeleteProcessorVersionMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata * @static - * @param {google.cloud.documentai.v1beta3.DisableProcessorResponse} message DisableProcessorResponse + * @param {google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata} message DeleteProcessorVersionMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DisableProcessorResponse.toObject = function toObject() { - return {}; + DeleteProcessorVersionMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.commonMetadata = null; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; }; /** - * Converts this DisableProcessorResponse to JSON. + * Converts this DeleteProcessorVersionMetadata to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata * @instance * @returns {Object.} JSON object */ - DisableProcessorResponse.prototype.toJSON = function toJSON() { + DeleteProcessorVersionMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DisableProcessorResponse; + return DeleteProcessorVersionMetadata; })(); - v1beta3.DisableProcessorMetadata = (function() { + v1beta3.DeployProcessorVersionRequest = (function() { /** - * Properties of a DisableProcessorMetadata. + * Properties of a DeployProcessorVersionRequest. * @memberof google.cloud.documentai.v1beta3 - * @interface IDisableProcessorMetadata - * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] DisableProcessorMetadata commonMetadata + * @interface IDeployProcessorVersionRequest + * @property {string|null} [name] DeployProcessorVersionRequest name */ /** - * Constructs a new DisableProcessorMetadata. + * Constructs a new DeployProcessorVersionRequest. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a DisableProcessorMetadata. - * @implements IDisableProcessorMetadata + * @classdesc Represents a DeployProcessorVersionRequest. + * @implements IDeployProcessorVersionRequest * @constructor - * @param {google.cloud.documentai.v1beta3.IDisableProcessorMetadata=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest=} [properties] Properties to set */ - function DisableProcessorMetadata(properties) { + function DeployProcessorVersionRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -64626,75 +65750,75 @@ } /** - * DisableProcessorMetadata commonMetadata. - * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata - * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * DeployProcessorVersionRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionRequest * @instance */ - DisableProcessorMetadata.prototype.commonMetadata = null; + DeployProcessorVersionRequest.prototype.name = ""; /** - * Creates a new DisableProcessorMetadata instance using the specified properties. + * Creates a new DeployProcessorVersionRequest instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionRequest * @static - * @param {google.cloud.documentai.v1beta3.IDisableProcessorMetadata=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.DisableProcessorMetadata} DisableProcessorMetadata instance + * @param {google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DeployProcessorVersionRequest} DeployProcessorVersionRequest instance */ - DisableProcessorMetadata.create = function create(properties) { - return new DisableProcessorMetadata(properties); + DeployProcessorVersionRequest.create = function create(properties) { + return new DeployProcessorVersionRequest(properties); }; /** - * Encodes the specified DisableProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorMetadata.verify|verify} messages. + * Encodes the specified DeployProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeployProcessorVersionRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionRequest * @static - * @param {google.cloud.documentai.v1beta3.IDisableProcessorMetadata} message DisableProcessorMetadata message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest} message DeployProcessorVersionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DisableProcessorMetadata.encode = function encode(message, writer) { + DeployProcessorVersionRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) - $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, 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 DisableProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorMetadata.verify|verify} messages. + * Encodes the specified DeployProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeployProcessorVersionRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionRequest * @static - * @param {google.cloud.documentai.v1beta3.IDisableProcessorMetadata} message DisableProcessorMetadata message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest} message DeployProcessorVersionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DisableProcessorMetadata.encodeDelimited = function encodeDelimited(message, writer) { + DeployProcessorVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DisableProcessorMetadata message from the specified reader or buffer. + * Decodes a DeployProcessorVersionRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.DisableProcessorMetadata} DisableProcessorMetadata + * @returns {google.cloud.documentai.v1beta3.DeployProcessorVersionRequest} DeployProcessorVersionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DisableProcessorMetadata.decode = function decode(reader, length) { + DeployProcessorVersionRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DisableProcessorMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 5: - message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + case 1: + message.name = reader.string(); break; default: reader.skipType(tag & 7); @@ -64705,116 +65829,106 @@ }; /** - * Decodes a DisableProcessorMetadata message from the specified reader or buffer, length delimited. + * Decodes a DeployProcessorVersionRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.DisableProcessorMetadata} DisableProcessorMetadata + * @returns {google.cloud.documentai.v1beta3.DeployProcessorVersionRequest} DeployProcessorVersionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DisableProcessorMetadata.decodeDelimited = function decodeDelimited(reader) { + DeployProcessorVersionRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DisableProcessorMetadata message. + * Verifies a DeployProcessorVersionRequest message. * @function verify - * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DisableProcessorMetadata.verify = function verify(message) { + DeployProcessorVersionRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { - var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); - if (error) - return "commonMetadata." + error; - } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates a DisableProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a DeployProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.DisableProcessorMetadata} DisableProcessorMetadata + * @returns {google.cloud.documentai.v1beta3.DeployProcessorVersionRequest} DeployProcessorVersionRequest */ - DisableProcessorMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.DisableProcessorMetadata) + DeployProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest) return object; - var message = new $root.google.cloud.documentai.v1beta3.DisableProcessorMetadata(); - if (object.commonMetadata != null) { - if (typeof object.commonMetadata !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.DisableProcessorMetadata.commonMetadata: object expected"); - message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); - } + var message = new $root.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest(); + if (object.name != null) + message.name = String(object.name); return message; }; /** - * Creates a plain object from a DisableProcessorMetadata message. Also converts values to other types if specified. + * Creates a plain object from a DeployProcessorVersionRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionRequest * @static - * @param {google.cloud.documentai.v1beta3.DisableProcessorMetadata} message DisableProcessorMetadata + * @param {google.cloud.documentai.v1beta3.DeployProcessorVersionRequest} message DeployProcessorVersionRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DisableProcessorMetadata.toObject = function toObject(message, options) { + DeployProcessorVersionRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) - object.commonMetadata = null; - if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) - object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; return object; }; /** - * Converts this DisableProcessorMetadata to JSON. + * Converts this DeployProcessorVersionRequest to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionRequest * @instance * @returns {Object.} JSON object */ - DisableProcessorMetadata.prototype.toJSON = function toJSON() { + DeployProcessorVersionRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DisableProcessorMetadata; + return DeployProcessorVersionRequest; })(); - v1beta3.ReviewDocumentRequest = (function() { + v1beta3.DeployProcessorVersionResponse = (function() { /** - * Properties of a ReviewDocumentRequest. + * Properties of a DeployProcessorVersionResponse. * @memberof google.cloud.documentai.v1beta3 - * @interface IReviewDocumentRequest - * @property {google.cloud.documentai.v1beta3.IDocument|null} [inlineDocument] ReviewDocumentRequest inlineDocument - * @property {string|null} [humanReviewConfig] ReviewDocumentRequest humanReviewConfig - * @property {google.cloud.documentai.v1beta3.IDocument|null} [document] ReviewDocumentRequest document - * @property {boolean|null} [enableSchemaValidation] ReviewDocumentRequest enableSchemaValidation - * @property {google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority|null} [priority] ReviewDocumentRequest priority + * @interface IDeployProcessorVersionResponse */ /** - * Constructs a new ReviewDocumentRequest. + * Constructs a new DeployProcessorVersionResponse. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a ReviewDocumentRequest. - * @implements IReviewDocumentRequest + * @classdesc Represents a DeployProcessorVersionResponse. + * @implements IDeployProcessorVersionResponse * @constructor - * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse=} [properties] Properties to set */ - function ReviewDocumentRequest(properties) { + function DeployProcessorVersionResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -64822,142 +65936,63 @@ } /** - * ReviewDocumentRequest inlineDocument. - * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} inlineDocument - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest - * @instance - */ - ReviewDocumentRequest.prototype.inlineDocument = null; - - /** - * ReviewDocumentRequest humanReviewConfig. - * @member {string} humanReviewConfig - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest - * @instance - */ - ReviewDocumentRequest.prototype.humanReviewConfig = ""; - - /** - * ReviewDocumentRequest document. - * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} document - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest - * @instance - */ - ReviewDocumentRequest.prototype.document = null; - - /** - * ReviewDocumentRequest enableSchemaValidation. - * @member {boolean} enableSchemaValidation - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest - * @instance - */ - ReviewDocumentRequest.prototype.enableSchemaValidation = false; - - /** - * ReviewDocumentRequest priority. - * @member {google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority} priority - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest - * @instance - */ - ReviewDocumentRequest.prototype.priority = 0; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * ReviewDocumentRequest source. - * @member {"inlineDocument"|undefined} source - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest - * @instance - */ - Object.defineProperty(ReviewDocumentRequest.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["inlineDocument"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new ReviewDocumentRequest instance using the specified properties. + * Creates a new DeployProcessorVersionResponse instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionResponse * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest instance + * @param {google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DeployProcessorVersionResponse} DeployProcessorVersionResponse instance */ - ReviewDocumentRequest.create = function create(properties) { - return new ReviewDocumentRequest(properties); + DeployProcessorVersionResponse.create = function create(properties) { + return new DeployProcessorVersionResponse(properties); }; /** - * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * Encodes the specified DeployProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeployProcessorVersionResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionResponse * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse} message DeployProcessorVersionResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentRequest.encode = function encode(message, writer) { + DeployProcessorVersionResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.humanReviewConfig != null && Object.hasOwnProperty.call(message, "humanReviewConfig")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.humanReviewConfig); - if (message.document != null && Object.hasOwnProperty.call(message, "document")) - $root.google.cloud.documentai.v1beta3.Document.encode(message.document, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.enableSchemaValidation != null && Object.hasOwnProperty.call(message, "enableSchemaValidation")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableSchemaValidation); - if (message.inlineDocument != null && Object.hasOwnProperty.call(message, "inlineDocument")) - $root.google.cloud.documentai.v1beta3.Document.encode(message.inlineDocument, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.priority != null && Object.hasOwnProperty.call(message, "priority")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.priority); return writer; }; /** - * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * Encodes the specified DeployProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeployProcessorVersionResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionResponse * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse} message DeployProcessorVersionResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + DeployProcessorVersionResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * Decodes a DeployProcessorVersionResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + * @returns {google.cloud.documentai.v1beta3.DeployProcessorVersionResponse} DeployProcessorVersionResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentRequest.decode = function decode(reader, length) { + DeployProcessorVersionResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DeployProcessorVersionResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 4: - message.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); - break; - case 1: - message.humanReviewConfig = reader.string(); - break; - case 2: - message.document = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); - break; - case 3: - message.enableSchemaValidation = reader.bool(); - break; - case 5: - message.priority = reader.int32(); - break; default: reader.skipType(tag & 7); break; @@ -64967,183 +66002,94 @@ }; /** - * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * Decodes a DeployProcessorVersionResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + * @returns {google.cloud.documentai.v1beta3.DeployProcessorVersionResponse} DeployProcessorVersionResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + DeployProcessorVersionResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReviewDocumentRequest message. + * Verifies a DeployProcessorVersionResponse message. * @function verify - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ReviewDocumentRequest.verify = function verify(message) { + DeployProcessorVersionResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { - properties.source = 1; - { - var error = $root.google.cloud.documentai.v1beta3.Document.verify(message.inlineDocument); - if (error) - return "inlineDocument." + error; - } - } - if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) - if (!$util.isString(message.humanReviewConfig)) - return "humanReviewConfig: string expected"; - if (message.document != null && message.hasOwnProperty("document")) { - var error = $root.google.cloud.documentai.v1beta3.Document.verify(message.document); - if (error) - return "document." + error; - } - if (message.enableSchemaValidation != null && message.hasOwnProperty("enableSchemaValidation")) - if (typeof message.enableSchemaValidation !== "boolean") - return "enableSchemaValidation: boolean expected"; - if (message.priority != null && message.hasOwnProperty("priority")) - switch (message.priority) { - default: - return "priority: enum value expected"; - case 0: - case 1: - break; - } return null; }; /** - * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. + * Creates a DeployProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + * @returns {google.cloud.documentai.v1beta3.DeployProcessorVersionResponse} DeployProcessorVersionResponse */ - ReviewDocumentRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest) + DeployProcessorVersionResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DeployProcessorVersionResponse) return object; - var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest(); - if (object.inlineDocument != null) { - if (typeof object.inlineDocument !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentRequest.inlineDocument: object expected"); - message.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.fromObject(object.inlineDocument); - } - if (object.humanReviewConfig != null) - message.humanReviewConfig = String(object.humanReviewConfig); - if (object.document != null) { - if (typeof object.document !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentRequest.document: object expected"); - message.document = $root.google.cloud.documentai.v1beta3.Document.fromObject(object.document); - } - if (object.enableSchemaValidation != null) - message.enableSchemaValidation = Boolean(object.enableSchemaValidation); - switch (object.priority) { - case "DEFAULT": - case 0: - message.priority = 0; - break; - case "URGENT": - case 1: - message.priority = 1; - break; - } - return message; + return new $root.google.cloud.documentai.v1beta3.DeployProcessorVersionResponse(); }; /** - * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. + * Creates a plain object from a DeployProcessorVersionResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionResponse * @static - * @param {google.cloud.documentai.v1beta3.ReviewDocumentRequest} message ReviewDocumentRequest + * @param {google.cloud.documentai.v1beta3.DeployProcessorVersionResponse} message DeployProcessorVersionResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReviewDocumentRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.humanReviewConfig = ""; - object.document = null; - object.enableSchemaValidation = false; - object.priority = options.enums === String ? "DEFAULT" : 0; - } - if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) - object.humanReviewConfig = message.humanReviewConfig; - if (message.document != null && message.hasOwnProperty("document")) - object.document = $root.google.cloud.documentai.v1beta3.Document.toObject(message.document, options); - if (message.enableSchemaValidation != null && message.hasOwnProperty("enableSchemaValidation")) - object.enableSchemaValidation = message.enableSchemaValidation; - if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { - object.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.toObject(message.inlineDocument, options); - if (options.oneofs) - object.source = "inlineDocument"; - } - if (message.priority != null && message.hasOwnProperty("priority")) - object.priority = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority[message.priority] : message.priority; - return object; + DeployProcessorVersionResponse.toObject = function toObject() { + return {}; }; /** - * Converts this ReviewDocumentRequest to JSON. + * Converts this DeployProcessorVersionResponse to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionResponse * @instance * @returns {Object.} JSON object */ - ReviewDocumentRequest.prototype.toJSON = function toJSON() { + DeployProcessorVersionResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * Priority enum. - * @name google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority - * @enum {number} - * @property {number} DEFAULT=0 DEFAULT value - * @property {number} URGENT=1 URGENT value - */ - ReviewDocumentRequest.Priority = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "DEFAULT"] = 0; - values[valuesById[1] = "URGENT"] = 1; - return values; - })(); - - return ReviewDocumentRequest; + return DeployProcessorVersionResponse; })(); - v1beta3.ReviewDocumentResponse = (function() { + v1beta3.DeployProcessorVersionMetadata = (function() { /** - * Properties of a ReviewDocumentResponse. + * Properties of a DeployProcessorVersionMetadata. * @memberof google.cloud.documentai.v1beta3 - * @interface IReviewDocumentResponse - * @property {string|null} [gcsDestination] ReviewDocumentResponse gcsDestination + * @interface IDeployProcessorVersionMetadata + * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] DeployProcessorVersionMetadata commonMetadata */ /** - * Constructs a new ReviewDocumentResponse. + * Constructs a new DeployProcessorVersionMetadata. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a ReviewDocumentResponse. - * @implements IReviewDocumentResponse + * @classdesc Represents a DeployProcessorVersionMetadata. + * @implements IDeployProcessorVersionMetadata * @constructor - * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata=} [properties] Properties to set */ - function ReviewDocumentResponse(properties) { + function DeployProcessorVersionMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -65151,75 +66097,75 @@ } /** - * ReviewDocumentResponse gcsDestination. - * @member {string} gcsDestination - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * DeployProcessorVersionMetadata commonMetadata. + * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata * @instance */ - ReviewDocumentResponse.prototype.gcsDestination = ""; + DeployProcessorVersionMetadata.prototype.commonMetadata = null; /** - * Creates a new ReviewDocumentResponse instance using the specified properties. + * Creates a new DeployProcessorVersionMetadata instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse instance + * @param {google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata} DeployProcessorVersionMetadata instance */ - ReviewDocumentResponse.create = function create(properties) { - return new ReviewDocumentResponse(properties); + DeployProcessorVersionMetadata.create = function create(properties) { + return new DeployProcessorVersionMetadata(properties); }; /** - * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * Encodes the specified DeployProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata} message DeployProcessorVersionMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentResponse.encode = function encode(message, writer) { + DeployProcessorVersionMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsDestination); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * Encodes the specified DeployProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata} message DeployProcessorVersionMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { + DeployProcessorVersionMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * Decodes a DeployProcessorVersionMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @returns {google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata} DeployProcessorVersionMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentResponse.decode = function decode(reader, length) { + DeployProcessorVersionMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsDestination = reader.string(); + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -65230,112 +66176,112 @@ }; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * Decodes a DeployProcessorVersionMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @returns {google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata} DeployProcessorVersionMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentResponse.decodeDelimited = function decodeDelimited(reader) { + DeployProcessorVersionMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReviewDocumentResponse message. + * Verifies a DeployProcessorVersionMetadata message. * @function verify - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ReviewDocumentResponse.verify = function verify(message) { + DeployProcessorVersionMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) - if (!$util.isString(message.gcsDestination)) - return "gcsDestination: string expected"; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } return null; }; /** - * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * Creates a DeployProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @returns {google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata} DeployProcessorVersionMetadata */ - ReviewDocumentResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse) + DeployProcessorVersionMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata) return object; - var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse(); - if (object.gcsDestination != null) - message.gcsDestination = String(object.gcsDestination); + var message = new $root.google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); + } return message; }; /** - * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. + * Creates a plain object from a DeployProcessorVersionMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata * @static - * @param {google.cloud.documentai.v1beta3.ReviewDocumentResponse} message ReviewDocumentResponse + * @param {google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata} message DeployProcessorVersionMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReviewDocumentResponse.toObject = function toObject(message, options) { + DeployProcessorVersionMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) - object.gcsDestination = ""; - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) - object.gcsDestination = message.gcsDestination; + object.commonMetadata = null; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); return object; }; /** - * Converts this ReviewDocumentResponse to JSON. + * Converts this DeployProcessorVersionMetadata to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata * @instance * @returns {Object.} JSON object */ - ReviewDocumentResponse.prototype.toJSON = function toJSON() { + DeployProcessorVersionMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ReviewDocumentResponse; + return DeployProcessorVersionMetadata; })(); - v1beta3.ReviewDocumentOperationMetadata = (function() { + v1beta3.UndeployProcessorVersionRequest = (function() { /** - * Properties of a ReviewDocumentOperationMetadata. + * Properties of an UndeployProcessorVersionRequest. * @memberof google.cloud.documentai.v1beta3 - * @interface IReviewDocumentOperationMetadata - * @property {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|null} [state] ReviewDocumentOperationMetadata state - * @property {string|null} [stateMessage] ReviewDocumentOperationMetadata stateMessage - * @property {google.protobuf.ITimestamp|null} [createTime] ReviewDocumentOperationMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] ReviewDocumentOperationMetadata updateTime - * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] ReviewDocumentOperationMetadata commonMetadata - * @property {string|null} [questionId] ReviewDocumentOperationMetadata questionId + * @interface IUndeployProcessorVersionRequest + * @property {string|null} [name] UndeployProcessorVersionRequest name */ /** - * Constructs a new ReviewDocumentOperationMetadata. + * Constructs a new UndeployProcessorVersionRequest. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a ReviewDocumentOperationMetadata. - * @implements IReviewDocumentOperationMetadata + * @classdesc Represents an UndeployProcessorVersionRequest. + * @implements IUndeployProcessorVersionRequest * @constructor - * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest=} [properties] Properties to set */ - function ReviewDocumentOperationMetadata(properties) { + function UndeployProcessorVersionRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -65343,140 +66289,75 @@ } /** - * ReviewDocumentOperationMetadata state. - * @member {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State} state - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata - * @instance - */ - ReviewDocumentOperationMetadata.prototype.state = 0; - - /** - * ReviewDocumentOperationMetadata stateMessage. - * @member {string} stateMessage - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata - * @instance - */ - ReviewDocumentOperationMetadata.prototype.stateMessage = ""; - - /** - * ReviewDocumentOperationMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata - * @instance - */ - ReviewDocumentOperationMetadata.prototype.createTime = null; - - /** - * ReviewDocumentOperationMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata - * @instance - */ - ReviewDocumentOperationMetadata.prototype.updateTime = null; - - /** - * ReviewDocumentOperationMetadata commonMetadata. - * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata - * @instance - */ - ReviewDocumentOperationMetadata.prototype.commonMetadata = null; - - /** - * ReviewDocumentOperationMetadata questionId. - * @member {string} questionId - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * UndeployProcessorVersionRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest * @instance */ - ReviewDocumentOperationMetadata.prototype.questionId = ""; + UndeployProcessorVersionRequest.prototype.name = ""; /** - * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * Creates a new UndeployProcessorVersionRequest instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata instance + * @param {google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest} UndeployProcessorVersionRequest instance */ - ReviewDocumentOperationMetadata.create = function create(properties) { - return new ReviewDocumentOperationMetadata(properties); + UndeployProcessorVersionRequest.create = function create(properties) { + return new UndeployProcessorVersionRequest(properties); }; /** - * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * Encodes the specified UndeployProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest} message UndeployProcessorVersionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentOperationMetadata.encode = function encode(message, writer) { + UndeployProcessorVersionRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) - $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.questionId != null && Object.hasOwnProperty.call(message, "questionId")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.questionId); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; /** - * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * Encodes the specified UndeployProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest} message UndeployProcessorVersionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + UndeployProcessorVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * Decodes an UndeployProcessorVersionRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @returns {google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest} UndeployProcessorVersionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentOperationMetadata.decode = function decode(reader, length) { + UndeployProcessorVersionRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.state = reader.int32(); - break; - case 2: - message.stateMessage = reader.string(); - break; - case 3: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 5: - message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); - break; - case 6: - message.questionId = reader.string(); + message.name = reader.string(); break; default: reader.skipType(tag & 7); @@ -65487,221 +66368,106 @@ }; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * Decodes an UndeployProcessorVersionRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @returns {google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest} UndeployProcessorVersionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + UndeployProcessorVersionRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReviewDocumentOperationMetadata message. + * Verifies an UndeployProcessorVersionRequest message. * @function verify - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ReviewDocumentOperationMetadata.verify = function verify(message) { + UndeployProcessorVersionRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) - if (!$util.isString(message.stateMessage)) - return "stateMessage: string 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.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { - var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); - if (error) - return "commonMetadata." + error; - } - if (message.questionId != null && message.hasOwnProperty("questionId")) - if (!$util.isString(message.questionId)) - return "questionId: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an UndeployProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @returns {google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest} UndeployProcessorVersionRequest */ - ReviewDocumentOperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata) + UndeployProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest) return object; - var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata(); - switch (object.state) { - case "STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "RUNNING": - case 1: - message.state = 1; - break; - case "CANCELLING": - case 2: - message.state = 2; - break; - case "SUCCEEDED": - case 3: - message.state = 3; - break; - case "FAILED": - case 4: - message.state = 4; - break; - case "CANCELLED": - case 5: - message.state = 5; - break; - } - if (object.stateMessage != null) - message.stateMessage = String(object.stateMessage); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.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.documentai.v1beta3.ReviewDocumentOperationMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); - } - if (object.commonMetadata != null) { - if (typeof object.commonMetadata !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.commonMetadata: object expected"); - message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); - } - if (object.questionId != null) - message.questionId = String(object.questionId); + var message = new $root.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest(); + if (object.name != null) + message.name = String(object.name); return message; }; /** - * Creates a plain object from a ReviewDocumentOperationMetadata message. Also converts values to other types if specified. + * Creates a plain object from an UndeployProcessorVersionRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest * @static - * @param {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata + * @param {google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest} message UndeployProcessorVersionRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReviewDocumentOperationMetadata.toObject = function toObject(message, options) { + UndeployProcessorVersionRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; - object.stateMessage = ""; - object.createTime = null; - object.updateTime = null; - object.commonMetadata = null; - object.questionId = ""; - } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State[message.state] : message.state; - if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) - object.stateMessage = message.stateMessage; - 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.commonMetadata != null && message.hasOwnProperty("commonMetadata")) - object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); - if (message.questionId != null && message.hasOwnProperty("questionId")) - object.questionId = message.questionId; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; return object; }; /** - * Converts this ReviewDocumentOperationMetadata to JSON. + * Converts this UndeployProcessorVersionRequest to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest * @instance * @returns {Object.} JSON object */ - ReviewDocumentOperationMetadata.prototype.toJSON = function toJSON() { + UndeployProcessorVersionRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * State enum. - * @name google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State - * @enum {number} - * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} RUNNING=1 RUNNING value - * @property {number} CANCELLING=2 CANCELLING value - * @property {number} SUCCEEDED=3 SUCCEEDED value - * @property {number} FAILED=4 FAILED value - * @property {number} CANCELLED=5 CANCELLED value - */ - ReviewDocumentOperationMetadata.State = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "RUNNING"] = 1; - values[valuesById[2] = "CANCELLING"] = 2; - values[valuesById[3] = "SUCCEEDED"] = 3; - values[valuesById[4] = "FAILED"] = 4; - values[valuesById[5] = "CANCELLED"] = 5; - return values; - })(); - - return ReviewDocumentOperationMetadata; + return UndeployProcessorVersionRequest; })(); - v1beta3.CommonOperationMetadata = (function() { + v1beta3.UndeployProcessorVersionResponse = (function() { /** - * Properties of a CommonOperationMetadata. + * Properties of an UndeployProcessorVersionResponse. * @memberof google.cloud.documentai.v1beta3 - * @interface ICommonOperationMetadata - * @property {google.cloud.documentai.v1beta3.CommonOperationMetadata.State|null} [state] CommonOperationMetadata state - * @property {string|null} [stateMessage] CommonOperationMetadata stateMessage - * @property {google.protobuf.ITimestamp|null} [createTime] CommonOperationMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] CommonOperationMetadata updateTime + * @interface IUndeployProcessorVersionResponse */ /** - * Constructs a new CommonOperationMetadata. + * Constructs a new UndeployProcessorVersionResponse. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a CommonOperationMetadata. - * @implements ICommonOperationMetadata + * @classdesc Represents an UndeployProcessorVersionResponse. + * @implements IUndeployProcessorVersionResponse * @constructor - * @param {google.cloud.documentai.v1beta3.ICommonOperationMetadata=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse=} [properties] Properties to set */ - function CommonOperationMetadata(properties) { + function UndeployProcessorVersionResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -65709,114 +66475,236 @@ } /** - * CommonOperationMetadata state. - * @member {google.cloud.documentai.v1beta3.CommonOperationMetadata.State} state - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata - * @instance + * Creates a new UndeployProcessorVersionResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse} UndeployProcessorVersionResponse instance */ - CommonOperationMetadata.prototype.state = 0; + UndeployProcessorVersionResponse.create = function create(properties) { + return new UndeployProcessorVersionResponse(properties); + }; /** - * CommonOperationMetadata stateMessage. - * @member {string} stateMessage - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata - * @instance + * Encodes the specified UndeployProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse} message UndeployProcessorVersionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - CommonOperationMetadata.prototype.stateMessage = ""; + UndeployProcessorVersionResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; /** - * CommonOperationMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata - * @instance + * Encodes the specified UndeployProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse} message UndeployProcessorVersionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - CommonOperationMetadata.prototype.createTime = null; + UndeployProcessorVersionResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * CommonOperationMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * Decodes an UndeployProcessorVersionResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse} UndeployProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeployProcessorVersionResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UndeployProcessorVersionResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse} UndeployProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeployProcessorVersionResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UndeployProcessorVersionResponse message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UndeployProcessorVersionResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an UndeployProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse} UndeployProcessorVersionResponse + */ + UndeployProcessorVersionResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse) + return object; + return new $root.google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse(); + }; + + /** + * Creates a plain object from an UndeployProcessorVersionResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse} message UndeployProcessorVersionResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UndeployProcessorVersionResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this UndeployProcessorVersionResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse * @instance + * @returns {Object.} JSON object */ - CommonOperationMetadata.prototype.updateTime = null; + UndeployProcessorVersionResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UndeployProcessorVersionResponse; + })(); + + v1beta3.UndeployProcessorVersionMetadata = (function() { /** - * Creates a new CommonOperationMetadata instance using the specified properties. + * Properties of an UndeployProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @interface IUndeployProcessorVersionMetadata + * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] UndeployProcessorVersionMetadata commonMetadata + */ + + /** + * Constructs a new UndeployProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents an UndeployProcessorVersionMetadata. + * @implements IUndeployProcessorVersionMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata=} [properties] Properties to set + */ + function UndeployProcessorVersionMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UndeployProcessorVersionMetadata commonMetadata. + * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata + * @instance + */ + UndeployProcessorVersionMetadata.prototype.commonMetadata = null; + + /** + * Creates a new UndeployProcessorVersionMetadata instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata * @static - * @param {google.cloud.documentai.v1beta3.ICommonOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.CommonOperationMetadata} CommonOperationMetadata instance + * @param {google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata} UndeployProcessorVersionMetadata instance */ - CommonOperationMetadata.create = function create(properties) { - return new CommonOperationMetadata(properties); + UndeployProcessorVersionMetadata.create = function create(properties) { + return new UndeployProcessorVersionMetadata(properties); }; /** - * Encodes the specified CommonOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.CommonOperationMetadata.verify|verify} messages. + * Encodes the specified UndeployProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata * @static - * @param {google.cloud.documentai.v1beta3.ICommonOperationMetadata} message CommonOperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata} message UndeployProcessorVersionMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CommonOperationMetadata.encode = function encode(message, writer) { + UndeployProcessorVersionMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified CommonOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.CommonOperationMetadata.verify|verify} messages. + * Encodes the specified UndeployProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata * @static - * @param {google.cloud.documentai.v1beta3.ICommonOperationMetadata} message CommonOperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata} message UndeployProcessorVersionMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CommonOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + UndeployProcessorVersionMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CommonOperationMetadata message from the specified reader or buffer. + * Decodes an UndeployProcessorVersionMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.CommonOperationMetadata} CommonOperationMetadata + * @returns {google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata} UndeployProcessorVersionMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CommonOperationMetadata.decode = function decode(reader, length) { + UndeployProcessorVersionMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.CommonOperationMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.state = reader.int32(); - break; - case 2: - message.stateMessage = reader.string(); - break; - case 3: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -65827,177 +66715,5655 @@ }; /** - * Decodes a CommonOperationMetadata message from the specified reader or buffer, length delimited. + * Decodes an UndeployProcessorVersionMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.CommonOperationMetadata} CommonOperationMetadata + * @returns {google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata} UndeployProcessorVersionMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CommonOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + UndeployProcessorVersionMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CommonOperationMetadata message. + * Verifies an UndeployProcessorVersionMetadata message. * @function verify - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CommonOperationMetadata.verify = function verify(message) { + UndeployProcessorVersionMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates an UndeployProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata} UndeployProcessorVersionMetadata + */ + UndeployProcessorVersionMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata) + return object; + var message = new $root.google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from an UndeployProcessorVersionMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata} message UndeployProcessorVersionMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UndeployProcessorVersionMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.commonMetadata = null; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this UndeployProcessorVersionMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata + * @instance + * @returns {Object.} JSON object + */ + UndeployProcessorVersionMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UndeployProcessorVersionMetadata; + })(); + + v1beta3.CreateProcessorRequest = (function() { + + /** + * Properties of a CreateProcessorRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface ICreateProcessorRequest + * @property {string|null} [parent] CreateProcessorRequest parent + * @property {google.cloud.documentai.v1beta3.IProcessor|null} [processor] CreateProcessorRequest processor + */ + + /** + * Constructs a new CreateProcessorRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a CreateProcessorRequest. + * @implements ICreateProcessorRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.ICreateProcessorRequest=} [properties] Properties to set + */ + function CreateProcessorRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateProcessorRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @instance + */ + CreateProcessorRequest.prototype.parent = ""; + + /** + * CreateProcessorRequest processor. + * @member {google.cloud.documentai.v1beta3.IProcessor|null|undefined} processor + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @instance + */ + CreateProcessorRequest.prototype.processor = null; + + /** + * Creates a new CreateProcessorRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.ICreateProcessorRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.CreateProcessorRequest} CreateProcessorRequest instance + */ + CreateProcessorRequest.create = function create(properties) { + return new CreateProcessorRequest(properties); + }; + + /** + * Encodes the specified CreateProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.CreateProcessorRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.ICreateProcessorRequest} message CreateProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProcessorRequest.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.processor != null && Object.hasOwnProperty.call(message, "processor")) + $root.google.cloud.documentai.v1beta3.Processor.encode(message.processor, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.CreateProcessorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.ICreateProcessorRequest} message CreateProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateProcessorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.CreateProcessorRequest} CreateProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProcessorRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.CreateProcessorRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.processor = $root.google.cloud.documentai.v1beta3.Processor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateProcessorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.CreateProcessorRequest} CreateProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateProcessorRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateProcessorRequest.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.processor != null && message.hasOwnProperty("processor")) { + var error = $root.google.cloud.documentai.v1beta3.Processor.verify(message.processor); + if (error) + return "processor." + error; + } + return null; + }; + + /** + * Creates a CreateProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.CreateProcessorRequest} CreateProcessorRequest + */ + CreateProcessorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.CreateProcessorRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta3.CreateProcessorRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.processor != null) { + if (typeof object.processor !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.CreateProcessorRequest.processor: object expected"); + message.processor = $root.google.cloud.documentai.v1beta3.Processor.fromObject(object.processor); + } + return message; + }; + + /** + * Creates a plain object from a CreateProcessorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.CreateProcessorRequest} message CreateProcessorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateProcessorRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.processor = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.processor != null && message.hasOwnProperty("processor")) + object.processor = $root.google.cloud.documentai.v1beta3.Processor.toObject(message.processor, options); + return object; + }; + + /** + * Converts this CreateProcessorRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @instance + * @returns {Object.} JSON object + */ + CreateProcessorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateProcessorRequest; + })(); + + v1beta3.DeleteProcessorRequest = (function() { + + /** + * Properties of a DeleteProcessorRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IDeleteProcessorRequest + * @property {string|null} [name] DeleteProcessorRequest name + */ + + /** + * Constructs a new DeleteProcessorRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a DeleteProcessorRequest. + * @implements IDeleteProcessorRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorRequest=} [properties] Properties to set + */ + function DeleteProcessorRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteProcessorRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @instance + */ + DeleteProcessorRequest.prototype.name = ""; + + /** + * Creates a new DeleteProcessorRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorRequest} DeleteProcessorRequest instance + */ + DeleteProcessorRequest.create = function create(properties) { + return new DeleteProcessorRequest(properties); + }; + + /** + * Encodes the specified DeleteProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorRequest} message DeleteProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorRequest.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 DeleteProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorRequest} message DeleteProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteProcessorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorRequest} DeleteProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DeleteProcessorRequest(); + 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 DeleteProcessorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorRequest} DeleteProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteProcessorRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteProcessorRequest.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 DeleteProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorRequest} DeleteProcessorRequest + */ + DeleteProcessorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DeleteProcessorRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DeleteProcessorRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteProcessorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.DeleteProcessorRequest} message DeleteProcessorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteProcessorRequest.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 DeleteProcessorRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteProcessorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteProcessorRequest; + })(); + + v1beta3.DeleteProcessorMetadata = (function() { + + /** + * Properties of a DeleteProcessorMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @interface IDeleteProcessorMetadata + * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] DeleteProcessorMetadata commonMetadata + */ + + /** + * Constructs a new DeleteProcessorMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a DeleteProcessorMetadata. + * @implements IDeleteProcessorMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorMetadata=} [properties] Properties to set + */ + function DeleteProcessorMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteProcessorMetadata commonMetadata. + * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @instance + */ + DeleteProcessorMetadata.prototype.commonMetadata = null; + + /** + * Creates a new DeleteProcessorMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorMetadata} DeleteProcessorMetadata instance + */ + DeleteProcessorMetadata.create = function create(properties) { + return new DeleteProcessorMetadata(properties); + }; + + /** + * Encodes the specified DeleteProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorMetadata} message DeleteProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DeleteProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorMetadata} message DeleteProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteProcessorMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorMetadata} DeleteProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DeleteProcessorMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteProcessorMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorMetadata} DeleteProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteProcessorMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteProcessorMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates a DeleteProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorMetadata} DeleteProcessorMetadata + */ + DeleteProcessorMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DeleteProcessorMetadata) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DeleteProcessorMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.DeleteProcessorMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from a DeleteProcessorMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.DeleteProcessorMetadata} message DeleteProcessorMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteProcessorMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.commonMetadata = null; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this DeleteProcessorMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @instance + * @returns {Object.} JSON object + */ + DeleteProcessorMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteProcessorMetadata; + })(); + + v1beta3.EnableProcessorRequest = (function() { + + /** + * Properties of an EnableProcessorRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IEnableProcessorRequest + * @property {string|null} [name] EnableProcessorRequest name + */ + + /** + * Constructs a new EnableProcessorRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents an EnableProcessorRequest. + * @implements IEnableProcessorRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.IEnableProcessorRequest=} [properties] Properties to set + */ + function EnableProcessorRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnableProcessorRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @instance + */ + EnableProcessorRequest.prototype.name = ""; + + /** + * Creates a new EnableProcessorRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.IEnableProcessorRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.EnableProcessorRequest} EnableProcessorRequest instance + */ + EnableProcessorRequest.create = function create(properties) { + return new EnableProcessorRequest(properties); + }; + + /** + * Encodes the specified EnableProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.IEnableProcessorRequest} message EnableProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorRequest.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 EnableProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.IEnableProcessorRequest} message EnableProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnableProcessorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.EnableProcessorRequest} EnableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.EnableProcessorRequest(); + 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 an EnableProcessorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.EnableProcessorRequest} EnableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnableProcessorRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnableProcessorRequest.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 EnableProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.EnableProcessorRequest} EnableProcessorRequest + */ + EnableProcessorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.EnableProcessorRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta3.EnableProcessorRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from an EnableProcessorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.EnableProcessorRequest} message EnableProcessorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnableProcessorRequest.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 EnableProcessorRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @instance + * @returns {Object.} JSON object + */ + EnableProcessorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnableProcessorRequest; + })(); + + v1beta3.EnableProcessorResponse = (function() { + + /** + * Properties of an EnableProcessorResponse. + * @memberof google.cloud.documentai.v1beta3 + * @interface IEnableProcessorResponse + */ + + /** + * Constructs a new EnableProcessorResponse. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents an EnableProcessorResponse. + * @implements IEnableProcessorResponse + * @constructor + * @param {google.cloud.documentai.v1beta3.IEnableProcessorResponse=} [properties] Properties to set + */ + function EnableProcessorResponse(properties) { + if (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 EnableProcessorResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @static + * @param {google.cloud.documentai.v1beta3.IEnableProcessorResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.EnableProcessorResponse} EnableProcessorResponse instance + */ + EnableProcessorResponse.create = function create(properties) { + return new EnableProcessorResponse(properties); + }; + + /** + * Encodes the specified EnableProcessorResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @static + * @param {google.cloud.documentai.v1beta3.IEnableProcessorResponse} message EnableProcessorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified EnableProcessorResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @static + * @param {google.cloud.documentai.v1beta3.IEnableProcessorResponse} message EnableProcessorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnableProcessorResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.EnableProcessorResponse} EnableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.EnableProcessorResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnableProcessorResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.EnableProcessorResponse} EnableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnableProcessorResponse message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnableProcessorResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an EnableProcessorResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.EnableProcessorResponse} EnableProcessorResponse + */ + EnableProcessorResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.EnableProcessorResponse) + return object; + return new $root.google.cloud.documentai.v1beta3.EnableProcessorResponse(); + }; + + /** + * Creates a plain object from an EnableProcessorResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @static + * @param {google.cloud.documentai.v1beta3.EnableProcessorResponse} message EnableProcessorResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnableProcessorResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this EnableProcessorResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @instance + * @returns {Object.} JSON object + */ + EnableProcessorResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnableProcessorResponse; + })(); + + v1beta3.EnableProcessorMetadata = (function() { + + /** + * Properties of an EnableProcessorMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @interface IEnableProcessorMetadata + * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] EnableProcessorMetadata commonMetadata + */ + + /** + * Constructs a new EnableProcessorMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents an EnableProcessorMetadata. + * @implements IEnableProcessorMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.IEnableProcessorMetadata=} [properties] Properties to set + */ + function EnableProcessorMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnableProcessorMetadata commonMetadata. + * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @instance + */ + EnableProcessorMetadata.prototype.commonMetadata = null; + + /** + * Creates a new EnableProcessorMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IEnableProcessorMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.EnableProcessorMetadata} EnableProcessorMetadata instance + */ + EnableProcessorMetadata.create = function create(properties) { + return new EnableProcessorMetadata(properties); + }; + + /** + * Encodes the specified EnableProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IEnableProcessorMetadata} message EnableProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnableProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EnableProcessorMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IEnableProcessorMetadata} message EnableProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnableProcessorMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.EnableProcessorMetadata} EnableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.EnableProcessorMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnableProcessorMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.EnableProcessorMetadata} EnableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnableProcessorMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnableProcessorMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates an EnableProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.EnableProcessorMetadata} EnableProcessorMetadata + */ + EnableProcessorMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.EnableProcessorMetadata) + return object; + var message = new $root.google.cloud.documentai.v1beta3.EnableProcessorMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.EnableProcessorMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from an EnableProcessorMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.EnableProcessorMetadata} message EnableProcessorMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnableProcessorMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.commonMetadata = null; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this EnableProcessorMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @instance + * @returns {Object.} JSON object + */ + EnableProcessorMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnableProcessorMetadata; + })(); + + v1beta3.DisableProcessorRequest = (function() { + + /** + * Properties of a DisableProcessorRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IDisableProcessorRequest + * @property {string|null} [name] DisableProcessorRequest name + */ + + /** + * Constructs a new DisableProcessorRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a DisableProcessorRequest. + * @implements IDisableProcessorRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.IDisableProcessorRequest=} [properties] Properties to set + */ + function DisableProcessorRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DisableProcessorRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @instance + */ + DisableProcessorRequest.prototype.name = ""; + + /** + * Creates a new DisableProcessorRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.IDisableProcessorRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DisableProcessorRequest} DisableProcessorRequest instance + */ + DisableProcessorRequest.create = function create(properties) { + return new DisableProcessorRequest(properties); + }; + + /** + * Encodes the specified DisableProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.IDisableProcessorRequest} message DisableProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorRequest.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 DisableProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.IDisableProcessorRequest} message DisableProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DisableProcessorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DisableProcessorRequest} DisableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DisableProcessorRequest(); + 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 DisableProcessorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DisableProcessorRequest} DisableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DisableProcessorRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DisableProcessorRequest.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 DisableProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DisableProcessorRequest} DisableProcessorRequest + */ + DisableProcessorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DisableProcessorRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DisableProcessorRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DisableProcessorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.DisableProcessorRequest} message DisableProcessorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DisableProcessorRequest.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 DisableProcessorRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @instance + * @returns {Object.} JSON object + */ + DisableProcessorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DisableProcessorRequest; + })(); + + v1beta3.DisableProcessorResponse = (function() { + + /** + * Properties of a DisableProcessorResponse. + * @memberof google.cloud.documentai.v1beta3 + * @interface IDisableProcessorResponse + */ + + /** + * Constructs a new DisableProcessorResponse. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a DisableProcessorResponse. + * @implements IDisableProcessorResponse + * @constructor + * @param {google.cloud.documentai.v1beta3.IDisableProcessorResponse=} [properties] Properties to set + */ + function DisableProcessorResponse(properties) { + if (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 DisableProcessorResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @static + * @param {google.cloud.documentai.v1beta3.IDisableProcessorResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DisableProcessorResponse} DisableProcessorResponse instance + */ + DisableProcessorResponse.create = function create(properties) { + return new DisableProcessorResponse(properties); + }; + + /** + * Encodes the specified DisableProcessorResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @static + * @param {google.cloud.documentai.v1beta3.IDisableProcessorResponse} message DisableProcessorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified DisableProcessorResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @static + * @param {google.cloud.documentai.v1beta3.IDisableProcessorResponse} message DisableProcessorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DisableProcessorResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DisableProcessorResponse} DisableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DisableProcessorResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DisableProcessorResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DisableProcessorResponse} DisableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DisableProcessorResponse message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DisableProcessorResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a DisableProcessorResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DisableProcessorResponse} DisableProcessorResponse + */ + DisableProcessorResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DisableProcessorResponse) + return object; + return new $root.google.cloud.documentai.v1beta3.DisableProcessorResponse(); + }; + + /** + * Creates a plain object from a DisableProcessorResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @static + * @param {google.cloud.documentai.v1beta3.DisableProcessorResponse} message DisableProcessorResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DisableProcessorResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this DisableProcessorResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @instance + * @returns {Object.} JSON object + */ + DisableProcessorResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DisableProcessorResponse; + })(); + + v1beta3.DisableProcessorMetadata = (function() { + + /** + * Properties of a DisableProcessorMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @interface IDisableProcessorMetadata + * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] DisableProcessorMetadata commonMetadata + */ + + /** + * Constructs a new DisableProcessorMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a DisableProcessorMetadata. + * @implements IDisableProcessorMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.IDisableProcessorMetadata=} [properties] Properties to set + */ + function DisableProcessorMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DisableProcessorMetadata commonMetadata. + * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @instance + */ + DisableProcessorMetadata.prototype.commonMetadata = null; + + /** + * Creates a new DisableProcessorMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IDisableProcessorMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DisableProcessorMetadata} DisableProcessorMetadata instance + */ + DisableProcessorMetadata.create = function create(properties) { + return new DisableProcessorMetadata(properties); + }; + + /** + * Encodes the specified DisableProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IDisableProcessorMetadata} message DisableProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DisableProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DisableProcessorMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IDisableProcessorMetadata} message DisableProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DisableProcessorMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DisableProcessorMetadata} DisableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DisableProcessorMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DisableProcessorMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DisableProcessorMetadata} DisableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DisableProcessorMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DisableProcessorMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates a DisableProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DisableProcessorMetadata} DisableProcessorMetadata + */ + DisableProcessorMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DisableProcessorMetadata) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DisableProcessorMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.DisableProcessorMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from a DisableProcessorMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1beta3.DisableProcessorMetadata} message DisableProcessorMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DisableProcessorMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.commonMetadata = null; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this DisableProcessorMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @instance + * @returns {Object.} JSON object + */ + DisableProcessorMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DisableProcessorMetadata; + })(); + + v1beta3.SetDefaultProcessorVersionRequest = (function() { + + /** + * Properties of a SetDefaultProcessorVersionRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface ISetDefaultProcessorVersionRequest + * @property {string|null} [processor] SetDefaultProcessorVersionRequest processor + * @property {string|null} [defaultProcessorVersion] SetDefaultProcessorVersionRequest defaultProcessorVersion + */ + + /** + * Constructs a new SetDefaultProcessorVersionRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a SetDefaultProcessorVersionRequest. + * @implements ISetDefaultProcessorVersionRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionRequest=} [properties] Properties to set + */ + function SetDefaultProcessorVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SetDefaultProcessorVersionRequest processor. + * @member {string} processor + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest + * @instance + */ + SetDefaultProcessorVersionRequest.prototype.processor = ""; + + /** + * SetDefaultProcessorVersionRequest defaultProcessorVersion. + * @member {string} defaultProcessorVersion + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest + * @instance + */ + SetDefaultProcessorVersionRequest.prototype.defaultProcessorVersion = ""; + + /** + * Creates a new SetDefaultProcessorVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest} SetDefaultProcessorVersionRequest instance + */ + SetDefaultProcessorVersionRequest.create = function create(properties) { + return new SetDefaultProcessorVersionRequest(properties); + }; + + /** + * Encodes the specified SetDefaultProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionRequest} message SetDefaultProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultProcessorVersionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.processor != null && Object.hasOwnProperty.call(message, "processor")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.processor); + if (message.defaultProcessorVersion != null && Object.hasOwnProperty.call(message, "defaultProcessorVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.defaultProcessorVersion); + return writer; + }; + + /** + * Encodes the specified SetDefaultProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionRequest} message SetDefaultProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultProcessorVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetDefaultProcessorVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest} SetDefaultProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultProcessorVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.processor = reader.string(); + break; + case 2: + message.defaultProcessorVersion = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetDefaultProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest} SetDefaultProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultProcessorVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetDefaultProcessorVersionRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetDefaultProcessorVersionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.processor != null && message.hasOwnProperty("processor")) + if (!$util.isString(message.processor)) + return "processor: string expected"; + if (message.defaultProcessorVersion != null && message.hasOwnProperty("defaultProcessorVersion")) + if (!$util.isString(message.defaultProcessorVersion)) + return "defaultProcessorVersion: string expected"; + return null; + }; + + /** + * Creates a SetDefaultProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest} SetDefaultProcessorVersionRequest + */ + SetDefaultProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest(); + if (object.processor != null) + message.processor = String(object.processor); + if (object.defaultProcessorVersion != null) + message.defaultProcessorVersion = String(object.defaultProcessorVersion); + return message; + }; + + /** + * Creates a plain object from a SetDefaultProcessorVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest} message SetDefaultProcessorVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetDefaultProcessorVersionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.processor = ""; + object.defaultProcessorVersion = ""; + } + if (message.processor != null && message.hasOwnProperty("processor")) + object.processor = message.processor; + if (message.defaultProcessorVersion != null && message.hasOwnProperty("defaultProcessorVersion")) + object.defaultProcessorVersion = message.defaultProcessorVersion; + return object; + }; + + /** + * Converts this SetDefaultProcessorVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest + * @instance + * @returns {Object.} JSON object + */ + SetDefaultProcessorVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SetDefaultProcessorVersionRequest; + })(); + + v1beta3.SetDefaultProcessorVersionResponse = (function() { + + /** + * Properties of a SetDefaultProcessorVersionResponse. + * @memberof google.cloud.documentai.v1beta3 + * @interface ISetDefaultProcessorVersionResponse + */ + + /** + * Constructs a new SetDefaultProcessorVersionResponse. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a SetDefaultProcessorVersionResponse. + * @implements ISetDefaultProcessorVersionResponse + * @constructor + * @param {google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionResponse=} [properties] Properties to set + */ + function SetDefaultProcessorVersionResponse(properties) { + if (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 SetDefaultProcessorVersionResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse} SetDefaultProcessorVersionResponse instance + */ + SetDefaultProcessorVersionResponse.create = function create(properties) { + return new SetDefaultProcessorVersionResponse(properties); + }; + + /** + * Encodes the specified SetDefaultProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionResponse} message SetDefaultProcessorVersionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultProcessorVersionResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified SetDefaultProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionResponse} message SetDefaultProcessorVersionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultProcessorVersionResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetDefaultProcessorVersionResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse} SetDefaultProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultProcessorVersionResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetDefaultProcessorVersionResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse} SetDefaultProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultProcessorVersionResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetDefaultProcessorVersionResponse message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetDefaultProcessorVersionResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a SetDefaultProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse} SetDefaultProcessorVersionResponse + */ + SetDefaultProcessorVersionResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse) + return object; + return new $root.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse(); + }; + + /** + * Creates a plain object from a SetDefaultProcessorVersionResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse} message SetDefaultProcessorVersionResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetDefaultProcessorVersionResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this SetDefaultProcessorVersionResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse + * @instance + * @returns {Object.} JSON object + */ + SetDefaultProcessorVersionResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SetDefaultProcessorVersionResponse; + })(); + + v1beta3.SetDefaultProcessorVersionMetadata = (function() { + + /** + * Properties of a SetDefaultProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @interface ISetDefaultProcessorVersionMetadata + * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] SetDefaultProcessorVersionMetadata commonMetadata + */ + + /** + * Constructs a new SetDefaultProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a SetDefaultProcessorVersionMetadata. + * @implements ISetDefaultProcessorVersionMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionMetadata=} [properties] Properties to set + */ + function SetDefaultProcessorVersionMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SetDefaultProcessorVersionMetadata commonMetadata. + * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata + * @instance + */ + SetDefaultProcessorVersionMetadata.prototype.commonMetadata = null; + + /** + * Creates a new SetDefaultProcessorVersionMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata} SetDefaultProcessorVersionMetadata instance + */ + SetDefaultProcessorVersionMetadata.create = function create(properties) { + return new SetDefaultProcessorVersionMetadata(properties); + }; + + /** + * Encodes the specified SetDefaultProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionMetadata} message SetDefaultProcessorVersionMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultProcessorVersionMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SetDefaultProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionMetadata} message SetDefaultProcessorVersionMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultProcessorVersionMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetDefaultProcessorVersionMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata} SetDefaultProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultProcessorVersionMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetDefaultProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata} SetDefaultProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultProcessorVersionMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetDefaultProcessorVersionMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetDefaultProcessorVersionMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates a SetDefaultProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata} SetDefaultProcessorVersionMetadata + */ + SetDefaultProcessorVersionMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata) + return object; + var message = new $root.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from a SetDefaultProcessorVersionMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata} message SetDefaultProcessorVersionMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetDefaultProcessorVersionMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.commonMetadata = null; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this SetDefaultProcessorVersionMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata + * @instance + * @returns {Object.} JSON object + */ + SetDefaultProcessorVersionMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SetDefaultProcessorVersionMetadata; + })(); + + v1beta3.ReviewDocumentRequest = (function() { + + /** + * Properties of a ReviewDocumentRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IReviewDocumentRequest + * @property {google.cloud.documentai.v1beta3.IDocument|null} [inlineDocument] ReviewDocumentRequest inlineDocument + * @property {string|null} [humanReviewConfig] ReviewDocumentRequest humanReviewConfig + * @property {google.cloud.documentai.v1beta3.IDocument|null} [document] ReviewDocumentRequest document + * @property {boolean|null} [enableSchemaValidation] ReviewDocumentRequest enableSchemaValidation + * @property {google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority|null} [priority] ReviewDocumentRequest priority + * @property {google.cloud.documentai.v1beta3.IDocumentSchema|null} [documentSchema] ReviewDocumentRequest documentSchema + */ + + /** + * Constructs a new ReviewDocumentRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ReviewDocumentRequest. + * @implements IReviewDocumentRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest=} [properties] Properties to set + */ + function ReviewDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReviewDocumentRequest inlineDocument. + * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} inlineDocument + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.inlineDocument = null; + + /** + * ReviewDocumentRequest humanReviewConfig. + * @member {string} humanReviewConfig + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.humanReviewConfig = ""; + + /** + * ReviewDocumentRequest document. + * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} document + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.document = null; + + /** + * ReviewDocumentRequest enableSchemaValidation. + * @member {boolean} enableSchemaValidation + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.enableSchemaValidation = false; + + /** + * ReviewDocumentRequest priority. + * @member {google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority} priority + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.priority = 0; + + /** + * ReviewDocumentRequest documentSchema. + * @member {google.cloud.documentai.v1beta3.IDocumentSchema|null|undefined} documentSchema + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.documentSchema = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ReviewDocumentRequest source. + * @member {"inlineDocument"|undefined} source + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + Object.defineProperty(ReviewDocumentRequest.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["inlineDocument"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ReviewDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest instance + */ + ReviewDocumentRequest.create = function create(properties) { + return new ReviewDocumentRequest(properties); + }; + + /** + * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.humanReviewConfig != null && Object.hasOwnProperty.call(message, "humanReviewConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.humanReviewConfig); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.cloud.documentai.v1beta3.Document.encode(message.document, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.enableSchemaValidation != null && Object.hasOwnProperty.call(message, "enableSchemaValidation")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableSchemaValidation); + if (message.inlineDocument != null && Object.hasOwnProperty.call(message, "inlineDocument")) + $root.google.cloud.documentai.v1beta3.Document.encode(message.inlineDocument, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.priority != null && Object.hasOwnProperty.call(message, "priority")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.priority); + if (message.documentSchema != null && Object.hasOwnProperty.call(message, "documentSchema")) + $root.google.cloud.documentai.v1beta3.DocumentSchema.encode(message.documentSchema, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + message.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); + break; + case 1: + message.humanReviewConfig = reader.string(); + break; + case 2: + message.document = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); + break; + case 3: + message.enableSchemaValidation = reader.bool(); + break; + case 5: + message.priority = reader.int32(); + break; + case 6: + message.documentSchema = $root.google.cloud.documentai.v1beta3.DocumentSchema.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReviewDocumentRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReviewDocumentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { + properties.source = 1; + { + var error = $root.google.cloud.documentai.v1beta3.Document.verify(message.inlineDocument); + if (error) + return "inlineDocument." + error; + } + } + if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) + if (!$util.isString(message.humanReviewConfig)) + return "humanReviewConfig: string expected"; + if (message.document != null && message.hasOwnProperty("document")) { + var error = $root.google.cloud.documentai.v1beta3.Document.verify(message.document); + if (error) + return "document." + error; + } + if (message.enableSchemaValidation != null && message.hasOwnProperty("enableSchemaValidation")) + if (typeof message.enableSchemaValidation !== "boolean") + return "enableSchemaValidation: boolean expected"; + if (message.priority != null && message.hasOwnProperty("priority")) + switch (message.priority) { + default: + return "priority: enum value expected"; + case 0: + case 1: + break; + } + if (message.documentSchema != null && message.hasOwnProperty("documentSchema")) { + var error = $root.google.cloud.documentai.v1beta3.DocumentSchema.verify(message.documentSchema); + if (error) + return "documentSchema." + error; + } + return null; + }; + + /** + * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + */ + ReviewDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest(); + if (object.inlineDocument != null) { + if (typeof object.inlineDocument !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentRequest.inlineDocument: object expected"); + message.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.fromObject(object.inlineDocument); + } + if (object.humanReviewConfig != null) + message.humanReviewConfig = String(object.humanReviewConfig); + if (object.document != null) { + if (typeof object.document !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentRequest.document: object expected"); + message.document = $root.google.cloud.documentai.v1beta3.Document.fromObject(object.document); + } + if (object.enableSchemaValidation != null) + message.enableSchemaValidation = Boolean(object.enableSchemaValidation); + switch (object.priority) { + case "DEFAULT": + case 0: + message.priority = 0; + break; + case "URGENT": + case 1: + message.priority = 1; + break; + } + if (object.documentSchema != null) { + if (typeof object.documentSchema !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentRequest.documentSchema: object expected"); + message.documentSchema = $root.google.cloud.documentai.v1beta3.DocumentSchema.fromObject(object.documentSchema); + } + return message; + }; + + /** + * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta3.ReviewDocumentRequest} message ReviewDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReviewDocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.humanReviewConfig = ""; + object.document = null; + object.enableSchemaValidation = false; + object.priority = options.enums === String ? "DEFAULT" : 0; + object.documentSchema = null; + } + if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) + object.humanReviewConfig = message.humanReviewConfig; + if (message.document != null && message.hasOwnProperty("document")) + object.document = $root.google.cloud.documentai.v1beta3.Document.toObject(message.document, options); + if (message.enableSchemaValidation != null && message.hasOwnProperty("enableSchemaValidation")) + object.enableSchemaValidation = message.enableSchemaValidation; + if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { + object.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.toObject(message.inlineDocument, options); + if (options.oneofs) + object.source = "inlineDocument"; + } + if (message.priority != null && message.hasOwnProperty("priority")) + object.priority = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority[message.priority] : message.priority; + if (message.documentSchema != null && message.hasOwnProperty("documentSchema")) + object.documentSchema = $root.google.cloud.documentai.v1beta3.DocumentSchema.toObject(message.documentSchema, options); + return object; + }; + + /** + * Converts this ReviewDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Priority enum. + * @name google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority + * @enum {number} + * @property {number} DEFAULT=0 DEFAULT value + * @property {number} URGENT=1 URGENT value + */ + ReviewDocumentRequest.Priority = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT"] = 0; + values[valuesById[1] = "URGENT"] = 1; + return values; + })(); + + return ReviewDocumentRequest; + })(); + + v1beta3.ReviewDocumentResponse = (function() { + + /** + * Properties of a ReviewDocumentResponse. + * @memberof google.cloud.documentai.v1beta3 + * @interface IReviewDocumentResponse + * @property {string|null} [gcsDestination] ReviewDocumentResponse gcsDestination + * @property {google.cloud.documentai.v1beta3.ReviewDocumentResponse.State|null} [state] ReviewDocumentResponse state + * @property {string|null} [rejectionReason] ReviewDocumentResponse rejectionReason + */ + + /** + * Constructs a new ReviewDocumentResponse. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ReviewDocumentResponse. + * @implements IReviewDocumentResponse + * @constructor + * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse=} [properties] Properties to set + */ + function ReviewDocumentResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReviewDocumentResponse gcsDestination. + * @member {string} gcsDestination + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @instance + */ + ReviewDocumentResponse.prototype.gcsDestination = ""; + + /** + * ReviewDocumentResponse state. + * @member {google.cloud.documentai.v1beta3.ReviewDocumentResponse.State} state + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @instance + */ + ReviewDocumentResponse.prototype.state = 0; + + /** + * ReviewDocumentResponse rejectionReason. + * @member {string} rejectionReason + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @instance + */ + ReviewDocumentResponse.prototype.rejectionReason = ""; + + /** + * Creates a new ReviewDocumentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse instance + */ + ReviewDocumentResponse.create = function create(properties) { + return new ReviewDocumentResponse(properties); + }; + + /** + * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsDestination); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.state); + if (message.rejectionReason != null && Object.hasOwnProperty.call(message, "rejectionReason")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.rejectionReason); + return writer; + }; + + /** + * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsDestination = reader.string(); + break; + case 2: + message.state = reader.int32(); + break; + case 3: + message.rejectionReason = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReviewDocumentResponse message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReviewDocumentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + if (!$util.isString(message.gcsDestination)) + return "gcsDestination: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.rejectionReason != null && message.hasOwnProperty("rejectionReason")) + if (!$util.isString(message.rejectionReason)) + return "rejectionReason: string expected"; + return null; + }; + + /** + * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + */ + ReviewDocumentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse(); + if (object.gcsDestination != null) + message.gcsDestination = String(object.gcsDestination); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "REJECTED": + case 1: + message.state = 1; + break; + case "SUCCEEDED": + case 2: + message.state = 2; + break; + } + if (object.rejectionReason != null) + message.rejectionReason = String(object.rejectionReason); + return message; + }; + + /** + * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta3.ReviewDocumentResponse} message ReviewDocumentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReviewDocumentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.gcsDestination = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.rejectionReason = ""; + } + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + object.gcsDestination = message.gcsDestination; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse.State[message.state] : message.state; + if (message.rejectionReason != null && message.hasOwnProperty("rejectionReason")) + object.rejectionReason = message.rejectionReason; + return object; + }; + + /** + * Converts this ReviewDocumentResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.documentai.v1beta3.ReviewDocumentResponse.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} REJECTED=1 REJECTED value + * @property {number} SUCCEEDED=2 SUCCEEDED value + */ + ReviewDocumentResponse.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "REJECTED"] = 1; + values[valuesById[2] = "SUCCEEDED"] = 2; + return values; + })(); + + return ReviewDocumentResponse; + })(); + + v1beta3.ReviewDocumentOperationMetadata = (function() { + + /** + * Properties of a ReviewDocumentOperationMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @interface IReviewDocumentOperationMetadata + * @property {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|null} [state] ReviewDocumentOperationMetadata state + * @property {string|null} [stateMessage] ReviewDocumentOperationMetadata stateMessage + * @property {google.protobuf.ITimestamp|null} [createTime] ReviewDocumentOperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ReviewDocumentOperationMetadata updateTime + * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] ReviewDocumentOperationMetadata commonMetadata + * @property {string|null} [questionId] ReviewDocumentOperationMetadata questionId + */ + + /** + * Constructs a new ReviewDocumentOperationMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ReviewDocumentOperationMetadata. + * @implements IReviewDocumentOperationMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata=} [properties] Properties to set + */ + function ReviewDocumentOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReviewDocumentOperationMetadata state. + * @member {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State} state + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.state = 0; + + /** + * ReviewDocumentOperationMetadata stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.stateMessage = ""; + + /** + * ReviewDocumentOperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.createTime = null; + + /** + * ReviewDocumentOperationMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.updateTime = null; + + /** + * ReviewDocumentOperationMetadata commonMetadata. + * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.commonMetadata = null; + + /** + * ReviewDocumentOperationMetadata questionId. + * @member {string} questionId + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.questionId = ""; + + /** + * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata instance + */ + ReviewDocumentOperationMetadata.create = function create(properties) { + return new ReviewDocumentOperationMetadata(properties); + }; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.questionId != null && Object.hasOwnProperty.call(message, "questionId")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.questionId); + return writer; + }; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.int32(); + break; + case 2: + message.stateMessage = reader.string(); + break; + case 3: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + case 6: + message.questionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReviewDocumentOperationMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReviewDocumentOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + if (!$util.isString(message.stateMessage)) + return "stateMessage: string 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.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + if (message.questionId != null && message.hasOwnProperty("questionId")) + if (!$util.isString(message.questionId)) + return "questionId: string expected"; + return null; + }; + + /** + * Creates a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + */ + ReviewDocumentOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "RUNNING": + case 1: + message.state = 1; + break; + case "CANCELLING": + case 2: + message.state = 2; + break; + case "SUCCEEDED": + case 3: + message.state = 3; + break; + case "FAILED": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + } + if (object.stateMessage != null) + message.stateMessage = String(object.stateMessage); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.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.documentai.v1beta3.ReviewDocumentOperationMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); + } + if (object.questionId != null) + message.questionId = String(object.questionId); + return message; + }; + + /** + * Creates a plain object from a ReviewDocumentOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReviewDocumentOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.stateMessage = ""; + object.createTime = null; + object.updateTime = null; + object.commonMetadata = null; + object.questionId = ""; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State[message.state] : message.state; + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + object.stateMessage = message.stateMessage; + 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.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); + if (message.questionId != null && message.hasOwnProperty("questionId")) + object.questionId = message.questionId; + return object; + }; + + /** + * Converts this ReviewDocumentOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} CANCELLING=2 CANCELLING value + * @property {number} SUCCEEDED=3 SUCCEEDED value + * @property {number} FAILED=4 FAILED value + * @property {number} CANCELLED=5 CANCELLED value + */ + ReviewDocumentOperationMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "CANCELLING"] = 2; + values[valuesById[3] = "SUCCEEDED"] = 3; + values[valuesById[4] = "FAILED"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return ReviewDocumentOperationMetadata; + })(); + + v1beta3.DocumentSchema = (function() { + + /** + * Properties of a DocumentSchema. + * @memberof google.cloud.documentai.v1beta3 + * @interface IDocumentSchema + * @property {string|null} [displayName] DocumentSchema displayName + * @property {string|null} [description] DocumentSchema description + * @property {Array.|null} [entityTypes] DocumentSchema entityTypes + * @property {google.cloud.documentai.v1beta3.DocumentSchema.IMetadata|null} [metadata] DocumentSchema metadata + */ + + /** + * Constructs a new DocumentSchema. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a DocumentSchema. + * @implements IDocumentSchema + * @constructor + * @param {google.cloud.documentai.v1beta3.IDocumentSchema=} [properties] Properties to set + */ + function DocumentSchema(properties) { + this.entityTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentSchema displayName. + * @member {string} displayName + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @instance + */ + DocumentSchema.prototype.displayName = ""; + + /** + * DocumentSchema description. + * @member {string} description + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @instance + */ + DocumentSchema.prototype.description = ""; + + /** + * DocumentSchema entityTypes. + * @member {Array.} entityTypes + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @instance + */ + DocumentSchema.prototype.entityTypes = $util.emptyArray; + + /** + * DocumentSchema metadata. + * @member {google.cloud.documentai.v1beta3.DocumentSchema.IMetadata|null|undefined} metadata + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @instance + */ + DocumentSchema.prototype.metadata = null; + + /** + * Creates a new DocumentSchema instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @static + * @param {google.cloud.documentai.v1beta3.IDocumentSchema=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DocumentSchema} DocumentSchema instance + */ + DocumentSchema.create = function create(properties) { + return new DocumentSchema(properties); + }; + + /** + * Encodes the specified DocumentSchema message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @static + * @param {google.cloud.documentai.v1beta3.IDocumentSchema} message DocumentSchema message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentSchema.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.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.entityTypes != null && message.entityTypes.length) + for (var i = 0; i < message.entityTypes.length; ++i) + $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.encode(message.entityTypes[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata.encode(message.metadata, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DocumentSchema message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @static + * @param {google.cloud.documentai.v1beta3.IDocumentSchema} message DocumentSchema message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentSchema.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DocumentSchema message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DocumentSchema} DocumentSchema + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentSchema.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DocumentSchema(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.displayName = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + if (!(message.entityTypes && message.entityTypes.length)) + message.entityTypes = []; + message.entityTypes.push($root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.decode(reader, reader.uint32())); + break; + case 4: + message.metadata = $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentSchema message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DocumentSchema} DocumentSchema + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentSchema.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentSchema message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentSchema.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.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.entityTypes != null && message.hasOwnProperty("entityTypes")) { + if (!Array.isArray(message.entityTypes)) + return "entityTypes: array expected"; + for (var i = 0; i < message.entityTypes.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.verify(message.entityTypes[i]); + if (error) + return "entityTypes." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; + + /** + * Creates a DocumentSchema message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DocumentSchema} DocumentSchema + */ + DocumentSchema.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DocumentSchema) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DocumentSchema(); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.description != null) + message.description = String(object.description); + if (object.entityTypes) { + if (!Array.isArray(object.entityTypes)) + throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.entityTypes: array expected"); + message.entityTypes = []; + for (var i = 0; i < object.entityTypes.length; ++i) { + if (typeof object.entityTypes[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.entityTypes: object expected"); + message.entityTypes[i] = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.fromObject(object.entityTypes[i]); + } + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.metadata: object expected"); + message.metadata = $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata.fromObject(object.metadata); + } + return message; + }; + + /** + * Creates a plain object from a DocumentSchema message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema} message DocumentSchema + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentSchema.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entityTypes = []; + if (options.defaults) { + object.displayName = ""; + object.description = ""; + object.metadata = null; + } + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.entityTypes && message.entityTypes.length) { + object.entityTypes = []; + for (var j = 0; j < message.entityTypes.length; ++j) + object.entityTypes[j] = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.toObject(message.entityTypes[j], options); + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata.toObject(message.metadata, options); + return object; + }; + + /** + * Converts this DocumentSchema to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @instance + * @returns {Object.} JSON object + */ + DocumentSchema.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + DocumentSchema.EntityType = (function() { + + /** + * Properties of an EntityType. + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @interface IEntityType + * @property {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues|null} [enumValues] EntityType enumValues + * @property {string|null} [displayName] EntityType displayName + * @property {string|null} [name] EntityType name + * @property {Array.|null} [baseTypes] EntityType baseTypes + * @property {Array.|null} [properties] EntityType properties + */ + + /** + * Constructs a new EntityType. + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @classdesc Represents an EntityType. + * @implements IEntityType + * @constructor + * @param {google.cloud.documentai.v1beta3.DocumentSchema.IEntityType=} [properties] Properties to set + */ + function EntityType(properties) { + this.baseTypes = []; + this.properties = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EntityType enumValues. + * @member {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues|null|undefined} enumValues + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @instance + */ + EntityType.prototype.enumValues = null; + + /** + * EntityType displayName. + * @member {string} displayName + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @instance + */ + EntityType.prototype.displayName = ""; + + /** + * EntityType name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @instance + */ + EntityType.prototype.name = ""; + + /** + * EntityType baseTypes. + * @member {Array.} baseTypes + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @instance + */ + EntityType.prototype.baseTypes = $util.emptyArray; + + /** + * EntityType properties. + * @member {Array.} properties + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @instance + */ + EntityType.prototype.properties = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * EntityType valueSource. + * @member {"enumValues"|undefined} valueSource + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @instance + */ + Object.defineProperty(EntityType.prototype, "valueSource", { + get: $util.oneOfGetter($oneOfFields = ["enumValues"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new EntityType instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.IEntityType=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType} EntityType instance + */ + EntityType.create = function create(properties) { + return new EntityType(properties); + }; + + /** + * Encodes the specified EntityType message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.IEntityType} message EntityType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityType.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.baseTypes != null && message.baseTypes.length) + for (var i = 0; i < message.baseTypes.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.baseTypes[i]); + if (message.properties != null && message.properties.length) + for (var i = 0; i < message.properties.length; ++i) + $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.encode(message.properties[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.displayName); + if (message.enumValues != null && Object.hasOwnProperty.call(message, "enumValues")) + $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.encode(message.enumValues, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EntityType message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.IEntityType} message EntityType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityType.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EntityType message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType} EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityType.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 14: + message.enumValues = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.decode(reader, reader.uint32()); + break; + case 13: + message.displayName = reader.string(); + break; + case 1: + message.name = reader.string(); + break; + case 2: + if (!(message.baseTypes && message.baseTypes.length)) + message.baseTypes = []; + message.baseTypes.push(reader.string()); + break; + case 6: + if (!(message.properties && message.properties.length)) + message.properties = []; + message.properties.push($root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EntityType message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType} EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityType.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EntityType message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EntityType.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.enumValues != null && message.hasOwnProperty("enumValues")) { + properties.valueSource = 1; + { + var error = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.verify(message.enumValues); + if (error) + return "enumValues." + error; + } + } + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.baseTypes != null && message.hasOwnProperty("baseTypes")) { + if (!Array.isArray(message.baseTypes)) + return "baseTypes: array expected"; + for (var i = 0; i < message.baseTypes.length; ++i) + if (!$util.isString(message.baseTypes[i])) + return "baseTypes: string[] expected"; + } + if (message.properties != null && message.hasOwnProperty("properties")) { + if (!Array.isArray(message.properties)) + return "properties: array expected"; + for (var i = 0; i < message.properties.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.verify(message.properties[i]); + if (error) + return "properties." + error; + } + } + return null; + }; + + /** + * Creates an EntityType message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType} EntityType + */ + EntityType.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType(); + if (object.enumValues != null) { + if (typeof object.enumValues !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.EntityType.enumValues: object expected"); + message.enumValues = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.fromObject(object.enumValues); + } + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.name != null) + message.name = String(object.name); + if (object.baseTypes) { + if (!Array.isArray(object.baseTypes)) + throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.EntityType.baseTypes: array expected"); + message.baseTypes = []; + for (var i = 0; i < object.baseTypes.length; ++i) + message.baseTypes[i] = String(object.baseTypes[i]); + } + if (object.properties) { + if (!Array.isArray(object.properties)) + throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.EntityType.properties: array expected"); + message.properties = []; + for (var i = 0; i < object.properties.length; ++i) { + if (typeof object.properties[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.EntityType.properties: object expected"); + message.properties[i] = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.fromObject(object.properties[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EntityType message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType} message EntityType + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EntityType.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.baseTypes = []; + object.properties = []; + } + if (options.defaults) { + object.name = ""; + object.displayName = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.baseTypes && message.baseTypes.length) { + object.baseTypes = []; + for (var j = 0; j < message.baseTypes.length; ++j) + object.baseTypes[j] = message.baseTypes[j]; + } + if (message.properties && message.properties.length) { + object.properties = []; + for (var j = 0; j < message.properties.length; ++j) + object.properties[j] = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.toObject(message.properties[j], options); + } + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.enumValues != null && message.hasOwnProperty("enumValues")) { + object.enumValues = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.toObject(message.enumValues, options); + if (options.oneofs) + object.valueSource = "enumValues"; + } + return object; + }; + + /** + * Converts this EntityType to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @instance + * @returns {Object.} JSON object + */ + EntityType.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + EntityType.EnumValues = (function() { + + /** + * Properties of an EnumValues. + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @interface IEnumValues + * @property {Array.|null} [values] EnumValues values + */ + + /** + * Constructs a new EnumValues. + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @classdesc Represents an EnumValues. + * @implements IEnumValues + * @constructor + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues=} [properties] Properties to set + */ + function EnumValues(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]]; + } + + /** + * EnumValues values. + * @member {Array.} values + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @instance + */ + EnumValues.prototype.values = $util.emptyArray; + + /** + * Creates a new EnumValues instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues} EnumValues instance + */ + EnumValues.create = function create(properties) { + return new EnumValues(properties); + }; + + /** + * Encodes the specified EnumValues message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues} message EnumValues message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValues.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) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.values[i]); + return writer; + }; + + /** + * Encodes the specified EnumValues message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues} message EnumValues message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValues.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValues message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues} EnumValues + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValues.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.values && message.values.length)) + message.values = []; + message.values.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValues message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues} EnumValues + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValues.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValues message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValues.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) + if (!$util.isString(message.values[i])) + return "values: string[] expected"; + } + return null; + }; + + /** + * Creates an EnumValues message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues} EnumValues + */ + EnumValues.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues(); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) + message.values[i] = String(object.values[i]); + } + return message; + }; + + /** + * Creates a plain object from an EnumValues message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues} message EnumValues + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValues.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] = message.values[j]; + } + return object; + }; + + /** + * Converts this EnumValues to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @instance + * @returns {Object.} JSON object + */ + EnumValues.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumValues; + })(); + + EntityType.Property = (function() { + + /** + * Properties of a Property. + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @interface IProperty + * @property {string|null} [name] Property name + * @property {string|null} [valueType] Property valueType + * @property {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType|null} [occurrenceType] Property occurrenceType + */ + + /** + * Constructs a new Property. + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @classdesc Represents a Property. + * @implements IProperty + * @constructor + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty=} [properties] Properties to set + */ + function Property(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Property name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @instance + */ + Property.prototype.name = ""; + + /** + * Property valueType. + * @member {string} valueType + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @instance + */ + Property.prototype.valueType = ""; + + /** + * Property occurrenceType. + * @member {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType} occurrenceType + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @instance + */ + Property.prototype.occurrenceType = 0; + + /** + * Creates a new Property instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property} Property instance + */ + Property.create = function create(properties) { + return new Property(properties); + }; + + /** + * Encodes the specified Property message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty} message Property message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Property.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.valueType != null && Object.hasOwnProperty.call(message, "valueType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.valueType); + if (message.occurrenceType != null && Object.hasOwnProperty.call(message, "occurrenceType")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.occurrenceType); + return writer; + }; + + /** + * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty} message Property message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Property.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Property message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property} Property + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Property.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.valueType = reader.string(); + break; + case 3: + message.occurrenceType = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Property message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property} Property + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Property.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Property message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Property.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.valueType != null && message.hasOwnProperty("valueType")) + if (!$util.isString(message.valueType)) + return "valueType: string expected"; + if (message.occurrenceType != null && message.hasOwnProperty("occurrenceType")) + switch (message.occurrenceType) { + default: + return "occurrenceType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a Property message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property} Property + */ + Property.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property(); + if (object.name != null) + message.name = String(object.name); + if (object.valueType != null) + message.valueType = String(object.valueType); + switch (object.occurrenceType) { + case "OCCURRENCE_TYPE_UNSPECIFIED": + case 0: + message.occurrenceType = 0; + break; + case "OPTIONAL_ONCE": + case 1: + message.occurrenceType = 1; + break; + case "OPTIONAL_MULTIPLE": + case 2: + message.occurrenceType = 2; + break; + case "REQUIRED_ONCE": + case 3: + message.occurrenceType = 3; + break; + case "REQUIRED_MULTIPLE": + case 4: + message.occurrenceType = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a Property message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property} message Property + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Property.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.valueType = ""; + object.occurrenceType = options.enums === String ? "OCCURRENCE_TYPE_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.valueType != null && message.hasOwnProperty("valueType")) + object.valueType = message.valueType; + if (message.occurrenceType != null && message.hasOwnProperty("occurrenceType")) + object.occurrenceType = options.enums === String ? $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType[message.occurrenceType] : message.occurrenceType; + return object; + }; + + /** + * Converts this Property to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @instance + * @returns {Object.} JSON object + */ + Property.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * OccurrenceType enum. + * @name google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType + * @enum {number} + * @property {number} OCCURRENCE_TYPE_UNSPECIFIED=0 OCCURRENCE_TYPE_UNSPECIFIED value + * @property {number} OPTIONAL_ONCE=1 OPTIONAL_ONCE value + * @property {number} OPTIONAL_MULTIPLE=2 OPTIONAL_MULTIPLE value + * @property {number} REQUIRED_ONCE=3 REQUIRED_ONCE value + * @property {number} REQUIRED_MULTIPLE=4 REQUIRED_MULTIPLE value + */ + Property.OccurrenceType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "OCCURRENCE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "OPTIONAL_ONCE"] = 1; + values[valuesById[2] = "OPTIONAL_MULTIPLE"] = 2; + values[valuesById[3] = "REQUIRED_ONCE"] = 3; + values[valuesById[4] = "REQUIRED_MULTIPLE"] = 4; + return values; + })(); + + return Property; + })(); + + return EntityType; + })(); + + DocumentSchema.Metadata = (function() { + + /** + * Properties of a Metadata. + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @interface IMetadata + * @property {boolean|null} [documentSplitter] Metadata documentSplitter + * @property {boolean|null} [documentAllowMultipleLabels] Metadata documentAllowMultipleLabels + * @property {boolean|null} [prefixedNamingOnProperties] Metadata prefixedNamingOnProperties + * @property {boolean|null} [skipNamingValidation] Metadata skipNamingValidation + */ + + /** + * Constructs a new Metadata. + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @classdesc Represents a Metadata. + * @implements IMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.DocumentSchema.IMetadata=} [properties] Properties to set + */ + function Metadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Metadata documentSplitter. + * @member {boolean} documentSplitter + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @instance + */ + Metadata.prototype.documentSplitter = false; + + /** + * Metadata documentAllowMultipleLabels. + * @member {boolean} documentAllowMultipleLabels + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @instance + */ + Metadata.prototype.documentAllowMultipleLabels = false; + + /** + * Metadata prefixedNamingOnProperties. + * @member {boolean} prefixedNamingOnProperties + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @instance + */ + Metadata.prototype.prefixedNamingOnProperties = false; + + /** + * Metadata skipNamingValidation. + * @member {boolean} skipNamingValidation + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @instance + */ + Metadata.prototype.skipNamingValidation = false; + + /** + * Creates a new Metadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.IMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.Metadata} Metadata instance + */ + Metadata.create = function create(properties) { + return new Metadata(properties); + }; + + /** + * Encodes the specified Metadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.Metadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.IMetadata} message Metadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.documentSplitter != null && Object.hasOwnProperty.call(message, "documentSplitter")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.documentSplitter); + if (message.documentAllowMultipleLabels != null && Object.hasOwnProperty.call(message, "documentAllowMultipleLabels")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.documentAllowMultipleLabels); + if (message.prefixedNamingOnProperties != null && Object.hasOwnProperty.call(message, "prefixedNamingOnProperties")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.prefixedNamingOnProperties); + if (message.skipNamingValidation != null && Object.hasOwnProperty.call(message, "skipNamingValidation")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.skipNamingValidation); + return writer; + }; + + /** + * Encodes the specified Metadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.Metadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.IMetadata} message Metadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Metadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.Metadata} Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.documentSplitter = reader.bool(); + break; + case 2: + message.documentAllowMultipleLabels = reader.bool(); + break; + case 6: + message.prefixedNamingOnProperties = reader.bool(); + break; + case 7: + message.skipNamingValidation = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Metadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.Metadata} Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Metadata message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Metadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.documentSplitter != null && message.hasOwnProperty("documentSplitter")) + if (typeof message.documentSplitter !== "boolean") + return "documentSplitter: boolean expected"; + if (message.documentAllowMultipleLabels != null && message.hasOwnProperty("documentAllowMultipleLabels")) + if (typeof message.documentAllowMultipleLabels !== "boolean") + return "documentAllowMultipleLabels: boolean expected"; + if (message.prefixedNamingOnProperties != null && message.hasOwnProperty("prefixedNamingOnProperties")) + if (typeof message.prefixedNamingOnProperties !== "boolean") + return "prefixedNamingOnProperties: boolean expected"; + if (message.skipNamingValidation != null && message.hasOwnProperty("skipNamingValidation")) + if (typeof message.skipNamingValidation !== "boolean") + return "skipNamingValidation: boolean expected"; + return null; + }; + + /** + * Creates a Metadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.Metadata} Metadata + */ + Metadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata(); + if (object.documentSplitter != null) + message.documentSplitter = Boolean(object.documentSplitter); + if (object.documentAllowMultipleLabels != null) + message.documentAllowMultipleLabels = Boolean(object.documentAllowMultipleLabels); + if (object.prefixedNamingOnProperties != null) + message.prefixedNamingOnProperties = Boolean(object.prefixedNamingOnProperties); + if (object.skipNamingValidation != null) + message.skipNamingValidation = Boolean(object.skipNamingValidation); + return message; + }; + + /** + * Creates a plain object from a Metadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.Metadata} message Metadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Metadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.documentSplitter = false; + object.documentAllowMultipleLabels = false; + object.prefixedNamingOnProperties = false; + object.skipNamingValidation = false; + } + if (message.documentSplitter != null && message.hasOwnProperty("documentSplitter")) + object.documentSplitter = message.documentSplitter; + if (message.documentAllowMultipleLabels != null && message.hasOwnProperty("documentAllowMultipleLabels")) + object.documentAllowMultipleLabels = message.documentAllowMultipleLabels; + if (message.prefixedNamingOnProperties != null && message.hasOwnProperty("prefixedNamingOnProperties")) + object.prefixedNamingOnProperties = message.prefixedNamingOnProperties; + if (message.skipNamingValidation != null && message.hasOwnProperty("skipNamingValidation")) + object.skipNamingValidation = message.skipNamingValidation; + return object; + }; + + /** + * Converts this Metadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @instance + * @returns {Object.} JSON object + */ + Metadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Metadata; + })(); + + return DocumentSchema; + })(); + + v1beta3.CommonOperationMetadata = (function() { + + /** + * Properties of a CommonOperationMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @interface ICommonOperationMetadata + * @property {google.cloud.documentai.v1beta3.CommonOperationMetadata.State|null} [state] CommonOperationMetadata state + * @property {string|null} [stateMessage] CommonOperationMetadata stateMessage + * @property {string|null} [resource] CommonOperationMetadata resource + * @property {google.protobuf.ITimestamp|null} [createTime] CommonOperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] CommonOperationMetadata updateTime + */ + + /** + * Constructs a new CommonOperationMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a CommonOperationMetadata. + * @implements ICommonOperationMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.ICommonOperationMetadata=} [properties] Properties to set + */ + function CommonOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CommonOperationMetadata state. + * @member {google.cloud.documentai.v1beta3.CommonOperationMetadata.State} state + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.state = 0; + + /** + * CommonOperationMetadata stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.stateMessage = ""; + + /** + * CommonOperationMetadata resource. + * @member {string} resource + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.resource = ""; + + /** + * CommonOperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.createTime = null; + + /** + * CommonOperationMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.updateTime = null; + + /** + * Creates a new CommonOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.ICommonOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.CommonOperationMetadata} CommonOperationMetadata instance + */ + CommonOperationMetadata.create = function create(properties) { + return new CommonOperationMetadata(properties); + }; + + /** + * Encodes the specified CommonOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.CommonOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.ICommonOperationMetadata} message CommonOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommonOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.resource != null && Object.hasOwnProperty.call(message, "resource")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.resource); + return writer; + }; + + /** + * Encodes the specified CommonOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.CommonOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.ICommonOperationMetadata} message CommonOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommonOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CommonOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.CommonOperationMetadata} CommonOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommonOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.CommonOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.int32(); + break; + case 2: + message.stateMessage = reader.string(); + break; + case 5: + message.resource = reader.string(); + break; + case 3: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CommonOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.CommonOperationMetadata} CommonOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommonOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CommonOperationMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CommonOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + if (!$util.isString(message.stateMessage)) + return "stateMessage: string expected"; + if (message.resource != null && message.hasOwnProperty("resource")) + if (!$util.isString(message.resource)) + return "resource: string 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 a CommonOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.CommonOperationMetadata} CommonOperationMetadata + */ + CommonOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.CommonOperationMetadata) + return object; + var message = new $root.google.cloud.documentai.v1beta3.CommonOperationMetadata(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "RUNNING": + case 1: + message.state = 1; + break; + case "CANCELLING": + case 2: + message.state = 2; + break; + case "SUCCEEDED": + case 3: + message.state = 3; + break; + case "FAILED": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + } + if (object.stateMessage != null) + message.stateMessage = String(object.stateMessage); + if (object.resource != null) + message.resource = String(object.resource); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.CommonOperationMetadata.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.documentai.v1beta3.CommonOperationMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + return message; + }; + + /** + * Creates a plain object from a CommonOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.CommonOperationMetadata} message CommonOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CommonOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.stateMessage = ""; + object.createTime = null; + object.updateTime = null; + object.resource = ""; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.State[message.state] : message.state; + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + object.stateMessage = message.stateMessage; + 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.resource != null && message.hasOwnProperty("resource")) + object.resource = message.resource; + return object; + }; + + /** + * Converts this CommonOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + CommonOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.documentai.v1beta3.CommonOperationMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} CANCELLING=2 CANCELLING value + * @property {number} SUCCEEDED=3 SUCCEEDED value + * @property {number} FAILED=4 FAILED value + * @property {number} CANCELLED=5 CANCELLED value + */ + CommonOperationMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "CANCELLING"] = 2; + values[valuesById[3] = "SUCCEEDED"] = 3; + values[valuesById[4] = "FAILED"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return CommonOperationMetadata; + })(); + + v1beta3.ProcessorVersion = (function() { + + /** + * Properties of a ProcessorVersion. + * @memberof google.cloud.documentai.v1beta3 + * @interface IProcessorVersion + * @property {string|null} [name] ProcessorVersion name + * @property {string|null} [displayName] ProcessorVersion displayName + * @property {google.cloud.documentai.v1beta3.ProcessorVersion.State|null} [state] ProcessorVersion state + * @property {google.protobuf.ITimestamp|null} [createTime] ProcessorVersion createTime + * @property {string|null} [kmsKeyName] ProcessorVersion kmsKeyName + * @property {string|null} [kmsKeyVersionName] ProcessorVersion kmsKeyVersionName + * @property {boolean|null} [googleManaged] ProcessorVersion googleManaged + * @property {google.cloud.documentai.v1beta3.ProcessorVersion.IDeprecationInfo|null} [deprecationInfo] ProcessorVersion deprecationInfo + */ + + /** + * Constructs a new ProcessorVersion. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ProcessorVersion. + * @implements IProcessorVersion + * @constructor + * @param {google.cloud.documentai.v1beta3.IProcessorVersion=} [properties] Properties to set + */ + function ProcessorVersion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProcessorVersion name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.name = ""; + + /** + * ProcessorVersion displayName. + * @member {string} displayName + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.displayName = ""; + + /** + * ProcessorVersion state. + * @member {google.cloud.documentai.v1beta3.ProcessorVersion.State} state + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.state = 0; + + /** + * ProcessorVersion createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.createTime = null; + + /** + * ProcessorVersion kmsKeyName. + * @member {string} kmsKeyName + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.kmsKeyName = ""; + + /** + * ProcessorVersion kmsKeyVersionName. + * @member {string} kmsKeyVersionName + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.kmsKeyVersionName = ""; + + /** + * ProcessorVersion googleManaged. + * @member {boolean} googleManaged + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.googleManaged = false; + + /** + * ProcessorVersion deprecationInfo. + * @member {google.cloud.documentai.v1beta3.ProcessorVersion.IDeprecationInfo|null|undefined} deprecationInfo + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.deprecationInfo = null; + + /** + * Creates a new ProcessorVersion instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @static + * @param {google.cloud.documentai.v1beta3.IProcessorVersion=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ProcessorVersion} ProcessorVersion instance + */ + ProcessorVersion.create = function create(properties) { + return new ProcessorVersion(properties); + }; + + /** + * Encodes the specified ProcessorVersion message. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessorVersion.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @static + * @param {google.cloud.documentai.v1beta3.IProcessorVersion} message ProcessorVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessorVersion.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.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.state); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.kmsKeyName); + if (message.kmsKeyVersionName != null && Object.hasOwnProperty.call(message, "kmsKeyVersionName")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.kmsKeyVersionName); + if (message.googleManaged != null && Object.hasOwnProperty.call(message, "googleManaged")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.googleManaged); + if (message.deprecationInfo != null && Object.hasOwnProperty.call(message, "deprecationInfo")) + $root.google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo.encode(message.deprecationInfo, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProcessorVersion message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessorVersion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @static + * @param {google.cloud.documentai.v1beta3.IProcessorVersion} message ProcessorVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessorVersion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProcessorVersion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ProcessorVersion} ProcessorVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessorVersion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ProcessorVersion(); + 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 6: + message.state = reader.int32(); + break; + case 7: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 9: + message.kmsKeyName = reader.string(); + break; + case 10: + message.kmsKeyVersionName = reader.string(); + break; + case 11: + message.googleManaged = reader.bool(); + break; + case 13: + message.deprecationInfo = $root.google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProcessorVersion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ProcessorVersion} ProcessorVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessorVersion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProcessorVersion message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProcessorVersion.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.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + if (!$util.isString(message.kmsKeyName)) + return "kmsKeyName: string expected"; + if (message.kmsKeyVersionName != null && message.hasOwnProperty("kmsKeyVersionName")) + if (!$util.isString(message.kmsKeyVersionName)) + return "kmsKeyVersionName: string expected"; + if (message.googleManaged != null && message.hasOwnProperty("googleManaged")) + if (typeof message.googleManaged !== "boolean") + return "googleManaged: boolean expected"; + if (message.deprecationInfo != null && message.hasOwnProperty("deprecationInfo")) { + var error = $root.google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo.verify(message.deprecationInfo); + if (error) + return "deprecationInfo." + error; + } + return null; + }; + + /** + * Creates a ProcessorVersion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ProcessorVersion} ProcessorVersion + */ + ProcessorVersion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ProcessorVersion) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ProcessorVersion(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "DEPLOYED": + case 1: + message.state = 1; + break; + case "DEPLOYING": + case 2: + message.state = 2; + break; + case "UNDEPLOYED": + case 3: + message.state = 3; + break; + case "UNDEPLOYING": + case 4: + message.state = 4; + break; + case "CREATING": + case 5: + message.state = 5; + break; + case "DELETING": + case 6: + message.state = 6; + break; + case "FAILED": + case 7: + message.state = 7; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ProcessorVersion.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.kmsKeyName != null) + message.kmsKeyName = String(object.kmsKeyName); + if (object.kmsKeyVersionName != null) + message.kmsKeyVersionName = String(object.kmsKeyVersionName); + if (object.googleManaged != null) + message.googleManaged = Boolean(object.googleManaged); + if (object.deprecationInfo != null) { + if (typeof object.deprecationInfo !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ProcessorVersion.deprecationInfo: object expected"); + message.deprecationInfo = $root.google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo.fromObject(object.deprecationInfo); + } + return message; + }; + + /** + * Creates a plain object from a ProcessorVersion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @static + * @param {google.cloud.documentai.v1beta3.ProcessorVersion} message ProcessorVersion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProcessorVersion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.createTime = null; + object.kmsKeyName = ""; + object.kmsKeyVersionName = ""; + object.googleManaged = false; + object.deprecationInfo = 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.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.ProcessorVersion.State[message.state] : message.state; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + object.kmsKeyName = message.kmsKeyName; + if (message.kmsKeyVersionName != null && message.hasOwnProperty("kmsKeyVersionName")) + object.kmsKeyVersionName = message.kmsKeyVersionName; + if (message.googleManaged != null && message.hasOwnProperty("googleManaged")) + object.googleManaged = message.googleManaged; + if (message.deprecationInfo != null && message.hasOwnProperty("deprecationInfo")) + object.deprecationInfo = $root.google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo.toObject(message.deprecationInfo, options); + return object; + }; + + /** + * Converts this ProcessorVersion to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @instance + * @returns {Object.} JSON object + */ + ProcessorVersion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + ProcessorVersion.DeprecationInfo = (function() { + + /** + * Properties of a DeprecationInfo. + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @interface IDeprecationInfo + * @property {google.protobuf.ITimestamp|null} [deprecationTime] DeprecationInfo deprecationTime + * @property {string|null} [replacementProcessorVersion] DeprecationInfo replacementProcessorVersion + */ + + /** + * Constructs a new DeprecationInfo. + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @classdesc Represents a DeprecationInfo. + * @implements IDeprecationInfo + * @constructor + * @param {google.cloud.documentai.v1beta3.ProcessorVersion.IDeprecationInfo=} [properties] Properties to set + */ + function DeprecationInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeprecationInfo deprecationTime. + * @member {google.protobuf.ITimestamp|null|undefined} deprecationTime + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo + * @instance + */ + DeprecationInfo.prototype.deprecationTime = null; + + /** + * DeprecationInfo replacementProcessorVersion. + * @member {string} replacementProcessorVersion + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo + * @instance + */ + DeprecationInfo.prototype.replacementProcessorVersion = ""; + + /** + * Creates a new DeprecationInfo instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo + * @static + * @param {google.cloud.documentai.v1beta3.ProcessorVersion.IDeprecationInfo=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo} DeprecationInfo instance + */ + DeprecationInfo.create = function create(properties) { + return new DeprecationInfo(properties); + }; + + /** + * Encodes the specified DeprecationInfo message. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo + * @static + * @param {google.cloud.documentai.v1beta3.ProcessorVersion.IDeprecationInfo} message DeprecationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeprecationInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecationTime != null && Object.hasOwnProperty.call(message, "deprecationTime")) + $root.google.protobuf.Timestamp.encode(message.deprecationTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.replacementProcessorVersion != null && Object.hasOwnProperty.call(message, "replacementProcessorVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.replacementProcessorVersion); + return writer; + }; + + /** + * Encodes the specified DeprecationInfo message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo + * @static + * @param {google.cloud.documentai.v1beta3.ProcessorVersion.IDeprecationInfo} message DeprecationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeprecationInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeprecationInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo} DeprecationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeprecationInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deprecationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.replacementProcessorVersion = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeprecationInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo} DeprecationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeprecationInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeprecationInfo message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeprecationInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecationTime != null && message.hasOwnProperty("deprecationTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.deprecationTime); + if (error) + return "deprecationTime." + error; } - if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) - if (!$util.isString(message.stateMessage)) - return "stateMessage: string 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; - }; + if (message.replacementProcessorVersion != null && message.hasOwnProperty("replacementProcessorVersion")) + if (!$util.isString(message.replacementProcessorVersion)) + return "replacementProcessorVersion: string expected"; + return null; + }; - /** - * Creates a CommonOperationMetadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.CommonOperationMetadata} CommonOperationMetadata - */ - CommonOperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.CommonOperationMetadata) + /** + * Creates a DeprecationInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo} DeprecationInfo + */ + DeprecationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo(); + if (object.deprecationTime != null) { + if (typeof object.deprecationTime !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo.deprecationTime: object expected"); + message.deprecationTime = $root.google.protobuf.Timestamp.fromObject(object.deprecationTime); + } + if (object.replacementProcessorVersion != null) + message.replacementProcessorVersion = String(object.replacementProcessorVersion); + return message; + }; + + /** + * Creates a plain object from a DeprecationInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo + * @static + * @param {google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo} message DeprecationInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeprecationInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.deprecationTime = null; + object.replacementProcessorVersion = ""; + } + if (message.deprecationTime != null && message.hasOwnProperty("deprecationTime")) + object.deprecationTime = $root.google.protobuf.Timestamp.toObject(message.deprecationTime, options); + if (message.replacementProcessorVersion != null && message.hasOwnProperty("replacementProcessorVersion")) + object.replacementProcessorVersion = message.replacementProcessorVersion; return object; - var message = new $root.google.cloud.documentai.v1beta3.CommonOperationMetadata(); - switch (object.state) { - case "STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "RUNNING": - case 1: - message.state = 1; - break; - case "CANCELLING": - case 2: - message.state = 2; - break; - case "SUCCEEDED": - case 3: - message.state = 3; - break; - case "FAILED": - case 4: - message.state = 4; - break; - case "CANCELLED": - case 5: - message.state = 5; - break; - } - if (object.stateMessage != null) - message.stateMessage = String(object.stateMessage); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.CommonOperationMetadata.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.documentai.v1beta3.CommonOperationMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); - } - return message; - }; + }; - /** - * Creates a plain object from a CommonOperationMetadata message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata - * @static - * @param {google.cloud.documentai.v1beta3.CommonOperationMetadata} message CommonOperationMetadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CommonOperationMetadata.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; - object.stateMessage = ""; - object.createTime = null; - object.updateTime = null; - } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.State[message.state] : message.state; - if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) - object.stateMessage = message.stateMessage; - 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 DeprecationInfo to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo + * @instance + * @returns {Object.} JSON object + */ + DeprecationInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this CommonOperationMetadata to JSON. - * @function toJSON - * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata - * @instance - * @returns {Object.} JSON object - */ - CommonOperationMetadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return DeprecationInfo; + })(); /** * State enum. - * @name google.cloud.documentai.v1beta3.CommonOperationMetadata.State + * @name google.cloud.documentai.v1beta3.ProcessorVersion.State * @enum {number} * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} RUNNING=1 RUNNING value - * @property {number} CANCELLING=2 CANCELLING value - * @property {number} SUCCEEDED=3 SUCCEEDED value - * @property {number} FAILED=4 FAILED value - * @property {number} CANCELLED=5 CANCELLED value + * @property {number} DEPLOYED=1 DEPLOYED value + * @property {number} DEPLOYING=2 DEPLOYING value + * @property {number} UNDEPLOYED=3 UNDEPLOYED value + * @property {number} UNDEPLOYING=4 UNDEPLOYING value + * @property {number} CREATING=5 CREATING value + * @property {number} DELETING=6 DELETING value + * @property {number} FAILED=7 FAILED value */ - CommonOperationMetadata.State = (function() { + ProcessorVersion.State = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "RUNNING"] = 1; - values[valuesById[2] = "CANCELLING"] = 2; - values[valuesById[3] = "SUCCEEDED"] = 3; - values[valuesById[4] = "FAILED"] = 4; - values[valuesById[5] = "CANCELLED"] = 5; + values[valuesById[1] = "DEPLOYED"] = 1; + values[valuesById[2] = "DEPLOYING"] = 2; + values[valuesById[3] = "UNDEPLOYED"] = 3; + values[valuesById[4] = "UNDEPLOYING"] = 4; + values[valuesById[5] = "CREATING"] = 5; + values[valuesById[6] = "DELETING"] = 6; + values[valuesById[7] = "FAILED"] = 7; return values; })(); - return CommonOperationMetadata; + return ProcessorVersion; })(); v1beta3.Processor = (function() { @@ -66427,6 +72793,7 @@ * @property {string|null} [category] ProcessorType category * @property {Array.|null} [availableLocations] ProcessorType availableLocations * @property {boolean|null} [allowCreation] ProcessorType allowCreation + * @property {google.api.LaunchStage|null} [launchStage] ProcessorType launchStage */ /** @@ -66485,6 +72852,14 @@ */ ProcessorType.prototype.allowCreation = false; + /** + * ProcessorType launchStage. + * @member {google.api.LaunchStage} launchStage + * @memberof google.cloud.documentai.v1beta3.ProcessorType + * @instance + */ + ProcessorType.prototype.launchStage = 0; + /** * Creates a new ProcessorType instance using the specified properties. * @function create @@ -66520,6 +72895,8 @@ $root.google.cloud.documentai.v1beta3.ProcessorType.LocationInfo.encode(message.availableLocations[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.allowCreation != null && Object.hasOwnProperty.call(message, "allowCreation")) writer.uint32(/* id 6, wireType 0 =*/48).bool(message.allowCreation); + if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.launchStage); return writer; }; @@ -66571,6 +72948,9 @@ case 6: message.allowCreation = reader.bool(); break; + case 8: + message.launchStage = reader.int32(); + break; default: reader.skipType(tag & 7); break; @@ -66627,6 +73007,20 @@ if (message.allowCreation != null && message.hasOwnProperty("allowCreation")) if (typeof message.allowCreation !== "boolean") return "allowCreation: boolean expected"; + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + switch (message.launchStage) { + default: + return "launchStage: enum value expected"; + case 0: + case 6: + case 7: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } return null; }; @@ -66660,6 +73054,40 @@ } if (object.allowCreation != null) message.allowCreation = Boolean(object.allowCreation); + switch (object.launchStage) { + case "LAUNCH_STAGE_UNSPECIFIED": + case 0: + message.launchStage = 0; + break; + case "UNIMPLEMENTED": + case 6: + message.launchStage = 6; + break; + case "PRELAUNCH": + case 7: + message.launchStage = 7; + break; + case "EARLY_ACCESS": + case 1: + message.launchStage = 1; + break; + case "ALPHA": + case 2: + message.launchStage = 2; + break; + case "BETA": + case 3: + message.launchStage = 3; + break; + case "GA": + case 4: + message.launchStage = 4; + break; + case "DEPRECATED": + case 5: + message.launchStage = 5; + break; + } return message; }; @@ -66683,6 +73111,7 @@ object.type = ""; object.category = ""; object.allowCreation = false; + object.launchStage = options.enums === String ? "LAUNCH_STAGE_UNSPECIFIED" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -66697,6 +73126,8 @@ } if (message.allowCreation != null && message.hasOwnProperty("allowCreation")) object.allowCreation = message.allowCreation; + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] : message.launchStage; return object; }; diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 10ece4e69df..5723fdf7380 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -4209,10 +4209,26 @@ "java_package": "com.google.cloud.documentai.v1beta3", "php_namespace": "Google\\Cloud\\DocumentAI\\V1beta3", "ruby_package": "Google::Cloud::DocumentAI::V1beta3", - "(google.api.resource_definition).type": "documentai.googleapis.com/HumanReviewConfig", - "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig" + "(google.api.resource_definition).type": "documentai.googleapis.com/Location", + "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}" }, "nested": { + "Barcode": { + "fields": { + "format": { + "type": "string", + "id": 1 + }, + "valueFormat": { + "type": "string", + "id": 2 + }, + "rawValue": { + "type": "string", + "id": 3 + } + } + }, "Document": { "oneofs": { "source": { @@ -4418,6 +4434,11 @@ "type": "Symbol", "id": 12 }, + "detectedBarcodes": { + "rule": "repeated", + "type": "DetectedBarcode", + "id": 15 + }, "provenance": { "type": "Provenance", "id": 16 @@ -4712,12 +4733,32 @@ "type": "string", "id": 5 }, + "correctedKeyText": { + "type": "string", + "id": 6 + }, + "correctedValueText": { + "type": "string", + "id": 7 + }, "provenance": { "type": "Provenance", "id": 8 } } }, + "DetectedBarcode": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "barcode": { + "type": "Barcode", + "id": 2 + } + } + }, "DetectedLanguage": { "fields": { "languageCode": { @@ -4822,7 +4863,9 @@ "dateValue", "datetimeValue", "addressValue", - "booleanValue" + "booleanValue", + "integerValue", + "floatValue" ] } }, @@ -4847,6 +4890,14 @@ "type": "bool", "id": 6 }, + "integerValue": { + "type": "int32", + "id": 7 + }, + "floatValue": { + "type": "float", + "id": 8 + }, "text": { "type": "string", "id": 1, @@ -5047,7 +5098,15 @@ "parent": { "rule": "repeated", "type": "int32", - "id": 2 + "id": 2, + "options": { + "deprecated": true + } + }, + "parentIds": { + "rule": "repeated", + "type": "string", + "id": 7 }, "createTime": { "type": "google.protobuf.Timestamp", @@ -5228,13 +5287,19 @@ "options": { "(google.api.http).post": "/v1beta3/{name=projects/*/locations/*/processors/*}:process", "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}:process", + "(google.api.http).additional_bindings.body": "*", "(google.api.method_signature)": "name" }, "parsedOptions": [ { "(google.api.http)": { "post": "/v1beta3/{name=projects/*/locations/*/processors/*}:process", - "body": "*" + "body": "*", + "additional_bindings": { + "post": "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}:process", + "body": "*" + } } }, { @@ -5248,6 +5313,8 @@ "options": { "(google.api.http).post": "/v1beta3/{name=projects/*/locations/*/processors/*}:batchProcess", "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}:batchProcess", + "(google.api.http).additional_bindings.body": "*", "(google.api.method_signature)": "name", "(google.longrunning.operation_info).response_type": "BatchProcessResponse", "(google.longrunning.operation_info).metadata_type": "BatchProcessMetadata" @@ -5256,7 +5323,11 @@ { "(google.api.http)": { "post": "/v1beta3/{name=projects/*/locations/*/processors/*}:batchProcess", - "body": "*" + "body": "*", + "additional_bindings": { + "post": "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}:batchProcess", + "body": "*" + } } }, { @@ -5288,6 +5359,24 @@ } ] }, + "ListProcessorTypes": { + "requestType": "ListProcessorTypesRequest", + "responseType": "ListProcessorTypesResponse", + "options": { + "(google.api.http).get": "/v1beta3/{parent=projects/*/locations/*}/processorTypes", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta3/{parent=projects/*/locations/*}/processorTypes" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, "ListProcessors": { "requestType": "ListProcessorsRequest", "responseType": "ListProcessorsResponse", @@ -5306,6 +5395,142 @@ } ] }, + "GetProcessor": { + "requestType": "GetProcessorRequest", + "responseType": "Processor", + "options": { + "(google.api.http).get": "/v1beta3/{name=projects/*/locations/*/processors/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta3/{name=projects/*/locations/*/processors/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "GetProcessorVersion": { + "requestType": "GetProcessorVersionRequest", + "responseType": "ProcessorVersion", + "options": { + "(google.api.http).get": "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListProcessorVersions": { + "requestType": "ListProcessorVersionsRequest", + "responseType": "ListProcessorVersionsResponse", + "options": { + "(google.api.http).get": "/v1beta3/{parent=projects/*/locations/*/processors/*}/processorVersions", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta3/{parent=projects/*/locations/*/processors/*}/processorVersions" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "DeleteProcessorVersion": { + "requestType": "DeleteProcessorVersionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "DeleteProcessorVersionMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "DeleteProcessorVersionMetadata" + } + } + ] + }, + "DeployProcessorVersion": { + "requestType": "DeployProcessorVersionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}:deploy", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "DeployProcessorVersionResponse", + "(google.longrunning.operation_info).metadata_type": "DeployProcessorVersionMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}:deploy", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "DeployProcessorVersionResponse", + "metadata_type": "DeployProcessorVersionMetadata" + } + } + ] + }, + "UndeployProcessorVersion": { + "requestType": "UndeployProcessorVersionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}:undeploy", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "UndeployProcessorVersionResponse", + "(google.longrunning.operation_info).metadata_type": "UndeployProcessorVersionMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}:undeploy", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "UndeployProcessorVersionResponse", + "metadata_type": "UndeployProcessorVersionMetadata" + } + } + ] + }, "CreateProcessor": { "requestType": "CreateProcessorRequest", "responseType": "Processor", @@ -5400,6 +5625,30 @@ } ] }, + "SetDefaultProcessorVersion": { + "requestType": "SetDefaultProcessorVersionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1beta3/{processor=projects/*/locations/*/processors/*}:setDefaultProcessorVersion", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "SetDefaultProcessorVersionResponse", + "(google.longrunning.operation_info).metadata_type": "SetDefaultProcessorVersionMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta3/{processor=projects/*/locations/*/processors/*}:setDefaultProcessorVersion", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "SetDefaultProcessorVersionResponse", + "metadata_type": "SetDefaultProcessorVersionMetadata" + } + } + ] + }, "ReviewDocument": { "requestType": "ReviewDocumentRequest", "responseType": "google.longrunning.Operation", @@ -5453,7 +5702,7 @@ "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + "(google.api.resource_reference).type": "*" } }, "document": { @@ -5466,6 +5715,10 @@ "skipHumanReview": { "type": "bool", "id": 3 + }, + "fieldMask": { + "type": "google.protobuf.FieldMask", + "id": 6 } } }, @@ -5522,7 +5775,7 @@ "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + "(google.api.resource_reference).type": "*" } }, "inputConfigs": { @@ -5671,14 +5924,14 @@ } } }, - "ListProcessorsRequest": { + "ListProcessorTypesRequest": { "fields": { "parent": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "documentai.googleapis.com/Processor" + "(google.api.resource_reference).child_type": "documentai.googleapis.com/ProcessorType" } }, "pageSize": { @@ -5691,11 +5944,11 @@ } } }, - "ListProcessorsResponse": { + "ListProcessorTypesResponse": { "fields": { - "processors": { + "processorTypes": { "rule": "repeated", - "type": "Processor", + "type": "ProcessorType", "id": 1 }, "nextPageToken": { @@ -5704,6 +5957,162 @@ } } }, + "ListProcessorsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "documentai.googleapis.com/Processor" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListProcessorsResponse": { + "fields": { + "processors": { + "rule": "repeated", + "type": "Processor", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetProcessorRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + } + } + } + }, + "GetProcessorVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } + } + } + }, + "ListProcessorVersionsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "documentai.googleapis.com/ProcessorVersion" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListProcessorVersionsResponse": { + "fields": { + "processorVersions": { + "rule": "repeated", + "type": "ProcessorVersion", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "DeleteProcessorVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } + } + } + }, + "DeleteProcessorVersionMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 1 + } + } + }, + "DeployProcessorVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } + } + } + }, + "DeployProcessorVersionResponse": { + "fields": {} + }, + "DeployProcessorVersionMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 1 + } + } + }, + "UndeployProcessorVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } + } + } + }, + "UndeployProcessorVersionResponse": { + "fields": {} + }, + "UndeployProcessorVersionMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 1 + } + } + }, "CreateProcessorRequest": { "fields": { "parent": { @@ -5789,6 +6198,37 @@ } } }, + "SetDefaultProcessorVersionRequest": { + "fields": { + "processor": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + } + }, + "defaultProcessorVersion": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } + } + } + }, + "SetDefaultProcessorVersionResponse": { + "fields": {} + }, + "SetDefaultProcessorVersionMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 1 + } + } + }, "ReviewDocumentRequest": { "oneofs": { "source": { @@ -5824,6 +6264,10 @@ "priority": { "type": "Priority", "id": 5 + }, + "documentSchema": { + "type": "DocumentSchema", + "id": 6 } }, "nested": { @@ -5840,6 +6284,23 @@ "gcsDestination": { "type": "string", "id": 1 + }, + "state": { + "type": "State", + "id": 2 + }, + "rejectionReason": { + "type": "string", + "id": 3 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "REJECTED": 1, + "SUCCEEDED": 2 + } } } }, @@ -5883,6 +6344,120 @@ } } }, + "DocumentSchema": { + "fields": { + "displayName": { + "type": "string", + "id": 1 + }, + "description": { + "type": "string", + "id": 2 + }, + "entityTypes": { + "rule": "repeated", + "type": "EntityType", + "id": 3 + }, + "metadata": { + "type": "Metadata", + "id": 4 + } + }, + "nested": { + "EntityType": { + "oneofs": { + "valueSource": { + "oneof": [ + "enumValues" + ] + } + }, + "fields": { + "enumValues": { + "type": "EnumValues", + "id": 14 + }, + "displayName": { + "type": "string", + "id": 13 + }, + "name": { + "type": "string", + "id": 1 + }, + "baseTypes": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "properties": { + "rule": "repeated", + "type": "Property", + "id": 6 + } + }, + "nested": { + "EnumValues": { + "fields": { + "values": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "Property": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "valueType": { + "type": "string", + "id": 2 + }, + "occurrenceType": { + "type": "OccurrenceType", + "id": 3 + } + }, + "nested": { + "OccurrenceType": { + "values": { + "OCCURRENCE_TYPE_UNSPECIFIED": 0, + "OPTIONAL_ONCE": 1, + "OPTIONAL_MULTIPLE": 2, + "REQUIRED_ONCE": 3, + "REQUIRED_MULTIPLE": 4 + } + } + } + } + } + }, + "Metadata": { + "fields": { + "documentSplitter": { + "type": "bool", + "id": 1 + }, + "documentAllowMultipleLabels": { + "type": "bool", + "id": 2 + }, + "prefixedNamingOnProperties": { + "type": "bool", + "id": 6 + }, + "skipNamingValidation": { + "type": "bool", + "id": 7 + } + } + } + } + }, "CommonOperationMetadata": { "fields": { "state": { @@ -5893,6 +6468,10 @@ "type": "string", "id": 2 }, + "resource": { + "type": "string", + "id": 5 + }, "createTime": { "type": "google.protobuf.Timestamp", "id": 3 @@ -5915,6 +6494,75 @@ } } }, + "ProcessorVersion": { + "options": { + "(google.api.resource).type": "documentai.googleapis.com/ProcessorVersion", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2 + }, + "state": { + "type": "State", + "id": 6 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 7 + }, + "kmsKeyName": { + "type": "string", + "id": 9 + }, + "kmsKeyVersionName": { + "type": "string", + "id": 10 + }, + "googleManaged": { + "type": "bool", + "id": 11 + }, + "deprecationInfo": { + "type": "DeprecationInfo", + "id": 13 + } + }, + "nested": { + "DeprecationInfo": { + "fields": { + "deprecationTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "replacementProcessorVersion": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } + } + } + }, + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "DEPLOYED": 1, + "DEPLOYING": 2, + "UNDEPLOYED": 3, + "UNDEPLOYING": 4, + "CREATING": 5, + "DELETING": 6, + "FAILED": 7 + } + } + } + }, "Processor": { "options": { "(google.api.resource).type": "documentai.googleapis.com/Processor", @@ -5945,7 +6593,10 @@ }, "defaultProcessorVersion": { "type": "string", - "id": 9 + "id": 9, + "options": { + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } }, "processEndpoint": { "type": "string", @@ -6004,6 +6655,10 @@ "allowCreation": { "type": "bool", "id": 6 + }, + "launchStage": { + "type": "google.api.LaunchStage", + "id": 8 } }, "nested": { diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js index 65ed20475d7..e03908b5835 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js @@ -26,7 +26,11 @@ function main(name) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The processor resource name. + * Required. The resource name of Processor google.cloud.documentai.v1beta3.Processor or + * ProcessorVersion google.cloud.documentai.v1beta3.ProcessorVersion. + * Format: `projects/{project}/locations/{location}/processors/{processor}`, + * or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` */ // const name = 'abc123' /** diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js index 6fa2b2766f3..050feab2913 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js @@ -27,7 +27,7 @@ function main(parent, processor) { */ /** * Required. The parent (project and location) under which to create the processor. - * Format: projects/{project}/locations/{location} + * Format: `projects/{project}/locations/{location}` */ // const parent = 'abc123' /** diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor_version.js new file mode 100644 index 00000000000..b0503d6485f --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor_version.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 documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessorVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor version resource name to be deleted. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callDeleteProcessorVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await documentaiClient.deleteProcessorVersion(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteProcessorVersion(); + // [END documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessorVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.deploy_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.deploy_processor_version.js new file mode 100644 index 00000000000..e1dfce344da --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.deploy_processor_version.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 documentai_v1beta3_generated_DocumentProcessorService_DeployProcessorVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor version resource name to be deployed. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callDeployProcessorVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await documentaiClient.deployProcessorVersion(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeployProcessorVersion(); + // [END documentai_v1beta3_generated_DocumentProcessorService_DeployProcessorVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js index c0c9b717ee4..15b6348f3a2 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js @@ -27,7 +27,8 @@ function main(parent) { */ /** * Required. The project of processor type to list. - * Format: projects/{project}/locations/{location} + * The available processor types may depend on the allow-listing on projects. + * Format: `projects/{project}/locations/{location}` */ // const parent = 'abc123' diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor.js new file mode 100644 index 00000000000..c265c6bf6ef --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor.js @@ -0,0 +1,58 @@ +// 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 documentai_v1beta3_generated_DocumentProcessorService_GetProcessor_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor resource name. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callGetProcessor() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await documentaiClient.getProcessor(request); + console.log(response); + } + + callGetProcessor(); + // [END documentai_v1beta3_generated_DocumentProcessorService_GetProcessor_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor_version.js new file mode 100644 index 00000000000..979a477ccc7 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor_version.js @@ -0,0 +1,58 @@ +// 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 documentai_v1beta3_generated_DocumentProcessorService_GetProcessorVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor resource name. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callGetProcessorVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await documentaiClient.getProcessorVersion(request); + console.log(response); + } + + callGetProcessorVersion(); + // [END documentai_v1beta3_generated_DocumentProcessorService_GetProcessorVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_types.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_types.js new file mode 100644 index 00000000000..681610ead8c --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_types.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 documentai_v1beta3_generated_DocumentProcessorService_ListProcessorTypes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The location of processor type to list. + * The available processor types may depend on the allow-listing on projects. + * Format: `projects/{project}/locations/{location}` + */ + // const parent = 'abc123' + /** + * The maximum number of processor types to return. + * If unspecified, at most 100 processor types will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + */ + // const pageSize = 1234 + /** + * Used to retrieve the next page of results, empty if at the end of the list. + */ + // const pageToken = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callListProcessorTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await documentaiClient.listProcessorTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListProcessorTypes(); + // [END documentai_v1beta3_generated_DocumentProcessorService_ListProcessorTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_versions.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_versions.js new file mode 100644 index 00000000000..af97f27e432 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_versions.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 documentai_v1beta3_generated_DocumentProcessorService_ListProcessorVersions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent (project, location and processor) to list all versions. + * Format: `projects/{project}/locations/{location}/processors/{processor}` + */ + // const parent = 'abc123' + /** + * The maximum number of processor versions to return. + * If unspecified, at most 10 processor versions will be returned. + * The maximum value is 20; values above 20 will be coerced to 20. + */ + // const pageSize = 1234 + /** + * We will return the processor versions sorted by creation time. The page + * token will point to the next processor version. + */ + // const pageToken = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callListProcessorVersions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await documentaiClient.listProcessorVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListProcessorVersions(); + // [END documentai_v1beta3_generated_DocumentProcessorService_ListProcessorVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js index cfea7fd672e..4012d0b7aaa 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js @@ -27,7 +27,7 @@ function main(parent) { */ /** * Required. The parent (project and location) which owns this collection of Processors. - * Format: projects/{project}/locations/{location} + * Format: `projects/{project}/locations/{location}` */ // const parent = 'abc123' /** diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js index 2c0d6e90f6f..9e37ab06e43 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js @@ -34,7 +34,12 @@ function main(name) { */ // const rawDocument = {} /** - * Required. The processor resource name. + * Required. The resource name of the Processor google.cloud.documentai.v1beta3.Processor or + * ProcessorVersion google.cloud.documentai.v1beta3.ProcessorVersion + * to use for processing. If a Processor google.cloud.documentai.v1beta3.Processor is specified, the server will use + * its default version google.cloud.documentai.v1beta3.Processor.default_processor_version. Format: + * `projects/{project}/locations/{location}/processors/{processor}`, or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` */ // const name = 'abc123' /** @@ -46,6 +51,10 @@ function main(name) { * false. */ // const skipHumanReview = true + /** + * Specifies which fields to include in ProcessResponse's document. + */ + // const fieldMask = {} // Imports the Documentai library const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js index fd35938f62d..8c3bb75711b 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js @@ -46,6 +46,10 @@ function main(humanReviewConfig) { * The priority of the human review task. */ // const priority = {} + /** + * The document schema of the human review task. + */ + // const documentSchema = {} // Imports the Documentai library const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.set_default_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.set_default_processor_version.js new file mode 100644 index 00000000000..42909b970a4 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.set_default_processor_version.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(processor, defaultProcessorVersion) { + // [START documentai_v1beta3_generated_DocumentProcessorService_SetDefaultProcessorVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Processor google.cloud.documentai.v1beta3.Processor to change default version. + */ + // const processor = 'abc123' + /** + * Required. The resource name of child ProcessorVersion google.cloud.documentai.v1beta3.ProcessorVersion to use as default. + * Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}` + */ + // const defaultProcessorVersion = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callSetDefaultProcessorVersion() { + // Construct request + const request = { + processor, + defaultProcessorVersion, + }; + + // Run request + const [operation] = await documentaiClient.setDefaultProcessorVersion(request); + const [response] = await operation.promise(); + console.log(response); + } + + callSetDefaultProcessorVersion(); + // [END documentai_v1beta3_generated_DocumentProcessorService_SetDefaultProcessorVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.undeploy_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.undeploy_processor_version.js new file mode 100644 index 00000000000..05957013cfd --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.undeploy_processor_version.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 documentai_v1beta3_generated_DocumentProcessorService_UndeployProcessorVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor version resource name to be undeployed. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callUndeployProcessorVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await documentaiClient.undeployProcessorVersion(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUndeployProcessorVersion(); + // [END documentai_v1beta3_generated_DocumentProcessorService_UndeployProcessorVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json index 0fb2f7802d8..6657b6d2917 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 67, + "end": 76, "type": "FULL" } ], @@ -50,6 +50,10 @@ { "name": "skip_human_review", "type": "TYPE_BOOL" + }, + { + "name": "field_mask", + "type": ".google.protobuf.FieldMask" } ], "resultType": ".google.cloud.documentai.v1beta3.ProcessResponse", @@ -78,7 +82,7 @@ "segments": [ { "start": 25, - "end": 72, + "end": 76, "type": "FULL" } ], @@ -131,14 +135,14 @@ "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_FetchProcessorTypes_async", "title": "DocumentProcessorService fetchProcessorTypes Sample", "origin": "API_DEFINITION", - "description": " Fetches processor types.", + "description": " Fetches processor types. Note that we do not use ListProcessorTypes here because it is not paginated.", "canonical": true, "file": "document_processor_service.fetch_processor_types.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 51, + "end": 52, "type": "FULL" } ], @@ -167,6 +171,54 @@ } } }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_ListProcessorTypes_async", + "title": "DocumentProcessorService listProcessorTypes Sample", + "origin": "API_DEFINITION", + "description": " Lists the processor types that exist.", + "canonical": true, + "file": "document_processor_service.list_processor_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListProcessorTypes", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessorTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1beta3.ListProcessorTypesResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ListProcessorTypes", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessorTypes", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, { "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_ListProcessors_async", "title": "DocumentProcessorService listProcessors Sample", @@ -215,6 +267,254 @@ } } }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_GetProcessor_async", + "title": "DocumentProcessorService getProcessor Sample", + "origin": "API_DEFINITION", + "description": " Gets a processor detail.", + "canonical": true, + "file": "document_processor_service.get_processor.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.GetProcessor", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1beta3.Processor", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "GetProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.GetProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_GetProcessorVersion_async", + "title": "DocumentProcessorService getProcessorVersion Sample", + "origin": "API_DEFINITION", + "description": " Gets a processor version detail.", + "canonical": true, + "file": "document_processor_service.get_processor_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetProcessorVersion", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.GetProcessorVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1beta3.ProcessorVersion", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "GetProcessorVersion", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.GetProcessorVersion", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_ListProcessorVersions_async", + "title": "DocumentProcessorService listProcessorVersions Sample", + "origin": "API_DEFINITION", + "description": " Lists all versions of a processor.", + "canonical": true, + "file": "document_processor_service.list_processor_versions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListProcessorVersions", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessorVersions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1beta3.ListProcessorVersionsResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ListProcessorVersions", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessorVersions", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessorVersion_async", + "title": "DocumentProcessorService deleteProcessorVersion Sample", + "origin": "API_DEFINITION", + "description": " Deletes the processor version, all artifacts under the processor version will be deleted.", + "canonical": true, + "file": "document_processor_service.delete_processor_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteProcessorVersion", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.DeleteProcessorVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "DeleteProcessorVersion", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.DeleteProcessorVersion", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_DeployProcessorVersion_async", + "title": "DocumentProcessorService deployProcessorVersion Sample", + "origin": "API_DEFINITION", + "description": " Deploys the processor version.", + "canonical": true, + "file": "document_processor_service.deploy_processor_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeployProcessorVersion", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.DeployProcessorVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "DeployProcessorVersion", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.DeployProcessorVersion", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_UndeployProcessorVersion_async", + "title": "DocumentProcessorService undeployProcessorVersion Sample", + "origin": "API_DEFINITION", + "description": " Undeploys the processor version.", + "canonical": true, + "file": "document_processor_service.undeploy_processor_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UndeployProcessorVersion", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.UndeployProcessorVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "UndeployProcessorVersion", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.UndeployProcessorVersion", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, { "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_CreateProcessor_async", "title": "DocumentProcessorService createProcessor Sample", @@ -379,6 +679,50 @@ } } }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_SetDefaultProcessorVersion_async", + "title": "DocumentProcessorService setDefaultProcessorVersion Sample", + "origin": "API_DEFINITION", + "description": " Set the default (active) version of a [Processor][google.cloud.documentai.v1beta3.Processor] that will be used in [ProcessDocument][google.cloud.documentai.v1beta3.DocumentProcessorService.ProcessDocument] and [BatchProcessDocuments][google.cloud.documentai.v1beta3.DocumentProcessorService.BatchProcessDocuments].", + "canonical": true, + "file": "document_processor_service.set_default_processor_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetDefaultProcessorVersion", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.SetDefaultProcessorVersion", + "async": true, + "parameters": [ + { + "name": "processor", + "type": "TYPE_STRING" + }, + { + "name": "default_processor_version", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "SetDefaultProcessorVersion", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.SetDefaultProcessorVersion", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, { "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_ReviewDocument_async", "title": "DocumentProcessorService reviewDocument Sample", @@ -390,7 +734,7 @@ "segments": [ { "start": 25, - "end": 68, + "end": 72, "type": "FULL" } ], @@ -418,6 +762,10 @@ { "name": "priority", "type": ".google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority" + }, + { + "name": "document_schema", + "type": ".google.cloud.documentai.v1beta3.DocumentSchema" } ], "resultType": ".google.longrunning.Operation", diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index 5fa75e4be12..d3c447799d6 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts @@ -27,6 +27,8 @@ import { LROperation, PaginationCallback, GaxCall, + LocationsClient, + LocationProtos, } from 'google-gax'; import {Transform} from 'stream'; @@ -67,6 +69,7 @@ export class DocumentProcessorServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; documentProcessorServiceStub?: Promise<{[name: string]: Function}>; @@ -143,6 +146,8 @@ export class DocumentProcessorServiceClient { // Set defaultServicePath on the auth object. this.auth.defaultServicePath = staticMembers.servicePath; + 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) { @@ -177,6 +182,9 @@ export class DocumentProcessorServiceClient { processorTypePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/processorTypes/{processor_type}' ), + processorVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}' + ), projectPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}' ), @@ -186,11 +194,21 @@ export class DocumentProcessorServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { + listProcessorTypes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'processorTypes' + ), listProcessors: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'processors' ), + listProcessorVersions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'processorVersions' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -203,7 +221,45 @@ export class DocumentProcessorServiceClient { }; if (opts.fallback === 'rest') { lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1beta3/{name=projects/*/locations/*}', + additional_bindings: [ + {get: '/uiv1beta3/{name=projects/*/locations/*}'}, + ], + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1beta3/{name=projects/*}/locations', + additional_bindings: [ + {get: '/uiv1beta3/{name=projects/*}/locations'}, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1beta3/{name=projects/*/locations/*/operations/*}:cancel', + additional_bindings: [ + { + post: '/uiv1beta3/{name=projects/*/locations/*/operations/*}:cancel', + }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1beta3/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + {get: '/uiv1beta3/{name=projects/*/locations/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1beta3/{name=projects/*/locations/*/operations}', + additional_bindings: [ + {get: '/uiv1beta3/{name=projects/*/locations/*/operations}'}, + ], + }, + ]; } this.operationsClient = this._gaxModule .lro(lroOptions) @@ -214,6 +270,24 @@ export class DocumentProcessorServiceClient { const batchProcessDocumentsMetadata = protoFilesRoot.lookup( '.google.cloud.documentai.v1beta3.BatchProcessMetadata' ) as gax.protobuf.Type; + const deleteProcessorVersionResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const deleteProcessorVersionMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata' + ) as gax.protobuf.Type; + const deployProcessorVersionResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta3.DeployProcessorVersionResponse' + ) as gax.protobuf.Type; + const deployProcessorVersionMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata' + ) as gax.protobuf.Type; + const undeployProcessorVersionResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse' + ) as gax.protobuf.Type; + const undeployProcessorVersionMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata' + ) as gax.protobuf.Type; const deleteProcessorResponse = protoFilesRoot.lookup( '.google.protobuf.Empty' ) as gax.protobuf.Type; @@ -232,6 +306,12 @@ export class DocumentProcessorServiceClient { const disableProcessorMetadata = protoFilesRoot.lookup( '.google.cloud.documentai.v1beta3.DisableProcessorMetadata' ) as gax.protobuf.Type; + const setDefaultProcessorVersionResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse' + ) as gax.protobuf.Type; + const setDefaultProcessorVersionMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata' + ) as gax.protobuf.Type; const reviewDocumentResponse = protoFilesRoot.lookup( '.google.cloud.documentai.v1beta3.ReviewDocumentResponse' ) as gax.protobuf.Type; @@ -247,6 +327,33 @@ export class DocumentProcessorServiceClient { ), batchProcessDocumentsMetadata.decode.bind(batchProcessDocumentsMetadata) ), + deleteProcessorVersion: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteProcessorVersionResponse.decode.bind( + deleteProcessorVersionResponse + ), + deleteProcessorVersionMetadata.decode.bind( + deleteProcessorVersionMetadata + ) + ), + deployProcessorVersion: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deployProcessorVersionResponse.decode.bind( + deployProcessorVersionResponse + ), + deployProcessorVersionMetadata.decode.bind( + deployProcessorVersionMetadata + ) + ), + undeployProcessorVersion: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + undeployProcessorVersionResponse.decode.bind( + undeployProcessorVersionResponse + ), + undeployProcessorVersionMetadata.decode.bind( + undeployProcessorVersionMetadata + ) + ), deleteProcessor: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteProcessorResponse.decode.bind(deleteProcessorResponse), @@ -262,6 +369,15 @@ export class DocumentProcessorServiceClient { disableProcessorResponse.decode.bind(disableProcessorResponse), disableProcessorMetadata.decode.bind(disableProcessorMetadata) ), + setDefaultProcessorVersion: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + setDefaultProcessorVersionResponse.decode.bind( + setDefaultProcessorVersionResponse + ), + setDefaultProcessorVersionMetadata.decode.bind( + setDefaultProcessorVersionMetadata + ) + ), reviewDocument: new this._gaxModule.LongrunningDescriptor( this.operationsClient, reviewDocumentResponse.decode.bind(reviewDocumentResponse), @@ -323,11 +439,19 @@ export class DocumentProcessorServiceClient { 'processDocument', 'batchProcessDocuments', 'fetchProcessorTypes', + 'listProcessorTypes', 'listProcessors', + 'getProcessor', + 'getProcessorVersion', + 'listProcessorVersions', + 'deleteProcessorVersion', + 'deployProcessorVersion', + 'undeployProcessorVersion', 'createProcessor', 'deleteProcessor', 'enableProcessor', 'disableProcessor', + 'setDefaultProcessorVersion', 'reviewDocument', ]; for (const methodName of documentProcessorServiceStubMethods) { @@ -424,12 +548,19 @@ export class DocumentProcessorServiceClient { * @param {google.cloud.documentai.v1beta3.RawDocument} request.rawDocument * A raw document content (bytes). * @param {string} request.name - * Required. The processor resource name. + * Required. The resource name of the {@link google.cloud.documentai.v1beta3.Processor|Processor} or + * {@link google.cloud.documentai.v1beta3.ProcessorVersion|ProcessorVersion} + * to use for processing. If a {@link google.cloud.documentai.v1beta3.Processor|Processor} is specified, the server will use + * its {@link google.cloud.documentai.v1beta3.Processor.default_processor_version|default version}. Format: + * `projects/{project}/locations/{location}/processors/{processor}`, or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` * @param {google.cloud.documentai.v1beta3.Document} request.document * The document payload, the [content] and [mime_type] fields must be set. * @param {boolean} request.skipHumanReview * Whether Human Review feature should be skipped for this request. Default to * false. + * @param {google.protobuf.FieldMask} request.fieldMask + * Specifies which fields to include in ProcessResponse's document. * @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. @@ -509,13 +640,15 @@ export class DocumentProcessorServiceClient { return this.innerApiCalls.processDocument(request, options, callback); } /** - * Fetches processor types. + * Fetches processor types. Note that we do not use ListProcessorTypes here + * because it is not paginated. * * @param {Object} request * The request object that will be sent. * @param {string} request.parent * Required. The project of processor type to list. - * Format: projects/{project}/locations/{location} + * The available processor types may depend on the allow-listing on projects. + * Format: `projects/{project}/locations/{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. @@ -606,6 +739,194 @@ export class DocumentProcessorServiceClient { this.initialize(); return this.innerApiCalls.fetchProcessorTypes(request, options, callback); } + /** + * Gets a processor detail. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name. + * @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 [Processor]{@link google.cloud.documentai.v1beta3.Processor}. + * 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/v1beta3/document_processor_service.get_processor.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_GetProcessor_async + */ + getProcessor( + request?: protos.google.cloud.documentai.v1beta3.IGetProcessorRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IProcessor, + protos.google.cloud.documentai.v1beta3.IGetProcessorRequest | undefined, + {} | undefined + ] + >; + getProcessor( + request: protos.google.cloud.documentai.v1beta3.IGetProcessorRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.documentai.v1beta3.IProcessor, + | protos.google.cloud.documentai.v1beta3.IGetProcessorRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getProcessor( + request: protos.google.cloud.documentai.v1beta3.IGetProcessorRequest, + callback: Callback< + protos.google.cloud.documentai.v1beta3.IProcessor, + | protos.google.cloud.documentai.v1beta3.IGetProcessorRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getProcessor( + request?: protos.google.cloud.documentai.v1beta3.IGetProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.documentai.v1beta3.IProcessor, + | protos.google.cloud.documentai.v1beta3.IGetProcessorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.documentai.v1beta3.IProcessor, + | protos.google.cloud.documentai.v1beta3.IGetProcessorRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IProcessor, + protos.google.cloud.documentai.v1beta3.IGetProcessorRequest | 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.getProcessor(request, options, callback); + } + /** + * Gets a processor version detail. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name. + * @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 [ProcessorVersion]{@link google.cloud.documentai.v1beta3.ProcessorVersion}. + * 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/v1beta3/document_processor_service.get_processor_version.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_GetProcessorVersion_async + */ + getProcessorVersion( + request?: protos.google.cloud.documentai.v1beta3.IGetProcessorVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IProcessorVersion, + ( + | protos.google.cloud.documentai.v1beta3.IGetProcessorVersionRequest + | undefined + ), + {} | undefined + ] + >; + getProcessorVersion( + request: protos.google.cloud.documentai.v1beta3.IGetProcessorVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.documentai.v1beta3.IProcessorVersion, + | protos.google.cloud.documentai.v1beta3.IGetProcessorVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getProcessorVersion( + request: protos.google.cloud.documentai.v1beta3.IGetProcessorVersionRequest, + callback: Callback< + protos.google.cloud.documentai.v1beta3.IProcessorVersion, + | protos.google.cloud.documentai.v1beta3.IGetProcessorVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getProcessorVersion( + request?: protos.google.cloud.documentai.v1beta3.IGetProcessorVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.documentai.v1beta3.IProcessorVersion, + | protos.google.cloud.documentai.v1beta3.IGetProcessorVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.documentai.v1beta3.IProcessorVersion, + | protos.google.cloud.documentai.v1beta3.IGetProcessorVersionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IProcessorVersion, + ( + | protos.google.cloud.documentai.v1beta3.IGetProcessorVersionRequest + | 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.getProcessorVersion(request, options, callback); + } /** * Creates a processor from the type processor that the user chose. * The processor will be at "ENABLED" state by default after its creation. @@ -614,7 +935,7 @@ export class DocumentProcessorServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The parent (project and location) under which to create the processor. - * Format: projects/{project}/locations/{location} + * Format: `projects/{project}/locations/{location}` * @param {google.cloud.documentai.v1beta3.Processor} request.processor * Required. The processor to be created, requires [processor_type] and [display_name] * to be set. Also, the processor is under CMEK if CMEK fields are set. @@ -716,7 +1037,11 @@ export class DocumentProcessorServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.name - * Required. The processor resource name. + * Required. The resource name of {@link google.cloud.documentai.v1beta3.Processor|Processor} or + * {@link google.cloud.documentai.v1beta3.ProcessorVersion|ProcessorVersion}. + * Format: `projects/{project}/locations/{location}/processors/{processor}`, + * or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` * @param {number[]} request.inputConfigs * The input config for each single document in the batch process. * @param {google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig} request.outputConfig @@ -859,13 +1184,13 @@ export class DocumentProcessorServiceClient { >; } /** - * Deletes the processor, unloads all deployed model artifacts if it was - * enabled and then deletes all artifacts associated with this processor. + * Deletes the processor version, all artifacts under the processor version + * will be deleted. * * @param {Object} request * The request object that will be sent. * @param {string} request.name - * Required. The processor resource name to be deleted. + * Required. The processor version resource name to 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. @@ -875,53 +1200,53 @@ export class DocumentProcessorServiceClient { * 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/v1beta3/document_processor_service.delete_processor.js - * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessor_async + * @example include:samples/generated/v1beta3/document_processor_service.delete_processor_version.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessorVersion_async */ - deleteProcessor( - request?: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, + deleteProcessorVersion( + request?: protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest, options?: CallOptions ): Promise< [ LROperation< protos.google.protobuf.IEmpty, - protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata + protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] >; - deleteProcessor( - request: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, + deleteProcessorVersion( + request: protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest, options: CallOptions, callback: Callback< LROperation< protos.google.protobuf.IEmpty, - protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata + protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; - deleteProcessor( - request: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, + deleteProcessorVersion( + request: protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest, callback: Callback< LROperation< protos.google.protobuf.IEmpty, - protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata + protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; - deleteProcessor( - request?: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, + deleteProcessorVersion( + request?: protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest, optionsOrCallback?: | CallOptions | Callback< LROperation< protos.google.protobuf.IEmpty, - protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata + protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined @@ -929,7 +1254,7 @@ export class DocumentProcessorServiceClient { callback?: Callback< LROperation< protos.google.protobuf.IEmpty, - protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata + protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined @@ -938,7 +1263,7 @@ export class DocumentProcessorServiceClient { [ LROperation< protos.google.protobuf.IEmpty, - protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata + protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined @@ -960,10 +1285,14 @@ export class DocumentProcessorServiceClient { name: request.name || '', }); this.initialize(); - return this.innerApiCalls.deleteProcessor(request, options, callback); + return this.innerApiCalls.deleteProcessorVersion( + request, + options, + callback + ); } /** - * Check the status of the long running operation returned by `deleteProcessor()`. + * Check the status of the long running operation returned by `deleteProcessorVersion()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. @@ -971,15 +1300,15 @@ export class DocumentProcessorServiceClient { * 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/v1beta3/document_processor_service.delete_processor.js - * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessor_async + * @example include:samples/generated/v1beta3/document_processor_service.delete_processor_version.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessorVersion_async */ - async checkDeleteProcessorProgress( + async checkDeleteProcessorVersionProgress( name: string ): Promise< LROperation< protos.google.protobuf.Empty, - protos.google.cloud.documentai.v1beta3.DeleteProcessorMetadata + protos.google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata > > { const request = new operationsProtos.google.longrunning.GetOperationRequest( @@ -988,21 +1317,21 @@ export class DocumentProcessorServiceClient { const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new gax.Operation( operation, - this.descriptors.longrunning.deleteProcessor, + this.descriptors.longrunning.deleteProcessorVersion, gax.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.protobuf.Empty, - protos.google.cloud.documentai.v1beta3.DeleteProcessorMetadata + protos.google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata >; } /** - * Enables a processor + * Deploys the processor version. * * @param {Object} request * The request object that will be sent. * @param {string} request.name - * Required. The processor resource name to be enabled. + * Required. The processor version resource name to be deployed. * @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. @@ -1012,61 +1341,61 @@ export class DocumentProcessorServiceClient { * 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/v1beta3/document_processor_service.enable_processor.js - * region_tag:documentai_v1beta3_generated_DocumentProcessorService_EnableProcessor_async + * @example include:samples/generated/v1beta3/document_processor_service.deploy_processor_version.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DeployProcessorVersion_async */ - enableProcessor( - request?: protos.google.cloud.documentai.v1beta3.IEnableProcessorRequest, + deployProcessorVersion( + request?: protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest, options?: CallOptions ): Promise< [ LROperation< - protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, - protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] >; - enableProcessor( - request: protos.google.cloud.documentai.v1beta3.IEnableProcessorRequest, + deployProcessorVersion( + request: protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest, options: CallOptions, callback: Callback< LROperation< - protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, - protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; - enableProcessor( - request: protos.google.cloud.documentai.v1beta3.IEnableProcessorRequest, + deployProcessorVersion( + request: protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest, callback: Callback< LROperation< - protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, - protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; - enableProcessor( - request?: protos.google.cloud.documentai.v1beta3.IEnableProcessorRequest, + deployProcessorVersion( + request?: protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest, optionsOrCallback?: | CallOptions | Callback< LROperation< - protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, - protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined >, callback?: Callback< LROperation< - protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, - protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined @@ -1074,8 +1403,8 @@ export class DocumentProcessorServiceClient { ): Promise< [ LROperation< - protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, - protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined @@ -1097,10 +1426,14 @@ export class DocumentProcessorServiceClient { name: request.name || '', }); this.initialize(); - return this.innerApiCalls.enableProcessor(request, options, callback); + return this.innerApiCalls.deployProcessorVersion( + request, + options, + callback + ); } /** - * Check the status of the long running operation returned by `enableProcessor()`. + * Check the status of the long running operation returned by `deployProcessorVersion()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. @@ -1108,15 +1441,15 @@ export class DocumentProcessorServiceClient { * 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/v1beta3/document_processor_service.enable_processor.js - * region_tag:documentai_v1beta3_generated_DocumentProcessorService_EnableProcessor_async + * @example include:samples/generated/v1beta3/document_processor_service.deploy_processor_version.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DeployProcessorVersion_async */ - async checkEnableProcessorProgress( + async checkDeployProcessorVersionProgress( name: string ): Promise< LROperation< - protos.google.cloud.documentai.v1beta3.EnableProcessorResponse, - protos.google.cloud.documentai.v1beta3.EnableProcessorMetadata + protos.google.cloud.documentai.v1beta3.DeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata > > { const request = new operationsProtos.google.longrunning.GetOperationRequest( @@ -1125,21 +1458,21 @@ export class DocumentProcessorServiceClient { const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new gax.Operation( operation, - this.descriptors.longrunning.enableProcessor, + this.descriptors.longrunning.deployProcessorVersion, gax.createDefaultBackoffSettings() ); return decodeOperation as LROperation< - protos.google.cloud.documentai.v1beta3.EnableProcessorResponse, - protos.google.cloud.documentai.v1beta3.EnableProcessorMetadata + protos.google.cloud.documentai.v1beta3.DeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata >; } /** - * Disables a processor + * Undeploys the processor version. * * @param {Object} request * The request object that will be sent. * @param {string} request.name - * Required. The processor resource name to be disabled. + * Required. The processor version resource name to be undeployed. * @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. @@ -1149,61 +1482,61 @@ export class DocumentProcessorServiceClient { * 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/v1beta3/document_processor_service.disable_processor.js - * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DisableProcessor_async + * @example include:samples/generated/v1beta3/document_processor_service.undeploy_processor_version.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_UndeployProcessorVersion_async */ - disableProcessor( - request?: protos.google.cloud.documentai.v1beta3.IDisableProcessorRequest, + undeployProcessorVersion( + request?: protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest, options?: CallOptions ): Promise< [ LROperation< - protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, - protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] >; - disableProcessor( - request: protos.google.cloud.documentai.v1beta3.IDisableProcessorRequest, + undeployProcessorVersion( + request: protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest, options: CallOptions, callback: Callback< LROperation< - protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, - protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; - disableProcessor( - request: protos.google.cloud.documentai.v1beta3.IDisableProcessorRequest, + undeployProcessorVersion( + request: protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest, callback: Callback< LROperation< - protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, - protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; - disableProcessor( - request?: protos.google.cloud.documentai.v1beta3.IDisableProcessorRequest, + undeployProcessorVersion( + request?: protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest, optionsOrCallback?: | CallOptions | Callback< LROperation< - protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, - protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined >, callback?: Callback< LROperation< - protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, - protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined @@ -1211,8 +1544,8 @@ export class DocumentProcessorServiceClient { ): Promise< [ LROperation< - protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, - protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined @@ -1234,10 +1567,14 @@ export class DocumentProcessorServiceClient { name: request.name || '', }); this.initialize(); - return this.innerApiCalls.disableProcessor(request, options, callback); + return this.innerApiCalls.undeployProcessorVersion( + request, + options, + callback + ); } /** - * Check the status of the long running operation returned by `disableProcessor()`. + * Check the status of the long running operation returned by `undeployProcessorVersion()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. @@ -1245,15 +1582,15 @@ export class DocumentProcessorServiceClient { * 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/v1beta3/document_processor_service.disable_processor.js - * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DisableProcessor_async + * @example include:samples/generated/v1beta3/document_processor_service.undeploy_processor_version.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_UndeployProcessorVersion_async */ - async checkDisableProcessorProgress( + async checkUndeployProcessorVersionProgress( name: string ): Promise< LROperation< - protos.google.cloud.documentai.v1beta3.DisableProcessorResponse, - protos.google.cloud.documentai.v1beta3.DisableProcessorMetadata + protos.google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata > > { const request = new operationsProtos.google.longrunning.GetOperationRequest( @@ -1262,31 +1599,22 @@ export class DocumentProcessorServiceClient { const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new gax.Operation( operation, - this.descriptors.longrunning.disableProcessor, + this.descriptors.longrunning.undeployProcessorVersion, gax.createDefaultBackoffSettings() ); return decodeOperation as LROperation< - protos.google.cloud.documentai.v1beta3.DisableProcessorResponse, - protos.google.cloud.documentai.v1beta3.DisableProcessorMetadata + protos.google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata >; } /** - * Send a document for Human Review. The input document should be processed by - * the specified processor. + * Deletes the processor, unloads all deployed model artifacts if it was + * enabled and then deletes all artifacts associated with this processor. * * @param {Object} request * The request object that will be sent. - * @param {google.cloud.documentai.v1beta3.Document} request.inlineDocument - * An inline document proto. - * @param {string} request.humanReviewConfig - * Required. The resource name of the HumanReviewConfig that the document will be - * reviewed with. - * @param {google.cloud.documentai.v1beta3.Document} request.document - * The document that needs human review. - * @param {boolean} request.enableSchemaValidation - * Whether the validation should be performed on the ad-hoc review request. - * @param {google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority} request.priority - * The priority of the human review task. + * @param {string} request.name + * Required. The processor resource name to 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. @@ -1296,61 +1624,61 @@ export class DocumentProcessorServiceClient { * 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/v1beta3/document_processor_service.review_document.js - * region_tag:documentai_v1beta3_generated_DocumentProcessorService_ReviewDocument_async + * @example include:samples/generated/v1beta3/document_processor_service.delete_processor.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessor_async */ - reviewDocument( - request?: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + deleteProcessor( + request?: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, options?: CallOptions ): Promise< [ LROperation< - protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, - protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] >; - reviewDocument( - request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + deleteProcessor( + request: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, options: CallOptions, callback: Callback< LROperation< - protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, - protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; - reviewDocument( - request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + deleteProcessor( + request: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, callback: Callback< LROperation< - protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, - protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; - reviewDocument( - request?: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + deleteProcessor( + request?: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, optionsOrCallback?: | CallOptions | Callback< LROperation< - protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, - protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined >, callback?: Callback< LROperation< - protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, - protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined @@ -1358,147 +1686,1119 @@ export class DocumentProcessorServiceClient { ): Promise< [ LROperation< - protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, - protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata + >, + 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.deleteProcessor(request, options, callback); + } + /** + * Check the status of the long running operation returned by `deleteProcessor()`. + * @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/v1beta3/document_processor_service.delete_processor.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessor_async + */ + async checkDeleteProcessorProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.documentai.v1beta3.DeleteProcessorMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.deleteProcessor, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.documentai.v1beta3.DeleteProcessorMetadata + >; + } + /** + * Enables a processor + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name to be enabled. + * @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/v1beta3/document_processor_service.enable_processor.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_EnableProcessor_async + */ + enableProcessor( + request?: protos.google.cloud.documentai.v1beta3.IEnableProcessorRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + enableProcessor( + request: protos.google.cloud.documentai.v1beta3.IEnableProcessorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + enableProcessor( + request: protos.google.cloud.documentai.v1beta3.IEnableProcessorRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + enableProcessor( + request?: protos.google.cloud.documentai.v1beta3.IEnableProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata >, 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; - } + 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.enableProcessor(request, options, callback); + } + /** + * Check the status of the long running operation returned by `enableProcessor()`. + * @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/v1beta3/document_processor_service.enable_processor.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_EnableProcessor_async + */ + async checkEnableProcessorProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1beta3.EnableProcessorResponse, + protos.google.cloud.documentai.v1beta3.EnableProcessorMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.enableProcessor, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1beta3.EnableProcessorResponse, + protos.google.cloud.documentai.v1beta3.EnableProcessorMetadata + >; + } + /** + * Disables a processor + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name to be disabled. + * @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/v1beta3/document_processor_service.disable_processor.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DisableProcessor_async + */ + disableProcessor( + request?: protos.google.cloud.documentai.v1beta3.IDisableProcessorRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + disableProcessor( + request: protos.google.cloud.documentai.v1beta3.IDisableProcessorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + disableProcessor( + request: protos.google.cloud.documentai.v1beta3.IDisableProcessorRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + disableProcessor( + request?: protos.google.cloud.documentai.v1beta3.IDisableProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + >, + 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.disableProcessor(request, options, callback); + } + /** + * Check the status of the long running operation returned by `disableProcessor()`. + * @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/v1beta3/document_processor_service.disable_processor.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DisableProcessor_async + */ + async checkDisableProcessorProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1beta3.DisableProcessorResponse, + protos.google.cloud.documentai.v1beta3.DisableProcessorMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.disableProcessor, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1beta3.DisableProcessorResponse, + protos.google.cloud.documentai.v1beta3.DisableProcessorMetadata + >; + } + /** + * Set the default (active) version of a {@link google.cloud.documentai.v1beta3.Processor|Processor} that will be used in + * {@link google.cloud.documentai.v1beta3.DocumentProcessorService.ProcessDocument|ProcessDocument} and + * {@link google.cloud.documentai.v1beta3.DocumentProcessorService.BatchProcessDocuments|BatchProcessDocuments}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.processor + * Required. The resource name of the {@link google.cloud.documentai.v1beta3.Processor|Processor} to change default version. + * @param {string} request.defaultProcessorVersion + * Required. The resource name of child {@link google.cloud.documentai.v1beta3.ProcessorVersion|ProcessorVersion} to use as default. + * Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}` + * @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/v1beta3/document_processor_service.set_default_processor_version.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_SetDefaultProcessorVersion_async + */ + setDefaultProcessorVersion( + request?: protos.google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + setDefaultProcessorVersion( + request: protos.google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + setDefaultProcessorVersion( + request: protos.google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + setDefaultProcessorVersion( + request?: protos.google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionMetadata + >, + 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({ + processor: request.processor || '', + }); + this.initialize(); + return this.innerApiCalls.setDefaultProcessorVersion( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `setDefaultProcessorVersion()`. + * @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/v1beta3/document_processor_service.set_default_processor_version.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_SetDefaultProcessorVersion_async + */ + async checkSetDefaultProcessorVersionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.setDefaultProcessorVersion, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata + >; + } + /** + * Send a document for Human Review. The input document should be processed by + * the specified processor. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.documentai.v1beta3.Document} request.inlineDocument + * An inline document proto. + * @param {string} request.humanReviewConfig + * Required. The resource name of the HumanReviewConfig that the document will be + * reviewed with. + * @param {google.cloud.documentai.v1beta3.Document} request.document + * The document that needs human review. + * @param {boolean} request.enableSchemaValidation + * Whether the validation should be performed on the ad-hoc review request. + * @param {google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority} request.priority + * The priority of the human review task. + * @param {google.cloud.documentai.v1beta3.DocumentSchema} request.documentSchema + * The document schema of the human review task. + * @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/v1beta3/document_processor_service.review_document.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_ReviewDocument_async + */ + reviewDocument( + request?: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + reviewDocument( + request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + reviewDocument( + request: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + reviewDocument( + request?: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >, + 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({ + human_review_config: request.humanReviewConfig || '', + }); + this.initialize(); + return this.innerApiCalls.reviewDocument(request, options, callback); + } + /** + * Check the status of the long running operation returned by `reviewDocument()`. + * @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/v1beta3/document_processor_service.review_document.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_ReviewDocument_async + */ + async checkReviewDocumentProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1beta3.ReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.reviewDocument, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1beta3.ReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + >; + } + /** + * Lists the processor types that exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location of processor type to list. + * The available processor types may depend on the allow-listing on projects. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of processor types to return. + * If unspecified, at most 100 processor types will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + * @param {string} request.pageToken + * Used to retrieve the next page of results, empty if at the end of the list. + * @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 [ProcessorType]{@link google.cloud.documentai.v1beta3.ProcessorType}. + * 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 `listProcessorTypesAsync()` + * 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. + */ + listProcessorTypes( + request?: protos.google.cloud.documentai.v1beta3.IListProcessorTypesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IProcessorType[], + protos.google.cloud.documentai.v1beta3.IListProcessorTypesRequest | null, + protos.google.cloud.documentai.v1beta3.IListProcessorTypesResponse + ] + >; + listProcessorTypes( + request: protos.google.cloud.documentai.v1beta3.IListProcessorTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.documentai.v1beta3.IListProcessorTypesRequest, + | protos.google.cloud.documentai.v1beta3.IListProcessorTypesResponse + | null + | undefined, + protos.google.cloud.documentai.v1beta3.IProcessorType + > + ): void; + listProcessorTypes( + request: protos.google.cloud.documentai.v1beta3.IListProcessorTypesRequest, + callback: PaginationCallback< + protos.google.cloud.documentai.v1beta3.IListProcessorTypesRequest, + | protos.google.cloud.documentai.v1beta3.IListProcessorTypesResponse + | null + | undefined, + protos.google.cloud.documentai.v1beta3.IProcessorType + > + ): void; + listProcessorTypes( + request?: protos.google.cloud.documentai.v1beta3.IListProcessorTypesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.documentai.v1beta3.IListProcessorTypesRequest, + | protos.google.cloud.documentai.v1beta3.IListProcessorTypesResponse + | null + | undefined, + protos.google.cloud.documentai.v1beta3.IProcessorType + >, + callback?: PaginationCallback< + protos.google.cloud.documentai.v1beta3.IListProcessorTypesRequest, + | protos.google.cloud.documentai.v1beta3.IListProcessorTypesResponse + | null + | undefined, + protos.google.cloud.documentai.v1beta3.IProcessorType + > + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IProcessorType[], + protos.google.cloud.documentai.v1beta3.IListProcessorTypesRequest | null, + protos.google.cloud.documentai.v1beta3.IListProcessorTypesResponse + ] + > | 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.listProcessorTypes(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 location of processor type to list. + * The available processor types may depend on the allow-listing on projects. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of processor types to return. + * If unspecified, at most 100 processor types will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + * @param {string} request.pageToken + * Used to retrieve the next page of results, empty if at the end of the list. + * @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 [ProcessorType]{@link google.cloud.documentai.v1beta3.ProcessorType} 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 `listProcessorTypesAsync()` + * 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. + */ + listProcessorTypesStream( + request?: protos.google.cloud.documentai.v1beta3.IListProcessorTypesRequest, + 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['listProcessorTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listProcessorTypes.createStream( + this.innerApiCalls.listProcessorTypes as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listProcessorTypes`, 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 location of processor type to list. + * The available processor types may depend on the allow-listing on projects. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of processor types to return. + * If unspecified, at most 100 processor types will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + * @param {string} request.pageToken + * Used to retrieve the next page of results, empty if at the end of the list. + * @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 + * [ProcessorType]{@link google.cloud.documentai.v1beta3.ProcessorType}. 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/v1beta3/document_processor_service.list_processor_types.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_ListProcessorTypes_async + */ + listProcessorTypesAsync( + request?: protos.google.cloud.documentai.v1beta3.IListProcessorTypesRequest, + 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['listProcessorTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listProcessorTypes.asyncIterate( + this.innerApiCalls['listProcessorTypes'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists all processors which belong to this project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) which owns this collection of Processors. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of processors to return. + * If unspecified, at most 50 processors will be returned. + * The maximum value is 100; values above 100 will be coerced to 100. + * @param {string} request.pageToken + * We will return the processors sorted by creation time. The page token + * will point to the next processor. + * @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 [Processor]{@link google.cloud.documentai.v1beta3.Processor}. + * 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 `listProcessorsAsync()` + * 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. + */ + listProcessors( + request?: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IProcessor[], + protos.google.cloud.documentai.v1beta3.IListProcessorsRequest | null, + protos.google.cloud.documentai.v1beta3.IListProcessorsResponse + ] + >; + listProcessors( + request: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + | protos.google.cloud.documentai.v1beta3.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.documentai.v1beta3.IProcessor + > + ): void; + listProcessors( + request: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + callback: PaginationCallback< + protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + | protos.google.cloud.documentai.v1beta3.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.documentai.v1beta3.IProcessor + > + ): void; + listProcessors( + request?: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + | protos.google.cloud.documentai.v1beta3.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.documentai.v1beta3.IProcessor + >, + callback?: PaginationCallback< + protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + | protos.google.cloud.documentai.v1beta3.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.documentai.v1beta3.IProcessor + > + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IProcessor[], + protos.google.cloud.documentai.v1beta3.IListProcessorsRequest | null, + protos.google.cloud.documentai.v1beta3.IListProcessorsResponse + ] + > | 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.listProcessors(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 (project and location) which owns this collection of Processors. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of processors to return. + * If unspecified, at most 50 processors will be returned. + * The maximum value is 100; values above 100 will be coerced to 100. + * @param {string} request.pageToken + * We will return the processors sorted by creation time. The page token + * will point to the next processor. + * @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 [Processor]{@link google.cloud.documentai.v1beta3.Processor} 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 `listProcessorsAsync()` + * 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. + */ + listProcessorsStream( + request?: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + 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['listProcessors']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listProcessors.createStream( + this.innerApiCalls.listProcessors as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listProcessors`, 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 (project and location) which owns this collection of Processors. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of processors to return. + * If unspecified, at most 50 processors will be returned. + * The maximum value is 100; values above 100 will be coerced to 100. + * @param {string} request.pageToken + * We will return the processors sorted by creation time. The page token + * will point to the next processor. + * @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 + * [Processor]{@link google.cloud.documentai.v1beta3.Processor}. 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/v1beta3/document_processor_service.list_processors.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_ListProcessors_async + */ + listProcessorsAsync( + request?: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + 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({ - human_review_config: request.humanReviewConfig || '', + parent: request.parent || '', }); + const defaultCallSettings = this._defaults['listProcessors']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); - return this.innerApiCalls.reviewDocument(request, options, callback); - } - /** - * Check the status of the long running operation returned by `reviewDocument()`. - * @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/v1beta3/document_processor_service.review_document.js - * region_tag:documentai_v1beta3_generated_DocumentProcessorService_ReviewDocument_async - */ - async checkReviewDocumentProgress( - name: string - ): Promise< - LROperation< - protos.google.cloud.documentai.v1beta3.ReviewDocumentResponse, - protos.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata - > - > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( - operation, - this.descriptors.longrunning.reviewDocument, - gax.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.cloud.documentai.v1beta3.ReviewDocumentResponse, - protos.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata - >; + return this.descriptors.page.listProcessors.asyncIterate( + this.innerApiCalls['listProcessors'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; } /** - * Lists all processors which belong to this project. + * Lists all versions of a processor. * * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The parent (project and location) which owns this collection of Processors. - * Format: projects/{project}/locations/{location} + * Required. The parent (project, location and processor) to list all versions. + * Format: `projects/{project}/locations/{location}/processors/{processor}` * @param {number} request.pageSize - * The maximum number of processors to return. - * If unspecified, at most 50 processors will be returned. - * The maximum value is 100; values above 100 will be coerced to 100. + * The maximum number of processor versions to return. + * If unspecified, at most 10 processor versions will be returned. + * The maximum value is 20; values above 20 will be coerced to 20. * @param {string} request.pageToken - * We will return the processors sorted by creation time. The page token - * will point to the next processor. + * We will return the processor versions sorted by creation time. The page + * token will point to the next processor version. * @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 [Processor]{@link google.cloud.documentai.v1beta3.Processor}. + * The first element of the array is Array of [ProcessorVersion]{@link google.cloud.documentai.v1beta3.ProcessorVersion}. * 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 `listProcessorsAsync()` + * We recommend using `listProcessorVersionsAsync()` * 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. */ - listProcessors( - request?: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + listProcessorVersions( + request?: protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, options?: CallOptions ): Promise< [ - protos.google.cloud.documentai.v1beta3.IProcessor[], - protos.google.cloud.documentai.v1beta3.IListProcessorsRequest | null, - protos.google.cloud.documentai.v1beta3.IListProcessorsResponse + protos.google.cloud.documentai.v1beta3.IProcessorVersion[], + protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest | null, + protos.google.cloud.documentai.v1beta3.IListProcessorVersionsResponse ] >; - listProcessors( - request: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + listProcessorVersions( + request: protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, options: CallOptions, callback: PaginationCallback< - protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, - | protos.google.cloud.documentai.v1beta3.IListProcessorsResponse + protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, + | protos.google.cloud.documentai.v1beta3.IListProcessorVersionsResponse | null | undefined, - protos.google.cloud.documentai.v1beta3.IProcessor + protos.google.cloud.documentai.v1beta3.IProcessorVersion > ): void; - listProcessors( - request: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + listProcessorVersions( + request: protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, callback: PaginationCallback< - protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, - | protos.google.cloud.documentai.v1beta3.IListProcessorsResponse + protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, + | protos.google.cloud.documentai.v1beta3.IListProcessorVersionsResponse | null | undefined, - protos.google.cloud.documentai.v1beta3.IProcessor + protos.google.cloud.documentai.v1beta3.IProcessorVersion > ): void; - listProcessors( - request?: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + listProcessorVersions( + request?: protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, optionsOrCallback?: | CallOptions | PaginationCallback< - protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, - | protos.google.cloud.documentai.v1beta3.IListProcessorsResponse + protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, + | protos.google.cloud.documentai.v1beta3.IListProcessorVersionsResponse | null | undefined, - protos.google.cloud.documentai.v1beta3.IProcessor + protos.google.cloud.documentai.v1beta3.IProcessorVersion >, callback?: PaginationCallback< - protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, - | protos.google.cloud.documentai.v1beta3.IListProcessorsResponse + protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, + | protos.google.cloud.documentai.v1beta3.IListProcessorVersionsResponse | null | undefined, - protos.google.cloud.documentai.v1beta3.IProcessor + protos.google.cloud.documentai.v1beta3.IProcessorVersion > ): Promise< [ - protos.google.cloud.documentai.v1beta3.IProcessor[], - protos.google.cloud.documentai.v1beta3.IListProcessorsRequest | null, - protos.google.cloud.documentai.v1beta3.IListProcessorsResponse + protos.google.cloud.documentai.v1beta3.IProcessorVersion[], + protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest | null, + protos.google.cloud.documentai.v1beta3.IListProcessorVersionsResponse ] > | void { request = request || {}; @@ -1517,7 +2817,7 @@ export class DocumentProcessorServiceClient { parent: request.parent || '', }); this.initialize(); - return this.innerApiCalls.listProcessors(request, options, callback); + return this.innerApiCalls.listProcessorVersions(request, options, callback); } /** @@ -1525,29 +2825,29 @@ export class DocumentProcessorServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The parent (project and location) which owns this collection of Processors. - * Format: projects/{project}/locations/{location} + * Required. The parent (project, location and processor) to list all versions. + * Format: `projects/{project}/locations/{location}/processors/{processor}` * @param {number} request.pageSize - * The maximum number of processors to return. - * If unspecified, at most 50 processors will be returned. - * The maximum value is 100; values above 100 will be coerced to 100. + * The maximum number of processor versions to return. + * If unspecified, at most 10 processor versions will be returned. + * The maximum value is 20; values above 20 will be coerced to 20. * @param {string} request.pageToken - * We will return the processors sorted by creation time. The page token - * will point to the next processor. + * We will return the processor versions sorted by creation time. The page + * token will point to the next processor version. * @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 [Processor]{@link google.cloud.documentai.v1beta3.Processor} on 'data' event. + * An object stream which emits an object representing [ProcessorVersion]{@link google.cloud.documentai.v1beta3.ProcessorVersion} 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 `listProcessorsAsync()` + * We recommend using `listProcessorVersionsAsync()` * 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. */ - listProcessorsStream( - request?: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + listProcessorVersionsStream( + request?: protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, options?: CallOptions ): Transform { request = request || {}; @@ -1558,49 +2858,49 @@ export class DocumentProcessorServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const defaultCallSettings = this._defaults['listProcessors']; + const defaultCallSettings = this._defaults['listProcessorVersions']; const callSettings = defaultCallSettings.merge(options); this.initialize(); - return this.descriptors.page.listProcessors.createStream( - this.innerApiCalls.listProcessors as gax.GaxCall, + return this.descriptors.page.listProcessorVersions.createStream( + this.innerApiCalls.listProcessorVersions as gax.GaxCall, request, callSettings ); } /** - * Equivalent to `listProcessors`, but returns an iterable object. + * Equivalent to `listProcessorVersions`, 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 (project and location) which owns this collection of Processors. - * Format: projects/{project}/locations/{location} + * Required. The parent (project, location and processor) to list all versions. + * Format: `projects/{project}/locations/{location}/processors/{processor}` * @param {number} request.pageSize - * The maximum number of processors to return. - * If unspecified, at most 50 processors will be returned. - * The maximum value is 100; values above 100 will be coerced to 100. + * The maximum number of processor versions to return. + * If unspecified, at most 10 processor versions will be returned. + * The maximum value is 20; values above 20 will be coerced to 20. * @param {string} request.pageToken - * We will return the processors sorted by creation time. The page token - * will point to the next processor. + * We will return the processor versions sorted by creation time. The page + * token will point to the next processor version. * @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 - * [Processor]{@link google.cloud.documentai.v1beta3.Processor}. The API will be called under the hood as needed, once per the page, + * [ProcessorVersion]{@link google.cloud.documentai.v1beta3.ProcessorVersion}. 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/v1beta3/document_processor_service.list_processors.js - * region_tag:documentai_v1beta3_generated_DocumentProcessorService_ListProcessors_async + * @example include:samples/generated/v1beta3/document_processor_service.list_processor_versions.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_ListProcessorVersions_async */ - listProcessorsAsync( - request?: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest, + listProcessorVersionsAsync( + request?: protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, options?: CallOptions - ): AsyncIterable { + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -1609,15 +2909,272 @@ export class DocumentProcessorServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const defaultCallSettings = this._defaults['listProcessors']; + const defaultCallSettings = this._defaults['listProcessorVersions']; const callSettings = defaultCallSettings.merge(options); this.initialize(); - return this.descriptors.page.listProcessors.asyncIterate( - this.innerApiCalls['listProcessors'] as GaxCall, + return this.descriptors.page.listProcessorVersions.asyncIterate( + this.innerApiCalls['listProcessorVersions'] as GaxCall, request as unknown as RequestType, callSettings - ) as AsyncIterable; + ) 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 -- // -------------------- @@ -1817,6 +3374,81 @@ export class DocumentProcessorServiceClient { .processor_type; } + /** + * Return a fully-qualified processorVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} processor + * @param {string} processor_version + * @returns {string} Resource name string. + */ + processorVersionPath( + project: string, + location: string, + processor: string, + processorVersion: string + ) { + return this.pathTemplates.processorVersionPathTemplate.render({ + project: project, + location: location, + processor: processor, + processor_version: processorVersion, + }); + } + + /** + * Parse the project from ProcessorVersion resource. + * + * @param {string} processorVersionName + * A fully-qualified path representing ProcessorVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProcessorVersionName(processorVersionName: string) { + return this.pathTemplates.processorVersionPathTemplate.match( + processorVersionName + ).project; + } + + /** + * Parse the location from ProcessorVersion resource. + * + * @param {string} processorVersionName + * A fully-qualified path representing ProcessorVersion resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProcessorVersionName(processorVersionName: string) { + return this.pathTemplates.processorVersionPathTemplate.match( + processorVersionName + ).location; + } + + /** + * Parse the processor from ProcessorVersion resource. + * + * @param {string} processorVersionName + * A fully-qualified path representing ProcessorVersion resource. + * @returns {string} A string representing the processor. + */ + matchProcessorFromProcessorVersionName(processorVersionName: string) { + return this.pathTemplates.processorVersionPathTemplate.match( + processorVersionName + ).processor; + } + + /** + * Parse the processor_version from ProcessorVersion resource. + * + * @param {string} processorVersionName + * A fully-qualified path representing ProcessorVersion resource. + * @returns {string} A string representing the processor_version. + */ + matchProcessorVersionFromProcessorVersionName(processorVersionName: string) { + return this.pathTemplates.processorVersionPathTemplate.match( + processorVersionName + ).processor_version; + } + /** * Return a fully-qualified project resource name string. * @@ -1851,6 +3483,7 @@ export class DocumentProcessorServiceClient { return this.documentProcessorServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); this.operationsClient.close(); }); } diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client_config.json b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client_config.json index 8fde58b8d7f..7f6b23b7082 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client_config.json +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client_config.json @@ -34,10 +34,38 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "ListProcessorTypes": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "ListProcessors": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "GetProcessor": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetProcessorVersion": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListProcessorVersions": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteProcessorVersion": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeployProcessorVersion": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UndeployProcessorVersion": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "CreateProcessor": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" @@ -54,6 +82,10 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "SetDefaultProcessorVersion": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "ReviewDocument": { "timeout_millis": 120000, "retry_codes_name": "idempotent", diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json index e6cd8590089..8264c6d698a 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json @@ -1,7 +1,9 @@ [ + "../../protos/google/cloud/documentai/v1beta3/barcode.proto", "../../protos/google/cloud/documentai/v1beta3/document.proto", "../../protos/google/cloud/documentai/v1beta3/document_io.proto", "../../protos/google/cloud/documentai/v1beta3/document_processor_service.proto", + "../../protos/google/cloud/documentai/v1beta3/document_schema.proto", "../../protos/google/cloud/documentai/v1beta3/geometry.proto", "../../protos/google/cloud/documentai/v1beta3/operation_metadata.proto", "../../protos/google/cloud/documentai/v1beta3/processor.proto", diff --git a/packages/google-cloud-documentai/src/v1beta3/gapic_metadata.json b/packages/google-cloud-documentai/src/v1beta3/gapic_metadata.json index 791a44e4dd5..120820fcb8e 100644 --- a/packages/google-cloud-documentai/src/v1beta3/gapic_metadata.json +++ b/packages/google-cloud-documentai/src/v1beta3/gapic_metadata.json @@ -20,6 +20,16 @@ "fetchProcessorTypes" ] }, + "GetProcessor": { + "methods": [ + "getProcessor" + ] + }, + "GetProcessorVersion": { + "methods": [ + "getProcessorVersion" + ] + }, "CreateProcessor": { "methods": [ "createProcessor" @@ -30,6 +40,21 @@ "batchProcessDocuments" ] }, + "DeleteProcessorVersion": { + "methods": [ + "deleteProcessorVersion" + ] + }, + "DeployProcessorVersion": { + "methods": [ + "deployProcessorVersion" + ] + }, + "UndeployProcessorVersion": { + "methods": [ + "undeployProcessorVersion" + ] + }, "DeleteProcessor": { "methods": [ "deleteProcessor" @@ -45,17 +70,36 @@ "disableProcessor" ] }, + "SetDefaultProcessorVersion": { + "methods": [ + "setDefaultProcessorVersion" + ] + }, "ReviewDocument": { "methods": [ "reviewDocument" ] }, + "ListProcessorTypes": { + "methods": [ + "listProcessorTypes", + "listProcessorTypesStream", + "listProcessorTypesAsync" + ] + }, "ListProcessors": { "methods": [ "listProcessors", "listProcessorsStream", "listProcessorsAsync" ] + }, + "ListProcessorVersions": { + "methods": [ + "listProcessorVersions", + "listProcessorVersionsStream", + "listProcessorVersionsAsync" + ] } } }, @@ -72,6 +116,16 @@ "fetchProcessorTypes" ] }, + "GetProcessor": { + "methods": [ + "getProcessor" + ] + }, + "GetProcessorVersion": { + "methods": [ + "getProcessorVersion" + ] + }, "CreateProcessor": { "methods": [ "createProcessor" @@ -82,6 +136,21 @@ "batchProcessDocuments" ] }, + "DeleteProcessorVersion": { + "methods": [ + "deleteProcessorVersion" + ] + }, + "DeployProcessorVersion": { + "methods": [ + "deployProcessorVersion" + ] + }, + "UndeployProcessorVersion": { + "methods": [ + "undeployProcessorVersion" + ] + }, "DeleteProcessor": { "methods": [ "deleteProcessor" @@ -97,17 +166,36 @@ "disableProcessor" ] }, + "SetDefaultProcessorVersion": { + "methods": [ + "setDefaultProcessorVersion" + ] + }, "ReviewDocument": { "methods": [ "reviewDocument" ] }, + "ListProcessorTypes": { + "methods": [ + "listProcessorTypes", + "listProcessorTypesStream", + "listProcessorTypesAsync" + ] + }, "ListProcessors": { "methods": [ "listProcessors", "listProcessorsStream", "listProcessorsAsync" ] + }, + "ListProcessorVersions": { + "methods": [ + "listProcessorVersions", + "listProcessorVersionsStream", + "listProcessorVersionsAsync" + ] } } } diff --git a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts index 24d778aea4d..0e1e515df9f 100644 --- a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts @@ -25,7 +25,12 @@ import * as documentprocessorserviceModule 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 = ( @@ -542,6 +547,283 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); }); + describe('getProcessor', () => { + it('invokes getProcessor without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.GetProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ); + client.innerApiCalls.getProcessor = stubSimpleCall(expectedResponse); + const [response] = await client.getProcessor(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getProcessor without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.GetProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ); + client.innerApiCalls.getProcessor = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getProcessor( + request, + ( + err?: Error | null, + result?: protos.google.cloud.documentai.v1beta3.IProcessor | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getProcessor with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.GetProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getProcessor = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getProcessor(request), expectedError); + assert( + (client.innerApiCalls.getProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getProcessor with closed client', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.GetProcessorRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getProcessor(request), expectedError); + }); + }); + + describe('getProcessorVersion', () => { + it('invokes getProcessorVersion without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.GetProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ); + client.innerApiCalls.getProcessorVersion = + stubSimpleCall(expectedResponse); + const [response] = await client.getProcessorVersion(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getProcessorVersion without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.GetProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ); + client.innerApiCalls.getProcessorVersion = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getProcessorVersion( + request, + ( + err?: Error | null, + result?: protos.google.cloud.documentai.v1beta3.IProcessorVersion | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getProcessorVersion with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.GetProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getProcessorVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getProcessorVersion(request), expectedError); + assert( + (client.innerApiCalls.getProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getProcessorVersion with closed client', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.GetProcessorVersionRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getProcessorVersion(request), expectedError); + }); + }); + describe('createProcessor', () => { it('invokes createProcessor without error', async () => { const client = @@ -895,8 +1177,8 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); }); - describe('deleteProcessor', () => { - it('invokes deleteProcessor without error', async () => { + describe('deleteProcessorVersion', () => { + it('invokes deleteProcessorVersion without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -906,7 +1188,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.DeleteProcessorRequest() + new protos.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest() ); request.name = ''; const expectedHeaderRequestParams = 'name='; @@ -920,19 +1202,19 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteProcessor = + client.innerApiCalls.deleteProcessorVersion = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteProcessor(request); + const [operation] = await client.deleteProcessorVersion(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.deleteProcessor as SinonStub) + (client.innerApiCalls.deleteProcessorVersion as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes deleteProcessor without error using callback', async () => { + it('invokes deleteProcessorVersion without error using callback', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -942,7 +1224,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.DeleteProcessorRequest() + new protos.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest() ); request.name = ''; const expectedHeaderRequestParams = 'name='; @@ -956,16 +1238,16 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteProcessor = + client.innerApiCalls.deleteProcessorVersion = stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.deleteProcessor( + client.deleteProcessorVersion( request, ( err?: Error | null, result?: LROperation< protos.google.protobuf.IEmpty, - protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata + protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata > | null ) => { if (err) { @@ -978,18 +1260,18 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); const operation = (await promise) as LROperation< protos.google.protobuf.IEmpty, - protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata + protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.deleteProcessor as SinonStub) + (client.innerApiCalls.deleteProcessorVersion as SinonStub) .getCall(0) .calledWith(request, expectedOptions /*, callback defined above */) ); }); - it('invokes deleteProcessor with call error', async () => { + it('invokes deleteProcessorVersion with call error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -999,7 +1281,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.DeleteProcessorRequest() + new protos.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest() ); request.name = ''; const expectedHeaderRequestParams = 'name='; @@ -1011,19 +1293,22 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }, }; const expectedError = new Error('expected'); - client.innerApiCalls.deleteProcessor = stubLongRunningCall( + client.innerApiCalls.deleteProcessorVersion = stubLongRunningCall( undefined, expectedError ); - await assert.rejects(client.deleteProcessor(request), expectedError); + await assert.rejects( + client.deleteProcessorVersion(request), + expectedError + ); assert( - (client.innerApiCalls.deleteProcessor as SinonStub) + (client.innerApiCalls.deleteProcessorVersion as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes deleteProcessor with LRO error', async () => { + it('invokes deleteProcessorVersion with LRO error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1033,7 +1318,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.DeleteProcessorRequest() + new protos.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest() ); request.name = ''; const expectedHeaderRequestParams = 'name='; @@ -1045,21 +1330,21 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }, }; const expectedError = new Error('expected'); - client.innerApiCalls.deleteProcessor = stubLongRunningCall( + client.innerApiCalls.deleteProcessorVersion = stubLongRunningCall( undefined, undefined, expectedError ); - const [operation] = await client.deleteProcessor(request); + const [operation] = await client.deleteProcessorVersion(request); await assert.rejects(operation.promise(), expectedError); assert( - (client.innerApiCalls.deleteProcessor as SinonStub) + (client.innerApiCalls.deleteProcessorVersion as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes checkDeleteProcessorProgress without error', async () => { + it('invokes checkDeleteProcessorVersionProgress without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1076,7 +1361,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteProcessorProgress( + const decodedOperation = await client.checkDeleteProcessorVersionProgress( expectedResponse.name ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); @@ -1084,7 +1369,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - it('invokes checkDeleteProcessorProgress with error', async () => { + it('invokes checkDeleteProcessorVersionProgress with error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1100,15 +1385,15 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { expectedError ); await assert.rejects( - client.checkDeleteProcessorProgress(''), + client.checkDeleteProcessorVersionProgress(''), expectedError ); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); - describe('enableProcessor', () => { - it('invokes enableProcessor without error', async () => { + describe('deployProcessorVersion', () => { + it('invokes deployProcessorVersion without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1118,7 +1403,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.EnableProcessorRequest() + new protos.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest() ); request.name = ''; const expectedHeaderRequestParams = 'name='; @@ -1132,19 +1417,19 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.enableProcessor = + client.innerApiCalls.deployProcessorVersion = stubLongRunningCall(expectedResponse); - const [operation] = await client.enableProcessor(request); + const [operation] = await client.deployProcessorVersion(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.enableProcessor as SinonStub) + (client.innerApiCalls.deployProcessorVersion as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes enableProcessor without error using callback', async () => { + it('invokes deployProcessorVersion without error using callback', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1154,7 +1439,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.EnableProcessorRequest() + new protos.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest() ); request.name = ''; const expectedHeaderRequestParams = 'name='; @@ -1168,16 +1453,16 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.enableProcessor = + client.innerApiCalls.deployProcessorVersion = stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.enableProcessor( + client.deployProcessorVersion( request, ( err?: Error | null, result?: LROperation< - protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, - protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata > | null ) => { if (err) { @@ -1189,19 +1474,19 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); }); const operation = (await promise) as LROperation< - protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, - protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.enableProcessor as SinonStub) + (client.innerApiCalls.deployProcessorVersion as SinonStub) .getCall(0) .calledWith(request, expectedOptions /*, callback defined above */) ); }); - it('invokes enableProcessor with call error', async () => { + it('invokes deployProcessorVersion with call error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1211,7 +1496,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.EnableProcessorRequest() + new protos.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest() ); request.name = ''; const expectedHeaderRequestParams = 'name='; @@ -1223,19 +1508,22 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }, }; const expectedError = new Error('expected'); - client.innerApiCalls.enableProcessor = stubLongRunningCall( + client.innerApiCalls.deployProcessorVersion = stubLongRunningCall( undefined, expectedError ); - await assert.rejects(client.enableProcessor(request), expectedError); + await assert.rejects( + client.deployProcessorVersion(request), + expectedError + ); assert( - (client.innerApiCalls.enableProcessor as SinonStub) + (client.innerApiCalls.deployProcessorVersion as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes enableProcessor with LRO error', async () => { + it('invokes deployProcessorVersion with LRO error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1245,7 +1533,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.EnableProcessorRequest() + new protos.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest() ); request.name = ''; const expectedHeaderRequestParams = 'name='; @@ -1257,21 +1545,21 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }, }; const expectedError = new Error('expected'); - client.innerApiCalls.enableProcessor = stubLongRunningCall( + client.innerApiCalls.deployProcessorVersion = stubLongRunningCall( undefined, undefined, expectedError ); - const [operation] = await client.enableProcessor(request); + const [operation] = await client.deployProcessorVersion(request); await assert.rejects(operation.promise(), expectedError); assert( - (client.innerApiCalls.enableProcessor as SinonStub) + (client.innerApiCalls.deployProcessorVersion as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes checkEnableProcessorProgress without error', async () => { + it('invokes checkDeployProcessorVersionProgress without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1288,7 +1576,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkEnableProcessorProgress( + const decodedOperation = await client.checkDeployProcessorVersionProgress( expectedResponse.name ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); @@ -1296,7 +1584,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - it('invokes checkEnableProcessorProgress with error', async () => { + it('invokes checkDeployProcessorVersionProgress with error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1312,15 +1600,15 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { expectedError ); await assert.rejects( - client.checkEnableProcessorProgress(''), + client.checkDeployProcessorVersionProgress(''), expectedError ); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); - describe('disableProcessor', () => { - it('invokes disableProcessor without error', async () => { + describe('undeployProcessorVersion', () => { + it('invokes undeployProcessorVersion without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1330,7 +1618,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.DisableProcessorRequest() + new protos.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest() ); request.name = ''; const expectedHeaderRequestParams = 'name='; @@ -1344,19 +1632,19 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.disableProcessor = + client.innerApiCalls.undeployProcessorVersion = stubLongRunningCall(expectedResponse); - const [operation] = await client.disableProcessor(request); + const [operation] = await client.undeployProcessorVersion(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.disableProcessor as SinonStub) + (client.innerApiCalls.undeployProcessorVersion as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes disableProcessor without error using callback', async () => { + it('invokes undeployProcessorVersion without error using callback', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1366,7 +1654,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.DisableProcessorRequest() + new protos.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest() ); request.name = ''; const expectedHeaderRequestParams = 'name='; @@ -1380,16 +1668,16 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.disableProcessor = + client.innerApiCalls.undeployProcessorVersion = stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.disableProcessor( + client.undeployProcessorVersion( request, ( err?: Error | null, result?: LROperation< - protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, - protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata > | null ) => { if (err) { @@ -1401,19 +1689,19 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); }); const operation = (await promise) as LROperation< - protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, - protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.disableProcessor as SinonStub) + (client.innerApiCalls.undeployProcessorVersion as SinonStub) .getCall(0) .calledWith(request, expectedOptions /*, callback defined above */) ); }); - it('invokes disableProcessor with call error', async () => { + it('invokes undeployProcessorVersion with call error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1423,7 +1711,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.DisableProcessorRequest() + new protos.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest() ); request.name = ''; const expectedHeaderRequestParams = 'name='; @@ -1435,19 +1723,22 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }, }; const expectedError = new Error('expected'); - client.innerApiCalls.disableProcessor = stubLongRunningCall( + client.innerApiCalls.undeployProcessorVersion = stubLongRunningCall( undefined, expectedError ); - await assert.rejects(client.disableProcessor(request), expectedError); + await assert.rejects( + client.undeployProcessorVersion(request), + expectedError + ); assert( - (client.innerApiCalls.disableProcessor as SinonStub) + (client.innerApiCalls.undeployProcessorVersion as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes disableProcessor with LRO error', async () => { + it('invokes undeployProcessorVersion with LRO error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1457,7 +1748,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.DisableProcessorRequest() + new protos.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest() ); request.name = ''; const expectedHeaderRequestParams = 'name='; @@ -1469,21 +1760,21 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }, }; const expectedError = new Error('expected'); - client.innerApiCalls.disableProcessor = stubLongRunningCall( + client.innerApiCalls.undeployProcessorVersion = stubLongRunningCall( undefined, undefined, expectedError ); - const [operation] = await client.disableProcessor(request); + const [operation] = await client.undeployProcessorVersion(request); await assert.rejects(operation.promise(), expectedError); assert( - (client.innerApiCalls.disableProcessor as SinonStub) + (client.innerApiCalls.undeployProcessorVersion as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes checkDisableProcessorProgress without error', async () => { + it('invokes checkUndeployProcessorVersionProgress without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1500,15 +1791,16 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDisableProcessorProgress( - expectedResponse.name - ); + const decodedOperation = + await client.checkUndeployProcessorVersionProgress( + expectedResponse.name + ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); assert(decodedOperation.metadata); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - it('invokes checkDisableProcessorProgress with error', async () => { + it('invokes checkUndeployProcessorVersionProgress with error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1524,15 +1816,15 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { expectedError ); await assert.rejects( - client.checkDisableProcessorProgress(''), + client.checkUndeployProcessorVersionProgress(''), expectedError ); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); - describe('reviewDocument', () => { - it('invokes reviewDocument without error', async () => { + describe('deleteProcessor', () => { + it('invokes deleteProcessor without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1542,10 +1834,10 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() + new protos.google.cloud.documentai.v1beta3.DeleteProcessorRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; + request.name = ''; + const expectedHeaderRequestParams = 'name='; const expectedOptions = { otherArgs: { headers: { @@ -1556,19 +1848,19 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.reviewDocument = + client.innerApiCalls.deleteProcessor = stubLongRunningCall(expectedResponse); - const [operation] = await client.reviewDocument(request); + const [operation] = await client.deleteProcessor(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.reviewDocument as SinonStub) + (client.innerApiCalls.deleteProcessor as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes reviewDocument without error using callback', async () => { + it('invokes deleteProcessor without error using callback', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1578,10 +1870,10 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() + new protos.google.cloud.documentai.v1beta3.DeleteProcessorRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; + request.name = ''; + const expectedHeaderRequestParams = 'name='; const expectedOptions = { otherArgs: { headers: { @@ -1592,16 +1884,16 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.reviewDocument = + client.innerApiCalls.deleteProcessor = stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.reviewDocument( + client.deleteProcessor( request, ( err?: Error | null, result?: LROperation< - protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, - protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata > | null ) => { if (err) { @@ -1613,19 +1905,19 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); }); const operation = (await promise) as LROperation< - protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, - protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.reviewDocument as SinonStub) + (client.innerApiCalls.deleteProcessor as SinonStub) .getCall(0) .calledWith(request, expectedOptions /*, callback defined above */) ); }); - it('invokes reviewDocument with call error', async () => { + it('invokes deleteProcessor with call error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1635,10 +1927,10 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() + new protos.google.cloud.documentai.v1beta3.DeleteProcessorRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; + request.name = ''; + const expectedHeaderRequestParams = 'name='; const expectedOptions = { otherArgs: { headers: { @@ -1647,19 +1939,19 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }, }; const expectedError = new Error('expected'); - client.innerApiCalls.reviewDocument = stubLongRunningCall( + client.innerApiCalls.deleteProcessor = stubLongRunningCall( undefined, expectedError ); - await assert.rejects(client.reviewDocument(request), expectedError); + await assert.rejects(client.deleteProcessor(request), expectedError); assert( - (client.innerApiCalls.reviewDocument as SinonStub) + (client.innerApiCalls.deleteProcessor as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes reviewDocument with LRO error', async () => { + it('invokes deleteProcessor with LRO error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1669,10 +1961,10 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() + new protos.google.cloud.documentai.v1beta3.DeleteProcessorRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; + request.name = ''; + const expectedHeaderRequestParams = 'name='; const expectedOptions = { otherArgs: { headers: { @@ -1681,21 +1973,21 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }, }; const expectedError = new Error('expected'); - client.innerApiCalls.reviewDocument = stubLongRunningCall( + client.innerApiCalls.deleteProcessor = stubLongRunningCall( undefined, undefined, expectedError ); - const [operation] = await client.reviewDocument(request); + const [operation] = await client.deleteProcessor(request); await assert.rejects(operation.promise(), expectedError); assert( - (client.innerApiCalls.reviewDocument as SinonStub) + (client.innerApiCalls.deleteProcessor as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes checkReviewDocumentProgress without error', async () => { + it('invokes checkDeleteProcessorProgress without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1712,7 +2004,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkReviewDocumentProgress( + const decodedOperation = await client.checkDeleteProcessorProgress( expectedResponse.name ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); @@ -1720,7 +2012,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - it('invokes checkReviewDocumentProgress with error', async () => { + it('invokes checkDeleteProcessorProgress with error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1736,15 +2028,15 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { expectedError ); await assert.rejects( - client.checkReviewDocumentProgress(''), + client.checkDeleteProcessorProgress(''), expectedError ); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); - describe('listProcessors', () => { - it('invokes listProcessors without error', async () => { + describe('enableProcessor', () => { + it('invokes enableProcessor without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1754,10 +2046,10 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + new protos.google.cloud.documentai.v1beta3.EnableProcessorRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + request.name = ''; + const expectedHeaderRequestParams = 'name='; const expectedOptions = { otherArgs: { headers: { @@ -1765,28 +2057,22 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }, }, }; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.Processor() - ), - generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.Processor() - ), - generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.Processor() - ), - ]; - client.innerApiCalls.listProcessors = stubSimpleCall(expectedResponse); - const [response] = await client.listProcessors(request); + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.enableProcessor = + stubLongRunningCall(expectedResponse); + const [operation] = await client.enableProcessor(request); + const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.listProcessors as SinonStub) + (client.innerApiCalls.enableProcessor as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes listProcessors without error using callback', async () => { + it('invokes enableProcessor without error using callback', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1796,10 +2082,10 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + new protos.google.cloud.documentai.v1beta3.EnableProcessorRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + request.name = ''; + const expectedHeaderRequestParams = 'name='; const expectedOptions = { otherArgs: { headers: { @@ -1807,25 +2093,20 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }, }, }; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.Processor() - ), - generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.Processor() - ), - generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.Processor() - ), - ]; - client.innerApiCalls.listProcessors = - stubSimpleCallWithCallback(expectedResponse); + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.enableProcessor = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.listProcessors( + client.enableProcessor( request, ( err?: Error | null, - result?: protos.google.cloud.documentai.v1beta3.IProcessor[] | null + result?: LROperation< + protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + > | null ) => { if (err) { reject(err); @@ -1835,16 +2116,20 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { } ); }); - const response = await promise; + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1beta3.IEnableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IEnableProcessorMetadata + >; + const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.listProcessors as SinonStub) + (client.innerApiCalls.enableProcessor as SinonStub) .getCall(0) .calledWith(request, expectedOptions /*, callback defined above */) ); }); - it('invokes listProcessors with error', async () => { + it('invokes enableProcessor with call error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1854,10 +2139,10 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + new protos.google.cloud.documentai.v1beta3.EnableProcessorRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + request.name = ''; + const expectedHeaderRequestParams = 'name='; const expectedOptions = { otherArgs: { headers: { @@ -1866,19 +2151,19 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }, }; const expectedError = new Error('expected'); - client.innerApiCalls.listProcessors = stubSimpleCall( + client.innerApiCalls.enableProcessor = stubLongRunningCall( undefined, expectedError ); - await assert.rejects(client.listProcessors(request), expectedError); + await assert.rejects(client.enableProcessor(request), expectedError); assert( - (client.innerApiCalls.listProcessors as SinonStub) + (client.innerApiCalls.enableProcessor as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes listProcessorsStream without error', async () => { + it('invokes enableProcessor with LRO error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1888,56 +2173,2119 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + new protos.google.cloud.documentai.v1beta3.EnableProcessorRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.Processor() - ), - generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.Processor() - ), - generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.Processor() - ), - ]; - client.descriptors.page.listProcessors.createStream = + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.enableProcessor = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.enableProcessor(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.enableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkEnableProcessorProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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.checkEnableProcessorProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkEnableProcessorProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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.checkEnableProcessorProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('disableProcessor', () => { + it('invokes disableProcessor without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.DisableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.disableProcessor = + stubLongRunningCall(expectedResponse); + const [operation] = await client.disableProcessor(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.disableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes disableProcessor without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.DisableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.disableProcessor = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.disableProcessor( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1beta3.IDisableProcessorResponse, + protos.google.cloud.documentai.v1beta3.IDisableProcessorMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.disableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes disableProcessor with call error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.DisableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.disableProcessor = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.disableProcessor(request), expectedError); + assert( + (client.innerApiCalls.disableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes disableProcessor with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.DisableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.disableProcessor = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.disableProcessor(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.disableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkDisableProcessorProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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.checkDisableProcessorProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDisableProcessorProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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.checkDisableProcessorProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('setDefaultProcessorVersion', () => { + it('invokes setDefaultProcessorVersion without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest() + ); + request.processor = ''; + const expectedHeaderRequestParams = 'processor='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.setDefaultProcessorVersion = + stubLongRunningCall(expectedResponse); + const [operation] = await client.setDefaultProcessorVersion(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setDefaultProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes setDefaultProcessorVersion without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest() + ); + request.processor = ''; + const expectedHeaderRequestParams = 'processor='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.setDefaultProcessorVersion = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setDefaultProcessorVersion( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.ISetDefaultProcessorVersionMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setDefaultProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes setDefaultProcessorVersion with call error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest() + ); + request.processor = ''; + const expectedHeaderRequestParams = 'processor='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setDefaultProcessorVersion = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.setDefaultProcessorVersion(request), + expectedError + ); + assert( + (client.innerApiCalls.setDefaultProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes setDefaultProcessorVersion with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest() + ); + request.processor = ''; + const expectedHeaderRequestParams = 'processor='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setDefaultProcessorVersion = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.setDefaultProcessorVersion(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.setDefaultProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkSetDefaultProcessorVersionProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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.checkSetDefaultProcessorVersionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkSetDefaultProcessorVersionProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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.checkSetDefaultProcessorVersionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('reviewDocument', () => { + it('invokes reviewDocument without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reviewDocument = + stubLongRunningCall(expectedResponse); + const [operation] = await client.reviewDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes reviewDocument without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reviewDocument = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.reviewDocument( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1beta3.IReviewDocumentResponse, + protos.google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes reviewDocument with call error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.reviewDocument = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.reviewDocument(request), expectedError); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes reviewDocument with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.reviewDocument = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.reviewDocument(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkReviewDocumentProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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.checkReviewDocumentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkReviewDocumentProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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.checkReviewDocumentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listProcessorTypes', () => { + it('invokes listProcessorTypes without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorType() + ), + ]; + client.innerApiCalls.listProcessorTypes = + stubSimpleCall(expectedResponse); + const [response] = await client.listProcessorTypes(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProcessorTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProcessorTypes without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorType() + ), + ]; + client.innerApiCalls.listProcessorTypes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listProcessorTypes( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.documentai.v1beta3.IProcessorType[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProcessorTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listProcessorTypes with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listProcessorTypes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listProcessorTypes(request), expectedError); + assert( + (client.innerApiCalls.listProcessorTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProcessorTypesStream without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorType() + ), + ]; + client.descriptors.page.listProcessorTypes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listProcessorTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.documentai.v1beta3.ProcessorType[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.documentai.v1beta3.ProcessorType) => { + 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.listProcessorTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessorTypes, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorTypes.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listProcessorTypesStream with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessorTypes.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listProcessorTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.documentai.v1beta3.ProcessorType[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.documentai.v1beta3.ProcessorType) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listProcessorTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessorTypes, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorTypes.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProcessorTypes without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorType() + ), + ]; + client.descriptors.page.listProcessorTypes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.documentai.v1beta3.IProcessorType[] = + []; + const iterable = client.listProcessorTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProcessorTypes with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessorTypes.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listProcessorTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.documentai.v1beta3.IProcessorType[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listProcessors', () => { + it('invokes listProcessors without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + ]; + client.innerApiCalls.listProcessors = stubSimpleCall(expectedResponse); + const [response] = await client.listProcessors(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProcessors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProcessors without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + ]; + client.innerApiCalls.listProcessors = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listProcessors( + request, + ( + err?: Error | null, + result?: protos.google.cloud.documentai.v1beta3.IProcessor[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProcessors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listProcessors with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listProcessors = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listProcessors(request), expectedError); + assert( + (client.innerApiCalls.listProcessors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProcessorsStream without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + ]; + client.descriptors.page.listProcessors.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listProcessorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.documentai.v1beta3.Processor[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.documentai.v1beta3.Processor) => { + 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.listProcessors.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessors, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessors.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listProcessorsStream with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessors.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listProcessorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.documentai.v1beta3.Processor[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.documentai.v1beta3.Processor) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listProcessors.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessors, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessors.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProcessors without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + ]; + client.descriptors.page.listProcessors.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.documentai.v1beta3.IProcessor[] = []; + const iterable = client.listProcessorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessors.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessors.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProcessors with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessors.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listProcessorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.documentai.v1beta3.IProcessor[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessors.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessors.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listProcessorVersions', () => { + it('invokes listProcessorVersions without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + ]; + client.innerApiCalls.listProcessorVersions = + stubSimpleCall(expectedResponse); + const [response] = await client.listProcessorVersions(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProcessorVersions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProcessorVersions without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + ]; + client.innerApiCalls.listProcessorVersions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listProcessorVersions( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.documentai.v1beta3.IProcessorVersion[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProcessorVersions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listProcessorVersions with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listProcessorVersions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listProcessorVersions(request), + expectedError + ); + assert( + (client.innerApiCalls.listProcessorVersions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProcessorVersionsStream without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + ]; + client.descriptors.page.listProcessorVersions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listProcessorsStream(request); + const stream = client.listProcessorVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.documentai.v1beta3.ProcessorVersion[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.documentai.v1beta3.ProcessorVersion + ) => { + 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.listProcessorVersions + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessorVersions, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorVersions + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listProcessorVersionsStream with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessorVersions.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listProcessorVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.documentai.v1beta3.ProcessorVersion[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.documentai.v1beta3.ProcessorVersion + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listProcessorVersions + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessorVersions, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorVersions + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProcessorVersions without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + ]; + client.descriptors.page.listProcessorVersions.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.documentai.v1beta3.IProcessorVersion[] = + []; + const iterable = client.listProcessorVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessorVersions + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorVersions + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProcessorVersions with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessorVersions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listProcessorVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.documentai.v1beta3.IProcessorVersion[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessorVersions + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorVersions + .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 documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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 documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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 documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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 documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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 documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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 documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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 documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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 documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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 documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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 documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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) => { - const responses: protos.google.cloud.documentai.v1beta3.Processor[] = - []; - stream.on( - 'data', - (response: protos.google.cloud.documentai.v1beta3.Processor) => { - responses.push(response); + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } } ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); + 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 documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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.descriptors.page.listProcessors.createStream as SinonStub) + (client.operationsClient.cancelOperation as SinonStub) .getCall(0) - .calledWith(client.innerApiCalls.listProcessors, request) - ); - assert.strictEqual( - ( - client.descriptors.page.listProcessors.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + .calledWith(request) ); }); - - it('invokes listProcessorsStream with error', async () => { + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1947,45 +4295,86 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + new operationsProtos.google.longrunning.DeleteOperationRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedError = new Error('expected'); - client.descriptors.page.listProcessors.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listProcessorsStream(request); + 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 documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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) => { - const responses: protos.google.cloud.documentai.v1beta3.Processor[] = - []; - stream.on( - 'data', - (response: protos.google.cloud.documentai.v1beta3.Processor) => { - responses.push(response); + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } } ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); }); - await assert.rejects(promise, expectedError); + 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 documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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.descriptors.page.listProcessors.createStream as SinonStub) + (client.operationsClient.deleteOperation as SinonStub) .getCall(0) - .calledWith(client.innerApiCalls.listProcessors, request) - ); - assert.strictEqual( - ( - client.descriptors.page.listProcessors.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + .calledWith(request) ); }); - - it('uses async iteration with listProcessors without error', async () => { + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1993,46 +4382,38 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { projectId: 'bogus', } ); - client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + new operationsProtos.google.longrunning.ListOperationsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; const expectedResponse = [ generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.Processor() + new operationsProtos.google.longrunning.ListOperationsResponse() ), generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.Processor() + new operationsProtos.google.longrunning.ListOperationsResponse() ), generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.Processor() + new operationsProtos.google.longrunning.ListOperationsResponse() ), ]; - client.descriptors.page.listProcessors.asyncIterate = + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.documentai.v1beta3.IProcessor[] = []; - const iterable = client.listProcessorsAsync(request); + 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.descriptors.page.listProcessors.asyncIterate as SinonStub + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listProcessors.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); }); - - it('uses async iteration with listProcessors with error', async () => { + it('uses async iteration with listOperations with error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -2042,16 +4423,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + new operationsProtos.google.longrunning.ListOperationsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listProcessors.asyncIterate = + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listProcessorsAsync(request); + const iterable = client.operationsClient.listOperationsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.documentai.v1beta3.IProcessor[] = + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; for await (const resource of iterable) { responses.push(resource!); @@ -2059,16 +4438,11 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); assert.deepStrictEqual( ( - client.descriptors.page.listProcessors.asyncIterate as SinonStub + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listProcessors.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); }); }); @@ -2338,6 +4712,89 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); }); + describe('processorVersion', () => { + const fakePath = '/rendered/path/processorVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + processor: 'processorValue', + processor_version: 'processorVersionValue', + }; + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.processorVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.processorVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('processorVersionPath', () => { + const result = client.processorVersionPath( + 'projectValue', + 'locationValue', + 'processorValue', + 'processorVersionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.processorVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProcessorVersionName', () => { + const result = client.matchProjectFromProcessorVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.processorVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProcessorVersionName', () => { + const result = client.matchLocationFromProcessorVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.processorVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProcessorFromProcessorVersionName', () => { + const result = client.matchProcessorFromProcessorVersionName(fakePath); + assert.strictEqual(result, 'processorValue'); + assert( + (client.pathTemplates.processorVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProcessorVersionFromProcessorVersionName', () => { + const result = + client.matchProcessorVersionFromProcessorVersionName(fakePath); + assert.strictEqual(result, 'processorVersionValue'); + assert( + (client.pathTemplates.processorVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('project', () => { const fakePath = '/rendered/path/project'; const expectedParameters = { From d9cc81349a51b257417a6fbaca0f0425ba61949e 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:04:42 +0000 Subject: [PATCH 197/213] fix: better support for fallback mode (#348) - [ ] 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 --- ...ocessor_service.batch_process_documents.js | 3 + ...ment_processor_service.create_processor.js | 3 + ...ment_processor_service.delete_processor.js | 3 + ...cessor_service.delete_processor_version.js | 3 + ...cessor_service.deploy_processor_version.js | 3 + ...ent_processor_service.disable_processor.js | 3 + ...ment_processor_service.enable_processor.js | 3 + ...processor_service.fetch_processor_types.js | 3 + ...ocument_processor_service.get_processor.js | 3 + ...processor_service.get_processor_version.js | 3 + ..._processor_service.list_processor_types.js | 3 + ...ocessor_service.list_processor_versions.js | 3 + ...ument_processor_service.list_processors.js | 3 + ...ment_processor_service.process_document.js | 3 + ...ument_processor_service.review_document.js | 3 + ...r_service.set_default_processor_version.js | 3 + ...ssor_service.undeploy_processor_version.js | 3 + ...t_metadata.google.cloud.documentai.v1.json | 34 +-- ...tanding_service.batch_process_documents.js | 3 + ...adata.google.cloud.documentai.v1beta1.json | 2 +- ...tanding_service.batch_process_documents.js | 3 + ..._understanding_service.process_document.js | 3 + ...adata.google.cloud.documentai.v1beta2.json | 4 +- ...ocessor_service.batch_process_documents.js | 3 + ...ment_processor_service.create_processor.js | 3 + ...ment_processor_service.delete_processor.js | 3 + ...cessor_service.delete_processor_version.js | 3 + ...cessor_service.deploy_processor_version.js | 3 + ...ent_processor_service.disable_processor.js | 3 + ...ment_processor_service.enable_processor.js | 3 + ...processor_service.fetch_processor_types.js | 3 + ...ocument_processor_service.get_processor.js | 3 + ...processor_service.get_processor_version.js | 3 + ..._processor_service.list_processor_types.js | 3 + ...ocessor_service.list_processor_versions.js | 3 + ...ument_processor_service.list_processors.js | 3 + ...ment_processor_service.process_document.js | 3 + ...ument_processor_service.review_document.js | 3 + ...r_service.set_default_processor_version.js | 3 + ...ssor_service.undeploy_processor_version.js | 3 + ...adata.google.cloud.documentai.v1beta3.json | 34 +-- .../v1/document_processor_service_client.ts | 34 +-- .../document_understanding_service_client.ts | 5 +- .../document_understanding_service_client.ts | 5 +- .../document_processor_service_client.ts | 34 +-- .../gapic_document_processor_service_v1.ts | 182 +++++++-------- ...apic_document_processor_service_v1beta3.ts | 212 +++++++++--------- ..._document_understanding_service_v1beta1.ts | 212 +++++++++--------- ..._document_understanding_service_v1beta2.ts | 212 +++++++++--------- 49 files changed, 601 insertions(+), 480 deletions(-) diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js index b7ae22929be..c099efd7b6c 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js @@ -23,6 +23,9 @@ function main(name) { // [START documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_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-documentai/samples/generated/v1/document_processor_service.create_processor.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.create_processor.js index dabf1797e81..24da55f864f 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.create_processor.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.create_processor.js @@ -23,6 +23,9 @@ function main(parent, processor) { // [START documentai_v1_generated_DocumentProcessorService_CreateProcessor_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-documentai/samples/generated/v1/document_processor_service.delete_processor.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor.js index 9b6be82cf08..2c087b70d5b 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor.js @@ -23,6 +23,9 @@ function main(name) { // [START documentai_v1_generated_DocumentProcessorService_DeleteProcessor_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-documentai/samples/generated/v1/document_processor_service.delete_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor_version.js index 2afd2cb69fa..2f19c69d877 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor_version.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor_version.js @@ -23,6 +23,9 @@ function main(name) { // [START documentai_v1_generated_DocumentProcessorService_DeleteProcessorVersion_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-documentai/samples/generated/v1/document_processor_service.deploy_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.deploy_processor_version.js index e2eb5a3f5d9..09379736014 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.deploy_processor_version.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.deploy_processor_version.js @@ -23,6 +23,9 @@ function main(name) { // [START documentai_v1_generated_DocumentProcessorService_DeployProcessorVersion_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-documentai/samples/generated/v1/document_processor_service.disable_processor.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.disable_processor.js index 31cb7edf0e0..80a52d09a2e 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.disable_processor.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.disable_processor.js @@ -23,6 +23,9 @@ function main(name) { // [START documentai_v1_generated_DocumentProcessorService_DisableProcessor_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-documentai/samples/generated/v1/document_processor_service.enable_processor.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.enable_processor.js index a0cb036bea4..8d66f45c069 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.enable_processor.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.enable_processor.js @@ -23,6 +23,9 @@ function main(name) { // [START documentai_v1_generated_DocumentProcessorService_EnableProcessor_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-documentai/samples/generated/v1/document_processor_service.fetch_processor_types.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.fetch_processor_types.js index d995bb995cb..5bb5c2383e4 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.fetch_processor_types.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.fetch_processor_types.js @@ -23,6 +23,9 @@ function main(parent) { // [START documentai_v1_generated_DocumentProcessorService_FetchProcessorTypes_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-documentai/samples/generated/v1/document_processor_service.get_processor.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor.js index 9a15ee51989..91913575c66 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor.js @@ -23,6 +23,9 @@ function main(name) { // [START documentai_v1_generated_DocumentProcessorService_GetProcessor_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-documentai/samples/generated/v1/document_processor_service.get_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor_version.js index c15c9e0a94c..31bcc81a04f 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor_version.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor_version.js @@ -23,6 +23,9 @@ function main(name) { // [START documentai_v1_generated_DocumentProcessorService_GetProcessorVersion_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-documentai/samples/generated/v1/document_processor_service.list_processor_types.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_types.js index 64702298034..a900fd1e249 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_types.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_types.js @@ -23,6 +23,9 @@ function main(parent) { // [START documentai_v1_generated_DocumentProcessorService_ListProcessorTypes_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-documentai/samples/generated/v1/document_processor_service.list_processor_versions.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_versions.js index 0a1c16204e6..490c0fb5038 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_versions.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_versions.js @@ -23,6 +23,9 @@ function main(parent) { // [START documentai_v1_generated_DocumentProcessorService_ListProcessorVersions_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-documentai/samples/generated/v1/document_processor_service.list_processors.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processors.js index 3038b092980..62b63c5ce60 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processors.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processors.js @@ -23,6 +23,9 @@ function main(parent) { // [START documentai_v1_generated_DocumentProcessorService_ListProcessors_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-documentai/samples/generated/v1/document_processor_service.process_document.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js index e22847c4216..f32cd03e0f0 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js @@ -23,6 +23,9 @@ function main(name) { // [START documentai_v1_generated_DocumentProcessorService_ProcessDocument_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-documentai/samples/generated/v1/document_processor_service.review_document.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js index 8dbd18cb467..583b5a9b150 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js @@ -23,6 +23,9 @@ function main(humanReviewConfig) { // [START documentai_v1_generated_DocumentProcessorService_ReviewDocument_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-documentai/samples/generated/v1/document_processor_service.set_default_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.set_default_processor_version.js index 8005da6375b..64556b986f5 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.set_default_processor_version.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.set_default_processor_version.js @@ -23,6 +23,9 @@ function main(processor, defaultProcessorVersion) { // [START documentai_v1_generated_DocumentProcessorService_SetDefaultProcessorVersion_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-documentai/samples/generated/v1/document_processor_service.undeploy_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.undeploy_processor_version.js index 7a617c1effc..5c84587ee7b 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.undeploy_processor_version.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.undeploy_processor_version.js @@ -23,6 +23,9 @@ function main(name) { // [START documentai_v1_generated_DocumentProcessorService_UndeployProcessorVersion_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-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json index 3075521f863..245fbffc2e6 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json +++ b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 72, + "end": 75, "type": "FULL" } ], @@ -78,7 +78,7 @@ "segments": [ { "start": 25, - "end": 68, + "end": 71, "type": "FULL" } ], @@ -130,7 +130,7 @@ "segments": [ { "start": 25, - "end": 52, + "end": 55, "type": "FULL" } ], @@ -170,7 +170,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 67, "type": "FULL" } ], @@ -218,7 +218,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 67, "type": "FULL" } ], @@ -266,7 +266,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -306,7 +306,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -346,7 +346,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 67, "type": "FULL" } ], @@ -394,7 +394,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -434,7 +434,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -474,7 +474,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -514,7 +514,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -558,7 +558,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -598,7 +598,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -638,7 +638,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -678,7 +678,7 @@ "segments": [ { "start": 25, - "end": 58, + "end": 61, "type": "FULL" } ], @@ -722,7 +722,7 @@ "segments": [ { "start": 25, - "end": 68, + "end": 71, "type": "FULL" } ], diff --git a/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js index b521d8f8f14..1c7c32af24f 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js @@ -23,6 +23,9 @@ function main(requests) { // [START documentai_v1beta1_generated_DocumentUnderstandingService_BatchProcessDocuments_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-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json b/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json index 72bcd115a7d..753d665edfa 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], diff --git a/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js index 8b2ab19f553..d8b7a19700e 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js @@ -23,6 +23,9 @@ function main(requests) { // [START documentai_v1beta2_generated_DocumentUnderstandingService_BatchProcessDocuments_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-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js index f689731c7ea..caf92fe342a 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js @@ -23,6 +23,9 @@ function main(inputConfig) { // [START documentai_v1beta2_generated_DocumentUnderstandingService_ProcessDocument_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-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json b/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json index 8461a1e05c3..8583d825470 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -66,7 +66,7 @@ "segments": [ { "start": 25, - "end": 93, + "end": 96, "type": "FULL" } ], diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js index e03908b5835..25bd5f659c2 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js @@ -23,6 +23,9 @@ function main(name) { // [START documentai_v1beta3_generated_DocumentProcessorService_BatchProcessDocuments_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-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js index 050feab2913..fc1916f0a92 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js @@ -23,6 +23,9 @@ function main(parent, processor) { // [START documentai_v1beta3_generated_DocumentProcessorService_CreateProcessor_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-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js index 23228e13926..ae5e7227c34 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js @@ -23,6 +23,9 @@ function main(name) { // [START documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessor_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-documentai/samples/generated/v1beta3/document_processor_service.delete_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor_version.js index b0503d6485f..a2c34c8befc 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor_version.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor_version.js @@ -23,6 +23,9 @@ function main(name) { // [START documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessorVersion_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-documentai/samples/generated/v1beta3/document_processor_service.deploy_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.deploy_processor_version.js index e1dfce344da..416d46b66b0 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.deploy_processor_version.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.deploy_processor_version.js @@ -23,6 +23,9 @@ function main(name) { // [START documentai_v1beta3_generated_DocumentProcessorService_DeployProcessorVersion_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-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js index 219f687ea5a..2fa77f79000 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js @@ -23,6 +23,9 @@ function main(name) { // [START documentai_v1beta3_generated_DocumentProcessorService_DisableProcessor_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-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js index 88e78e8d95e..e2ee9079f41 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js @@ -23,6 +23,9 @@ function main(name) { // [START documentai_v1beta3_generated_DocumentProcessorService_EnableProcessor_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-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js index 15b6348f3a2..4fc8c1275e3 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js @@ -23,6 +23,9 @@ function main(parent) { // [START documentai_v1beta3_generated_DocumentProcessorService_FetchProcessorTypes_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-documentai/samples/generated/v1beta3/document_processor_service.get_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor.js index c265c6bf6ef..4b89803a0c3 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor.js @@ -23,6 +23,9 @@ function main(name) { // [START documentai_v1beta3_generated_DocumentProcessorService_GetProcessor_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-documentai/samples/generated/v1beta3/document_processor_service.get_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor_version.js index 979a477ccc7..9c30f2d02fd 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor_version.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor_version.js @@ -23,6 +23,9 @@ function main(name) { // [START documentai_v1beta3_generated_DocumentProcessorService_GetProcessorVersion_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-documentai/samples/generated/v1beta3/document_processor_service.list_processor_types.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_types.js index 681610ead8c..7500d1d6dd7 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_types.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_types.js @@ -23,6 +23,9 @@ function main(parent) { // [START documentai_v1beta3_generated_DocumentProcessorService_ListProcessorTypes_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-documentai/samples/generated/v1beta3/document_processor_service.list_processor_versions.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_versions.js index af97f27e432..c922f46fadc 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_versions.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_versions.js @@ -23,6 +23,9 @@ function main(parent) { // [START documentai_v1beta3_generated_DocumentProcessorService_ListProcessorVersions_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-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js index 4012d0b7aaa..c136a802329 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js @@ -23,6 +23,9 @@ function main(parent) { // [START documentai_v1beta3_generated_DocumentProcessorService_ListProcessors_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-documentai/samples/generated/v1beta3/document_processor_service.process_document.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js index 9e37ab06e43..1a6657cabc9 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js @@ -23,6 +23,9 @@ function main(name) { // [START documentai_v1beta3_generated_DocumentProcessorService_ProcessDocument_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-documentai/samples/generated/v1beta3/document_processor_service.review_document.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js index 8c3bb75711b..cb7b942ae57 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js @@ -23,6 +23,9 @@ function main(humanReviewConfig) { // [START documentai_v1beta3_generated_DocumentProcessorService_ReviewDocument_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-documentai/samples/generated/v1beta3/document_processor_service.set_default_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.set_default_processor_version.js index 42909b970a4..44d9177db6b 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.set_default_processor_version.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.set_default_processor_version.js @@ -23,6 +23,9 @@ function main(processor, defaultProcessorVersion) { // [START documentai_v1beta3_generated_DocumentProcessorService_SetDefaultProcessorVersion_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-documentai/samples/generated/v1beta3/document_processor_service.undeploy_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.undeploy_processor_version.js index 05957013cfd..6bc7a006fb6 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.undeploy_processor_version.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.undeploy_processor_version.js @@ -23,6 +23,9 @@ function main(name) { // [START documentai_v1beta3_generated_DocumentProcessorService_UndeployProcessorVersion_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-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json index 6657b6d2917..8d3945829d4 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 76, + "end": 79, "type": "FULL" } ], @@ -82,7 +82,7 @@ "segments": [ { "start": 25, - "end": 76, + "end": 79, "type": "FULL" } ], @@ -142,7 +142,7 @@ "segments": [ { "start": 25, - "end": 52, + "end": 55, "type": "FULL" } ], @@ -182,7 +182,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 67, "type": "FULL" } ], @@ -230,7 +230,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 67, "type": "FULL" } ], @@ -278,7 +278,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -318,7 +318,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -358,7 +358,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 67, "type": "FULL" } ], @@ -406,7 +406,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -446,7 +446,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -486,7 +486,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -526,7 +526,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -570,7 +570,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -610,7 +610,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -650,7 +650,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -690,7 +690,7 @@ "segments": [ { "start": 25, - "end": 58, + "end": 61, "type": "FULL" } ], @@ -734,7 +734,7 @@ "segments": [ { "start": 25, - "end": 72, + "end": 75, "type": "FULL" } ], diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts index e3293a1ac30..a07ef2ce69a 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1/document_processor_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'); /** @@ -477,7 +476,8 @@ export class DocumentProcessorServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -1145,7 +1145,7 @@ export class DocumentProcessorServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.batchProcessDocuments, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.documentai.v1.BatchProcessResponse, @@ -1287,7 +1287,7 @@ export class DocumentProcessorServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.deleteProcessorVersion, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.protobuf.Empty, @@ -1428,7 +1428,7 @@ export class DocumentProcessorServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.deployProcessorVersion, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.documentai.v1.DeployProcessorVersionResponse, @@ -1569,7 +1569,7 @@ export class DocumentProcessorServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.undeployProcessorVersion, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.documentai.v1.UndeployProcessorVersionResponse, @@ -1707,7 +1707,7 @@ export class DocumentProcessorServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.deleteProcessor, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.protobuf.Empty, @@ -1844,7 +1844,7 @@ export class DocumentProcessorServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.enableProcessor, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.documentai.v1.EnableProcessorResponse, @@ -1981,7 +1981,7 @@ export class DocumentProcessorServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.disableProcessor, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.documentai.v1.DisableProcessorResponse, @@ -2128,7 +2128,7 @@ export class DocumentProcessorServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.setDefaultProcessorVersion, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.documentai.v1.SetDefaultProcessorVersionResponse, @@ -2275,7 +2275,7 @@ export class DocumentProcessorServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.reviewDocument, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.documentai.v1.ReviewDocumentResponse, @@ -2427,7 +2427,7 @@ export class DocumentProcessorServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listProcessorTypes.createStream( - this.innerApiCalls.listProcessorTypes as gax.GaxCall, + this.innerApiCalls.listProcessorTypes as GaxCall, request, callSettings ); @@ -2479,7 +2479,7 @@ export class DocumentProcessorServiceClient { this.initialize(); return this.descriptors.page.listProcessorTypes.asyncIterate( this.innerApiCalls['listProcessorTypes'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } @@ -2628,7 +2628,7 @@ export class DocumentProcessorServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listProcessors.createStream( - this.innerApiCalls.listProcessors as gax.GaxCall, + this.innerApiCalls.listProcessors as GaxCall, request, callSettings ); @@ -2680,7 +2680,7 @@ export class DocumentProcessorServiceClient { this.initialize(); return this.descriptors.page.listProcessors.asyncIterate( this.innerApiCalls['listProcessors'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } @@ -2829,7 +2829,7 @@ export class DocumentProcessorServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listProcessorVersions.createStream( - this.innerApiCalls.listProcessorVersions as gax.GaxCall, + this.innerApiCalls.listProcessorVersions as GaxCall, request, callSettings ); @@ -2881,7 +2881,7 @@ export class DocumentProcessorServiceClient { this.initialize(); return this.descriptors.page.listProcessorVersions.asyncIterate( this.innerApiCalls['listProcessorVersions'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts index 85e83bdb9d6..5ea7ee87113 100644 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts @@ -257,7 +257,8 @@ export class DocumentUnderstandingServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -456,7 +457,7 @@ export class DocumentUnderstandingServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.batchProcessDocuments, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse, diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index fd7b71fecc5..492b234d062 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -260,7 +260,8 @@ export class DocumentUnderstandingServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -586,7 +587,7 @@ export class DocumentUnderstandingServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.batchProcessDocuments, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse, diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index d3c447799d6..d9aa8aca554 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_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'); /** @@ -476,7 +475,8 @@ export class DocumentProcessorServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -1176,7 +1176,7 @@ export class DocumentProcessorServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.batchProcessDocuments, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.documentai.v1beta3.BatchProcessResponse, @@ -1318,7 +1318,7 @@ export class DocumentProcessorServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.deleteProcessorVersion, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.protobuf.Empty, @@ -1459,7 +1459,7 @@ export class DocumentProcessorServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.deployProcessorVersion, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.documentai.v1beta3.DeployProcessorVersionResponse, @@ -1600,7 +1600,7 @@ export class DocumentProcessorServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.undeployProcessorVersion, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse, @@ -1738,7 +1738,7 @@ export class DocumentProcessorServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.deleteProcessor, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.protobuf.Empty, @@ -1875,7 +1875,7 @@ export class DocumentProcessorServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.enableProcessor, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.documentai.v1beta3.EnableProcessorResponse, @@ -2012,7 +2012,7 @@ export class DocumentProcessorServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.disableProcessor, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.documentai.v1beta3.DisableProcessorResponse, @@ -2159,7 +2159,7 @@ export class DocumentProcessorServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.setDefaultProcessorVersion, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse, @@ -2308,7 +2308,7 @@ export class DocumentProcessorServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.reviewDocument, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.documentai.v1beta3.ReviewDocumentResponse, @@ -2460,7 +2460,7 @@ export class DocumentProcessorServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listProcessorTypes.createStream( - this.innerApiCalls.listProcessorTypes as gax.GaxCall, + this.innerApiCalls.listProcessorTypes as GaxCall, request, callSettings ); @@ -2512,7 +2512,7 @@ export class DocumentProcessorServiceClient { this.initialize(); return this.descriptors.page.listProcessorTypes.asyncIterate( this.innerApiCalls['listProcessorTypes'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } @@ -2661,7 +2661,7 @@ export class DocumentProcessorServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listProcessors.createStream( - this.innerApiCalls.listProcessors as gax.GaxCall, + this.innerApiCalls.listProcessors as GaxCall, request, callSettings ); @@ -2713,7 +2713,7 @@ export class DocumentProcessorServiceClient { this.initialize(); return this.descriptors.page.listProcessors.asyncIterate( this.innerApiCalls['listProcessors'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } @@ -2862,7 +2862,7 @@ export class DocumentProcessorServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listProcessorVersions.createStream( - this.innerApiCalls.listProcessorVersions as gax.GaxCall, + this.innerApiCalls.listProcessorVersions as GaxCall, request, callSettings ); @@ -2914,7 +2914,7 @@ export class DocumentProcessorServiceClient { this.initialize(); return this.descriptors.page.listProcessorVersions.asyncIterate( this.innerApiCalls['listProcessorVersions'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts index 83450a64348..0a56ba9cb4a 100644 --- a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts @@ -150,111 +150,113 @@ function stubAsyncIterationCall( } describe('v1.DocumentProcessorServiceClient', () => { - it('has servicePath', () => { - const servicePath = - documentprocessorserviceModule.v1.DocumentProcessorServiceClient - .servicePath; - assert(servicePath); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + documentprocessorserviceModule.v1.DocumentProcessorServiceClient + .servicePath; + assert(servicePath); + }); - it('has apiEndpoint', () => { - const apiEndpoint = - documentprocessorserviceModule.v1.DocumentProcessorServiceClient - .apiEndpoint; - assert(apiEndpoint); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + documentprocessorserviceModule.v1.DocumentProcessorServiceClient + .apiEndpoint; + assert(apiEndpoint); + }); - it('has port', () => { - const port = - documentprocessorserviceModule.v1.DocumentProcessorServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('has port', () => { + const port = + documentprocessorserviceModule.v1.DocumentProcessorServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with no option', () => { - const client = - new documentprocessorserviceModule.v1.DocumentProcessorServiceClient(); - assert(client); - }); + it('should create a client with no option', () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient(); + assert(client); + }); - it('should create a client with gRPC fallback', () => { - const client = - new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with gRPC fallback', () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + fallback: true, + }); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = - new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.documentProcessorServiceStub, undefined); - await client.initialize(); - assert(client.documentProcessorServiceStub); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.documentProcessorServiceStub, undefined); + await client.initialize(); + assert(client.documentProcessorServiceStub); + }); - it('has close method for the initialized client', done => { - const client = - new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the initialized client', done => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.documentProcessorServiceStub); + client.close().then(() => { + done(); }); - client.initialize(); - assert(client.documentProcessorServiceStub); - client.close().then(() => { - done(); }); - }); - it('has close method for the non-initialized client', done => { - const client = - new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.documentProcessorServiceStub, undefined); + client.close().then(() => { + done(); }); - assert.strictEqual(client.documentProcessorServiceStub, undefined); - client.close().then(() => { - done(); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ - 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 documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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 documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ - 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 documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + 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('processDocument', () => { diff --git a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts index 0e1e515df9f..b0e9bbf525f 100644 --- a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts @@ -150,124 +150,126 @@ function stubAsyncIterationCall( } describe('v1beta3.DocumentProcessorServiceClient', () => { - it('has servicePath', () => { - const servicePath = - documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient - .servicePath; - assert(servicePath); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient + .servicePath; + assert(servicePath); + }); - it('has apiEndpoint', () => { - const apiEndpoint = - documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient - .apiEndpoint; - assert(apiEndpoint); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient + .apiEndpoint; + assert(apiEndpoint); + }); - it('has port', () => { - const port = - documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient - .port; - assert(port); - assert(typeof port === 'number'); - }); + it('has port', () => { + const port = + documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient + .port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with no option', () => { - const client = - new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient(); - assert(client); - }); + it('should create a client with no option', () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient(); + assert(client); + }); - it('should create a client with gRPC fallback', () => { - const client = - new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - fallback: true, - } - ); - assert(client); - }); + it('should create a client with gRPC fallback', () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + fallback: true, + } + ); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = - new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - assert.strictEqual(client.documentProcessorServiceStub, undefined); - await client.initialize(); - assert(client.documentProcessorServiceStub); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.documentProcessorServiceStub, undefined); + await client.initialize(); + assert(client.documentProcessorServiceStub); + }); - it('has close method for the initialized client', done => { - const client = - new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - assert(client.documentProcessorServiceStub); - client.close().then(() => { - done(); + it('has close method for the initialized client', done => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + assert(client.documentProcessorServiceStub); + client.close().then(() => { + done(); + }); }); - }); - it('has close method for the non-initialized client', done => { - const client = - new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - assert.strictEqual(client.documentProcessorServiceStub, undefined); - client.close().then(() => { - done(); + it('has close method for the non-initialized client', done => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.documentProcessorServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - 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 documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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 documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( - { - 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 documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + 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('processDocument', () => { diff --git a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts index 521250e72a7..bd1b6eba3cc 100644 --- a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts +++ b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts @@ -73,124 +73,126 @@ function stubLongRunningCallWithCallback( } describe('v1beta1.DocumentUnderstandingServiceClient', () => { - it('has servicePath', () => { - const servicePath = - documentunderstandingserviceModule.v1beta1 - .DocumentUnderstandingServiceClient.servicePath; - assert(servicePath); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + documentunderstandingserviceModule.v1beta1 + .DocumentUnderstandingServiceClient.servicePath; + assert(servicePath); + }); - it('has apiEndpoint', () => { - const apiEndpoint = - documentunderstandingserviceModule.v1beta1 - .DocumentUnderstandingServiceClient.apiEndpoint; - assert(apiEndpoint); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + documentunderstandingserviceModule.v1beta1 + .DocumentUnderstandingServiceClient.apiEndpoint; + assert(apiEndpoint); + }); - it('has port', () => { - const port = - documentunderstandingserviceModule.v1beta1 - .DocumentUnderstandingServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('has port', () => { + const port = + documentunderstandingserviceModule.v1beta1 + .DocumentUnderstandingServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with no option', () => { - const client = - new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient(); - assert(client); - }); + it('should create a client with no option', () => { + const client = + new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient(); + assert(client); + }); - it('should create a client with gRPC fallback', () => { - const client = - new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( - { - fallback: true, - } - ); - assert(client); - }); + it('should create a client with gRPC fallback', () => { + const client = + new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + fallback: true, + } + ); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = - new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - assert.strictEqual(client.documentUnderstandingServiceStub, undefined); - await client.initialize(); - assert(client.documentUnderstandingServiceStub); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = + new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.documentUnderstandingServiceStub, undefined); + await client.initialize(); + assert(client.documentUnderstandingServiceStub); + }); - it('has close method for the initialized client', done => { - const client = - new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - assert(client.documentUnderstandingServiceStub); - client.close().then(() => { - done(); + it('has close method for the initialized client', done => { + const client = + new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + assert(client.documentUnderstandingServiceStub); + client.close().then(() => { + done(); + }); }); - }); - it('has close method for the non-initialized client', done => { - const client = - new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - assert.strictEqual(client.documentUnderstandingServiceStub, undefined); - client.close().then(() => { - done(); + it('has close method for the non-initialized client', done => { + const client = + new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.documentUnderstandingServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( - { - 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 documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + 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 documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( - { - 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 documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + 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('batchProcessDocuments', () => { diff --git a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts index 6feb89ff20a..ff88e78d06e 100644 --- a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts +++ b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts @@ -82,124 +82,126 @@ function stubLongRunningCallWithCallback( } describe('v1beta2.DocumentUnderstandingServiceClient', () => { - it('has servicePath', () => { - const servicePath = - documentunderstandingserviceModule.v1beta2 - .DocumentUnderstandingServiceClient.servicePath; - assert(servicePath); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + documentunderstandingserviceModule.v1beta2 + .DocumentUnderstandingServiceClient.servicePath; + assert(servicePath); + }); - it('has apiEndpoint', () => { - const apiEndpoint = - documentunderstandingserviceModule.v1beta2 - .DocumentUnderstandingServiceClient.apiEndpoint; - assert(apiEndpoint); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + documentunderstandingserviceModule.v1beta2 + .DocumentUnderstandingServiceClient.apiEndpoint; + assert(apiEndpoint); + }); - it('has port', () => { - const port = - documentunderstandingserviceModule.v1beta2 - .DocumentUnderstandingServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('has port', () => { + const port = + documentunderstandingserviceModule.v1beta2 + .DocumentUnderstandingServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with no option', () => { - const client = - new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient(); - assert(client); - }); + it('should create a client with no option', () => { + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient(); + assert(client); + }); - it('should create a client with gRPC fallback', () => { - const client = - new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - fallback: true, - } - ); - assert(client); - }); + it('should create a client with gRPC fallback', () => { + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + fallback: true, + } + ); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = - new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - assert.strictEqual(client.documentUnderstandingServiceStub, undefined); - await client.initialize(); - assert(client.documentUnderstandingServiceStub); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.documentUnderstandingServiceStub, undefined); + await client.initialize(); + assert(client.documentUnderstandingServiceStub); + }); - it('has close method for the initialized client', done => { - const client = - new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - assert(client.documentUnderstandingServiceStub); - client.close().then(() => { - done(); + it('has close method for the initialized client', done => { + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + assert(client.documentUnderstandingServiceStub); + client.close().then(() => { + done(); + }); }); - }); - it('has close method for the non-initialized client', done => { - const client = - new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - assert.strictEqual(client.documentUnderstandingServiceStub, undefined); - client.close().then(() => { - done(); + it('has close method for the non-initialized client', done => { + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.documentUnderstandingServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - 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 documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + 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 documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( - { - 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 documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + 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('processDocument', () => { From c16e943af8af0730926d21c4b058572948853f97 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:38:33 +0000 Subject: [PATCH 198/213] fix: change import long to require (#350) Source-Link: https://github.com/googleapis/synthtool/commit/d229a1258999f599a90a9b674a1c5541e00db588 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:74ab2b3c71ef27e6d8b69b1d0a0c9d31447777b79ac3cd4be82c265b45f37e5e --- .../protos/protos.d.ts | 2487 ++- .../google-cloud-documentai/protos/protos.js | 13675 +++++++++++----- .../protos/protos.json | 24 + 3 files changed, 12430 insertions(+), 3756 deletions(-) diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index e157c94e56c..32dc60eabe0 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/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 { @@ -126,6 +126,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Barcode + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Document. */ @@ -285,6 +292,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Document + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Document { @@ -389,6 +403,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ShardInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Style. */ @@ -515,6 +536,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Style + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Style { @@ -613,6 +641,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FontSize + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -794,6 +829,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Page + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Page { @@ -898,6 +940,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Dimension + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an Image. */ @@ -1006,6 +1055,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 a Matrix. */ @@ -1114,6 +1170,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Matrix + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Layout. */ @@ -1222,6 +1285,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Layout + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Layout { @@ -1336,6 +1406,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Block + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Paragraph. */ @@ -1438,6 +1515,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Paragraph + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Line. */ @@ -1540,6 +1624,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Line + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Token. */ @@ -1648,6 +1739,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Token + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Token { @@ -1740,6 +1838,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DetectedBreak + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace DetectedBreak { @@ -1848,6 +1953,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Symbol + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a VisualElement. */ @@ -1950,6 +2062,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VisualElement + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Table. */ @@ -2058,6 +2177,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Table + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Table { @@ -2150,6 +2276,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TableRow + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TableCell. */ @@ -2258,6 +2391,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TableCell + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -2391,6 +2531,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FormField + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DetectedBarcode. */ @@ -2487,6 +2634,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DetectedBarcode + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DetectedLanguage. */ @@ -2583,6 +2737,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DetectedLanguage + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -2734,6 +2895,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Entity + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Entity { @@ -2871,6 +3039,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NormalizedValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -2974,6 +3149,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EntityRelation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TextAnchor. */ @@ -3070,6 +3252,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TextAnchor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace TextAnchor { @@ -3168,6 +3357,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TextSegment + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -3259,6 +3455,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PageAnchor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace PageAnchor { @@ -3375,6 +3578,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PageRef + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace PageRef { @@ -3499,6 +3709,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Provenance + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Provenance { @@ -3603,6 +3820,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Parent + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** OperationType enum. */ @@ -3744,6 +3968,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Revision + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Revision { @@ -3842,6 +4073,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for HumanReview + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -3945,6 +4183,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TextChange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -4042,6 +4287,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Vertex + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a NormalizedVertex. */ @@ -4138,6 +4390,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NormalizedVertex + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BoundingPoly. */ @@ -4234,6 +4493,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BoundingPoly + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RawDocument. */ @@ -4330,6 +4596,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RawDocument + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GcsDocument. */ @@ -4426,6 +4699,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GcsDocument + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GcsDocuments. */ @@ -4516,6 +4796,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GcsDocuments + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GcsPrefix. */ @@ -4606,6 +4893,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GcsPrefix + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BatchDocumentsInputConfig. */ @@ -4705,6 +4999,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchDocumentsInputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DocumentOutputConfig. */ @@ -4798,6 +5099,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentOutputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace DocumentOutputConfig { @@ -4890,6 +5198,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GcsOutputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -5155,119 +5470,119 @@ export namespace google { namespace DocumentProcessorService { /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#processDocument}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|processDocument}. * @param error Error, if any * @param [response] ProcessResponse */ type ProcessDocumentCallback = (error: (Error|null), response?: google.cloud.documentai.v1.ProcessResponse) => void; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#batchProcessDocuments}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|batchProcessDocuments}. * @param error Error, if any * @param [response] Operation */ type BatchProcessDocumentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#fetchProcessorTypes}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|fetchProcessorTypes}. * @param error Error, if any * @param [response] FetchProcessorTypesResponse */ type FetchProcessorTypesCallback = (error: (Error|null), response?: google.cloud.documentai.v1.FetchProcessorTypesResponse) => void; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#listProcessorTypes}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|listProcessorTypes}. * @param error Error, if any * @param [response] ListProcessorTypesResponse */ type ListProcessorTypesCallback = (error: (Error|null), response?: google.cloud.documentai.v1.ListProcessorTypesResponse) => void; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#listProcessors}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|listProcessors}. * @param error Error, if any * @param [response] ListProcessorsResponse */ type ListProcessorsCallback = (error: (Error|null), response?: google.cloud.documentai.v1.ListProcessorsResponse) => void; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#getProcessor}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|getProcessor}. * @param error Error, if any * @param [response] Processor */ type GetProcessorCallback = (error: (Error|null), response?: google.cloud.documentai.v1.Processor) => void; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#getProcessorVersion}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|getProcessorVersion}. * @param error Error, if any * @param [response] ProcessorVersion */ type GetProcessorVersionCallback = (error: (Error|null), response?: google.cloud.documentai.v1.ProcessorVersion) => void; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#listProcessorVersions}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|listProcessorVersions}. * @param error Error, if any * @param [response] ListProcessorVersionsResponse */ type ListProcessorVersionsCallback = (error: (Error|null), response?: google.cloud.documentai.v1.ListProcessorVersionsResponse) => void; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#deleteProcessorVersion}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|deleteProcessorVersion}. * @param error Error, if any * @param [response] Operation */ type DeleteProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#deployProcessorVersion}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|deployProcessorVersion}. * @param error Error, if any * @param [response] Operation */ type DeployProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#undeployProcessorVersion}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|undeployProcessorVersion}. * @param error Error, if any * @param [response] Operation */ type UndeployProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#createProcessor}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|createProcessor}. * @param error Error, if any * @param [response] Processor */ type CreateProcessorCallback = (error: (Error|null), response?: google.cloud.documentai.v1.Processor) => void; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#deleteProcessor}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|deleteProcessor}. * @param error Error, if any * @param [response] Operation */ type DeleteProcessorCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#enableProcessor}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|enableProcessor}. * @param error Error, if any * @param [response] Operation */ type EnableProcessorCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#disableProcessor}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|disableProcessor}. * @param error Error, if any * @param [response] Operation */ type DisableProcessorCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#setDefaultProcessorVersion}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|setDefaultProcessorVersion}. * @param error Error, if any * @param [response] Operation */ type SetDefaultProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#reviewDocument}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|reviewDocument}. * @param error Error, if any * @param [response] Operation */ @@ -5389,6 +5704,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProcessRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a HumanReviewStatus. */ @@ -5491,6 +5813,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for HumanReviewStatus + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace HumanReviewStatus { @@ -5599,6 +5928,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProcessResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BatchProcessRequest. */ @@ -5707,6 +6043,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchProcessRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BatchProcessResponse. */ @@ -5791,6 +6134,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchProcessResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BatchProcessMetadata. */ @@ -5905,6 +6255,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchProcessMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace BatchProcessMetadata { @@ -6015,6 +6372,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for IndividualProcessStatus + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** State enum. */ @@ -6117,6 +6481,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FetchProcessorTypesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FetchProcessorTypesResponse. */ @@ -6207,6 +6578,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FetchProcessorTypesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListProcessorTypesRequest. */ @@ -6309,6 +6687,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListProcessorTypesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListProcessorTypesResponse. */ @@ -6405,6 +6790,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListProcessorTypesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListProcessorsRequest. */ @@ -6507,6 +6899,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListProcessorsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListProcessorsResponse. */ @@ -6603,6 +7002,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListProcessorsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetProcessorRequest. */ @@ -6693,6 +7099,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetProcessorRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetProcessorVersionRequest. */ @@ -6783,6 +7196,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetProcessorVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListProcessorVersionsRequest. */ @@ -6885,6 +7305,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListProcessorVersionsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListProcessorVersionsResponse. */ @@ -6981,6 +7408,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListProcessorVersionsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteProcessorVersionRequest. */ @@ -7071,6 +7505,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteProcessorVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteProcessorVersionMetadata. */ @@ -7161,6 +7602,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteProcessorVersionMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeployProcessorVersionRequest. */ @@ -7251,6 +7699,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeployProcessorVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeployProcessorVersionResponse. */ @@ -7335,6 +7790,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeployProcessorVersionResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeployProcessorVersionMetadata. */ @@ -7425,6 +7887,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeployProcessorVersionMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UndeployProcessorVersionRequest. */ @@ -7515,6 +7984,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UndeployProcessorVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UndeployProcessorVersionResponse. */ @@ -7599,6 +8075,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UndeployProcessorVersionResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UndeployProcessorVersionMetadata. */ @@ -7689,6 +8172,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UndeployProcessorVersionMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CreateProcessorRequest. */ @@ -7785,6 +8275,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateProcessorRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteProcessorRequest. */ @@ -7875,6 +8372,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteProcessorRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteProcessorMetadata. */ @@ -7965,6 +8469,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteProcessorMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an EnableProcessorRequest. */ @@ -8055,6 +8566,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnableProcessorRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an EnableProcessorResponse. */ @@ -8139,6 +8657,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnableProcessorResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an EnableProcessorMetadata. */ @@ -8229,6 +8754,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnableProcessorMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DisableProcessorRequest. */ @@ -8319,6 +8851,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DisableProcessorRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DisableProcessorResponse. */ @@ -8403,6 +8942,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DisableProcessorResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DisableProcessorMetadata. */ @@ -8493,6 +9039,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DisableProcessorMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SetDefaultProcessorVersionRequest. */ @@ -8589,6 +9142,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetDefaultProcessorVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SetDefaultProcessorVersionResponse. */ @@ -8673,6 +9233,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetDefaultProcessorVersionResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SetDefaultProcessorVersionMetadata. */ @@ -8763,6 +9330,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetDefaultProcessorVersionMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ReviewDocumentRequest. */ @@ -8880,6 +9454,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReviewDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace ReviewDocumentRequest { @@ -8991,6 +9572,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReviewDocumentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace ReviewDocumentResponse { @@ -9097,6 +9685,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReviewDocumentOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DocumentSchema. */ @@ -9205,6 +9800,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentSchema + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace DocumentSchema { @@ -9324,6 +9926,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EntityType + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace EntityType { @@ -9416,6 +10025,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumValues + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Property. */ @@ -9518,6 +10134,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Property + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Property { @@ -9639,6 +10262,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Metadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -9754,6 +10384,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CommonOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace CommonOperationMetadata { @@ -9899,6 +10536,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProcessorVersion + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace ProcessorVersion { @@ -9997,6 +10641,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeprecationInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** State enum. */ @@ -10142,6 +10793,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Processor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Processor { @@ -10277,6 +10935,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProcessorType + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace ProcessorType { @@ -10369,6 +11034,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LocationInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } } @@ -10521,6 +11193,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Document + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Document { @@ -10625,6 +11304,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ShardInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Style. */ @@ -10751,6 +11437,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Style + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Style { @@ -10849,6 +11542,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FontSize + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -11000,6 +11700,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Page + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Page { @@ -11104,6 +11811,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Dimension + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Layout. */ @@ -11212,6 +11926,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Layout + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Layout { @@ -11320,6 +12041,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Block + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Paragraph. */ @@ -11416,6 +12144,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Paragraph + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Line. */ @@ -11512,6 +12247,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Line + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Token. */ @@ -11614,6 +12356,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Token + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Token { @@ -11706,6 +12455,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DetectedBreak + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace DetectedBreak { @@ -11820,6 +12576,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VisualElement + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Table. */ @@ -11928,6 +12691,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Table + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Table { @@ -12020,6 +12790,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TableRow + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TableCell. */ @@ -12128,6 +12905,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TableCell + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -12237,6 +13021,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FormField + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DetectedLanguage. */ @@ -12333,6 +13124,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DetectedLanguage + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -12442,6 +13240,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Entity + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an EntityRelation. */ @@ -12544,6 +13349,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EntityRelation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TextAnchor. */ @@ -12634,6 +13446,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TextAnchor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace TextAnchor { @@ -12732,6 +13551,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TextSegment + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } } @@ -12830,6 +13656,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Vertex + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a NormalizedVertex. */ @@ -12926,6 +13759,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NormalizedVertex + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BoundingPoly. */ @@ -13022,6 +13862,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BoundingPoly + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Represents a DocumentUnderstandingService */ @@ -13062,7 +13909,7 @@ export namespace google { namespace DocumentUnderstandingService { /** - * Callback as used by {@link google.cloud.documentai.v1beta1.DocumentUnderstandingService#batchProcessDocuments}. + * Callback as used by {@link google.cloud.documentai.v1beta1.DocumentUnderstandingService|batchProcessDocuments}. * @param error Error, if any * @param [response] Operation */ @@ -13163,6 +14010,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchProcessDocumentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ProcessDocumentRequest. */ @@ -13289,6 +14143,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProcessDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BatchProcessDocumentsResponse. */ @@ -13379,6 +14240,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchProcessDocumentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ProcessDocumentResponse. */ @@ -13475,6 +14343,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProcessDocumentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an OcrParams. */ @@ -13565,6 +14440,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OcrParams + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TableExtractionParams. */ @@ -13673,6 +14555,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TableExtractionParams + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TableBoundHint. */ @@ -13769,6 +14658,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TableBoundHint + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FormExtractionParams. */ @@ -13871,6 +14767,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FormExtractionParams + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a KeyValuePairHint. */ @@ -13967,6 +14870,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for KeyValuePairHint + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an EntityExtractionParams. */ @@ -14063,6 +14973,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EntityExtractionParams + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an InputConfig. */ @@ -14162,6 +15079,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an OutputConfig. */ @@ -14261,6 +15185,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OutputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GcsSource. */ @@ -14351,6 +15282,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 GcsDestination. */ @@ -14441,6 +15379,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GcsDestination + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an OperationMetadata. */ @@ -14549,6 +15494,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace OperationMetadata { @@ -14720,6 +15672,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Document + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Document { @@ -14824,6 +15783,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ShardInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Label. */ @@ -14929,6 +15895,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Label + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Style. */ @@ -15055,6 +16028,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Style + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Style { @@ -15153,6 +16133,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FontSize + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -15304,6 +16291,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Page + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Page { @@ -15408,6 +16402,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Dimension + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Layout. */ @@ -15522,6 +16523,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Layout + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Layout { @@ -15630,6 +16638,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Block + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Paragraph. */ @@ -15726,6 +16741,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Paragraph + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Line. */ @@ -15822,6 +16844,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Line + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Token. */ @@ -15924,6 +16953,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Token + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Token { @@ -16016,6 +17052,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DetectedBreak + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace DetectedBreak { @@ -16130,6 +17173,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VisualElement + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Table. */ @@ -16238,6 +17288,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Table + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Table { @@ -16330,6 +17387,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TableRow + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TableCell. */ @@ -16438,6 +17502,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TableCell + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -16565,6 +17636,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FormField + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DetectedLanguage. */ @@ -16661,6 +17739,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DetectedLanguage + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -16788,6 +17873,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Entity + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an EntityRelation. */ @@ -16890,6 +17982,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EntityRelation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TextAnchor. */ @@ -16986,6 +18085,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TextAnchor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace TextAnchor { @@ -17084,6 +18190,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TextSegment + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -17175,6 +18288,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PageAnchor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace PageAnchor { @@ -17279,6 +18399,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PageRef + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace PageRef { @@ -17392,6 +18519,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Vertex + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a NormalizedVertex. */ @@ -17488,6 +18622,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NormalizedVertex + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BoundingPoly. */ @@ -17584,6 +18725,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BoundingPoly + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Represents a DocumentUnderstandingService */ @@ -17638,14 +18786,14 @@ export namespace google { namespace DocumentUnderstandingService { /** - * Callback as used by {@link google.cloud.documentai.v1beta2.DocumentUnderstandingService#batchProcessDocuments}. + * Callback as used by {@link google.cloud.documentai.v1beta2.DocumentUnderstandingService|batchProcessDocuments}. * @param error Error, if any * @param [response] Operation */ type BatchProcessDocumentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.documentai.v1beta2.DocumentUnderstandingService#processDocument}. + * Callback as used by {@link google.cloud.documentai.v1beta2.DocumentUnderstandingService|processDocument}. * @param error Error, if any * @param [response] Document */ @@ -17746,6 +18894,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchProcessDocumentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ProcessDocumentRequest. */ @@ -17884,6 +19039,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProcessDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BatchProcessDocumentsResponse. */ @@ -17974,6 +19136,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchProcessDocumentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ProcessDocumentResponse. */ @@ -18070,6 +19239,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProcessDocumentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an OcrParams. */ @@ -18160,6 +19336,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OcrParams + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TableExtractionParams. */ @@ -18268,6 +19451,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TableExtractionParams + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TableBoundHint. */ @@ -18364,6 +19554,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TableBoundHint + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FormExtractionParams. */ @@ -18466,6 +19663,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FormExtractionParams + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a KeyValuePairHint. */ @@ -18562,6 +19766,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for KeyValuePairHint + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an EntityExtractionParams. */ @@ -18658,6 +19869,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EntityExtractionParams + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AutoMlParams. */ @@ -18748,6 +19966,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AutoMlParams + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an InputConfig. */ @@ -18853,6 +20078,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an OutputConfig. */ @@ -18952,6 +20184,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OutputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GcsSource. */ @@ -19042,6 +20281,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 GcsDestination. */ @@ -19132,6 +20378,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GcsDestination + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an OperationMetadata. */ @@ -19240,6 +20493,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace OperationMetadata { @@ -19360,6 +20620,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Barcode + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Document. */ @@ -19519,6 +20786,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Document + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Document { @@ -19623,6 +20897,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ShardInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Style. */ @@ -19749,6 +21030,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Style + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Style { @@ -19847,6 +21135,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FontSize + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -20028,6 +21323,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Page + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Page { @@ -20132,6 +21434,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Dimension + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an Image. */ @@ -20240,6 +21549,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 a Matrix. */ @@ -20348,6 +21664,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Matrix + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Layout. */ @@ -20456,6 +21779,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Layout + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Layout { @@ -20570,6 +21900,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Block + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Paragraph. */ @@ -20672,6 +22009,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Paragraph + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Line. */ @@ -20774,6 +22118,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Line + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Token. */ @@ -20882,6 +22233,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Token + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Token { @@ -20974,6 +22332,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DetectedBreak + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace DetectedBreak { @@ -21082,6 +22447,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Symbol + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a VisualElement. */ @@ -21184,6 +22556,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VisualElement + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Table. */ @@ -21292,6 +22671,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Table + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Table { @@ -21384,6 +22770,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TableRow + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TableCell. */ @@ -21492,6 +22885,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TableCell + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -21625,6 +23025,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FormField + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DetectedBarcode. */ @@ -21721,6 +23128,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DetectedBarcode + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DetectedLanguage. */ @@ -21817,6 +23231,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DetectedLanguage + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -21968,6 +23389,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Entity + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Entity { @@ -22105,6 +23533,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NormalizedValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -22208,6 +23643,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EntityRelation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TextAnchor. */ @@ -22304,6 +23746,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TextAnchor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace TextAnchor { @@ -22402,6 +23851,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TextSegment + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -22493,6 +23949,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PageAnchor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace PageAnchor { @@ -22609,6 +24072,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PageRef + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace PageRef { @@ -22733,6 +24203,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Provenance + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Provenance { @@ -22837,6 +24314,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Parent + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** OperationType enum. */ @@ -22978,6 +24462,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Revision + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Revision { @@ -23076,6 +24567,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for HumanReview + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -23179,6 +24677,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TextChange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -23276,6 +24781,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Vertex + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a NormalizedVertex. */ @@ -23372,6 +24884,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NormalizedVertex + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BoundingPoly. */ @@ -23468,6 +24987,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BoundingPoly + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RawDocument. */ @@ -23564,6 +25090,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RawDocument + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GcsDocument. */ @@ -23660,6 +25193,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GcsDocument + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GcsDocuments. */ @@ -23750,6 +25290,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GcsDocuments + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GcsPrefix. */ @@ -23840,6 +25387,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GcsPrefix + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BatchDocumentsInputConfig. */ @@ -23939,6 +25493,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchDocumentsInputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DocumentOutputConfig. */ @@ -24032,6 +25593,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentOutputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace DocumentOutputConfig { @@ -24124,6 +25692,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GcsOutputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -24389,119 +25964,119 @@ export namespace google { namespace DocumentProcessorService { /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#processDocument}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|processDocument}. * @param error Error, if any * @param [response] ProcessResponse */ type ProcessDocumentCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.ProcessResponse) => void; /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#batchProcessDocuments}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|batchProcessDocuments}. * @param error Error, if any * @param [response] Operation */ type BatchProcessDocumentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#fetchProcessorTypes}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|fetchProcessorTypes}. * @param error Error, if any * @param [response] FetchProcessorTypesResponse */ type FetchProcessorTypesCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.FetchProcessorTypesResponse) => void; /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#listProcessorTypes}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|listProcessorTypes}. * @param error Error, if any * @param [response] ListProcessorTypesResponse */ type ListProcessorTypesCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.ListProcessorTypesResponse) => void; /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#listProcessors}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|listProcessors}. * @param error Error, if any * @param [response] ListProcessorsResponse */ type ListProcessorsCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.ListProcessorsResponse) => void; /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#getProcessor}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|getProcessor}. * @param error Error, if any * @param [response] Processor */ type GetProcessorCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.Processor) => void; /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#getProcessorVersion}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|getProcessorVersion}. * @param error Error, if any * @param [response] ProcessorVersion */ type GetProcessorVersionCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.ProcessorVersion) => void; /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#listProcessorVersions}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|listProcessorVersions}. * @param error Error, if any * @param [response] ListProcessorVersionsResponse */ type ListProcessorVersionsCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.ListProcessorVersionsResponse) => void; /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#deleteProcessorVersion}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|deleteProcessorVersion}. * @param error Error, if any * @param [response] Operation */ type DeleteProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#deployProcessorVersion}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|deployProcessorVersion}. * @param error Error, if any * @param [response] Operation */ type DeployProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#undeployProcessorVersion}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|undeployProcessorVersion}. * @param error Error, if any * @param [response] Operation */ type UndeployProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#createProcessor}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|createProcessor}. * @param error Error, if any * @param [response] Processor */ type CreateProcessorCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.Processor) => void; /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#deleteProcessor}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|deleteProcessor}. * @param error Error, if any * @param [response] Operation */ type DeleteProcessorCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#enableProcessor}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|enableProcessor}. * @param error Error, if any * @param [response] Operation */ type EnableProcessorCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#disableProcessor}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|disableProcessor}. * @param error Error, if any * @param [response] Operation */ type DisableProcessorCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#setDefaultProcessorVersion}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|setDefaultProcessorVersion}. * @param error Error, if any * @param [response] Operation */ type SetDefaultProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#reviewDocument}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|reviewDocument}. * @param error Error, if any * @param [response] Operation */ @@ -24629,6 +26204,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProcessRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a HumanReviewStatus. */ @@ -24731,6 +26313,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for HumanReviewStatus + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace HumanReviewStatus { @@ -24845,6 +26434,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProcessResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BatchProcessRequest. */ @@ -24965,6 +26561,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchProcessRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace BatchProcessRequest { @@ -25063,6 +26666,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchInputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BatchOutputConfig. */ @@ -25153,6 +26763,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchOutputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -25238,6 +26855,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchProcessResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BatchProcessMetadata. */ @@ -25352,6 +26976,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchProcessMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace BatchProcessMetadata { @@ -25468,6 +27099,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for IndividualProcessStatus + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** State enum. */ @@ -25570,6 +27208,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FetchProcessorTypesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FetchProcessorTypesResponse. */ @@ -25660,6 +27305,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FetchProcessorTypesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListProcessorTypesRequest. */ @@ -25762,6 +27414,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListProcessorTypesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListProcessorTypesResponse. */ @@ -25858,6 +27517,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListProcessorTypesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListProcessorsRequest. */ @@ -25960,6 +27626,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListProcessorsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListProcessorsResponse. */ @@ -26056,6 +27729,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListProcessorsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetProcessorRequest. */ @@ -26146,6 +27826,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetProcessorRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetProcessorVersionRequest. */ @@ -26236,6 +27923,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetProcessorVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListProcessorVersionsRequest. */ @@ -26338,6 +28032,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListProcessorVersionsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListProcessorVersionsResponse. */ @@ -26434,6 +28135,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListProcessorVersionsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteProcessorVersionRequest. */ @@ -26524,6 +28232,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteProcessorVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteProcessorVersionMetadata. */ @@ -26614,6 +28329,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteProcessorVersionMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeployProcessorVersionRequest. */ @@ -26704,6 +28426,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeployProcessorVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeployProcessorVersionResponse. */ @@ -26788,6 +28517,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeployProcessorVersionResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeployProcessorVersionMetadata. */ @@ -26878,6 +28614,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeployProcessorVersionMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UndeployProcessorVersionRequest. */ @@ -26968,6 +28711,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UndeployProcessorVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UndeployProcessorVersionResponse. */ @@ -27052,6 +28802,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UndeployProcessorVersionResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UndeployProcessorVersionMetadata. */ @@ -27142,6 +28899,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UndeployProcessorVersionMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CreateProcessorRequest. */ @@ -27238,6 +29002,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateProcessorRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteProcessorRequest. */ @@ -27328,6 +29099,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteProcessorRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteProcessorMetadata. */ @@ -27418,6 +29196,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteProcessorMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an EnableProcessorRequest. */ @@ -27508,6 +29293,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnableProcessorRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an EnableProcessorResponse. */ @@ -27592,6 +29384,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnableProcessorResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an EnableProcessorMetadata. */ @@ -27682,6 +29481,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnableProcessorMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DisableProcessorRequest. */ @@ -27772,6 +29578,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DisableProcessorRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DisableProcessorResponse. */ @@ -27856,6 +29669,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DisableProcessorResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DisableProcessorMetadata. */ @@ -27946,6 +29766,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DisableProcessorMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SetDefaultProcessorVersionRequest. */ @@ -28042,6 +29869,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetDefaultProcessorVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SetDefaultProcessorVersionResponse. */ @@ -28126,6 +29960,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetDefaultProcessorVersionResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SetDefaultProcessorVersionMetadata. */ @@ -28216,6 +30057,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetDefaultProcessorVersionMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ReviewDocumentRequest. */ @@ -28339,6 +30187,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReviewDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace ReviewDocumentRequest { @@ -28450,6 +30305,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReviewDocumentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace ReviewDocumentResponse { @@ -28580,6 +30442,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReviewDocumentOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace ReviewDocumentOperationMetadata { @@ -28701,6 +30570,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentSchema + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace DocumentSchema { @@ -28820,6 +30696,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EntityType + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace EntityType { @@ -28912,6 +30795,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumValues + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Property. */ @@ -29014,6 +30904,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Property + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Property { @@ -29135,6 +31032,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Metadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -29250,6 +31154,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CommonOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace CommonOperationMetadata { @@ -29395,6 +31306,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProcessorVersion + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace ProcessorVersion { @@ -29493,6 +31411,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeprecationInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** State enum. */ @@ -29638,6 +31563,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Processor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Processor { @@ -29773,6 +31705,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProcessorType + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace ProcessorType { @@ -29865,6 +31804,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LocationInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } } @@ -29980,6 +31926,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. */ @@ -30127,6 +32080,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. */ @@ -30223,6 +32183,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 ResourceDescriptor. */ @@ -30349,6 +32316,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 { @@ -30461,6 +32435,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; } /** LaunchStage enum. */ @@ -30567,6 +32548,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. */ @@ -30607,6 +32595,9 @@ export namespace google { /** FileDescriptorProto syntax */ syntax?: (string|null); + + /** FileDescriptorProto edition */ + edition?: (string|null); } /** Represents a FileDescriptorProto. */ @@ -30654,6 +32645,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 @@ -30723,6 +32717,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. */ @@ -30867,6 +32868,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 { @@ -30971,6 +32979,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. */ @@ -31067,6 +33082,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; } } @@ -31158,6 +33180,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. */ @@ -31308,6 +33337,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 { @@ -31436,6 +33472,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. */ @@ -31550,6 +33593,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 { @@ -31648,6 +33698,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; } } @@ -31751,6 +33808,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. */ @@ -31853,6 +33917,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. */ @@ -31973,6 +34044,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. */ @@ -32186,6 +34264,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 { @@ -32313,6 +34398,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. */ @@ -32330,6 +34422,9 @@ export namespace google { /** FieldOptions lazy */ lazy?: (boolean|null); + /** FieldOptions unverifiedLazy */ + unverifiedLazy?: (boolean|null); + /** FieldOptions deprecated */ deprecated?: (boolean|null); @@ -32367,6 +34462,9 @@ export namespace google { /** FieldOptions lazy. */ public lazy: boolean; + /** FieldOptions unverifiedLazy. */ + public unverifiedLazy: boolean; + /** FieldOptions deprecated. */ public deprecated: boolean; @@ -32445,6 +34543,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 { @@ -32552,6 +34657,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. */ @@ -32654,6 +34766,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. */ @@ -32750,6 +34869,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. */ @@ -32852,6 +34978,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. */ @@ -32963,6 +35096,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 { @@ -33099,6 +35239,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 { @@ -33197,6 +35344,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; } } @@ -33288,6 +35442,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 { @@ -33404,6 +35565,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; } } @@ -33495,6 +35663,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 { @@ -33513,6 +35688,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. */ @@ -33536,6 +35714,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 @@ -33605,6 +35786,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 + } } } @@ -33702,6 +35900,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 an Any. */ @@ -33798,6 +36003,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 DoubleValue. */ @@ -33888,6 +36100,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. */ @@ -33978,6 +36197,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. */ @@ -34068,6 +36294,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. */ @@ -34158,6 +36391,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. */ @@ -34248,6 +36488,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. */ @@ -34338,6 +36585,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. */ @@ -34428,6 +36682,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. */ @@ -34518,6 +36779,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. */ @@ -34608,6 +36876,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 a Duration. */ @@ -34704,6 +36979,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 an Empty. */ @@ -34788,6 +37070,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. */ @@ -34878,6 +37167,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; } } @@ -34984,6 +37280,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; } } @@ -35096,6 +37399,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Color + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Date. */ @@ -35198,6 +37508,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; } /** Properties of a DateTime. */ @@ -35339,6 +37656,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DateTime + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TimeZone. */ @@ -35435,6 +37759,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TimeZone + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Money. */ @@ -35537,6 +37868,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Money + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PostalAddress. */ @@ -35687,6 +38025,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PostalAddress + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -35787,35 +38132,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 */ @@ -35937,6 +38282,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. */ @@ -36027,6 +38379,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. */ @@ -36135,6 +38494,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. */ @@ -36231,6 +38597,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. */ @@ -36321,6 +38694,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. */ @@ -36411,6 +38791,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. */ @@ -36507,6 +38894,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. */ @@ -36603,6 +38997,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-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index d8ebf58dcc6..fb691f3f478 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -180,15 +180,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.format = reader.string(); - break; - case 2: - message.valueFormat = reader.string(); - break; - case 3: - message.rawValue = reader.string(); - break; + case 1: { + message.format = reader.string(); + break; + } + case 2: { + message.valueFormat = reader.string(); + break; + } + case 3: { + message.rawValue = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -295,6 +298,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Barcode + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Barcode + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Barcode.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Barcode"; + }; + return Barcode; })(); @@ -537,54 +555,66 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.uri = reader.string(); - break; - case 2: - message.content = reader.bytes(); - break; - case 3: - message.mimeType = reader.string(); - break; - case 4: - message.text = reader.string(); - break; - case 5: - if (!(message.textStyles && message.textStyles.length)) - message.textStyles = []; - message.textStyles.push($root.google.cloud.documentai.v1.Document.Style.decode(reader, reader.uint32())); - break; - case 6: - if (!(message.pages && message.pages.length)) - message.pages = []; - message.pages.push($root.google.cloud.documentai.v1.Document.Page.decode(reader, reader.uint32())); - break; - case 7: - if (!(message.entities && message.entities.length)) - message.entities = []; - message.entities.push($root.google.cloud.documentai.v1.Document.Entity.decode(reader, reader.uint32())); - break; - case 8: - if (!(message.entityRelations && message.entityRelations.length)) - message.entityRelations = []; - message.entityRelations.push($root.google.cloud.documentai.v1.Document.EntityRelation.decode(reader, reader.uint32())); - break; - case 14: - if (!(message.textChanges && message.textChanges.length)) - message.textChanges = []; - message.textChanges.push($root.google.cloud.documentai.v1.Document.TextChange.decode(reader, reader.uint32())); - break; - case 9: - message.shardInfo = $root.google.cloud.documentai.v1.Document.ShardInfo.decode(reader, reader.uint32()); - break; - case 10: - message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; - case 13: - if (!(message.revisions && message.revisions.length)) - message.revisions = []; - message.revisions.push($root.google.cloud.documentai.v1.Document.Revision.decode(reader, reader.uint32())); - break; + case 1: { + message.uri = reader.string(); + break; + } + case 2: { + message.content = reader.bytes(); + break; + } + case 3: { + message.mimeType = reader.string(); + break; + } + case 4: { + message.text = reader.string(); + break; + } + case 5: { + if (!(message.textStyles && message.textStyles.length)) + message.textStyles = []; + message.textStyles.push($root.google.cloud.documentai.v1.Document.Style.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.pages && message.pages.length)) + message.pages = []; + message.pages.push($root.google.cloud.documentai.v1.Document.Page.decode(reader, reader.uint32())); + break; + } + case 7: { + if (!(message.entities && message.entities.length)) + message.entities = []; + message.entities.push($root.google.cloud.documentai.v1.Document.Entity.decode(reader, reader.uint32())); + break; + } + case 8: { + if (!(message.entityRelations && message.entityRelations.length)) + message.entityRelations = []; + message.entityRelations.push($root.google.cloud.documentai.v1.Document.EntityRelation.decode(reader, reader.uint32())); + break; + } + case 14: { + if (!(message.textChanges && message.textChanges.length)) + message.textChanges = []; + message.textChanges.push($root.google.cloud.documentai.v1.Document.TextChange.decode(reader, reader.uint32())); + break; + } + case 9: { + message.shardInfo = $root.google.cloud.documentai.v1.Document.ShardInfo.decode(reader, reader.uint32()); + break; + } + case 10: { + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + case 13: { + if (!(message.revisions && message.revisions.length)) + message.revisions = []; + message.revisions.push($root.google.cloud.documentai.v1.Document.Revision.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -723,7 +753,7 @@ if (object.content != null) if (typeof object.content === "string") $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); - else if (object.content.length) + else if (object.content.length >= 0) message.content = object.content; if (object.mimeType != null) message.mimeType = String(object.mimeType); @@ -891,6 +921,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Document + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Document.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document"; + }; + Document.ShardInfo = (function() { /** @@ -1005,15 +1050,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.shardIndex = reader.int64(); - break; - case 2: - message.shardCount = reader.int64(); - break; - case 3: - message.textOffset = reader.int64(); - break; + case 1: { + message.shardIndex = reader.int64(); + break; + } + case 2: { + message.shardCount = reader.int64(); + break; + } + case 3: { + message.textOffset = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -1162,6 +1210,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ShardInfo + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.ShardInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ShardInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.ShardInfo"; + }; + return ShardInfo; })(); @@ -1323,27 +1386,34 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.decode(reader, reader.uint32()); - break; - case 2: - message.color = $root.google.type.Color.decode(reader, reader.uint32()); - break; - case 3: - message.backgroundColor = $root.google.type.Color.decode(reader, reader.uint32()); - break; - case 4: - message.fontWeight = reader.string(); - break; - case 5: - message.textStyle = reader.string(); - break; - case 6: - message.textDecoration = reader.string(); - break; - case 7: - message.fontSize = $root.google.cloud.documentai.v1.Document.Style.FontSize.decode(reader, reader.uint32()); - break; + case 1: { + message.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.decode(reader, reader.uint32()); + break; + } + case 2: { + message.color = $root.google.type.Color.decode(reader, reader.uint32()); + break; + } + case 3: { + message.backgroundColor = $root.google.type.Color.decode(reader, reader.uint32()); + break; + } + case 4: { + message.fontWeight = reader.string(); + break; + } + case 5: { + message.textStyle = reader.string(); + break; + } + case 6: { + message.textDecoration = reader.string(); + break; + } + case 7: { + message.fontSize = $root.google.cloud.documentai.v1.Document.Style.FontSize.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -1502,6 +1572,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Style + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Style + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Style.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Style"; + }; + Style.FontSize = (function() { /** @@ -1605,12 +1690,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.size = reader.float(); - break; - case 2: - message.unit = reader.string(); - break; + case 1: { + message.size = reader.float(); + break; + } + case 2: { + message.unit = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -1709,6 +1796,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FontSize + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Style.FontSize + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FontSize.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Style.FontSize"; + }; + return FontSize; })(); @@ -1994,76 +2096,92 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.pageNumber = reader.int32(); - break; - case 13: - message.image = $root.google.cloud.documentai.v1.Document.Page.Image.decode(reader, reader.uint32()); - break; - case 14: - if (!(message.transforms && message.transforms.length)) - message.transforms = []; - message.transforms.push($root.google.cloud.documentai.v1.Document.Page.Matrix.decode(reader, reader.uint32())); - break; - case 2: - message.dimension = $root.google.cloud.documentai.v1.Document.Page.Dimension.decode(reader, reader.uint32()); - break; - case 3: - message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.blocks && message.blocks.length)) - message.blocks = []; - message.blocks.push($root.google.cloud.documentai.v1.Document.Page.Block.decode(reader, reader.uint32())); - break; - case 6: - if (!(message.paragraphs && message.paragraphs.length)) - message.paragraphs = []; - message.paragraphs.push($root.google.cloud.documentai.v1.Document.Page.Paragraph.decode(reader, reader.uint32())); - break; - case 7: - if (!(message.lines && message.lines.length)) - message.lines = []; - message.lines.push($root.google.cloud.documentai.v1.Document.Page.Line.decode(reader, reader.uint32())); - break; - case 8: - if (!(message.tokens && message.tokens.length)) - message.tokens = []; - message.tokens.push($root.google.cloud.documentai.v1.Document.Page.Token.decode(reader, reader.uint32())); - break; - case 9: - if (!(message.visualElements && message.visualElements.length)) - message.visualElements = []; - message.visualElements.push($root.google.cloud.documentai.v1.Document.Page.VisualElement.decode(reader, reader.uint32())); - break; - case 10: - if (!(message.tables && message.tables.length)) - message.tables = []; - message.tables.push($root.google.cloud.documentai.v1.Document.Page.Table.decode(reader, reader.uint32())); - break; - case 11: - if (!(message.formFields && message.formFields.length)) - message.formFields = []; - message.formFields.push($root.google.cloud.documentai.v1.Document.Page.FormField.decode(reader, reader.uint32())); - break; - case 12: - if (!(message.symbols && message.symbols.length)) - message.symbols = []; - message.symbols.push($root.google.cloud.documentai.v1.Document.Page.Symbol.decode(reader, reader.uint32())); - break; - case 15: - if (!(message.detectedBarcodes && message.detectedBarcodes.length)) - message.detectedBarcodes = []; - message.detectedBarcodes.push($root.google.cloud.documentai.v1.Document.Page.DetectedBarcode.decode(reader, reader.uint32())); - break; - case 16: - message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); - break; + case 1: { + message.pageNumber = reader.int32(); + break; + } + case 13: { + message.image = $root.google.cloud.documentai.v1.Document.Page.Image.decode(reader, reader.uint32()); + break; + } + case 14: { + if (!(message.transforms && message.transforms.length)) + message.transforms = []; + message.transforms.push($root.google.cloud.documentai.v1.Document.Page.Matrix.decode(reader, reader.uint32())); + break; + } + case 2: { + message.dimension = $root.google.cloud.documentai.v1.Document.Page.Dimension.decode(reader, reader.uint32()); + break; + } + case 3: { + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.blocks && message.blocks.length)) + message.blocks = []; + message.blocks.push($root.google.cloud.documentai.v1.Document.Page.Block.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.paragraphs && message.paragraphs.length)) + message.paragraphs = []; + message.paragraphs.push($root.google.cloud.documentai.v1.Document.Page.Paragraph.decode(reader, reader.uint32())); + break; + } + case 7: { + if (!(message.lines && message.lines.length)) + message.lines = []; + message.lines.push($root.google.cloud.documentai.v1.Document.Page.Line.decode(reader, reader.uint32())); + break; + } + case 8: { + if (!(message.tokens && message.tokens.length)) + message.tokens = []; + message.tokens.push($root.google.cloud.documentai.v1.Document.Page.Token.decode(reader, reader.uint32())); + break; + } + case 9: { + if (!(message.visualElements && message.visualElements.length)) + message.visualElements = []; + message.visualElements.push($root.google.cloud.documentai.v1.Document.Page.VisualElement.decode(reader, reader.uint32())); + break; + } + case 10: { + if (!(message.tables && message.tables.length)) + message.tables = []; + message.tables.push($root.google.cloud.documentai.v1.Document.Page.Table.decode(reader, reader.uint32())); + break; + } + case 11: { + if (!(message.formFields && message.formFields.length)) + message.formFields = []; + message.formFields.push($root.google.cloud.documentai.v1.Document.Page.FormField.decode(reader, reader.uint32())); + break; + } + case 12: { + if (!(message.symbols && message.symbols.length)) + message.symbols = []; + message.symbols.push($root.google.cloud.documentai.v1.Document.Page.Symbol.decode(reader, reader.uint32())); + break; + } + case 15: { + if (!(message.detectedBarcodes && message.detectedBarcodes.length)) + message.detectedBarcodes = []; + message.detectedBarcodes.push($root.google.cloud.documentai.v1.Document.Page.DetectedBarcode.decode(reader, reader.uint32())); + break; + } + case 16: { + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -2483,6 +2601,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Page + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Page + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Page.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Page"; + }; + Page.Dimension = (function() { /** @@ -2597,15 +2730,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.width = reader.float(); - break; - case 2: - message.height = reader.float(); - break; - case 3: - message.unit = reader.string(); - break; + case 1: { + message.width = reader.float(); + break; + } + case 2: { + message.height = reader.float(); + break; + } + case 3: { + message.unit = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -2712,6 +2848,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Dimension + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Page.Dimension + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Dimension.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Page.Dimension"; + }; + return Dimension; })(); @@ -2840,18 +2991,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.content = reader.bytes(); - break; - case 2: - message.mimeType = reader.string(); - break; - case 3: - message.width = reader.int32(); - break; - case 4: - message.height = reader.int32(); - break; + case 1: { + message.content = reader.bytes(); + break; + } + case 2: { + message.mimeType = reader.string(); + break; + } + case 3: { + message.width = reader.int32(); + break; + } + case 4: { + message.height = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -2917,7 +3072,7 @@ if (object.content != null) if (typeof object.content === "string") $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); - else if (object.content.length) + else if (object.content.length >= 0) message.content = object.content; if (object.mimeType != null) message.mimeType = String(object.mimeType); @@ -2975,6 +3130,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Image + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Page.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.documentai.v1.Document.Page.Image"; + }; + return Image; })(); @@ -3103,18 +3273,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.rows = reader.int32(); - break; - case 2: - message.cols = reader.int32(); - break; - case 3: - message.type = reader.int32(); - break; - case 4: - message.data = reader.bytes(); - break; + case 1: { + message.rows = reader.int32(); + break; + } + case 2: { + message.cols = reader.int32(); + break; + } + case 3: { + message.type = reader.int32(); + break; + } + case 4: { + message.data = reader.bytes(); + break; + } default: reader.skipType(tag & 7); break; @@ -3186,7 +3360,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; return message; }; @@ -3238,6 +3412,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Matrix + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Page.Matrix + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Matrix.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Page.Matrix"; + }; + return Matrix; })(); @@ -3366,18 +3555,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.decode(reader, reader.uint32()); - break; - case 2: - message.confidence = reader.float(); - break; - case 3: - message.boundingPoly = $root.google.cloud.documentai.v1.BoundingPoly.decode(reader, reader.uint32()); - break; - case 4: - message.orientation = reader.int32(); - break; + case 1: { + message.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.decode(reader, reader.uint32()); + break; + } + case 2: { + message.confidence = reader.float(); + break; + } + case 3: { + message.boundingPoly = $root.google.cloud.documentai.v1.BoundingPoly.decode(reader, reader.uint32()); + break; + } + case 4: { + message.orientation = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -3530,6 +3723,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Layout + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Page.Layout + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Layout.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Page.Layout"; + }; + /** * Orientation enum. * @name google.cloud.documentai.v1.Document.Page.Layout.Orientation @@ -3669,17 +3877,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; - case 3: - message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + case 3: { + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -3814,6 +4025,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Block + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Page.Block + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Block.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Page.Block"; + }; + return Block; })(); @@ -3933,17 +4159,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; - case 3: - message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + case 3: { + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -4078,6 +4307,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Paragraph + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Page.Paragraph + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Paragraph.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Page.Paragraph"; + }; + return Paragraph; })(); @@ -4197,17 +4441,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; - case 3: - message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + case 3: { + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -4342,6 +4589,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Line + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Page.Line + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Line.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Page.Line"; + }; + return Line; })(); @@ -4472,20 +4734,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - message.detectedBreak = $root.google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.decode(reader, reader.uint32()); - break; - case 3: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; - case 4: - message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + message.detectedBreak = $root.google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.decode(reader, reader.uint32()); + break; + } + case 3: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + case 4: { + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -4633,6 +4899,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Token + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Page.Token + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Token.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Page.Token"; + }; + Token.DetectedBreak = (function() { /** @@ -4725,9 +5006,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.type = reader.int32(); - break; + case 1: { + message.type = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -4840,6 +5122,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DetectedBreak + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Page.Token.DetectedBreak + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DetectedBreak.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Page.Token.DetectedBreak"; + }; + /** * Type enum. * @name google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type @@ -4969,14 +5266,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -5097,6 +5396,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Symbol + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Symbol.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Page.Symbol"; + }; + return Symbol; })(); @@ -5216,17 +5530,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - message.type = reader.string(); - break; - case 3: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -5356,6 +5673,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for VisualElement + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Page.VisualElement + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VisualElement.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Page.VisualElement"; + }; + return VisualElement; })(); @@ -5490,24 +5822,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.headerRows && message.headerRows.length)) - message.headerRows = []; - message.headerRows.push($root.google.cloud.documentai.v1.Document.Page.Table.TableRow.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.bodyRows && message.bodyRows.length)) - message.bodyRows = []; - message.bodyRows.push($root.google.cloud.documentai.v1.Document.Page.Table.TableRow.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.headerRows && message.headerRows.length)) + message.headerRows = []; + message.headerRows.push($root.google.cloud.documentai.v1.Document.Page.Table.TableRow.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.bodyRows && message.bodyRows.length)) + message.bodyRows = []; + message.bodyRows.push($root.google.cloud.documentai.v1.Document.Page.Table.TableRow.decode(reader, reader.uint32())); + break; + } + case 4: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -5679,6 +6015,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Table + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Page.Table + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Table.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Page.Table"; + }; + Table.TableRow = (function() { /** @@ -5773,11 +6124,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.cells && message.cells.length)) - message.cells = []; - message.cells.push($root.google.cloud.documentai.v1.Document.Page.Table.TableCell.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.cells && message.cells.length)) + message.cells = []; + message.cells.push($root.google.cloud.documentai.v1.Document.Page.Table.TableCell.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -5884,6 +6236,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TableRow + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableRow + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TableRow.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Page.Table.TableRow"; + }; + return TableRow; })(); @@ -6014,20 +6381,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - message.rowSpan = reader.int32(); - break; - case 3: - message.colSpan = reader.int32(); - break; - case 4: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + message.rowSpan = reader.int32(); + break; + } + case 3: { + message.colSpan = reader.int32(); + break; + } + case 4: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -6165,6 +6536,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TableCell + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Page.Table.TableCell + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TableCell.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Page.Table.TableCell"; + }; + return TableCell; })(); @@ -6344,34 +6730,42 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.fieldName = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - message.fieldValue = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 3: - if (!(message.nameDetectedLanguages && message.nameDetectedLanguages.length)) - message.nameDetectedLanguages = []; - message.nameDetectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.valueDetectedLanguages && message.valueDetectedLanguages.length)) - message.valueDetectedLanguages = []; - message.valueDetectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; - case 5: - message.valueType = reader.string(); - break; - case 6: - message.correctedKeyText = reader.string(); - break; - case 7: - message.correctedValueText = reader.string(); - break; - case 8: - message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); - break; + case 1: { + message.fieldName = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + message.fieldValue = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 3: { + if (!(message.nameDetectedLanguages && message.nameDetectedLanguages.length)) + message.nameDetectedLanguages = []; + message.nameDetectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + case 4: { + if (!(message.valueDetectedLanguages && message.valueDetectedLanguages.length)) + message.valueDetectedLanguages = []; + message.valueDetectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + case 5: { + message.valueType = reader.string(); + break; + } + case 6: { + message.correctedKeyText = reader.string(); + break; + } + case 7: { + message.correctedValueText = reader.string(); + break; + } + case 8: { + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -6569,6 +6963,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FormField + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FormField.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Page.FormField"; + }; + return FormField; })(); @@ -6675,12 +7084,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - message.barcode = $root.google.cloud.documentai.v1.Barcode.decode(reader, reader.uint32()); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + message.barcode = $root.google.cloud.documentai.v1.Barcode.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -6789,6 +7200,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DetectedBarcode + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DetectedBarcode.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Page.DetectedBarcode"; + }; + return DetectedBarcode; })(); @@ -6895,12 +7321,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.languageCode = reader.string(); - break; - case 2: - message.confidence = reader.float(); - break; + case 1: { + message.languageCode = reader.string(); + break; + } + case 2: { + message.confidence = reader.float(); + break; + } default: reader.skipType(tag & 7); break; @@ -6999,6 +7427,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DetectedLanguage + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Page.DetectedLanguage + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DetectedLanguage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Page.DetectedLanguage"; + }; + return DetectedLanguage; })(); @@ -7209,41 +7652,52 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.decode(reader, reader.uint32()); - break; - case 2: - message.type = reader.string(); - break; - case 3: - message.mentionText = reader.string(); - break; - case 4: - message.mentionId = reader.string(); - break; - case 5: - message.confidence = reader.float(); - break; - case 6: - message.pageAnchor = $root.google.cloud.documentai.v1.Document.PageAnchor.decode(reader, reader.uint32()); - break; - case 7: - message.id = reader.string(); - break; - case 9: - message.normalizedValue = $root.google.cloud.documentai.v1.Document.Entity.NormalizedValue.decode(reader, reader.uint32()); - break; - case 10: - if (!(message.properties && message.properties.length)) - message.properties = []; - message.properties.push($root.google.cloud.documentai.v1.Document.Entity.decode(reader, reader.uint32())); - break; - case 11: - message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); - break; - case 12: - message.redacted = reader.bool(); - break; + case 1: { + message.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.decode(reader, reader.uint32()); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + message.mentionText = reader.string(); + break; + } + case 4: { + message.mentionId = reader.string(); + break; + } + case 5: { + message.confidence = reader.float(); + break; + } + case 6: { + message.pageAnchor = $root.google.cloud.documentai.v1.Document.PageAnchor.decode(reader, reader.uint32()); + break; + } + case 7: { + message.id = reader.string(); + break; + } + case 9: { + message.normalizedValue = $root.google.cloud.documentai.v1.Document.Entity.NormalizedValue.decode(reader, reader.uint32()); + break; + } + case 10: { + if (!(message.properties && message.properties.length)) + message.properties = []; + message.properties.push($root.google.cloud.documentai.v1.Document.Entity.decode(reader, reader.uint32())); + break; + } + case 11: { + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); + break; + } + case 12: { + message.redacted = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -7452,6 +7906,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Entity + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Entity + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Entity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Entity"; + }; + Entity.NormalizedValue = (function() { /** @@ -7635,30 +8104,38 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - message.moneyValue = $root.google.type.Money.decode(reader, reader.uint32()); - break; - case 3: - message.dateValue = $root.google.type.Date.decode(reader, reader.uint32()); - break; - case 4: - message.datetimeValue = $root.google.type.DateTime.decode(reader, reader.uint32()); - break; - case 5: - message.addressValue = $root.google.type.PostalAddress.decode(reader, reader.uint32()); - break; - case 6: - message.booleanValue = reader.bool(); - break; - case 7: - message.integerValue = reader.int32(); - break; - case 8: - message.floatValue = reader.float(); - break; - case 1: - message.text = reader.string(); - break; + case 2: { + message.moneyValue = $root.google.type.Money.decode(reader, reader.uint32()); + break; + } + case 3: { + message.dateValue = $root.google.type.Date.decode(reader, reader.uint32()); + break; + } + case 4: { + message.datetimeValue = $root.google.type.DateTime.decode(reader, reader.uint32()); + break; + } + case 5: { + message.addressValue = $root.google.type.PostalAddress.decode(reader, reader.uint32()); + break; + } + case 6: { + message.booleanValue = reader.bool(); + break; + } + case 7: { + message.integerValue = reader.int32(); + break; + } + case 8: { + message.floatValue = reader.float(); + break; + } + case 1: { + message.text = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -7869,6 +8346,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for NormalizedValue + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NormalizedValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Entity.NormalizedValue"; + }; + return NormalizedValue; })(); @@ -7989,15 +8481,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.subjectId = reader.string(); - break; - case 2: - message.objectId = reader.string(); - break; - case 3: - message.relation = reader.string(); - break; + case 1: { + message.subjectId = reader.string(); + break; + } + case 2: { + message.objectId = reader.string(); + break; + } + case 3: { + message.relation = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -8104,6 +8599,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EntityRelation + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.EntityRelation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EntityRelation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.EntityRelation"; + }; + return EntityRelation; })(); @@ -8212,14 +8722,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.textSegments && message.textSegments.length)) - message.textSegments = []; - message.textSegments.push($root.google.cloud.documentai.v1.Document.TextAnchor.TextSegment.decode(reader, reader.uint32())); - break; - case 2: - message.content = reader.string(); - break; + case 1: { + if (!(message.textSegments && message.textSegments.length)) + message.textSegments = []; + message.textSegments.push($root.google.cloud.documentai.v1.Document.TextAnchor.TextSegment.decode(reader, reader.uint32())); + break; + } + case 2: { + message.content = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -8335,6 +8847,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TextAnchor + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.TextAnchor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TextAnchor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.TextAnchor"; + }; + TextAnchor.TextSegment = (function() { /** @@ -8438,12 +8965,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.startIndex = reader.int64(); - break; - case 2: - message.endIndex = reader.int64(); - break; + case 1: { + message.startIndex = reader.int64(); + break; + } + case 2: { + message.endIndex = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -8570,6 +9099,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TextSegment + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.TextAnchor.TextSegment + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TextSegment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.TextAnchor.TextSegment"; + }; + return TextSegment; })(); @@ -8670,11 +9214,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.pageRefs && message.pageRefs.length)) - message.pageRefs = []; - message.pageRefs.push($root.google.cloud.documentai.v1.Document.PageAnchor.PageRef.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.pageRefs && message.pageRefs.length)) + message.pageRefs = []; + message.pageRefs.push($root.google.cloud.documentai.v1.Document.PageAnchor.PageRef.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -8781,6 +9326,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PageAnchor + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.PageAnchor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PageAnchor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.PageAnchor"; + }; + PageAnchor.PageRef = (function() { /** @@ -8917,21 +9477,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.page = reader.int64(); - break; - case 2: - message.layoutType = reader.int32(); - break; - case 3: - message.layoutId = reader.string(); - break; - case 4: - message.boundingPoly = $root.google.cloud.documentai.v1.BoundingPoly.decode(reader, reader.uint32()); - break; - case 5: - message.confidence = reader.float(); - break; + case 1: { + message.page = reader.int64(); + break; + } + case 2: { + message.layoutType = reader.int32(); + break; + } + case 3: { + message.layoutId = reader.string(); + break; + } + case 4: { + message.boundingPoly = $root.google.cloud.documentai.v1.BoundingPoly.decode(reader, reader.uint32()); + break; + } + case 5: { + message.confidence = reader.float(); + break; + } default: reader.skipType(tag & 7); break; @@ -9116,6 +9681,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PageRef + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.PageAnchor.PageRef + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PageRef.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.PageAnchor.PageRef"; + }; + /** * LayoutType enum. * @name google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType @@ -9275,20 +9855,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.revision = reader.int32(); - break; - case 2: - message.id = reader.int32(); - break; - case 3: - if (!(message.parents && message.parents.length)) - message.parents = []; - message.parents.push($root.google.cloud.documentai.v1.Document.Provenance.Parent.decode(reader, reader.uint32())); - break; - case 4: - message.type = reader.int32(); - break; + case 1: { + message.revision = reader.int32(); + break; + } + case 2: { + message.id = reader.int32(); + break; + } + case 3: { + if (!(message.parents && message.parents.length)) + message.parents = []; + message.parents.push($root.google.cloud.documentai.v1.Document.Provenance.Parent.decode(reader, reader.uint32())); + break; + } + case 4: { + message.type = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -9459,6 +10043,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Provenance + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Provenance + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Provenance.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Provenance"; + }; + Provenance.Parent = (function() { /** @@ -9573,15 +10172,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.revision = reader.int32(); - break; - case 3: - message.index = reader.int32(); - break; - case 2: - message.id = reader.int32(); - break; + case 1: { + message.revision = reader.int32(); + break; + } + case 3: { + message.index = reader.int32(); + break; + } + case 2: { + message.id = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -9688,6 +10290,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Parent + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Provenance.Parent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Parent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Provenance.Parent"; + }; + return Parent; })(); @@ -9897,36 +10514,43 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 4: - message.agent = reader.string(); - break; - case 5: - message.processor = reader.string(); - break; - case 1: - message.id = reader.string(); - break; - case 2: - if (!(message.parent && message.parent.length)) - message.parent = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 4: { + message.agent = reader.string(); + break; + } + case 5: { + message.processor = reader.string(); + break; + } + case 1: { + message.id = reader.string(); + break; + } + case 2: { + if (!(message.parent && message.parent.length)) + message.parent = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.parent.push(reader.int32()); + } else message.parent.push(reader.int32()); - } else - message.parent.push(reader.int32()); - break; - case 7: - if (!(message.parentIds && message.parentIds.length)) - message.parentIds = []; - message.parentIds.push(reader.string()); - break; - case 3: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 6: - message.humanReview = $root.google.cloud.documentai.v1.Document.Revision.HumanReview.decode(reader, reader.uint32()); - break; + break; + } + case 7: { + if (!(message.parentIds && message.parentIds.length)) + message.parentIds = []; + message.parentIds.push(reader.string()); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.humanReview = $root.google.cloud.documentai.v1.Document.Revision.HumanReview.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -10112,6 +10736,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Revision + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Revision + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Revision.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Revision"; + }; + Revision.HumanReview = (function() { /** @@ -10215,12 +10854,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.state = reader.string(); - break; - case 2: - message.stateMessage = reader.string(); - break; + case 1: { + message.state = reader.string(); + break; + } + case 2: { + message.stateMessage = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -10319,6 +10960,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for HumanReview + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Revision.HumanReview + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HumanReview.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Revision.HumanReview"; + }; + return HumanReview; })(); @@ -10441,17 +11097,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.decode(reader, reader.uint32()); - break; - case 2: - message.changedText = reader.string(); - break; - case 3: - if (!(message.provenance && message.provenance.length)) - message.provenance = []; - message.provenance.push($root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32())); - break; + case 1: { + message.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.decode(reader, reader.uint32()); + break; + } + case 2: { + message.changedText = reader.string(); + break; + } + case 3: { + if (!(message.provenance && message.provenance.length)) + message.provenance = []; + message.provenance.push($root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -10581,6 +11240,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TextChange + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.TextChange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TextChange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.TextChange"; + }; + return TextChange; })(); @@ -10690,12 +11364,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.x = reader.int32(); - break; - case 2: - message.y = reader.int32(); - break; + case 1: { + message.x = reader.int32(); + break; + } + case 2: { + message.y = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -10794,6 +11470,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Vertex + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Vertex + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Vertex.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Vertex"; + }; + return Vertex; })(); @@ -10900,12 +11591,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.x = reader.float(); - break; - case 2: - message.y = reader.float(); - break; + case 1: { + message.x = reader.float(); + break; + } + case 2: { + message.y = reader.float(); + break; + } default: reader.skipType(tag & 7); break; @@ -11004,6 +11697,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for NormalizedVertex + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.NormalizedVertex + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NormalizedVertex.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.NormalizedVertex"; + }; + return NormalizedVertex; })(); @@ -11114,16 +11822,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.vertices && message.vertices.length)) - message.vertices = []; - message.vertices.push($root.google.cloud.documentai.v1.Vertex.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.normalizedVertices && message.normalizedVertices.length)) - message.normalizedVertices = []; - message.normalizedVertices.push($root.google.cloud.documentai.v1.NormalizedVertex.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.vertices && message.vertices.length)) + message.vertices = []; + message.vertices.push($root.google.cloud.documentai.v1.Vertex.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.normalizedVertices && message.normalizedVertices.length)) + message.normalizedVertices = []; + message.normalizedVertices.push($root.google.cloud.documentai.v1.NormalizedVertex.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -11256,6 +11966,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BoundingPoly + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.BoundingPoly + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BoundingPoly.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.BoundingPoly"; + }; + return BoundingPoly; })(); @@ -11362,12 +12087,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.content = reader.bytes(); - break; - case 2: - message.mimeType = reader.string(); - break; + case 1: { + message.content = reader.bytes(); + break; + } + case 2: { + message.mimeType = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -11427,7 +12154,7 @@ if (object.content != null) if (typeof object.content === "string") $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); - else if (object.content.length) + else if (object.content.length >= 0) message.content = object.content; if (object.mimeType != null) message.mimeType = String(object.mimeType); @@ -11475,6 +12202,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RawDocument + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.RawDocument + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RawDocument.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.RawDocument"; + }; + return RawDocument; })(); @@ -11581,12 +12323,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsUri = reader.string(); - break; - case 2: - message.mimeType = reader.string(); - break; + case 1: { + message.gcsUri = reader.string(); + break; + } + case 2: { + message.mimeType = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -11685,6 +12429,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GcsDocument + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.GcsDocument + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GcsDocument.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.GcsDocument"; + }; + return GcsDocument; })(); @@ -11782,11 +12541,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.documents && message.documents.length)) - message.documents = []; - message.documents.push($root.google.cloud.documentai.v1.GcsDocument.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.documents && message.documents.length)) + message.documents = []; + message.documents.push($root.google.cloud.documentai.v1.GcsDocument.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -11893,6 +12653,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GcsDocuments + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.GcsDocuments + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GcsDocuments.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.GcsDocuments"; + }; + return GcsDocuments; })(); @@ -11988,9 +12763,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsUriPrefix = reader.string(); - break; + case 1: { + message.gcsUriPrefix = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -12080,6 +12856,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GcsPrefix + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.GcsPrefix + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GcsPrefix.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.GcsPrefix"; + }; + return GcsPrefix; })(); @@ -12200,12 +12991,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsPrefix = $root.google.cloud.documentai.v1.GcsPrefix.decode(reader, reader.uint32()); - break; - case 2: - message.gcsDocuments = $root.google.cloud.documentai.v1.GcsDocuments.decode(reader, reader.uint32()); - break; + case 1: { + message.gcsPrefix = $root.google.cloud.documentai.v1.GcsPrefix.decode(reader, reader.uint32()); + break; + } + case 2: { + message.gcsDocuments = $root.google.cloud.documentai.v1.GcsDocuments.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -12325,6 +13118,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BatchDocumentsInputConfig + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.BatchDocumentsInputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchDocumentsInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.BatchDocumentsInputConfig"; + }; + return BatchDocumentsInputConfig; })(); @@ -12434,9 +13242,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsOutputConfig = $root.google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.decode(reader, reader.uint32()); - break; + case 1: { + message.gcsOutputConfig = $root.google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -12536,6 +13345,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DocumentOutputConfig + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.DocumentOutputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentOutputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.DocumentOutputConfig"; + }; + DocumentOutputConfig.GcsOutputConfig = (function() { /** @@ -12628,9 +13452,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsUri = reader.string(); - break; + case 1: { + message.gcsUri = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -12720,6 +13545,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GcsOutputConfig + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GcsOutputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig"; + }; + return GcsOutputConfig; })(); @@ -12759,7 +13599,7 @@ }; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#processDocument}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|processDocument}. * @memberof google.cloud.documentai.v1.DocumentProcessorService * @typedef ProcessDocumentCallback * @type {function} @@ -12792,7 +13632,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#batchProcessDocuments}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|batchProcessDocuments}. * @memberof google.cloud.documentai.v1.DocumentProcessorService * @typedef BatchProcessDocumentsCallback * @type {function} @@ -12825,7 +13665,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#fetchProcessorTypes}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|fetchProcessorTypes}. * @memberof google.cloud.documentai.v1.DocumentProcessorService * @typedef FetchProcessorTypesCallback * @type {function} @@ -12858,7 +13698,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#listProcessorTypes}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|listProcessorTypes}. * @memberof google.cloud.documentai.v1.DocumentProcessorService * @typedef ListProcessorTypesCallback * @type {function} @@ -12891,7 +13731,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#listProcessors}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|listProcessors}. * @memberof google.cloud.documentai.v1.DocumentProcessorService * @typedef ListProcessorsCallback * @type {function} @@ -12924,7 +13764,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#getProcessor}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|getProcessor}. * @memberof google.cloud.documentai.v1.DocumentProcessorService * @typedef GetProcessorCallback * @type {function} @@ -12957,7 +13797,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#getProcessorVersion}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|getProcessorVersion}. * @memberof google.cloud.documentai.v1.DocumentProcessorService * @typedef GetProcessorVersionCallback * @type {function} @@ -12990,7 +13830,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#listProcessorVersions}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|listProcessorVersions}. * @memberof google.cloud.documentai.v1.DocumentProcessorService * @typedef ListProcessorVersionsCallback * @type {function} @@ -13023,7 +13863,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#deleteProcessorVersion}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|deleteProcessorVersion}. * @memberof google.cloud.documentai.v1.DocumentProcessorService * @typedef DeleteProcessorVersionCallback * @type {function} @@ -13056,7 +13896,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#deployProcessorVersion}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|deployProcessorVersion}. * @memberof google.cloud.documentai.v1.DocumentProcessorService * @typedef DeployProcessorVersionCallback * @type {function} @@ -13089,7 +13929,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#undeployProcessorVersion}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|undeployProcessorVersion}. * @memberof google.cloud.documentai.v1.DocumentProcessorService * @typedef UndeployProcessorVersionCallback * @type {function} @@ -13122,7 +13962,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#createProcessor}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|createProcessor}. * @memberof google.cloud.documentai.v1.DocumentProcessorService * @typedef CreateProcessorCallback * @type {function} @@ -13155,7 +13995,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#deleteProcessor}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|deleteProcessor}. * @memberof google.cloud.documentai.v1.DocumentProcessorService * @typedef DeleteProcessorCallback * @type {function} @@ -13188,7 +14028,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#enableProcessor}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|enableProcessor}. * @memberof google.cloud.documentai.v1.DocumentProcessorService * @typedef EnableProcessorCallback * @type {function} @@ -13221,7 +14061,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#disableProcessor}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|disableProcessor}. * @memberof google.cloud.documentai.v1.DocumentProcessorService * @typedef DisableProcessorCallback * @type {function} @@ -13254,7 +14094,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#setDefaultProcessorVersion}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|setDefaultProcessorVersion}. * @memberof google.cloud.documentai.v1.DocumentProcessorService * @typedef SetDefaultProcessorVersionCallback * @type {function} @@ -13287,7 +14127,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#reviewDocument}. + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService|reviewDocument}. * @memberof google.cloud.documentai.v1.DocumentProcessorService * @typedef ReviewDocumentCallback * @type {function} @@ -13472,21 +14312,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 4: - message.inlineDocument = $root.google.cloud.documentai.v1.Document.decode(reader, reader.uint32()); - break; - case 5: - message.rawDocument = $root.google.cloud.documentai.v1.RawDocument.decode(reader, reader.uint32()); - break; - case 1: - message.name = reader.string(); - break; - case 3: - message.skipHumanReview = reader.bool(); - break; - case 6: - message.fieldMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 4: { + message.inlineDocument = $root.google.cloud.documentai.v1.Document.decode(reader, reader.uint32()); + break; + } + case 5: { + message.rawDocument = $root.google.cloud.documentai.v1.RawDocument.decode(reader, reader.uint32()); + break; + } + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.skipHumanReview = reader.bool(); + break; + } + case 6: { + message.fieldMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -13637,6 +14482,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProcessRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.ProcessRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProcessRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.ProcessRequest"; + }; + return ProcessRequest; })(); @@ -13754,15 +14614,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.state = reader.int32(); - break; - case 2: - message.stateMessage = reader.string(); - break; - case 3: - message.humanReviewOperation = reader.string(); - break; + case 1: { + message.state = reader.int32(); + break; + } + case 2: { + message.stateMessage = reader.string(); + break; + } + case 3: { + message.humanReviewOperation = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -13897,6 +14760,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for HumanReviewStatus + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.HumanReviewStatus + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HumanReviewStatus.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.HumanReviewStatus"; + }; + /** * State enum. * @name google.cloud.documentai.v1.HumanReviewStatus.State @@ -14023,12 +14901,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.document = $root.google.cloud.documentai.v1.Document.decode(reader, reader.uint32()); - break; - case 3: - message.humanReviewStatus = $root.google.cloud.documentai.v1.HumanReviewStatus.decode(reader, reader.uint32()); - break; + case 1: { + message.document = $root.google.cloud.documentai.v1.Document.decode(reader, reader.uint32()); + break; + } + case 3: { + message.humanReviewStatus = $root.google.cloud.documentai.v1.HumanReviewStatus.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -14137,6 +15017,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProcessResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.ProcessResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProcessResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.ProcessResponse"; + }; + return ProcessResponse; })(); @@ -14265,18 +15160,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 5: - message.inputDocuments = $root.google.cloud.documentai.v1.BatchDocumentsInputConfig.decode(reader, reader.uint32()); - break; - case 6: - message.documentOutputConfig = $root.google.cloud.documentai.v1.DocumentOutputConfig.decode(reader, reader.uint32()); - break; - case 4: - message.skipHumanReview = reader.bool(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 5: { + message.inputDocuments = $root.google.cloud.documentai.v1.BatchDocumentsInputConfig.decode(reader, reader.uint32()); + break; + } + case 6: { + message.documentOutputConfig = $root.google.cloud.documentai.v1.DocumentOutputConfig.decode(reader, reader.uint32()); + break; + } + case 4: { + message.skipHumanReview = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -14401,6 +15300,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BatchProcessRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.BatchProcessRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchProcessRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.BatchProcessRequest"; + }; + return BatchProcessRequest; })(); @@ -14561,6 +15475,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BatchProcessResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.BatchProcessResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchProcessResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.BatchProcessResponse"; + }; + return BatchProcessResponse; })(); @@ -14702,23 +15631,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.state = reader.int32(); - break; - case 2: - message.stateMessage = reader.string(); - break; - case 3: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 5: - if (!(message.individualProcessStatuses && message.individualProcessStatuses.length)) - message.individualProcessStatuses = []; - message.individualProcessStatuses.push($root.google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.decode(reader, reader.uint32())); - break; + case 1: { + message.state = reader.int32(); + break; + } + case 2: { + message.stateMessage = reader.string(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + if (!(message.individualProcessStatuses && message.individualProcessStatuses.length)) + message.individualProcessStatuses = []; + message.individualProcessStatuses.push($root.google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -14907,6 +15841,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BatchProcessMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.BatchProcessMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchProcessMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.BatchProcessMetadata"; + }; + BatchProcessMetadata.IndividualProcessStatus = (function() { /** @@ -15032,18 +15981,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.inputGcsSource = reader.string(); - break; - case 2: - message.status = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; - case 3: - message.outputGcsDestination = reader.string(); - break; - case 5: - message.humanReviewStatus = $root.google.cloud.documentai.v1.HumanReviewStatus.decode(reader, reader.uint32()); - break; + case 1: { + message.inputGcsSource = reader.string(); + break; + } + case 2: { + message.status = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + case 3: { + message.outputGcsDestination = reader.string(); + break; + } + case 5: { + message.humanReviewStatus = $root.google.cloud.documentai.v1.HumanReviewStatus.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -15168,6 +16121,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for IndividualProcessStatus + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + IndividualProcessStatus.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus"; + }; + return IndividualProcessStatus; })(); @@ -15290,9 +16258,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -15382,6 +16351,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FetchProcessorTypesRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FetchProcessorTypesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.FetchProcessorTypesRequest"; + }; + return FetchProcessorTypesRequest; })(); @@ -15479,11 +16463,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.processorTypes && message.processorTypes.length)) - message.processorTypes = []; - message.processorTypes.push($root.google.cloud.documentai.v1.ProcessorType.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.processorTypes && message.processorTypes.length)) + message.processorTypes = []; + message.processorTypes.push($root.google.cloud.documentai.v1.ProcessorType.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -15590,6 +16575,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FetchProcessorTypesResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FetchProcessorTypesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.FetchProcessorTypesResponse"; + }; + return FetchProcessorTypesResponse; })(); @@ -15707,15 +16707,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; @@ -15822,6 +16825,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListProcessorTypesRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProcessorTypesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.ListProcessorTypesRequest"; + }; + return ListProcessorTypesRequest; })(); @@ -15930,14 +16948,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.processorTypes && message.processorTypes.length)) - message.processorTypes = []; - message.processorTypes.push($root.google.cloud.documentai.v1.ProcessorType.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.processorTypes && message.processorTypes.length)) + message.processorTypes = []; + message.processorTypes.push($root.google.cloud.documentai.v1.ProcessorType.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -16053,6 +17073,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListProcessorTypesResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProcessorTypesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.ListProcessorTypesResponse"; + }; + return ListProcessorTypesResponse; })(); @@ -16170,15 +17205,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; @@ -16285,6 +17323,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListProcessorsRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProcessorsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.ListProcessorsRequest"; + }; + return ListProcessorsRequest; })(); @@ -16393,14 +17446,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.processors && message.processors.length)) - message.processors = []; - message.processors.push($root.google.cloud.documentai.v1.Processor.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.processors && message.processors.length)) + message.processors = []; + message.processors.push($root.google.cloud.documentai.v1.Processor.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -16516,6 +17571,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListProcessorsResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProcessorsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.ListProcessorsResponse"; + }; + return ListProcessorsResponse; })(); @@ -16611,9 +17681,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; @@ -16703,6 +17774,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetProcessorRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetProcessorRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.GetProcessorRequest"; + }; + return GetProcessorRequest; })(); @@ -16798,9 +17884,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; @@ -16890,6 +17977,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetProcessorVersionRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetProcessorVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.GetProcessorVersionRequest"; + }; + return GetProcessorVersionRequest; })(); @@ -17007,15 +18109,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; @@ -17122,6 +18227,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListProcessorVersionsRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProcessorVersionsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.ListProcessorVersionsRequest"; + }; + return ListProcessorVersionsRequest; })(); @@ -17230,14 +18350,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.processorVersions && message.processorVersions.length)) - message.processorVersions = []; - message.processorVersions.push($root.google.cloud.documentai.v1.ProcessorVersion.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.processorVersions && message.processorVersions.length)) + message.processorVersions = []; + message.processorVersions.push($root.google.cloud.documentai.v1.ProcessorVersion.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -17353,6 +18475,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListProcessorVersionsResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProcessorVersionsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.ListProcessorVersionsResponse"; + }; + return ListProcessorVersionsResponse; })(); @@ -17448,9 +18585,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; @@ -17540,6 +18678,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteProcessorVersionRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteProcessorVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.DeleteProcessorVersionRequest"; + }; + return DeleteProcessorVersionRequest; })(); @@ -17635,9 +18788,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); - break; + case 1: { + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -17732,6 +18886,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteProcessorVersionMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteProcessorVersionMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.DeleteProcessorVersionMetadata"; + }; + return DeleteProcessorVersionMetadata; })(); @@ -17827,9 +18996,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; @@ -17919,6 +19089,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeployProcessorVersionRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeployProcessorVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.DeployProcessorVersionRequest"; + }; + return DeployProcessorVersionRequest; })(); @@ -18079,6 +19264,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeployProcessorVersionResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.DeployProcessorVersionResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeployProcessorVersionResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.DeployProcessorVersionResponse"; + }; + return DeployProcessorVersionResponse; })(); @@ -18174,9 +19374,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); - break; + case 1: { + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -18271,6 +19472,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeployProcessorVersionMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeployProcessorVersionMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.DeployProcessorVersionMetadata"; + }; + return DeployProcessorVersionMetadata; })(); @@ -18366,9 +19582,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; @@ -18458,6 +19675,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UndeployProcessorVersionRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UndeployProcessorVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.UndeployProcessorVersionRequest"; + }; + return UndeployProcessorVersionRequest; })(); @@ -18618,6 +19850,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UndeployProcessorVersionResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UndeployProcessorVersionResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.UndeployProcessorVersionResponse"; + }; + return UndeployProcessorVersionResponse; })(); @@ -18713,9 +19960,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); - break; + case 1: { + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -18810,6 +20058,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UndeployProcessorVersionMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UndeployProcessorVersionMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.UndeployProcessorVersionMetadata"; + }; + return UndeployProcessorVersionMetadata; })(); @@ -18916,12 +20179,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.processor = $root.google.cloud.documentai.v1.Processor.decode(reader, reader.uint32()); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.processor = $root.google.cloud.documentai.v1.Processor.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -19025,6 +20290,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CreateProcessorRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateProcessorRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.CreateProcessorRequest"; + }; + return CreateProcessorRequest; })(); @@ -19120,9 +20400,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; @@ -19212,6 +20493,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteProcessorRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteProcessorRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.DeleteProcessorRequest"; + }; + return DeleteProcessorRequest; })(); @@ -19307,9 +20603,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 5: - message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); - break; + case 5: { + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -19404,6 +20701,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteProcessorMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteProcessorMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.DeleteProcessorMetadata"; + }; + return DeleteProcessorMetadata; })(); @@ -19499,9 +20811,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; @@ -19591,6 +20904,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnableProcessorRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnableProcessorRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.EnableProcessorRequest"; + }; + return EnableProcessorRequest; })(); @@ -19751,6 +21079,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnableProcessorResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.EnableProcessorResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnableProcessorResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.EnableProcessorResponse"; + }; + return EnableProcessorResponse; })(); @@ -19846,9 +21189,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 5: - message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); - break; + case 5: { + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -19943,6 +21287,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnableProcessorMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnableProcessorMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.EnableProcessorMetadata"; + }; + return EnableProcessorMetadata; })(); @@ -20038,9 +21397,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; @@ -20130,6 +21490,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DisableProcessorRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DisableProcessorRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.DisableProcessorRequest"; + }; + return DisableProcessorRequest; })(); @@ -20290,6 +21665,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DisableProcessorResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.DisableProcessorResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DisableProcessorResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.DisableProcessorResponse"; + }; + return DisableProcessorResponse; })(); @@ -20385,9 +21775,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 5: - message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); - break; + case 5: { + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -20482,6 +21873,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DisableProcessorMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DisableProcessorMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.DisableProcessorMetadata"; + }; + return DisableProcessorMetadata; })(); @@ -20588,12 +21994,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.processor = reader.string(); - break; - case 2: - message.defaultProcessorVersion = reader.string(); - break; + case 1: { + message.processor = reader.string(); + break; + } + case 2: { + message.defaultProcessorVersion = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -20692,6 +22100,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SetDefaultProcessorVersionRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetDefaultProcessorVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.SetDefaultProcessorVersionRequest"; + }; + return SetDefaultProcessorVersionRequest; })(); @@ -20852,6 +22275,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SetDefaultProcessorVersionResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetDefaultProcessorVersionResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.SetDefaultProcessorVersionResponse"; + }; + return SetDefaultProcessorVersionResponse; })(); @@ -20947,9 +22385,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); - break; + case 1: { + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -21044,6 +22483,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SetDefaultProcessorVersionMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetDefaultProcessorVersionMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata"; + }; + return SetDefaultProcessorVersionMetadata; })(); @@ -21197,21 +22651,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 4: - message.inlineDocument = $root.google.cloud.documentai.v1.Document.decode(reader, reader.uint32()); - break; - case 1: - message.humanReviewConfig = reader.string(); - break; - case 3: - message.enableSchemaValidation = reader.bool(); - break; - case 5: - message.priority = reader.int32(); - break; - case 6: - message.documentSchema = $root.google.cloud.documentai.v1.DocumentSchema.decode(reader, reader.uint32()); - break; + case 4: { + message.inlineDocument = $root.google.cloud.documentai.v1.Document.decode(reader, reader.uint32()); + break; + } + case 1: { + message.humanReviewConfig = reader.string(); + break; + } + case 3: { + message.enableSchemaValidation = reader.bool(); + break; + } + case 5: { + message.priority = reader.int32(); + break; + } + case 6: { + message.documentSchema = $root.google.cloud.documentai.v1.DocumentSchema.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -21363,6 +22822,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ReviewDocumentRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReviewDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.ReviewDocumentRequest"; + }; + /** * Priority enum. * @name google.cloud.documentai.v1.ReviewDocumentRequest.Priority @@ -21494,15 +22968,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsDestination = reader.string(); - break; - case 2: - message.state = reader.int32(); - break; - case 3: - message.rejectionReason = reader.string(); - break; + case 1: { + message.gcsDestination = reader.string(); + break; + } + case 2: { + message.state = reader.int32(); + break; + } + case 3: { + message.rejectionReason = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -21627,6 +23104,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ReviewDocumentResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReviewDocumentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.ReviewDocumentResponse"; + }; + /** * State enum. * @name google.cloud.documentai.v1.ReviewDocumentResponse.State @@ -21749,12 +23241,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 5: - message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); - break; - case 6: - message.questionId = reader.string(); - break; + case 5: { + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + } + case 6: { + message.questionId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -21858,6 +23352,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ReviewDocumentOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReviewDocumentOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.ReviewDocumentOperationMetadata"; + }; + return ReviewDocumentOperationMetadata; })(); @@ -21988,20 +23497,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.displayName = reader.string(); - break; - case 2: - message.description = reader.string(); - break; - case 3: - if (!(message.entityTypes && message.entityTypes.length)) - message.entityTypes = []; - message.entityTypes.push($root.google.cloud.documentai.v1.DocumentSchema.EntityType.decode(reader, reader.uint32())); - break; - case 4: - message.metadata = $root.google.cloud.documentai.v1.DocumentSchema.Metadata.decode(reader, reader.uint32()); - break; + case 1: { + message.displayName = reader.string(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + if (!(message.entityTypes && message.entityTypes.length)) + message.entityTypes = []; + message.entityTypes.push($root.google.cloud.documentai.v1.DocumentSchema.EntityType.decode(reader, reader.uint32())); + break; + } + case 4: { + message.metadata = $root.google.cloud.documentai.v1.DocumentSchema.Metadata.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -22139,6 +23652,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DocumentSchema + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.DocumentSchema + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentSchema.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.DocumentSchema"; + }; + DocumentSchema.EntityType = (function() { /** @@ -22293,25 +23821,30 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 14: - message.enumValues = $root.google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues.decode(reader, reader.uint32()); - break; - case 13: - message.displayName = reader.string(); - break; - case 1: - message.name = reader.string(); - break; - case 2: - if (!(message.baseTypes && message.baseTypes.length)) - message.baseTypes = []; - message.baseTypes.push(reader.string()); - break; - case 6: - if (!(message.properties && message.properties.length)) - message.properties = []; - message.properties.push($root.google.cloud.documentai.v1.DocumentSchema.EntityType.Property.decode(reader, reader.uint32())); - break; + case 14: { + message.enumValues = $root.google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues.decode(reader, reader.uint32()); + break; + } + case 13: { + message.displayName = reader.string(); + break; + } + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.baseTypes && message.baseTypes.length)) + message.baseTypes = []; + message.baseTypes.push(reader.string()); + break; + } + case 6: { + if (!(message.properties && message.properties.length)) + message.properties = []; + message.properties.push($root.google.cloud.documentai.v1.DocumentSchema.EntityType.Property.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -22476,6 +24009,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EntityType + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EntityType.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.DocumentSchema.EntityType"; + }; + EntityType.EnumValues = (function() { /** @@ -22570,11 +24118,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(reader.string()); - break; + case 1: { + if (!(message.values && message.values.length)) + message.values = []; + message.values.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -22676,6 +24225,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnumValues + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumValues.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues"; + }; + return EnumValues; })(); @@ -22793,15 +24357,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.valueType = reader.string(); - break; - case 3: - message.occurrenceType = reader.int32(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.valueType = reader.string(); + break; + } + case 3: { + message.occurrenceType = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -22936,6 +24503,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Property + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.Property + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Property.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.DocumentSchema.EntityType.Property"; + }; + /** * OccurrenceType enum. * @name google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType @@ -23087,18 +24669,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.documentSplitter = reader.bool(); - break; - case 2: - message.documentAllowMultipleLabels = reader.bool(); - break; - case 6: - message.prefixedNamingOnProperties = reader.bool(); - break; - case 7: - message.skipNamingValidation = reader.bool(); - break; + case 1: { + message.documentSplitter = reader.bool(); + break; + } + case 2: { + message.documentAllowMultipleLabels = reader.bool(); + break; + } + case 6: { + message.prefixedNamingOnProperties = reader.bool(); + break; + } + case 7: { + message.skipNamingValidation = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -23213,6 +24799,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Metadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Metadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.DocumentSchema.Metadata"; + }; + return Metadata; })(); @@ -23355,21 +24956,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.state = reader.int32(); - break; - case 2: - message.stateMessage = reader.string(); - break; - case 5: - message.resource = reader.string(); - break; - case 3: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; + case 1: { + message.state = reader.int32(); + break; + } + case 2: { + message.stateMessage = reader.string(); + break; + } + case 5: { + message.resource = reader.string(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -23535,6 +25141,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CommonOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CommonOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.CommonOperationMetadata"; + }; + /** * State enum. * @name google.cloud.documentai.v1.CommonOperationMetadata.State @@ -23729,30 +25350,38 @@ 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 6: - message.state = reader.int32(); - break; - case 7: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 9: - message.kmsKeyName = reader.string(); - break; - case 10: - message.kmsKeyVersionName = reader.string(); - break; - case 11: - message.googleManaged = reader.bool(); - break; - case 13: - message.deprecationInfo = $root.google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.decode(reader, reader.uint32()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 6: { + message.state = reader.int32(); + break; + } + case 7: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 9: { + message.kmsKeyName = reader.string(); + break; + } + case 10: { + message.kmsKeyVersionName = reader.string(); + break; + } + case 11: { + message.googleManaged = reader.bool(); + break; + } + case 13: { + message.deprecationInfo = $root.google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -23952,6 +25581,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProcessorVersion + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProcessorVersion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.ProcessorVersion"; + }; + ProcessorVersion.DeprecationInfo = (function() { /** @@ -24055,12 +25699,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.deprecationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.replacementProcessorVersion = reader.string(); - break; + case 1: { + message.deprecationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.replacementProcessorVersion = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -24164,6 +25810,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeprecationInfo + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeprecationInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo"; + }; + return DeprecationInfo; })(); @@ -24365,30 +26026,38 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.type = reader.string(); - break; - case 3: - message.displayName = reader.string(); - break; - case 4: - message.state = reader.int32(); - break; - case 9: - message.defaultProcessorVersion = reader.string(); - break; - case 6: - message.processEndpoint = reader.string(); - break; - case 7: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 8: - message.kmsKeyName = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + message.displayName = reader.string(); + break; + } + case 4: { + message.state = reader.int32(); + break; + } + case 9: { + message.defaultProcessorVersion = reader.string(); + break; + } + case 6: { + message.processEndpoint = reader.string(); + break; + } + case 7: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 8: { + message.kmsKeyName = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -24583,6 +26252,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Processor + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Processor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Processor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Processor"; + }; + /** * State enum. * @name google.cloud.documentai.v1.Processor.State @@ -24761,26 +26445,32 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.type = reader.string(); - break; - case 3: - message.category = reader.string(); - break; - case 4: - if (!(message.availableLocations && message.availableLocations.length)) - message.availableLocations = []; - message.availableLocations.push($root.google.cloud.documentai.v1.ProcessorType.LocationInfo.decode(reader, reader.uint32())); - break; - case 6: - message.allowCreation = reader.bool(); - break; - case 8: - message.launchStage = reader.int32(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + message.category = reader.string(); + break; + } + case 4: { + if (!(message.availableLocations && message.availableLocations.length)) + message.availableLocations = []; + message.availableLocations.push($root.google.cloud.documentai.v1.ProcessorType.LocationInfo.decode(reader, reader.uint32())); + break; + } + case 6: { + message.allowCreation = reader.bool(); + break; + } + case 8: { + message.launchStage = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -24972,6 +26662,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProcessorType + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.ProcessorType + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProcessorType.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.ProcessorType"; + }; + ProcessorType.LocationInfo = (function() { /** @@ -25064,9 +26769,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.locationId = reader.string(); - break; + case 1: { + message.locationId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -25156,6 +26862,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for LocationInfo + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LocationInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.ProcessorType.LocationInfo"; + }; + return LocationInfo; })(); @@ -25387,44 +27108,54 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.uri = reader.string(); - break; - case 2: - message.content = reader.bytes(); - break; - case 3: - message.mimeType = reader.string(); - break; - case 4: - message.text = reader.string(); - break; - case 5: - if (!(message.textStyles && message.textStyles.length)) - message.textStyles = []; - message.textStyles.push($root.google.cloud.documentai.v1beta1.Document.Style.decode(reader, reader.uint32())); - break; - case 6: - if (!(message.pages && message.pages.length)) - message.pages = []; - message.pages.push($root.google.cloud.documentai.v1beta1.Document.Page.decode(reader, reader.uint32())); - break; - case 7: - if (!(message.entities && message.entities.length)) - message.entities = []; - message.entities.push($root.google.cloud.documentai.v1beta1.Document.Entity.decode(reader, reader.uint32())); - break; - case 8: - if (!(message.entityRelations && message.entityRelations.length)) - message.entityRelations = []; - message.entityRelations.push($root.google.cloud.documentai.v1beta1.Document.EntityRelation.decode(reader, reader.uint32())); - break; - case 9: - message.shardInfo = $root.google.cloud.documentai.v1beta1.Document.ShardInfo.decode(reader, reader.uint32()); - break; - case 10: - message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; + case 1: { + message.uri = reader.string(); + break; + } + case 2: { + message.content = reader.bytes(); + break; + } + case 3: { + message.mimeType = reader.string(); + break; + } + case 4: { + message.text = reader.string(); + break; + } + case 5: { + if (!(message.textStyles && message.textStyles.length)) + message.textStyles = []; + message.textStyles.push($root.google.cloud.documentai.v1beta1.Document.Style.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.pages && message.pages.length)) + message.pages = []; + message.pages.push($root.google.cloud.documentai.v1beta1.Document.Page.decode(reader, reader.uint32())); + break; + } + case 7: { + if (!(message.entities && message.entities.length)) + message.entities = []; + message.entities.push($root.google.cloud.documentai.v1beta1.Document.Entity.decode(reader, reader.uint32())); + break; + } + case 8: { + if (!(message.entityRelations && message.entityRelations.length)) + message.entityRelations = []; + message.entityRelations.push($root.google.cloud.documentai.v1beta1.Document.EntityRelation.decode(reader, reader.uint32())); + break; + } + case 9: { + message.shardInfo = $root.google.cloud.documentai.v1beta1.Document.ShardInfo.decode(reader, reader.uint32()); + break; + } + case 10: { + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -25545,7 +27276,7 @@ if (object.content != null) if (typeof object.content === "string") $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); - else if (object.content.length) + else if (object.content.length >= 0) message.content = object.content; if (object.mimeType != null) message.mimeType = String(object.mimeType); @@ -25681,6 +27412,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Document + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Document.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document"; + }; + Document.ShardInfo = (function() { /** @@ -25795,15 +27541,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.shardIndex = reader.int64(); - break; - case 2: - message.shardCount = reader.int64(); - break; - case 3: - message.textOffset = reader.int64(); - break; + case 1: { + message.shardIndex = reader.int64(); + break; + } + case 2: { + message.shardCount = reader.int64(); + break; + } + case 3: { + message.textOffset = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -25952,6 +27701,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ShardInfo + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.ShardInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ShardInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.ShardInfo"; + }; + return ShardInfo; })(); @@ -26113,27 +27877,34 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.textAnchor = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.decode(reader, reader.uint32()); - break; - case 2: - message.color = $root.google.type.Color.decode(reader, reader.uint32()); - break; - case 3: - message.backgroundColor = $root.google.type.Color.decode(reader, reader.uint32()); - break; - case 4: - message.fontWeight = reader.string(); - break; - case 5: - message.textStyle = reader.string(); - break; - case 6: - message.textDecoration = reader.string(); - break; - case 7: - message.fontSize = $root.google.cloud.documentai.v1beta1.Document.Style.FontSize.decode(reader, reader.uint32()); - break; + case 1: { + message.textAnchor = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.decode(reader, reader.uint32()); + break; + } + case 2: { + message.color = $root.google.type.Color.decode(reader, reader.uint32()); + break; + } + case 3: { + message.backgroundColor = $root.google.type.Color.decode(reader, reader.uint32()); + break; + } + case 4: { + message.fontWeight = reader.string(); + break; + } + case 5: { + message.textStyle = reader.string(); + break; + } + case 6: { + message.textDecoration = reader.string(); + break; + } + case 7: { + message.fontSize = $root.google.cloud.documentai.v1beta1.Document.Style.FontSize.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -26292,6 +28063,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Style + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.Style + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Style.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.Style"; + }; + Style.FontSize = (function() { /** @@ -26395,12 +28181,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.size = reader.float(); - break; - case 2: - message.unit = reader.string(); - break; + case 1: { + message.size = reader.float(); + break; + } + case 2: { + message.unit = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -26499,6 +28287,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FontSize + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.Style.FontSize + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FontSize.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.Style.FontSize"; + }; + return FontSize; })(); @@ -26723,55 +28526,66 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.pageNumber = reader.int32(); - break; - case 2: - message.dimension = $root.google.cloud.documentai.v1beta1.Document.Page.Dimension.decode(reader, reader.uint32()); - break; - case 3: - message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.blocks && message.blocks.length)) - message.blocks = []; - message.blocks.push($root.google.cloud.documentai.v1beta1.Document.Page.Block.decode(reader, reader.uint32())); - break; - case 6: - if (!(message.paragraphs && message.paragraphs.length)) - message.paragraphs = []; - message.paragraphs.push($root.google.cloud.documentai.v1beta1.Document.Page.Paragraph.decode(reader, reader.uint32())); - break; - case 7: - if (!(message.lines && message.lines.length)) - message.lines = []; - message.lines.push($root.google.cloud.documentai.v1beta1.Document.Page.Line.decode(reader, reader.uint32())); - break; - case 8: - if (!(message.tokens && message.tokens.length)) - message.tokens = []; - message.tokens.push($root.google.cloud.documentai.v1beta1.Document.Page.Token.decode(reader, reader.uint32())); - break; - case 9: - if (!(message.visualElements && message.visualElements.length)) - message.visualElements = []; - message.visualElements.push($root.google.cloud.documentai.v1beta1.Document.Page.VisualElement.decode(reader, reader.uint32())); - break; - case 10: - if (!(message.tables && message.tables.length)) - message.tables = []; - message.tables.push($root.google.cloud.documentai.v1beta1.Document.Page.Table.decode(reader, reader.uint32())); - break; - case 11: - if (!(message.formFields && message.formFields.length)) - message.formFields = []; - message.formFields.push($root.google.cloud.documentai.v1beta1.Document.Page.FormField.decode(reader, reader.uint32())); - break; + case 1: { + message.pageNumber = reader.int32(); + break; + } + case 2: { + message.dimension = $root.google.cloud.documentai.v1beta1.Document.Page.Dimension.decode(reader, reader.uint32()); + break; + } + case 3: { + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.blocks && message.blocks.length)) + message.blocks = []; + message.blocks.push($root.google.cloud.documentai.v1beta1.Document.Page.Block.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.paragraphs && message.paragraphs.length)) + message.paragraphs = []; + message.paragraphs.push($root.google.cloud.documentai.v1beta1.Document.Page.Paragraph.decode(reader, reader.uint32())); + break; + } + case 7: { + if (!(message.lines && message.lines.length)) + message.lines = []; + message.lines.push($root.google.cloud.documentai.v1beta1.Document.Page.Line.decode(reader, reader.uint32())); + break; + } + case 8: { + if (!(message.tokens && message.tokens.length)) + message.tokens = []; + message.tokens.push($root.google.cloud.documentai.v1beta1.Document.Page.Token.decode(reader, reader.uint32())); + break; + } + case 9: { + if (!(message.visualElements && message.visualElements.length)) + message.visualElements = []; + message.visualElements.push($root.google.cloud.documentai.v1beta1.Document.Page.VisualElement.decode(reader, reader.uint32())); + break; + } + case 10: { + if (!(message.tables && message.tables.length)) + message.tables = []; + message.tables.push($root.google.cloud.documentai.v1beta1.Document.Page.Table.decode(reader, reader.uint32())); + break; + } + case 11: { + if (!(message.formFields && message.formFields.length)) + message.formFields = []; + message.formFields.push($root.google.cloud.documentai.v1beta1.Document.Page.FormField.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -27090,6 +28904,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Page + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.Page + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Page.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.Page"; + }; + Page.Dimension = (function() { /** @@ -27204,15 +29033,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.width = reader.float(); - break; - case 2: - message.height = reader.float(); - break; - case 3: - message.unit = reader.string(); - break; + case 1: { + message.width = reader.float(); + break; + } + case 2: { + message.height = reader.float(); + break; + } + case 3: { + message.unit = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -27319,6 +29151,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Dimension + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.Page.Dimension + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Dimension.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.Page.Dimension"; + }; + return Dimension; })(); @@ -27447,18 +29294,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.textAnchor = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.decode(reader, reader.uint32()); - break; - case 2: - message.confidence = reader.float(); - break; - case 3: - message.boundingPoly = $root.google.cloud.documentai.v1beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - case 4: - message.orientation = reader.int32(); - break; + case 1: { + message.textAnchor = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.decode(reader, reader.uint32()); + break; + } + case 2: { + message.confidence = reader.float(); + break; + } + case 3: { + message.boundingPoly = $root.google.cloud.documentai.v1beta1.BoundingPoly.decode(reader, reader.uint32()); + break; + } + case 4: { + message.orientation = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -27611,6 +29462,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Layout + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.Page.Layout + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Layout.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.Page.Layout"; + }; + /** * Orientation enum. * @name google.cloud.documentai.v1beta1.Document.Page.Layout.Orientation @@ -27739,14 +29605,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -27867,6 +29735,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Block + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.Page.Block + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Block.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.Page.Block"; + }; + return Block; })(); @@ -27975,14 +29858,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -28103,6 +29988,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Paragraph + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.Page.Paragraph + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Paragraph.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.Page.Paragraph"; + }; + return Paragraph; })(); @@ -28211,14 +30111,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -28339,6 +30241,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Line + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.Page.Line + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Line.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.Page.Line"; + }; + return Line; })(); @@ -28458,17 +30375,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - message.detectedBreak = $root.google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.decode(reader, reader.uint32()); - break; - case 3: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + message.detectedBreak = $root.google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.decode(reader, reader.uint32()); + break; + } + case 3: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -28603,6 +30523,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Token + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Token.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.Page.Token"; + }; + Token.DetectedBreak = (function() { /** @@ -28695,9 +30630,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.type = reader.int32(); - break; + case 1: { + message.type = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -28810,6 +30746,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DetectedBreak + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DetectedBreak.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak"; + }; + /** * Type enum. * @name google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.Type @@ -28950,17 +30901,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - message.type = reader.string(); - break; - case 3: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -29090,6 +31044,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for VisualElement + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.Page.VisualElement + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VisualElement.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.Page.VisualElement"; + }; + return VisualElement; })(); @@ -29224,24 +31193,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.headerRows && message.headerRows.length)) - message.headerRows = []; - message.headerRows.push($root.google.cloud.documentai.v1beta1.Document.Page.Table.TableRow.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.bodyRows && message.bodyRows.length)) - message.bodyRows = []; - message.bodyRows.push($root.google.cloud.documentai.v1beta1.Document.Page.Table.TableRow.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.headerRows && message.headerRows.length)) + message.headerRows = []; + message.headerRows.push($root.google.cloud.documentai.v1beta1.Document.Page.Table.TableRow.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.bodyRows && message.bodyRows.length)) + message.bodyRows = []; + message.bodyRows.push($root.google.cloud.documentai.v1beta1.Document.Page.Table.TableRow.decode(reader, reader.uint32())); + break; + } + case 4: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -29413,6 +31386,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Table + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Table.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.Page.Table"; + }; + Table.TableRow = (function() { /** @@ -29507,11 +31495,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.cells && message.cells.length)) - message.cells = []; - message.cells.push($root.google.cloud.documentai.v1beta1.Document.Page.Table.TableCell.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.cells && message.cells.length)) + message.cells = []; + message.cells.push($root.google.cloud.documentai.v1beta1.Document.Page.Table.TableCell.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -29618,6 +31607,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TableRow + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableRow + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TableRow.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.Page.Table.TableRow"; + }; + return TableRow; })(); @@ -29748,20 +31752,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - message.rowSpan = reader.int32(); - break; - case 3: - message.colSpan = reader.int32(); - break; - case 4: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + message.rowSpan = reader.int32(); + break; + } + case 3: { + message.colSpan = reader.int32(); + break; + } + case 4: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -29899,6 +31907,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TableCell + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.Page.Table.TableCell + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TableCell.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.Page.Table.TableCell"; + }; + return TableCell; })(); @@ -30034,22 +32057,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.fieldName = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - message.fieldValue = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 3: - if (!(message.nameDetectedLanguages && message.nameDetectedLanguages.length)) - message.nameDetectedLanguages = []; - message.nameDetectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.valueDetectedLanguages && message.valueDetectedLanguages.length)) - message.valueDetectedLanguages = []; - message.valueDetectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.fieldName = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + message.fieldValue = $root.google.cloud.documentai.v1beta1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 3: { + if (!(message.nameDetectedLanguages && message.nameDetectedLanguages.length)) + message.nameDetectedLanguages = []; + message.nameDetectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + case 4: { + if (!(message.valueDetectedLanguages && message.valueDetectedLanguages.length)) + message.valueDetectedLanguages = []; + message.valueDetectedLanguages.push($root.google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -30210,6 +32237,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FormField + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.Page.FormField + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FormField.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.Page.FormField"; + }; + return FormField; })(); @@ -30316,12 +32358,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.languageCode = reader.string(); - break; - case 2: - message.confidence = reader.float(); - break; + case 1: { + message.languageCode = reader.string(); + break; + } + case 2: { + message.confidence = reader.float(); + break; + } default: reader.skipType(tag & 7); break; @@ -30420,6 +32464,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DetectedLanguage + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DetectedLanguage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.Page.DetectedLanguage"; + }; + return DetectedLanguage; })(); @@ -30551,18 +32610,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.textAnchor = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.decode(reader, reader.uint32()); - break; - case 2: - message.type = reader.string(); - break; - case 3: - message.mentionText = reader.string(); - break; - case 4: - message.mentionId = reader.string(); - break; + case 1: { + message.textAnchor = $root.google.cloud.documentai.v1beta1.Document.TextAnchor.decode(reader, reader.uint32()); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + message.mentionText = reader.string(); + break; + } + case 4: { + message.mentionId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -30682,6 +32745,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Entity + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.Entity + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Entity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.Entity"; + }; + return Entity; })(); @@ -30799,15 +32877,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.subjectId = reader.string(); - break; - case 2: - message.objectId = reader.string(); - break; - case 3: - message.relation = reader.string(); - break; + case 1: { + message.subjectId = reader.string(); + break; + } + case 2: { + message.objectId = reader.string(); + break; + } + case 3: { + message.relation = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -30914,6 +32995,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EntityRelation + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.EntityRelation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EntityRelation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.EntityRelation"; + }; + return EntityRelation; })(); @@ -31011,11 +33107,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.textSegments && message.textSegments.length)) - message.textSegments = []; - message.textSegments.push($root.google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.textSegments && message.textSegments.length)) + message.textSegments = []; + message.textSegments.push($root.google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -31122,6 +33219,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TextAnchor + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TextAnchor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.TextAnchor"; + }; + TextAnchor.TextSegment = (function() { /** @@ -31225,12 +33337,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.startIndex = reader.int64(); - break; - case 2: - message.endIndex = reader.int64(); - break; + case 1: { + message.startIndex = reader.int64(); + break; + } + case 2: { + message.endIndex = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -31357,6 +33471,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TextSegment + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TextSegment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Document.TextAnchor.TextSegment"; + }; + return TextSegment; })(); @@ -31469,12 +33598,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.x = reader.int32(); - break; - case 2: - message.y = reader.int32(); - break; + case 1: { + message.x = reader.int32(); + break; + } + case 2: { + message.y = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -31573,6 +33704,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Vertex + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.Vertex + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Vertex.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.Vertex"; + }; + return Vertex; })(); @@ -31679,12 +33825,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.x = reader.float(); - break; - case 2: - message.y = reader.float(); - break; + case 1: { + message.x = reader.float(); + break; + } + case 2: { + message.y = reader.float(); + break; + } default: reader.skipType(tag & 7); break; @@ -31783,6 +33931,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for NormalizedVertex + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.NormalizedVertex + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NormalizedVertex.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.NormalizedVertex"; + }; + return NormalizedVertex; })(); @@ -31893,16 +34056,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.vertices && message.vertices.length)) - message.vertices = []; - message.vertices.push($root.google.cloud.documentai.v1beta1.Vertex.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.normalizedVertices && message.normalizedVertices.length)) - message.normalizedVertices = []; - message.normalizedVertices.push($root.google.cloud.documentai.v1beta1.NormalizedVertex.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.vertices && message.vertices.length)) + message.vertices = []; + message.vertices.push($root.google.cloud.documentai.v1beta1.Vertex.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.normalizedVertices && message.normalizedVertices.length)) + message.normalizedVertices = []; + message.normalizedVertices.push($root.google.cloud.documentai.v1beta1.NormalizedVertex.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -32035,6 +34200,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BoundingPoly + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.BoundingPoly + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BoundingPoly.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.BoundingPoly"; + }; + return BoundingPoly; })(); @@ -32071,7 +34251,7 @@ }; /** - * Callback as used by {@link google.cloud.documentai.v1beta1.DocumentUnderstandingService#batchProcessDocuments}. + * Callback as used by {@link google.cloud.documentai.v1beta1.DocumentUnderstandingService|batchProcessDocuments}. * @memberof google.cloud.documentai.v1beta1.DocumentUnderstandingService * @typedef BatchProcessDocumentsCallback * @type {function} @@ -32211,14 +34391,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.requests && message.requests.length)) - message.requests = []; - message.requests.push($root.google.cloud.documentai.v1beta1.ProcessDocumentRequest.decode(reader, reader.uint32())); - break; - case 2: - message.parent = reader.string(); - break; + case 1: { + if (!(message.requests && message.requests.length)) + message.requests = []; + message.requests.push($root.google.cloud.documentai.v1beta1.ProcessDocumentRequest.decode(reader, reader.uint32())); + break; + } + case 2: { + message.parent = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -32334,6 +34516,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BatchProcessDocumentsRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchProcessDocumentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest"; + }; + return BatchProcessDocumentsRequest; })(); @@ -32495,27 +34692,34 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.decode(reader, reader.uint32()); - break; - case 2: - message.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.documentType = reader.string(); - break; - case 4: - message.tableExtractionParams = $root.google.cloud.documentai.v1beta1.TableExtractionParams.decode(reader, reader.uint32()); - break; - case 5: - message.formExtractionParams = $root.google.cloud.documentai.v1beta1.FormExtractionParams.decode(reader, reader.uint32()); - break; - case 6: - message.entityExtractionParams = $root.google.cloud.documentai.v1beta1.EntityExtractionParams.decode(reader, reader.uint32()); - break; - case 7: - message.ocrParams = $root.google.cloud.documentai.v1beta1.OcrParams.decode(reader, reader.uint32()); - break; + case 1: { + message.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.decode(reader, reader.uint32()); + break; + } + case 2: { + message.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.documentType = reader.string(); + break; + } + case 4: { + message.tableExtractionParams = $root.google.cloud.documentai.v1beta1.TableExtractionParams.decode(reader, reader.uint32()); + break; + } + case 5: { + message.formExtractionParams = $root.google.cloud.documentai.v1beta1.FormExtractionParams.decode(reader, reader.uint32()); + break; + } + case 6: { + message.entityExtractionParams = $root.google.cloud.documentai.v1beta1.EntityExtractionParams.decode(reader, reader.uint32()); + break; + } + case 7: { + message.ocrParams = $root.google.cloud.documentai.v1beta1.OcrParams.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -32684,6 +34888,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProcessDocumentRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProcessDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.ProcessDocumentRequest"; + }; + return ProcessDocumentRequest; })(); @@ -32781,11 +35000,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.responses && message.responses.length)) - message.responses = []; - message.responses.push($root.google.cloud.documentai.v1beta1.ProcessDocumentResponse.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.responses && message.responses.length)) + message.responses = []; + message.responses.push($root.google.cloud.documentai.v1beta1.ProcessDocumentResponse.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -32892,6 +35112,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BatchProcessDocumentsResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchProcessDocumentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse"; + }; + return BatchProcessDocumentsResponse; })(); @@ -32998,12 +35233,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.decode(reader, reader.uint32()); - break; - case 2: - message.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.decode(reader, reader.uint32()); - break; + case 1: { + message.inputConfig = $root.google.cloud.documentai.v1beta1.InputConfig.decode(reader, reader.uint32()); + break; + } + case 2: { + message.outputConfig = $root.google.cloud.documentai.v1beta1.OutputConfig.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -33112,6 +35349,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProcessDocumentResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.ProcessDocumentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProcessDocumentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.ProcessDocumentResponse"; + }; + return ProcessDocumentResponse; })(); @@ -33209,11 +35461,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.languageHints && message.languageHints.length)) - message.languageHints = []; - message.languageHints.push(reader.string()); - break; + case 1: { + if (!(message.languageHints && message.languageHints.length)) + message.languageHints = []; + message.languageHints.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -33315,6 +35568,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OcrParams + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.OcrParams + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OcrParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.OcrParams"; + }; + return OcrParams; })(); @@ -33447,22 +35715,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.enabled = reader.bool(); - break; - case 2: - if (!(message.tableBoundHints && message.tableBoundHints.length)) - message.tableBoundHints = []; - message.tableBoundHints.push($root.google.cloud.documentai.v1beta1.TableBoundHint.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.headerHints && message.headerHints.length)) - message.headerHints = []; - message.headerHints.push(reader.string()); - break; - case 4: - message.modelVersion = reader.string(); - break; + case 1: { + message.enabled = reader.bool(); + break; + } + case 2: { + if (!(message.tableBoundHints && message.tableBoundHints.length)) + message.tableBoundHints = []; + message.tableBoundHints.push($root.google.cloud.documentai.v1beta1.TableBoundHint.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.headerHints && message.headerHints.length)) + message.headerHints = []; + message.headerHints.push(reader.string()); + break; + } + case 4: { + message.modelVersion = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -33608,6 +35880,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TableExtractionParams + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.TableExtractionParams + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TableExtractionParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.TableExtractionParams"; + }; + return TableExtractionParams; })(); @@ -33714,12 +36001,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.pageNumber = reader.int32(); - break; - case 2: - message.boundingBox = $root.google.cloud.documentai.v1beta1.BoundingPoly.decode(reader, reader.uint32()); - break; + case 1: { + message.pageNumber = reader.int32(); + break; + } + case 2: { + message.boundingBox = $root.google.cloud.documentai.v1beta1.BoundingPoly.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -33823,6 +36112,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TableBoundHint + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.TableBoundHint + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TableBoundHint.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.TableBoundHint"; + }; + return TableBoundHint; })(); @@ -33942,17 +36246,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.enabled = reader.bool(); - break; - case 2: - if (!(message.keyValuePairHints && message.keyValuePairHints.length)) - message.keyValuePairHints = []; - message.keyValuePairHints.push($root.google.cloud.documentai.v1beta1.KeyValuePairHint.decode(reader, reader.uint32())); - break; - case 3: - message.modelVersion = reader.string(); - break; + case 1: { + message.enabled = reader.bool(); + break; + } + case 2: { + if (!(message.keyValuePairHints && message.keyValuePairHints.length)) + message.keyValuePairHints = []; + message.keyValuePairHints.push($root.google.cloud.documentai.v1beta1.KeyValuePairHint.decode(reader, reader.uint32())); + break; + } + case 3: { + message.modelVersion = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -34077,6 +36384,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FormExtractionParams + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.FormExtractionParams + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FormExtractionParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.FormExtractionParams"; + }; + return FormExtractionParams; })(); @@ -34185,14 +36507,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - if (!(message.valueTypes && message.valueTypes.length)) - message.valueTypes = []; - message.valueTypes.push(reader.string()); - break; + case 1: { + message.key = reader.string(); + break; + } + case 2: { + if (!(message.valueTypes && message.valueTypes.length)) + message.valueTypes = []; + message.valueTypes.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -34303,6 +36627,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for KeyValuePairHint + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.KeyValuePairHint + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + KeyValuePairHint.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.KeyValuePairHint"; + }; + return KeyValuePairHint; })(); @@ -34409,12 +36748,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.enabled = reader.bool(); - break; - case 2: - message.modelVersion = reader.string(); - break; + case 1: { + message.enabled = reader.bool(); + break; + } + case 2: { + message.modelVersion = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -34513,6 +36854,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EntityExtractionParams + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.EntityExtractionParams + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EntityExtractionParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.EntityExtractionParams"; + }; + return EntityExtractionParams; })(); @@ -34633,12 +36989,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsSource = $root.google.cloud.documentai.v1beta1.GcsSource.decode(reader, reader.uint32()); - break; - case 2: - message.mimeType = reader.string(); - break; + case 1: { + message.gcsSource = $root.google.cloud.documentai.v1beta1.GcsSource.decode(reader, reader.uint32()); + break; + } + case 2: { + message.mimeType = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -34747,6 +37105,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for InputConfig + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.InputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.InputConfig"; + }; + return InputConfig; })(); @@ -34867,12 +37240,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsDestination = $root.google.cloud.documentai.v1beta1.GcsDestination.decode(reader, reader.uint32()); - break; - case 2: - message.pagesPerShard = reader.int32(); - break; + case 1: { + message.gcsDestination = $root.google.cloud.documentai.v1beta1.GcsDestination.decode(reader, reader.uint32()); + break; + } + case 2: { + message.pagesPerShard = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -34981,6 +37356,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OutputConfig + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.OutputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OutputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.OutputConfig"; + }; + return OutputConfig; })(); @@ -35076,9 +37466,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.uri = reader.string(); - break; + case 1: { + message.uri = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -35168,6 +37559,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GcsSource + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.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.documentai.v1beta1.GcsSource"; + }; + return GcsSource; })(); @@ -35263,9 +37669,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.uri = reader.string(); - break; + case 1: { + message.uri = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -35355,6 +37762,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GcsDestination + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.GcsDestination + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GcsDestination.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.GcsDestination"; + }; + return GcsDestination; })(); @@ -35483,18 +37905,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.state = reader.int32(); - break; - case 2: - message.stateMessage = reader.string(); - break; - case 3: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; + case 1: { + message.state = reader.int32(); + break; + } + case 2: { + message.stateMessage = reader.string(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -35657,6 +38083,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OperationMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta1.OperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta1.OperationMetadata"; + }; + /** * State enum. * @name google.cloud.documentai.v1beta1.OperationMetadata.State @@ -35922,49 +38363,60 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.uri = reader.string(); - break; - case 2: - message.content = reader.bytes(); - break; - case 3: - message.mimeType = reader.string(); - break; - case 4: - message.text = reader.string(); - break; - case 5: - if (!(message.textStyles && message.textStyles.length)) - message.textStyles = []; - message.textStyles.push($root.google.cloud.documentai.v1beta2.Document.Style.decode(reader, reader.uint32())); - break; - case 6: - if (!(message.pages && message.pages.length)) - message.pages = []; - message.pages.push($root.google.cloud.documentai.v1beta2.Document.Page.decode(reader, reader.uint32())); - break; - case 7: - if (!(message.entities && message.entities.length)) - message.entities = []; - message.entities.push($root.google.cloud.documentai.v1beta2.Document.Entity.decode(reader, reader.uint32())); - break; - case 8: - if (!(message.entityRelations && message.entityRelations.length)) - message.entityRelations = []; - message.entityRelations.push($root.google.cloud.documentai.v1beta2.Document.EntityRelation.decode(reader, reader.uint32())); - break; - case 9: - message.shardInfo = $root.google.cloud.documentai.v1beta2.Document.ShardInfo.decode(reader, reader.uint32()); - break; - case 11: - if (!(message.labels && message.labels.length)) - message.labels = []; - message.labels.push($root.google.cloud.documentai.v1beta2.Document.Label.decode(reader, reader.uint32())); - break; - case 10: - message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; + case 1: { + message.uri = reader.string(); + break; + } + case 2: { + message.content = reader.bytes(); + break; + } + case 3: { + message.mimeType = reader.string(); + break; + } + case 4: { + message.text = reader.string(); + break; + } + case 5: { + if (!(message.textStyles && message.textStyles.length)) + message.textStyles = []; + message.textStyles.push($root.google.cloud.documentai.v1beta2.Document.Style.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.pages && message.pages.length)) + message.pages = []; + message.pages.push($root.google.cloud.documentai.v1beta2.Document.Page.decode(reader, reader.uint32())); + break; + } + case 7: { + if (!(message.entities && message.entities.length)) + message.entities = []; + message.entities.push($root.google.cloud.documentai.v1beta2.Document.Entity.decode(reader, reader.uint32())); + break; + } + case 8: { + if (!(message.entityRelations && message.entityRelations.length)) + message.entityRelations = []; + message.entityRelations.push($root.google.cloud.documentai.v1beta2.Document.EntityRelation.decode(reader, reader.uint32())); + break; + } + case 9: { + message.shardInfo = $root.google.cloud.documentai.v1beta2.Document.ShardInfo.decode(reader, reader.uint32()); + break; + } + case 11: { + if (!(message.labels && message.labels.length)) + message.labels = []; + message.labels.push($root.google.cloud.documentai.v1beta2.Document.Label.decode(reader, reader.uint32())); + break; + } + case 10: { + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -36094,7 +38546,7 @@ if (object.content != null) if (typeof object.content === "string") $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); - else if (object.content.length) + else if (object.content.length >= 0) message.content = object.content; if (object.mimeType != null) message.mimeType = String(object.mimeType); @@ -36246,6 +38698,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Document + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Document.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document"; + }; + Document.ShardInfo = (function() { /** @@ -36360,15 +38827,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.shardIndex = reader.int64(); - break; - case 2: - message.shardCount = reader.int64(); - break; - case 3: - message.textOffset = reader.int64(); - break; + case 1: { + message.shardIndex = reader.int64(); + break; + } + case 2: { + message.shardCount = reader.int64(); + break; + } + case 3: { + message.textOffset = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -36517,6 +38987,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ShardInfo + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.ShardInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ShardInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.ShardInfo"; + }; + return ShardInfo; })(); @@ -36648,15 +39133,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - message.automlModel = reader.string(); - break; - case 1: - message.name = reader.string(); - break; - case 3: - message.confidence = reader.float(); - break; + case 2: { + message.automlModel = reader.string(); + break; + } + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.confidence = reader.float(); + break; + } default: reader.skipType(tag & 7); break; @@ -36768,6 +39256,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Label + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.Label + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Label.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.Label"; + }; + return Label; })(); @@ -36929,27 +39432,34 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.textAnchor = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.decode(reader, reader.uint32()); - break; - case 2: - message.color = $root.google.type.Color.decode(reader, reader.uint32()); - break; - case 3: - message.backgroundColor = $root.google.type.Color.decode(reader, reader.uint32()); - break; - case 4: - message.fontWeight = reader.string(); - break; - case 5: - message.textStyle = reader.string(); - break; - case 6: - message.textDecoration = reader.string(); - break; - case 7: - message.fontSize = $root.google.cloud.documentai.v1beta2.Document.Style.FontSize.decode(reader, reader.uint32()); - break; + case 1: { + message.textAnchor = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.decode(reader, reader.uint32()); + break; + } + case 2: { + message.color = $root.google.type.Color.decode(reader, reader.uint32()); + break; + } + case 3: { + message.backgroundColor = $root.google.type.Color.decode(reader, reader.uint32()); + break; + } + case 4: { + message.fontWeight = reader.string(); + break; + } + case 5: { + message.textStyle = reader.string(); + break; + } + case 6: { + message.textDecoration = reader.string(); + break; + } + case 7: { + message.fontSize = $root.google.cloud.documentai.v1beta2.Document.Style.FontSize.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -37108,6 +39618,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Style + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.Style + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Style.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.Style"; + }; + Style.FontSize = (function() { /** @@ -37211,12 +39736,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.size = reader.float(); - break; - case 2: - message.unit = reader.string(); - break; + case 1: { + message.size = reader.float(); + break; + } + case 2: { + message.unit = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -37315,6 +39842,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FontSize + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.Style.FontSize + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FontSize.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.Style.FontSize"; + }; + return FontSize; })(); @@ -37539,55 +40081,66 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.pageNumber = reader.int32(); - break; - case 2: - message.dimension = $root.google.cloud.documentai.v1beta2.Document.Page.Dimension.decode(reader, reader.uint32()); - break; - case 3: - message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.blocks && message.blocks.length)) - message.blocks = []; - message.blocks.push($root.google.cloud.documentai.v1beta2.Document.Page.Block.decode(reader, reader.uint32())); - break; - case 6: - if (!(message.paragraphs && message.paragraphs.length)) - message.paragraphs = []; - message.paragraphs.push($root.google.cloud.documentai.v1beta2.Document.Page.Paragraph.decode(reader, reader.uint32())); - break; - case 7: - if (!(message.lines && message.lines.length)) - message.lines = []; - message.lines.push($root.google.cloud.documentai.v1beta2.Document.Page.Line.decode(reader, reader.uint32())); - break; - case 8: - if (!(message.tokens && message.tokens.length)) - message.tokens = []; - message.tokens.push($root.google.cloud.documentai.v1beta2.Document.Page.Token.decode(reader, reader.uint32())); - break; - case 9: - if (!(message.visualElements && message.visualElements.length)) - message.visualElements = []; - message.visualElements.push($root.google.cloud.documentai.v1beta2.Document.Page.VisualElement.decode(reader, reader.uint32())); - break; - case 10: - if (!(message.tables && message.tables.length)) - message.tables = []; - message.tables.push($root.google.cloud.documentai.v1beta2.Document.Page.Table.decode(reader, reader.uint32())); - break; - case 11: - if (!(message.formFields && message.formFields.length)) - message.formFields = []; - message.formFields.push($root.google.cloud.documentai.v1beta2.Document.Page.FormField.decode(reader, reader.uint32())); - break; + case 1: { + message.pageNumber = reader.int32(); + break; + } + case 2: { + message.dimension = $root.google.cloud.documentai.v1beta2.Document.Page.Dimension.decode(reader, reader.uint32()); + break; + } + case 3: { + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.blocks && message.blocks.length)) + message.blocks = []; + message.blocks.push($root.google.cloud.documentai.v1beta2.Document.Page.Block.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.paragraphs && message.paragraphs.length)) + message.paragraphs = []; + message.paragraphs.push($root.google.cloud.documentai.v1beta2.Document.Page.Paragraph.decode(reader, reader.uint32())); + break; + } + case 7: { + if (!(message.lines && message.lines.length)) + message.lines = []; + message.lines.push($root.google.cloud.documentai.v1beta2.Document.Page.Line.decode(reader, reader.uint32())); + break; + } + case 8: { + if (!(message.tokens && message.tokens.length)) + message.tokens = []; + message.tokens.push($root.google.cloud.documentai.v1beta2.Document.Page.Token.decode(reader, reader.uint32())); + break; + } + case 9: { + if (!(message.visualElements && message.visualElements.length)) + message.visualElements = []; + message.visualElements.push($root.google.cloud.documentai.v1beta2.Document.Page.VisualElement.decode(reader, reader.uint32())); + break; + } + case 10: { + if (!(message.tables && message.tables.length)) + message.tables = []; + message.tables.push($root.google.cloud.documentai.v1beta2.Document.Page.Table.decode(reader, reader.uint32())); + break; + } + case 11: { + if (!(message.formFields && message.formFields.length)) + message.formFields = []; + message.formFields.push($root.google.cloud.documentai.v1beta2.Document.Page.FormField.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -37906,6 +40459,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Page + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.Page + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Page.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.Page"; + }; + Page.Dimension = (function() { /** @@ -38020,15 +40588,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.width = reader.float(); - break; - case 2: - message.height = reader.float(); - break; - case 3: - message.unit = reader.string(); - break; + case 1: { + message.width = reader.float(); + break; + } + case 2: { + message.height = reader.float(); + break; + } + case 3: { + message.unit = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -38135,6 +40706,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Dimension + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.Page.Dimension + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Dimension.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.Page.Dimension"; + }; + return Dimension; })(); @@ -38274,21 +40860,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.textAnchor = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.decode(reader, reader.uint32()); - break; - case 2: - message.confidence = reader.float(); - break; - case 3: - message.boundingPoly = $root.google.cloud.documentai.v1beta2.BoundingPoly.decode(reader, reader.uint32()); - break; - case 4: - message.orientation = reader.int32(); - break; - case 5: - message.id = reader.string(); - break; + case 1: { + message.textAnchor = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.decode(reader, reader.uint32()); + break; + } + case 2: { + message.confidence = reader.float(); + break; + } + case 3: { + message.boundingPoly = $root.google.cloud.documentai.v1beta2.BoundingPoly.decode(reader, reader.uint32()); + break; + } + case 4: { + message.orientation = reader.int32(); + break; + } + case 5: { + message.id = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -38449,6 +41040,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Layout + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.Page.Layout + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Layout.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.Page.Layout"; + }; + /** * Orientation enum. * @name google.cloud.documentai.v1beta2.Document.Page.Layout.Orientation @@ -38577,14 +41183,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -38705,6 +41313,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Block + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.Page.Block + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Block.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.Page.Block"; + }; + return Block; })(); @@ -38813,14 +41436,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -38941,6 +41566,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Paragraph + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.Page.Paragraph + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Paragraph.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.Page.Paragraph"; + }; + return Paragraph; })(); @@ -39049,14 +41689,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -39177,6 +41819,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Line + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.Page.Line + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Line.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.Page.Line"; + }; + return Line; })(); @@ -39296,17 +41953,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - message.detectedBreak = $root.google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.decode(reader, reader.uint32()); - break; - case 3: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + message.detectedBreak = $root.google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.decode(reader, reader.uint32()); + break; + } + case 3: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -39441,6 +42101,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Token + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Token.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.Page.Token"; + }; + Token.DetectedBreak = (function() { /** @@ -39533,9 +42208,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.type = reader.int32(); - break; + case 1: { + message.type = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -39648,6 +42324,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DetectedBreak + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DetectedBreak.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak"; + }; + /** * Type enum. * @name google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.Type @@ -39788,17 +42479,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - message.type = reader.string(); - break; - case 3: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -39928,6 +42622,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for VisualElement + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.Page.VisualElement + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VisualElement.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.Page.VisualElement"; + }; + return VisualElement; })(); @@ -40062,24 +42771,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.headerRows && message.headerRows.length)) - message.headerRows = []; - message.headerRows.push($root.google.cloud.documentai.v1beta2.Document.Page.Table.TableRow.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.bodyRows && message.bodyRows.length)) - message.bodyRows = []; - message.bodyRows.push($root.google.cloud.documentai.v1beta2.Document.Page.Table.TableRow.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.headerRows && message.headerRows.length)) + message.headerRows = []; + message.headerRows.push($root.google.cloud.documentai.v1beta2.Document.Page.Table.TableRow.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.bodyRows && message.bodyRows.length)) + message.bodyRows = []; + message.bodyRows.push($root.google.cloud.documentai.v1beta2.Document.Page.Table.TableRow.decode(reader, reader.uint32())); + break; + } + case 4: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -40251,6 +42964,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Table + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Table.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.Page.Table"; + }; + Table.TableRow = (function() { /** @@ -40345,11 +43073,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.cells && message.cells.length)) - message.cells = []; - message.cells.push($root.google.cloud.documentai.v1beta2.Document.Page.Table.TableCell.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.cells && message.cells.length)) + message.cells = []; + message.cells.push($root.google.cloud.documentai.v1beta2.Document.Page.Table.TableCell.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -40456,6 +43185,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TableRow + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableRow + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TableRow.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.Page.Table.TableRow"; + }; + return TableRow; })(); @@ -40586,20 +43330,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - message.rowSpan = reader.int32(); - break; - case 3: - message.colSpan = reader.int32(); - break; - case 4: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + message.rowSpan = reader.int32(); + break; + } + case 3: { + message.colSpan = reader.int32(); + break; + } + case 4: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -40737,6 +43485,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TableCell + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.Page.Table.TableCell + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TableCell.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.Page.Table.TableCell"; + }; + return TableCell; })(); @@ -40905,31 +43668,38 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.fieldName = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - message.fieldValue = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 3: - if (!(message.nameDetectedLanguages && message.nameDetectedLanguages.length)) - message.nameDetectedLanguages = []; - message.nameDetectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.valueDetectedLanguages && message.valueDetectedLanguages.length)) - message.valueDetectedLanguages = []; - message.valueDetectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; - case 5: - message.valueType = reader.string(); - break; - case 6: - message.correctedKeyText = reader.string(); - break; - case 7: - message.correctedValueText = reader.string(); - break; + case 1: { + message.fieldName = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + message.fieldValue = $root.google.cloud.documentai.v1beta2.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 3: { + if (!(message.nameDetectedLanguages && message.nameDetectedLanguages.length)) + message.nameDetectedLanguages = []; + message.nameDetectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + case 4: { + if (!(message.valueDetectedLanguages && message.valueDetectedLanguages.length)) + message.valueDetectedLanguages = []; + message.valueDetectedLanguages.push($root.google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + case 5: { + message.valueType = reader.string(); + break; + } + case 6: { + message.correctedKeyText = reader.string(); + break; + } + case 7: { + message.correctedValueText = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -41114,6 +43884,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FormField + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.Page.FormField + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FormField.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.Page.FormField"; + }; + return FormField; })(); @@ -41220,12 +44005,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.languageCode = reader.string(); - break; - case 2: - message.confidence = reader.float(); - break; + case 1: { + message.languageCode = reader.string(); + break; + } + case 2: { + message.confidence = reader.float(); + break; + } default: reader.skipType(tag & 7); break; @@ -41324,6 +44111,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DetectedLanguage + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DetectedLanguage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.Page.DetectedLanguage"; + }; + return DetectedLanguage; })(); @@ -41488,27 +44290,34 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.textAnchor = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.decode(reader, reader.uint32()); - break; - case 2: - message.type = reader.string(); - break; - case 3: - message.mentionText = reader.string(); - break; - case 4: - message.mentionId = reader.string(); - break; - case 5: - message.confidence = reader.float(); - break; - case 6: - message.pageAnchor = $root.google.cloud.documentai.v1beta2.Document.PageAnchor.decode(reader, reader.uint32()); - break; - case 7: - message.id = reader.string(); - break; + case 1: { + message.textAnchor = $root.google.cloud.documentai.v1beta2.Document.TextAnchor.decode(reader, reader.uint32()); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + message.mentionText = reader.string(); + break; + } + case 4: { + message.mentionId = reader.string(); + break; + } + case 5: { + message.confidence = reader.float(); + break; + } + case 6: { + message.pageAnchor = $root.google.cloud.documentai.v1beta2.Document.PageAnchor.decode(reader, reader.uint32()); + break; + } + case 7: { + message.id = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -41657,6 +44466,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Entity + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.Entity + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Entity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.Entity"; + }; + return Entity; })(); @@ -41774,15 +44598,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.subjectId = reader.string(); - break; - case 2: - message.objectId = reader.string(); - break; - case 3: - message.relation = reader.string(); - break; + case 1: { + message.subjectId = reader.string(); + break; + } + case 2: { + message.objectId = reader.string(); + break; + } + case 3: { + message.relation = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -41889,6 +44716,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EntityRelation + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.EntityRelation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EntityRelation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.EntityRelation"; + }; + return EntityRelation; })(); @@ -41997,14 +44839,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.textSegments && message.textSegments.length)) - message.textSegments = []; - message.textSegments.push($root.google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment.decode(reader, reader.uint32())); - break; - case 2: - message.content = reader.string(); - break; + case 1: { + if (!(message.textSegments && message.textSegments.length)) + message.textSegments = []; + message.textSegments.push($root.google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment.decode(reader, reader.uint32())); + break; + } + case 2: { + message.content = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -42120,6 +44964,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TextAnchor + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TextAnchor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.TextAnchor"; + }; + TextAnchor.TextSegment = (function() { /** @@ -42223,12 +45082,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.startIndex = reader.int64(); - break; - case 2: - message.endIndex = reader.int64(); - break; + case 1: { + message.startIndex = reader.int64(); + break; + } + case 2: { + message.endIndex = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -42355,6 +45216,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TextSegment + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TextSegment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.TextAnchor.TextSegment"; + }; + return TextSegment; })(); @@ -42455,11 +45331,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.pageRefs && message.pageRefs.length)) - message.pageRefs = []; - message.pageRefs.push($root.google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.pageRefs && message.pageRefs.length)) + message.pageRefs = []; + message.pageRefs.push($root.google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -42566,6 +45443,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PageAnchor + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PageAnchor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.PageAnchor"; + }; + PageAnchor.PageRef = (function() { /** @@ -42680,15 +45572,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.page = reader.int64(); - break; - case 2: - message.layoutType = reader.int32(); - break; - case 3: - message.layoutId = reader.string(); - break; + case 1: { + message.page = reader.int64(); + break; + } + case 2: { + message.layoutType = reader.int32(); + break; + } + case 3: { + message.layoutId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -42852,6 +45747,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PageRef + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PageRef.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef"; + }; + /** * LayoutType enum. * @name google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.LayoutType @@ -42990,12 +45900,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.x = reader.int32(); - break; - case 2: - message.y = reader.int32(); - break; + case 1: { + message.x = reader.int32(); + break; + } + case 2: { + message.y = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -43094,6 +46006,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Vertex + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.Vertex + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Vertex.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.Vertex"; + }; + return Vertex; })(); @@ -43200,12 +46127,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.x = reader.float(); - break; - case 2: - message.y = reader.float(); - break; + case 1: { + message.x = reader.float(); + break; + } + case 2: { + message.y = reader.float(); + break; + } default: reader.skipType(tag & 7); break; @@ -43304,6 +46233,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for NormalizedVertex + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.NormalizedVertex + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NormalizedVertex.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.NormalizedVertex"; + }; + return NormalizedVertex; })(); @@ -43414,16 +46358,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.vertices && message.vertices.length)) - message.vertices = []; - message.vertices.push($root.google.cloud.documentai.v1beta2.Vertex.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.normalizedVertices && message.normalizedVertices.length)) - message.normalizedVertices = []; - message.normalizedVertices.push($root.google.cloud.documentai.v1beta2.NormalizedVertex.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.vertices && message.vertices.length)) + message.vertices = []; + message.vertices.push($root.google.cloud.documentai.v1beta2.Vertex.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.normalizedVertices && message.normalizedVertices.length)) + message.normalizedVertices = []; + message.normalizedVertices.push($root.google.cloud.documentai.v1beta2.NormalizedVertex.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -43556,6 +46502,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BoundingPoly + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.BoundingPoly + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BoundingPoly.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.BoundingPoly"; + }; + return BoundingPoly; })(); @@ -43592,7 +46553,7 @@ }; /** - * Callback as used by {@link google.cloud.documentai.v1beta2.DocumentUnderstandingService#batchProcessDocuments}. + * Callback as used by {@link google.cloud.documentai.v1beta2.DocumentUnderstandingService|batchProcessDocuments}. * @memberof google.cloud.documentai.v1beta2.DocumentUnderstandingService * @typedef BatchProcessDocumentsCallback * @type {function} @@ -43625,7 +46586,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1beta2.DocumentUnderstandingService#processDocument}. + * Callback as used by {@link google.cloud.documentai.v1beta2.DocumentUnderstandingService|processDocument}. * @memberof google.cloud.documentai.v1beta2.DocumentUnderstandingService * @typedef ProcessDocumentCallback * @type {function} @@ -43765,14 +46726,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.requests && message.requests.length)) - message.requests = []; - message.requests.push($root.google.cloud.documentai.v1beta2.ProcessDocumentRequest.decode(reader, reader.uint32())); - break; - case 2: - message.parent = reader.string(); - break; + case 1: { + if (!(message.requests && message.requests.length)) + message.requests = []; + message.requests.push($root.google.cloud.documentai.v1beta2.ProcessDocumentRequest.decode(reader, reader.uint32())); + break; + } + case 2: { + message.parent = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -43888,6 +46851,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BatchProcessDocumentsRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchProcessDocumentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest"; + }; + return BatchProcessDocumentsRequest; })(); @@ -44071,33 +47049,42 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 9: - message.parent = reader.string(); - break; - case 1: - message.inputConfig = $root.google.cloud.documentai.v1beta2.InputConfig.decode(reader, reader.uint32()); - break; - case 2: - message.outputConfig = $root.google.cloud.documentai.v1beta2.OutputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.documentType = reader.string(); - break; - case 4: - message.tableExtractionParams = $root.google.cloud.documentai.v1beta2.TableExtractionParams.decode(reader, reader.uint32()); - break; - case 5: - message.formExtractionParams = $root.google.cloud.documentai.v1beta2.FormExtractionParams.decode(reader, reader.uint32()); - break; - case 6: - message.entityExtractionParams = $root.google.cloud.documentai.v1beta2.EntityExtractionParams.decode(reader, reader.uint32()); - break; - case 7: - message.ocrParams = $root.google.cloud.documentai.v1beta2.OcrParams.decode(reader, reader.uint32()); - break; - case 8: - message.automlParams = $root.google.cloud.documentai.v1beta2.AutoMlParams.decode(reader, reader.uint32()); - break; + case 9: { + message.parent = reader.string(); + break; + } + case 1: { + message.inputConfig = $root.google.cloud.documentai.v1beta2.InputConfig.decode(reader, reader.uint32()); + break; + } + case 2: { + message.outputConfig = $root.google.cloud.documentai.v1beta2.OutputConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.documentType = reader.string(); + break; + } + case 4: { + message.tableExtractionParams = $root.google.cloud.documentai.v1beta2.TableExtractionParams.decode(reader, reader.uint32()); + break; + } + case 5: { + message.formExtractionParams = $root.google.cloud.documentai.v1beta2.FormExtractionParams.decode(reader, reader.uint32()); + break; + } + case 6: { + message.entityExtractionParams = $root.google.cloud.documentai.v1beta2.EntityExtractionParams.decode(reader, reader.uint32()); + break; + } + case 7: { + message.ocrParams = $root.google.cloud.documentai.v1beta2.OcrParams.decode(reader, reader.uint32()); + break; + } + case 8: { + message.automlParams = $root.google.cloud.documentai.v1beta2.AutoMlParams.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -44287,6 +47274,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProcessDocumentRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProcessDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.ProcessDocumentRequest"; + }; + return ProcessDocumentRequest; })(); @@ -44384,11 +47386,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.responses && message.responses.length)) - message.responses = []; - message.responses.push($root.google.cloud.documentai.v1beta2.ProcessDocumentResponse.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.responses && message.responses.length)) + message.responses = []; + message.responses.push($root.google.cloud.documentai.v1beta2.ProcessDocumentResponse.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -44495,6 +47498,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BatchProcessDocumentsResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchProcessDocumentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse"; + }; + return BatchProcessDocumentsResponse; })(); @@ -44601,12 +47619,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.inputConfig = $root.google.cloud.documentai.v1beta2.InputConfig.decode(reader, reader.uint32()); - break; - case 2: - message.outputConfig = $root.google.cloud.documentai.v1beta2.OutputConfig.decode(reader, reader.uint32()); - break; + case 1: { + message.inputConfig = $root.google.cloud.documentai.v1beta2.InputConfig.decode(reader, reader.uint32()); + break; + } + case 2: { + message.outputConfig = $root.google.cloud.documentai.v1beta2.OutputConfig.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -44715,6 +47735,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProcessDocumentResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProcessDocumentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.ProcessDocumentResponse"; + }; + return ProcessDocumentResponse; })(); @@ -44812,11 +47847,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.languageHints && message.languageHints.length)) - message.languageHints = []; - message.languageHints.push(reader.string()); - break; + case 1: { + if (!(message.languageHints && message.languageHints.length)) + message.languageHints = []; + message.languageHints.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -44918,6 +47954,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OcrParams + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.OcrParams + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OcrParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.OcrParams"; + }; + return OcrParams; })(); @@ -45050,22 +48101,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.enabled = reader.bool(); - break; - case 2: - if (!(message.tableBoundHints && message.tableBoundHints.length)) - message.tableBoundHints = []; - message.tableBoundHints.push($root.google.cloud.documentai.v1beta2.TableBoundHint.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.headerHints && message.headerHints.length)) - message.headerHints = []; - message.headerHints.push(reader.string()); - break; - case 4: - message.modelVersion = reader.string(); - break; + case 1: { + message.enabled = reader.bool(); + break; + } + case 2: { + if (!(message.tableBoundHints && message.tableBoundHints.length)) + message.tableBoundHints = []; + message.tableBoundHints.push($root.google.cloud.documentai.v1beta2.TableBoundHint.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.headerHints && message.headerHints.length)) + message.headerHints = []; + message.headerHints.push(reader.string()); + break; + } + case 4: { + message.modelVersion = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -45211,6 +48266,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TableExtractionParams + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TableExtractionParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.TableExtractionParams"; + }; + return TableExtractionParams; })(); @@ -45317,12 +48387,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.pageNumber = reader.int32(); - break; - case 2: - message.boundingBox = $root.google.cloud.documentai.v1beta2.BoundingPoly.decode(reader, reader.uint32()); - break; + case 1: { + message.pageNumber = reader.int32(); + break; + } + case 2: { + message.boundingBox = $root.google.cloud.documentai.v1beta2.BoundingPoly.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -45426,6 +48498,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TableBoundHint + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.TableBoundHint + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TableBoundHint.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.TableBoundHint"; + }; + return TableBoundHint; })(); @@ -45545,17 +48632,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.enabled = reader.bool(); - break; - case 2: - if (!(message.keyValuePairHints && message.keyValuePairHints.length)) - message.keyValuePairHints = []; - message.keyValuePairHints.push($root.google.cloud.documentai.v1beta2.KeyValuePairHint.decode(reader, reader.uint32())); - break; - case 3: - message.modelVersion = reader.string(); - break; + case 1: { + message.enabled = reader.bool(); + break; + } + case 2: { + if (!(message.keyValuePairHints && message.keyValuePairHints.length)) + message.keyValuePairHints = []; + message.keyValuePairHints.push($root.google.cloud.documentai.v1beta2.KeyValuePairHint.decode(reader, reader.uint32())); + break; + } + case 3: { + message.modelVersion = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -45680,6 +48770,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FormExtractionParams + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.FormExtractionParams + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FormExtractionParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.FormExtractionParams"; + }; + return FormExtractionParams; })(); @@ -45788,14 +48893,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - if (!(message.valueTypes && message.valueTypes.length)) - message.valueTypes = []; - message.valueTypes.push(reader.string()); - break; + case 1: { + message.key = reader.string(); + break; + } + case 2: { + if (!(message.valueTypes && message.valueTypes.length)) + message.valueTypes = []; + message.valueTypes.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -45906,6 +49013,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for KeyValuePairHint + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.KeyValuePairHint + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + KeyValuePairHint.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.KeyValuePairHint"; + }; + return KeyValuePairHint; })(); @@ -46012,12 +49134,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.enabled = reader.bool(); - break; - case 2: - message.modelVersion = reader.string(); - break; + case 1: { + message.enabled = reader.bool(); + break; + } + case 2: { + message.modelVersion = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -46116,6 +49240,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EntityExtractionParams + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.EntityExtractionParams + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EntityExtractionParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.EntityExtractionParams"; + }; + return EntityExtractionParams; })(); @@ -46211,9 +49350,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; @@ -46303,6 +49443,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AutoMlParams + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.AutoMlParams + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AutoMlParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.AutoMlParams"; + }; + return AutoMlParams; })(); @@ -46434,15 +49589,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsSource = $root.google.cloud.documentai.v1beta2.GcsSource.decode(reader, reader.uint32()); - break; - case 3: - message.contents = reader.bytes(); - break; - case 2: - message.mimeType = reader.string(); - break; + case 1: { + message.gcsSource = $root.google.cloud.documentai.v1beta2.GcsSource.decode(reader, reader.uint32()); + break; + } + case 3: { + message.contents = reader.bytes(); + break; + } + case 2: { + message.mimeType = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -46520,7 +49678,7 @@ if (object.contents != null) if (typeof object.contents === "string") $util.base64.decode(object.contents, message.contents = $util.newBuffer($util.base64.length(object.contents)), 0); - else if (object.contents.length) + else if (object.contents.length >= 0) message.contents = object.contents; if (object.mimeType != null) message.mimeType = String(object.mimeType); @@ -46568,6 +49726,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for InputConfig + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.InputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.InputConfig"; + }; + return InputConfig; })(); @@ -46688,12 +49861,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsDestination = $root.google.cloud.documentai.v1beta2.GcsDestination.decode(reader, reader.uint32()); - break; - case 2: - message.pagesPerShard = reader.int32(); - break; + case 1: { + message.gcsDestination = $root.google.cloud.documentai.v1beta2.GcsDestination.decode(reader, reader.uint32()); + break; + } + case 2: { + message.pagesPerShard = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -46802,6 +49977,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OutputConfig + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.OutputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OutputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.OutputConfig"; + }; + return OutputConfig; })(); @@ -46897,9 +50087,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.uri = reader.string(); - break; + case 1: { + message.uri = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -46989,6 +50180,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GcsSource + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.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.documentai.v1beta2.GcsSource"; + }; + return GcsSource; })(); @@ -47084,9 +50290,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.uri = reader.string(); - break; + case 1: { + message.uri = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -47176,6 +50383,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GcsDestination + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.GcsDestination + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GcsDestination.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.GcsDestination"; + }; + return GcsDestination; })(); @@ -47304,18 +50526,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.state = reader.int32(); - break; - case 2: - message.stateMessage = reader.string(); - break; - case 3: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; + case 1: { + message.state = reader.int32(); + break; + } + case 2: { + message.stateMessage = reader.string(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -47478,6 +50704,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OperationMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta2.OperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta2.OperationMetadata"; + }; + /** * State enum. * @name google.cloud.documentai.v1beta2.OperationMetadata.State @@ -47631,15 +50872,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.format = reader.string(); - break; - case 2: - message.valueFormat = reader.string(); - break; - case 3: - message.rawValue = reader.string(); - break; + case 1: { + message.format = reader.string(); + break; + } + case 2: { + message.valueFormat = reader.string(); + break; + } + case 3: { + message.rawValue = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -47746,6 +50990,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Barcode + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Barcode + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Barcode.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Barcode"; + }; + return Barcode; })(); @@ -47988,54 +51247,66 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.uri = reader.string(); - break; - case 2: - message.content = reader.bytes(); - break; - case 3: - message.mimeType = reader.string(); - break; - case 4: - message.text = reader.string(); - break; - case 5: - if (!(message.textStyles && message.textStyles.length)) - message.textStyles = []; - message.textStyles.push($root.google.cloud.documentai.v1beta3.Document.Style.decode(reader, reader.uint32())); - break; - case 6: - if (!(message.pages && message.pages.length)) - message.pages = []; - message.pages.push($root.google.cloud.documentai.v1beta3.Document.Page.decode(reader, reader.uint32())); - break; - case 7: - if (!(message.entities && message.entities.length)) - message.entities = []; - message.entities.push($root.google.cloud.documentai.v1beta3.Document.Entity.decode(reader, reader.uint32())); - break; - case 8: - if (!(message.entityRelations && message.entityRelations.length)) - message.entityRelations = []; - message.entityRelations.push($root.google.cloud.documentai.v1beta3.Document.EntityRelation.decode(reader, reader.uint32())); - break; - case 14: - if (!(message.textChanges && message.textChanges.length)) - message.textChanges = []; - message.textChanges.push($root.google.cloud.documentai.v1beta3.Document.TextChange.decode(reader, reader.uint32())); - break; - case 9: - message.shardInfo = $root.google.cloud.documentai.v1beta3.Document.ShardInfo.decode(reader, reader.uint32()); - break; - case 10: - message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; - case 13: - if (!(message.revisions && message.revisions.length)) - message.revisions = []; - message.revisions.push($root.google.cloud.documentai.v1beta3.Document.Revision.decode(reader, reader.uint32())); - break; + case 1: { + message.uri = reader.string(); + break; + } + case 2: { + message.content = reader.bytes(); + break; + } + case 3: { + message.mimeType = reader.string(); + break; + } + case 4: { + message.text = reader.string(); + break; + } + case 5: { + if (!(message.textStyles && message.textStyles.length)) + message.textStyles = []; + message.textStyles.push($root.google.cloud.documentai.v1beta3.Document.Style.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.pages && message.pages.length)) + message.pages = []; + message.pages.push($root.google.cloud.documentai.v1beta3.Document.Page.decode(reader, reader.uint32())); + break; + } + case 7: { + if (!(message.entities && message.entities.length)) + message.entities = []; + message.entities.push($root.google.cloud.documentai.v1beta3.Document.Entity.decode(reader, reader.uint32())); + break; + } + case 8: { + if (!(message.entityRelations && message.entityRelations.length)) + message.entityRelations = []; + message.entityRelations.push($root.google.cloud.documentai.v1beta3.Document.EntityRelation.decode(reader, reader.uint32())); + break; + } + case 14: { + if (!(message.textChanges && message.textChanges.length)) + message.textChanges = []; + message.textChanges.push($root.google.cloud.documentai.v1beta3.Document.TextChange.decode(reader, reader.uint32())); + break; + } + case 9: { + message.shardInfo = $root.google.cloud.documentai.v1beta3.Document.ShardInfo.decode(reader, reader.uint32()); + break; + } + case 10: { + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + case 13: { + if (!(message.revisions && message.revisions.length)) + message.revisions = []; + message.revisions.push($root.google.cloud.documentai.v1beta3.Document.Revision.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -48174,7 +51445,7 @@ if (object.content != null) if (typeof object.content === "string") $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); - else if (object.content.length) + else if (object.content.length >= 0) message.content = object.content; if (object.mimeType != null) message.mimeType = String(object.mimeType); @@ -48342,6 +51613,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Document + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Document.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document"; + }; + Document.ShardInfo = (function() { /** @@ -48456,15 +51742,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.shardIndex = reader.int64(); - break; - case 2: - message.shardCount = reader.int64(); - break; - case 3: - message.textOffset = reader.int64(); - break; + case 1: { + message.shardIndex = reader.int64(); + break; + } + case 2: { + message.shardCount = reader.int64(); + break; + } + case 3: { + message.textOffset = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -48613,6 +51902,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ShardInfo + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.ShardInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ShardInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.ShardInfo"; + }; + return ShardInfo; })(); @@ -48774,27 +52078,34 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.decode(reader, reader.uint32()); - break; - case 2: - message.color = $root.google.type.Color.decode(reader, reader.uint32()); - break; - case 3: - message.backgroundColor = $root.google.type.Color.decode(reader, reader.uint32()); - break; - case 4: - message.fontWeight = reader.string(); - break; - case 5: - message.textStyle = reader.string(); - break; - case 6: - message.textDecoration = reader.string(); - break; - case 7: - message.fontSize = $root.google.cloud.documentai.v1beta3.Document.Style.FontSize.decode(reader, reader.uint32()); - break; + case 1: { + message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.decode(reader, reader.uint32()); + break; + } + case 2: { + message.color = $root.google.type.Color.decode(reader, reader.uint32()); + break; + } + case 3: { + message.backgroundColor = $root.google.type.Color.decode(reader, reader.uint32()); + break; + } + case 4: { + message.fontWeight = reader.string(); + break; + } + case 5: { + message.textStyle = reader.string(); + break; + } + case 6: { + message.textDecoration = reader.string(); + break; + } + case 7: { + message.fontSize = $root.google.cloud.documentai.v1beta3.Document.Style.FontSize.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -48953,6 +52264,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Style + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Style + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Style.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Style"; + }; + Style.FontSize = (function() { /** @@ -49056,12 +52382,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.size = reader.float(); - break; - case 2: - message.unit = reader.string(); - break; + case 1: { + message.size = reader.float(); + break; + } + case 2: { + message.unit = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -49160,6 +52488,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FontSize + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Style.FontSize + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FontSize.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Style.FontSize"; + }; + return FontSize; })(); @@ -49445,76 +52788,92 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.pageNumber = reader.int32(); - break; - case 13: - message.image = $root.google.cloud.documentai.v1beta3.Document.Page.Image.decode(reader, reader.uint32()); - break; - case 14: - if (!(message.transforms && message.transforms.length)) - message.transforms = []; - message.transforms.push($root.google.cloud.documentai.v1beta3.Document.Page.Matrix.decode(reader, reader.uint32())); - break; - case 2: - message.dimension = $root.google.cloud.documentai.v1beta3.Document.Page.Dimension.decode(reader, reader.uint32()); - break; - case 3: - message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.blocks && message.blocks.length)) - message.blocks = []; - message.blocks.push($root.google.cloud.documentai.v1beta3.Document.Page.Block.decode(reader, reader.uint32())); - break; - case 6: - if (!(message.paragraphs && message.paragraphs.length)) - message.paragraphs = []; - message.paragraphs.push($root.google.cloud.documentai.v1beta3.Document.Page.Paragraph.decode(reader, reader.uint32())); - break; - case 7: - if (!(message.lines && message.lines.length)) - message.lines = []; - message.lines.push($root.google.cloud.documentai.v1beta3.Document.Page.Line.decode(reader, reader.uint32())); - break; - case 8: - if (!(message.tokens && message.tokens.length)) - message.tokens = []; - message.tokens.push($root.google.cloud.documentai.v1beta3.Document.Page.Token.decode(reader, reader.uint32())); - break; - case 9: - if (!(message.visualElements && message.visualElements.length)) - message.visualElements = []; - message.visualElements.push($root.google.cloud.documentai.v1beta3.Document.Page.VisualElement.decode(reader, reader.uint32())); - break; - case 10: - if (!(message.tables && message.tables.length)) - message.tables = []; - message.tables.push($root.google.cloud.documentai.v1beta3.Document.Page.Table.decode(reader, reader.uint32())); - break; - case 11: - if (!(message.formFields && message.formFields.length)) - message.formFields = []; - message.formFields.push($root.google.cloud.documentai.v1beta3.Document.Page.FormField.decode(reader, reader.uint32())); - break; - case 12: - if (!(message.symbols && message.symbols.length)) - message.symbols = []; - message.symbols.push($root.google.cloud.documentai.v1beta3.Document.Page.Symbol.decode(reader, reader.uint32())); - break; - case 15: - if (!(message.detectedBarcodes && message.detectedBarcodes.length)) - message.detectedBarcodes = []; - message.detectedBarcodes.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode.decode(reader, reader.uint32())); - break; - case 16: - message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); - break; + case 1: { + message.pageNumber = reader.int32(); + break; + } + case 13: { + message.image = $root.google.cloud.documentai.v1beta3.Document.Page.Image.decode(reader, reader.uint32()); + break; + } + case 14: { + if (!(message.transforms && message.transforms.length)) + message.transforms = []; + message.transforms.push($root.google.cloud.documentai.v1beta3.Document.Page.Matrix.decode(reader, reader.uint32())); + break; + } + case 2: { + message.dimension = $root.google.cloud.documentai.v1beta3.Document.Page.Dimension.decode(reader, reader.uint32()); + break; + } + case 3: { + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.blocks && message.blocks.length)) + message.blocks = []; + message.blocks.push($root.google.cloud.documentai.v1beta3.Document.Page.Block.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.paragraphs && message.paragraphs.length)) + message.paragraphs = []; + message.paragraphs.push($root.google.cloud.documentai.v1beta3.Document.Page.Paragraph.decode(reader, reader.uint32())); + break; + } + case 7: { + if (!(message.lines && message.lines.length)) + message.lines = []; + message.lines.push($root.google.cloud.documentai.v1beta3.Document.Page.Line.decode(reader, reader.uint32())); + break; + } + case 8: { + if (!(message.tokens && message.tokens.length)) + message.tokens = []; + message.tokens.push($root.google.cloud.documentai.v1beta3.Document.Page.Token.decode(reader, reader.uint32())); + break; + } + case 9: { + if (!(message.visualElements && message.visualElements.length)) + message.visualElements = []; + message.visualElements.push($root.google.cloud.documentai.v1beta3.Document.Page.VisualElement.decode(reader, reader.uint32())); + break; + } + case 10: { + if (!(message.tables && message.tables.length)) + message.tables = []; + message.tables.push($root.google.cloud.documentai.v1beta3.Document.Page.Table.decode(reader, reader.uint32())); + break; + } + case 11: { + if (!(message.formFields && message.formFields.length)) + message.formFields = []; + message.formFields.push($root.google.cloud.documentai.v1beta3.Document.Page.FormField.decode(reader, reader.uint32())); + break; + } + case 12: { + if (!(message.symbols && message.symbols.length)) + message.symbols = []; + message.symbols.push($root.google.cloud.documentai.v1beta3.Document.Page.Symbol.decode(reader, reader.uint32())); + break; + } + case 15: { + if (!(message.detectedBarcodes && message.detectedBarcodes.length)) + message.detectedBarcodes = []; + message.detectedBarcodes.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode.decode(reader, reader.uint32())); + break; + } + case 16: { + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -49934,6 +53293,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Page + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Page.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Page"; + }; + Page.Dimension = (function() { /** @@ -50048,15 +53422,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.width = reader.float(); - break; - case 2: - message.height = reader.float(); - break; - case 3: - message.unit = reader.string(); - break; + case 1: { + message.width = reader.float(); + break; + } + case 2: { + message.height = reader.float(); + break; + } + case 3: { + message.unit = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -50163,6 +53540,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Dimension + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Page.Dimension + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Dimension.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Page.Dimension"; + }; + return Dimension; })(); @@ -50291,18 +53683,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.content = reader.bytes(); - break; - case 2: - message.mimeType = reader.string(); - break; - case 3: - message.width = reader.int32(); - break; - case 4: - message.height = reader.int32(); - break; + case 1: { + message.content = reader.bytes(); + break; + } + case 2: { + message.mimeType = reader.string(); + break; + } + case 3: { + message.width = reader.int32(); + break; + } + case 4: { + message.height = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -50368,7 +53764,7 @@ if (object.content != null) if (typeof object.content === "string") $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); - else if (object.content.length) + else if (object.content.length >= 0) message.content = object.content; if (object.mimeType != null) message.mimeType = String(object.mimeType); @@ -50426,6 +53822,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Image + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Page.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.documentai.v1beta3.Document.Page.Image"; + }; + return Image; })(); @@ -50554,18 +53965,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.rows = reader.int32(); - break; - case 2: - message.cols = reader.int32(); - break; - case 3: - message.type = reader.int32(); - break; - case 4: - message.data = reader.bytes(); - break; + case 1: { + message.rows = reader.int32(); + break; + } + case 2: { + message.cols = reader.int32(); + break; + } + case 3: { + message.type = reader.int32(); + break; + } + case 4: { + message.data = reader.bytes(); + break; + } default: reader.skipType(tag & 7); break; @@ -50637,7 +54052,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; return message; }; @@ -50689,6 +54104,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Matrix + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Page.Matrix + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Matrix.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Page.Matrix"; + }; + return Matrix; })(); @@ -50817,18 +54247,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.decode(reader, reader.uint32()); - break; - case 2: - message.confidence = reader.float(); - break; - case 3: - message.boundingPoly = $root.google.cloud.documentai.v1beta3.BoundingPoly.decode(reader, reader.uint32()); - break; - case 4: - message.orientation = reader.int32(); - break; + case 1: { + message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.decode(reader, reader.uint32()); + break; + } + case 2: { + message.confidence = reader.float(); + break; + } + case 3: { + message.boundingPoly = $root.google.cloud.documentai.v1beta3.BoundingPoly.decode(reader, reader.uint32()); + break; + } + case 4: { + message.orientation = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -50981,6 +54415,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Layout + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Page.Layout + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Layout.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Page.Layout"; + }; + /** * Orientation enum. * @name google.cloud.documentai.v1beta3.Document.Page.Layout.Orientation @@ -51120,17 +54569,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; - case 3: - message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + case 3: { + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -51265,6 +54717,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Block + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Page.Block + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Block.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Page.Block"; + }; + return Block; })(); @@ -51384,17 +54851,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; - case 3: - message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + case 3: { + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -51529,6 +54999,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Paragraph + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Page.Paragraph + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Paragraph.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Page.Paragraph"; + }; + return Paragraph; })(); @@ -51648,17 +55133,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; - case 3: - message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + case 3: { + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -51793,6 +55281,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Line + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Page.Line + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Line.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Page.Line"; + }; + return Line; })(); @@ -51923,20 +55426,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - message.detectedBreak = $root.google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.decode(reader, reader.uint32()); - break; - case 3: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; - case 4: - message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + message.detectedBreak = $root.google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.decode(reader, reader.uint32()); + break; + } + case 3: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + case 4: { + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -52084,6 +55591,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Token + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Token.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Page.Token"; + }; + Token.DetectedBreak = (function() { /** @@ -52176,9 +55698,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.type = reader.int32(); - break; + case 1: { + message.type = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -52291,6 +55814,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DetectedBreak + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DetectedBreak.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak"; + }; + /** * Type enum. * @name google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.Type @@ -52420,14 +55958,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -52548,6 +56088,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Symbol + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Symbol.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Page.Symbol"; + }; + return Symbol; })(); @@ -52667,17 +56222,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - message.type = reader.string(); - break; - case 3: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -52807,6 +56365,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for VisualElement + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Page.VisualElement + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VisualElement.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Page.VisualElement"; + }; + return VisualElement; })(); @@ -52941,24 +56514,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.headerRows && message.headerRows.length)) - message.headerRows = []; - message.headerRows.push($root.google.cloud.documentai.v1beta3.Document.Page.Table.TableRow.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.bodyRows && message.bodyRows.length)) - message.bodyRows = []; - message.bodyRows.push($root.google.cloud.documentai.v1beta3.Document.Page.Table.TableRow.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.headerRows && message.headerRows.length)) + message.headerRows = []; + message.headerRows.push($root.google.cloud.documentai.v1beta3.Document.Page.Table.TableRow.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.bodyRows && message.bodyRows.length)) + message.bodyRows = []; + message.bodyRows.push($root.google.cloud.documentai.v1beta3.Document.Page.Table.TableRow.decode(reader, reader.uint32())); + break; + } + case 4: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -53130,6 +56707,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Table + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Table.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Page.Table"; + }; + Table.TableRow = (function() { /** @@ -53224,11 +56816,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.cells && message.cells.length)) - message.cells = []; - message.cells.push($root.google.cloud.documentai.v1beta3.Document.Page.Table.TableCell.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.cells && message.cells.length)) + message.cells = []; + message.cells.push($root.google.cloud.documentai.v1beta3.Document.Page.Table.TableCell.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -53335,6 +56928,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TableRow + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableRow + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TableRow.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Page.Table.TableRow"; + }; + return TableRow; })(); @@ -53465,20 +57073,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - message.rowSpan = reader.int32(); - break; - case 3: - message.colSpan = reader.int32(); - break; - case 4: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + message.rowSpan = reader.int32(); + break; + } + case 3: { + message.colSpan = reader.int32(); + break; + } + case 4: { + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -53616,6 +57228,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TableCell + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table.TableCell + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TableCell.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Page.Table.TableCell"; + }; + return TableCell; })(); @@ -53795,34 +57422,42 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.fieldName = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - message.fieldValue = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 3: - if (!(message.nameDetectedLanguages && message.nameDetectedLanguages.length)) - message.nameDetectedLanguages = []; - message.nameDetectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.valueDetectedLanguages && message.valueDetectedLanguages.length)) - message.valueDetectedLanguages = []; - message.valueDetectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); - break; - case 5: - message.valueType = reader.string(); - break; - case 6: - message.correctedKeyText = reader.string(); - break; - case 7: - message.correctedValueText = reader.string(); - break; - case 8: - message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); - break; + case 1: { + message.fieldName = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + message.fieldValue = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 3: { + if (!(message.nameDetectedLanguages && message.nameDetectedLanguages.length)) + message.nameDetectedLanguages = []; + message.nameDetectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + case 4: { + if (!(message.valueDetectedLanguages && message.valueDetectedLanguages.length)) + message.valueDetectedLanguages = []; + message.valueDetectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + case 5: { + message.valueType = reader.string(); + break; + } + case 6: { + message.correctedKeyText = reader.string(); + break; + } + case 7: { + message.correctedValueText = reader.string(); + break; + } + case 8: { + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -54020,6 +57655,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FormField + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FormField.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Page.FormField"; + }; + return FormField; })(); @@ -54126,12 +57776,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); - break; - case 2: - message.barcode = $root.google.cloud.documentai.v1beta3.Barcode.decode(reader, reader.uint32()); - break; + case 1: { + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + } + case 2: { + message.barcode = $root.google.cloud.documentai.v1beta3.Barcode.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -54240,6 +57892,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DetectedBarcode + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DetectedBarcode.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode"; + }; + return DetectedBarcode; })(); @@ -54346,12 +58013,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.languageCode = reader.string(); - break; - case 2: - message.confidence = reader.float(); - break; + case 1: { + message.languageCode = reader.string(); + break; + } + case 2: { + message.confidence = reader.float(); + break; + } default: reader.skipType(tag & 7); break; @@ -54450,6 +58119,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DetectedLanguage + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DetectedLanguage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage"; + }; + return DetectedLanguage; })(); @@ -54660,41 +58344,52 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.decode(reader, reader.uint32()); - break; - case 2: - message.type = reader.string(); - break; - case 3: - message.mentionText = reader.string(); - break; - case 4: - message.mentionId = reader.string(); - break; - case 5: - message.confidence = reader.float(); - break; - case 6: - message.pageAnchor = $root.google.cloud.documentai.v1beta3.Document.PageAnchor.decode(reader, reader.uint32()); - break; - case 7: - message.id = reader.string(); - break; - case 9: - message.normalizedValue = $root.google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue.decode(reader, reader.uint32()); - break; - case 10: - if (!(message.properties && message.properties.length)) - message.properties = []; - message.properties.push($root.google.cloud.documentai.v1beta3.Document.Entity.decode(reader, reader.uint32())); - break; - case 11: - message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); - break; - case 12: - message.redacted = reader.bool(); - break; + case 1: { + message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.decode(reader, reader.uint32()); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + message.mentionText = reader.string(); + break; + } + case 4: { + message.mentionId = reader.string(); + break; + } + case 5: { + message.confidence = reader.float(); + break; + } + case 6: { + message.pageAnchor = $root.google.cloud.documentai.v1beta3.Document.PageAnchor.decode(reader, reader.uint32()); + break; + } + case 7: { + message.id = reader.string(); + break; + } + case 9: { + message.normalizedValue = $root.google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue.decode(reader, reader.uint32()); + break; + } + case 10: { + if (!(message.properties && message.properties.length)) + message.properties = []; + message.properties.push($root.google.cloud.documentai.v1beta3.Document.Entity.decode(reader, reader.uint32())); + break; + } + case 11: { + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); + break; + } + case 12: { + message.redacted = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -54903,6 +58598,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Entity + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Entity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Entity"; + }; + Entity.NormalizedValue = (function() { /** @@ -55086,30 +58796,38 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - message.moneyValue = $root.google.type.Money.decode(reader, reader.uint32()); - break; - case 3: - message.dateValue = $root.google.type.Date.decode(reader, reader.uint32()); - break; - case 4: - message.datetimeValue = $root.google.type.DateTime.decode(reader, reader.uint32()); - break; - case 5: - message.addressValue = $root.google.type.PostalAddress.decode(reader, reader.uint32()); - break; - case 6: - message.booleanValue = reader.bool(); - break; - case 7: - message.integerValue = reader.int32(); - break; - case 8: - message.floatValue = reader.float(); - break; - case 1: - message.text = reader.string(); - break; + case 2: { + message.moneyValue = $root.google.type.Money.decode(reader, reader.uint32()); + break; + } + case 3: { + message.dateValue = $root.google.type.Date.decode(reader, reader.uint32()); + break; + } + case 4: { + message.datetimeValue = $root.google.type.DateTime.decode(reader, reader.uint32()); + break; + } + case 5: { + message.addressValue = $root.google.type.PostalAddress.decode(reader, reader.uint32()); + break; + } + case 6: { + message.booleanValue = reader.bool(); + break; + } + case 7: { + message.integerValue = reader.int32(); + break; + } + case 8: { + message.floatValue = reader.float(); + break; + } + case 1: { + message.text = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -55320,6 +59038,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for NormalizedValue + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NormalizedValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue"; + }; + return NormalizedValue; })(); @@ -55440,15 +59173,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.subjectId = reader.string(); - break; - case 2: - message.objectId = reader.string(); - break; - case 3: - message.relation = reader.string(); - break; + case 1: { + message.subjectId = reader.string(); + break; + } + case 2: { + message.objectId = reader.string(); + break; + } + case 3: { + message.relation = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -55555,6 +59291,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EntityRelation + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.EntityRelation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EntityRelation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.EntityRelation"; + }; + return EntityRelation; })(); @@ -55663,14 +59414,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.textSegments && message.textSegments.length)) - message.textSegments = []; - message.textSegments.push($root.google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment.decode(reader, reader.uint32())); - break; - case 2: - message.content = reader.string(); - break; + case 1: { + if (!(message.textSegments && message.textSegments.length)) + message.textSegments = []; + message.textSegments.push($root.google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment.decode(reader, reader.uint32())); + break; + } + case 2: { + message.content = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -55786,6 +59539,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TextAnchor + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TextAnchor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.TextAnchor"; + }; + TextAnchor.TextSegment = (function() { /** @@ -55889,12 +59657,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.startIndex = reader.int64(); - break; - case 2: - message.endIndex = reader.int64(); - break; + case 1: { + message.startIndex = reader.int64(); + break; + } + case 2: { + message.endIndex = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -56021,6 +59791,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TextSegment + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TextSegment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment"; + }; + return TextSegment; })(); @@ -56121,11 +59906,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.pageRefs && message.pageRefs.length)) - message.pageRefs = []; - message.pageRefs.push($root.google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.pageRefs && message.pageRefs.length)) + message.pageRefs = []; + message.pageRefs.push($root.google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -56232,6 +60018,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PageAnchor + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PageAnchor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.PageAnchor"; + }; + PageAnchor.PageRef = (function() { /** @@ -56368,21 +60169,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.page = reader.int64(); - break; - case 2: - message.layoutType = reader.int32(); - break; - case 3: - message.layoutId = reader.string(); - break; - case 4: - message.boundingPoly = $root.google.cloud.documentai.v1beta3.BoundingPoly.decode(reader, reader.uint32()); - break; - case 5: - message.confidence = reader.float(); - break; + case 1: { + message.page = reader.int64(); + break; + } + case 2: { + message.layoutType = reader.int32(); + break; + } + case 3: { + message.layoutId = reader.string(); + break; + } + case 4: { + message.boundingPoly = $root.google.cloud.documentai.v1beta3.BoundingPoly.decode(reader, reader.uint32()); + break; + } + case 5: { + message.confidence = reader.float(); + break; + } default: reader.skipType(tag & 7); break; @@ -56567,6 +60373,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PageRef + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PageRef.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef"; + }; + /** * LayoutType enum. * @name google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.LayoutType @@ -56726,20 +60547,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.revision = reader.int32(); - break; - case 2: - message.id = reader.int32(); - break; - case 3: - if (!(message.parents && message.parents.length)) - message.parents = []; - message.parents.push($root.google.cloud.documentai.v1beta3.Document.Provenance.Parent.decode(reader, reader.uint32())); - break; - case 4: - message.type = reader.int32(); - break; + case 1: { + message.revision = reader.int32(); + break; + } + case 2: { + message.id = reader.int32(); + break; + } + case 3: { + if (!(message.parents && message.parents.length)) + message.parents = []; + message.parents.push($root.google.cloud.documentai.v1beta3.Document.Provenance.Parent.decode(reader, reader.uint32())); + break; + } + case 4: { + message.type = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -56910,6 +60735,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Provenance + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Provenance + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Provenance.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Provenance"; + }; + Provenance.Parent = (function() { /** @@ -57024,15 +60864,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.revision = reader.int32(); - break; - case 3: - message.index = reader.int32(); - break; - case 2: - message.id = reader.int32(); - break; + case 1: { + message.revision = reader.int32(); + break; + } + case 3: { + message.index = reader.int32(); + break; + } + case 2: { + message.id = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -57139,6 +60982,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Parent + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Provenance.Parent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Parent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Provenance.Parent"; + }; + return Parent; })(); @@ -57348,36 +61206,43 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 4: - message.agent = reader.string(); - break; - case 5: - message.processor = reader.string(); - break; - case 1: - message.id = reader.string(); - break; - case 2: - if (!(message.parent && message.parent.length)) - message.parent = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 4: { + message.agent = reader.string(); + break; + } + case 5: { + message.processor = reader.string(); + break; + } + case 1: { + message.id = reader.string(); + break; + } + case 2: { + if (!(message.parent && message.parent.length)) + message.parent = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.parent.push(reader.int32()); + } else message.parent.push(reader.int32()); - } else - message.parent.push(reader.int32()); - break; - case 7: - if (!(message.parentIds && message.parentIds.length)) - message.parentIds = []; - message.parentIds.push(reader.string()); - break; - case 3: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 6: - message.humanReview = $root.google.cloud.documentai.v1beta3.Document.Revision.HumanReview.decode(reader, reader.uint32()); - break; + break; + } + case 7: { + if (!(message.parentIds && message.parentIds.length)) + message.parentIds = []; + message.parentIds.push(reader.string()); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.humanReview = $root.google.cloud.documentai.v1beta3.Document.Revision.HumanReview.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -57563,6 +61428,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Revision + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Revision.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Revision"; + }; + Revision.HumanReview = (function() { /** @@ -57666,12 +61546,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.state = reader.string(); - break; - case 2: - message.stateMessage = reader.string(); - break; + case 1: { + message.state = reader.string(); + break; + } + case 2: { + message.stateMessage = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -57770,6 +61652,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for HumanReview + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Revision.HumanReview + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HumanReview.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Revision.HumanReview"; + }; + return HumanReview; })(); @@ -57892,17 +61789,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.decode(reader, reader.uint32()); - break; - case 2: - message.changedText = reader.string(); - break; - case 3: - if (!(message.provenance && message.provenance.length)) - message.provenance = []; - message.provenance.push($root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32())); - break; + case 1: { + message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.decode(reader, reader.uint32()); + break; + } + case 2: { + message.changedText = reader.string(); + break; + } + case 3: { + if (!(message.provenance && message.provenance.length)) + message.provenance = []; + message.provenance.push($root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -58032,6 +61932,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TextChange + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.TextChange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TextChange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.TextChange"; + }; + return TextChange; })(); @@ -58141,12 +62056,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.x = reader.int32(); - break; - case 2: - message.y = reader.int32(); - break; + case 1: { + message.x = reader.int32(); + break; + } + case 2: { + message.y = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -58245,6 +62162,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Vertex + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Vertex + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Vertex.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Vertex"; + }; + return Vertex; })(); @@ -58351,12 +62283,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.x = reader.float(); - break; - case 2: - message.y = reader.float(); - break; + case 1: { + message.x = reader.float(); + break; + } + case 2: { + message.y = reader.float(); + break; + } default: reader.skipType(tag & 7); break; @@ -58455,6 +62389,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for NormalizedVertex + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.NormalizedVertex + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NormalizedVertex.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.NormalizedVertex"; + }; + return NormalizedVertex; })(); @@ -58565,16 +62514,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.vertices && message.vertices.length)) - message.vertices = []; - message.vertices.push($root.google.cloud.documentai.v1beta3.Vertex.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.normalizedVertices && message.normalizedVertices.length)) - message.normalizedVertices = []; - message.normalizedVertices.push($root.google.cloud.documentai.v1beta3.NormalizedVertex.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.vertices && message.vertices.length)) + message.vertices = []; + message.vertices.push($root.google.cloud.documentai.v1beta3.Vertex.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.normalizedVertices && message.normalizedVertices.length)) + message.normalizedVertices = []; + message.normalizedVertices.push($root.google.cloud.documentai.v1beta3.NormalizedVertex.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -58707,6 +62658,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BoundingPoly + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.BoundingPoly + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BoundingPoly.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.BoundingPoly"; + }; + return BoundingPoly; })(); @@ -58813,12 +62779,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.content = reader.bytes(); - break; - case 2: - message.mimeType = reader.string(); - break; + case 1: { + message.content = reader.bytes(); + break; + } + case 2: { + message.mimeType = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -58878,7 +62846,7 @@ if (object.content != null) if (typeof object.content === "string") $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); - else if (object.content.length) + else if (object.content.length >= 0) message.content = object.content; if (object.mimeType != null) message.mimeType = String(object.mimeType); @@ -58926,6 +62894,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RawDocument + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.RawDocument + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RawDocument.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.RawDocument"; + }; + return RawDocument; })(); @@ -59032,12 +63015,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsUri = reader.string(); - break; - case 2: - message.mimeType = reader.string(); - break; + case 1: { + message.gcsUri = reader.string(); + break; + } + case 2: { + message.mimeType = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -59136,6 +63121,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GcsDocument + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.GcsDocument + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GcsDocument.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.GcsDocument"; + }; + return GcsDocument; })(); @@ -59233,11 +63233,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.documents && message.documents.length)) - message.documents = []; - message.documents.push($root.google.cloud.documentai.v1beta3.GcsDocument.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.documents && message.documents.length)) + message.documents = []; + message.documents.push($root.google.cloud.documentai.v1beta3.GcsDocument.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -59344,6 +63345,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GcsDocuments + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.GcsDocuments + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GcsDocuments.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.GcsDocuments"; + }; + return GcsDocuments; })(); @@ -59439,9 +63455,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsUriPrefix = reader.string(); - break; + case 1: { + message.gcsUriPrefix = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -59531,6 +63548,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GcsPrefix + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.GcsPrefix + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GcsPrefix.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.GcsPrefix"; + }; + return GcsPrefix; })(); @@ -59651,12 +63683,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsPrefix = $root.google.cloud.documentai.v1beta3.GcsPrefix.decode(reader, reader.uint32()); - break; - case 2: - message.gcsDocuments = $root.google.cloud.documentai.v1beta3.GcsDocuments.decode(reader, reader.uint32()); - break; + case 1: { + message.gcsPrefix = $root.google.cloud.documentai.v1beta3.GcsPrefix.decode(reader, reader.uint32()); + break; + } + case 2: { + message.gcsDocuments = $root.google.cloud.documentai.v1beta3.GcsDocuments.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -59776,6 +63810,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BatchDocumentsInputConfig + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.BatchDocumentsInputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchDocumentsInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.BatchDocumentsInputConfig"; + }; + return BatchDocumentsInputConfig; })(); @@ -59885,9 +63934,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsOutputConfig = $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.decode(reader, reader.uint32()); - break; + case 1: { + message.gcsOutputConfig = $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -59987,6 +64037,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DocumentOutputConfig + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentOutputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DocumentOutputConfig"; + }; + DocumentOutputConfig.GcsOutputConfig = (function() { /** @@ -60079,9 +64144,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsUri = reader.string(); - break; + case 1: { + message.gcsUri = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -60171,6 +64237,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GcsOutputConfig + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GcsOutputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig"; + }; + return GcsOutputConfig; })(); @@ -60210,7 +64291,7 @@ }; /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#processDocument}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|processDocument}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @typedef ProcessDocumentCallback * @type {function} @@ -60243,7 +64324,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#batchProcessDocuments}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|batchProcessDocuments}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @typedef BatchProcessDocumentsCallback * @type {function} @@ -60276,7 +64357,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#fetchProcessorTypes}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|fetchProcessorTypes}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @typedef FetchProcessorTypesCallback * @type {function} @@ -60309,7 +64390,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#listProcessorTypes}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|listProcessorTypes}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @typedef ListProcessorTypesCallback * @type {function} @@ -60342,7 +64423,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#listProcessors}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|listProcessors}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @typedef ListProcessorsCallback * @type {function} @@ -60375,7 +64456,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#getProcessor}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|getProcessor}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @typedef GetProcessorCallback * @type {function} @@ -60408,7 +64489,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#getProcessorVersion}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|getProcessorVersion}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @typedef GetProcessorVersionCallback * @type {function} @@ -60441,7 +64522,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#listProcessorVersions}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|listProcessorVersions}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @typedef ListProcessorVersionsCallback * @type {function} @@ -60474,7 +64555,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#deleteProcessorVersion}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|deleteProcessorVersion}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @typedef DeleteProcessorVersionCallback * @type {function} @@ -60507,7 +64588,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#deployProcessorVersion}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|deployProcessorVersion}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @typedef DeployProcessorVersionCallback * @type {function} @@ -60540,7 +64621,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#undeployProcessorVersion}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|undeployProcessorVersion}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @typedef UndeployProcessorVersionCallback * @type {function} @@ -60573,7 +64654,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#createProcessor}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|createProcessor}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @typedef CreateProcessorCallback * @type {function} @@ -60606,7 +64687,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#deleteProcessor}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|deleteProcessor}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @typedef DeleteProcessorCallback * @type {function} @@ -60639,7 +64720,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#enableProcessor}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|enableProcessor}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @typedef EnableProcessorCallback * @type {function} @@ -60672,7 +64753,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#disableProcessor}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|disableProcessor}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @typedef DisableProcessorCallback * @type {function} @@ -60705,7 +64786,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#setDefaultProcessorVersion}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|setDefaultProcessorVersion}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @typedef SetDefaultProcessorVersionCallback * @type {function} @@ -60738,7 +64819,7 @@ */ /** - * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService#reviewDocument}. + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|reviewDocument}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService * @typedef ReviewDocumentCallback * @type {function} @@ -60934,24 +65015,30 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 4: - message.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); - break; - case 5: - message.rawDocument = $root.google.cloud.documentai.v1beta3.RawDocument.decode(reader, reader.uint32()); - break; - case 1: - message.name = reader.string(); - break; - case 2: - message.document = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); - break; - case 3: - message.skipHumanReview = reader.bool(); - break; - case 6: - message.fieldMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 4: { + message.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); + break; + } + case 5: { + message.rawDocument = $root.google.cloud.documentai.v1beta3.RawDocument.decode(reader, reader.uint32()); + break; + } + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.document = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); + break; + } + case 3: { + message.skipHumanReview = reader.bool(); + break; + } + case 6: { + message.fieldMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -61115,6 +65202,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProcessRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.ProcessRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProcessRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ProcessRequest"; + }; + return ProcessRequest; })(); @@ -61232,15 +65334,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.state = reader.int32(); - break; - case 2: - message.stateMessage = reader.string(); - break; - case 3: - message.humanReviewOperation = reader.string(); - break; + case 1: { + message.state = reader.int32(); + break; + } + case 2: { + message.stateMessage = reader.string(); + break; + } + case 3: { + message.humanReviewOperation = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -61375,6 +65480,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for HumanReviewStatus + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.HumanReviewStatus + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HumanReviewStatus.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.HumanReviewStatus"; + }; + /** * State enum. * @name google.cloud.documentai.v1beta3.HumanReviewStatus.State @@ -61512,15 +65632,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.document = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); - break; - case 2: - message.humanReviewOperation = reader.string(); - break; - case 3: - message.humanReviewStatus = $root.google.cloud.documentai.v1beta3.HumanReviewStatus.decode(reader, reader.uint32()); - break; + case 1: { + message.document = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); + break; + } + case 2: { + message.humanReviewOperation = reader.string(); + break; + } + case 3: { + message.humanReviewStatus = $root.google.cloud.documentai.v1beta3.HumanReviewStatus.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -61637,6 +65760,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProcessResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.ProcessResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProcessResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ProcessResponse"; + }; + return ProcessResponse; })(); @@ -61789,26 +65927,32 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - if (!(message.inputConfigs && message.inputConfigs.length)) - message.inputConfigs = []; - message.inputConfigs.push($root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.decode(reader, reader.uint32())); - break; - case 3: - message.outputConfig = $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.decode(reader, reader.uint32()); - break; - case 5: - message.inputDocuments = $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.decode(reader, reader.uint32()); - break; - case 6: - message.documentOutputConfig = $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.decode(reader, reader.uint32()); - break; - case 4: - message.skipHumanReview = reader.bool(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.inputConfigs && message.inputConfigs.length)) + message.inputConfigs = []; + message.inputConfigs.push($root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.decode(reader, reader.uint32())); + break; + } + case 3: { + message.outputConfig = $root.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.decode(reader, reader.uint32()); + break; + } + case 5: { + message.inputDocuments = $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.decode(reader, reader.uint32()); + break; + } + case 6: { + message.documentOutputConfig = $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.decode(reader, reader.uint32()); + break; + } + case 4: { + message.skipHumanReview = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -61972,6 +66116,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BatchProcessRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchProcessRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.BatchProcessRequest"; + }; + BatchProcessRequest.BatchInputConfig = (function() { /** @@ -62075,12 +66234,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsSource = reader.string(); - break; - case 2: - message.mimeType = reader.string(); - break; + case 1: { + message.gcsSource = reader.string(); + break; + } + case 2: { + message.mimeType = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -62179,6 +66340,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BatchInputConfig + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig"; + }; + return BatchInputConfig; })(); @@ -62274,9 +66450,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsDestination = reader.string(); - break; + case 1: { + message.gcsDestination = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -62366,6 +66543,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BatchOutputConfig + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchOutputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig"; + }; + return BatchOutputConfig; })(); @@ -62529,6 +66721,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BatchProcessResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.BatchProcessResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchProcessResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.BatchProcessResponse"; + }; + return BatchProcessResponse; })(); @@ -62670,23 +66877,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.state = reader.int32(); - break; - case 2: - message.stateMessage = reader.string(); - break; - case 3: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 5: - if (!(message.individualProcessStatuses && message.individualProcessStatuses.length)) - message.individualProcessStatuses = []; - message.individualProcessStatuses.push($root.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus.decode(reader, reader.uint32())); - break; + case 1: { + message.state = reader.int32(); + break; + } + case 2: { + message.stateMessage = reader.string(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + if (!(message.individualProcessStatuses && message.individualProcessStatuses.length)) + message.individualProcessStatuses = []; + message.individualProcessStatuses.push($root.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -62875,6 +67087,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BatchProcessMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchProcessMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.BatchProcessMetadata"; + }; + BatchProcessMetadata.IndividualProcessStatus = (function() { /** @@ -63011,21 +67238,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.inputGcsSource = reader.string(); - break; - case 2: - message.status = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; - case 3: - message.outputGcsDestination = reader.string(); - break; - case 4: - message.humanReviewOperation = reader.string(); - break; - case 5: - message.humanReviewStatus = $root.google.cloud.documentai.v1beta3.HumanReviewStatus.decode(reader, reader.uint32()); - break; + case 1: { + message.inputGcsSource = reader.string(); + break; + } + case 2: { + message.status = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + case 3: { + message.outputGcsDestination = reader.string(); + break; + } + case 4: { + message.humanReviewOperation = reader.string(); + break; + } + case 5: { + message.humanReviewStatus = $root.google.cloud.documentai.v1beta3.HumanReviewStatus.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -63158,6 +67390,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for IndividualProcessStatus + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + IndividualProcessStatus.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus"; + }; + return IndividualProcessStatus; })(); @@ -63280,9 +67527,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -63372,6 +67620,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FetchProcessorTypesRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FetchProcessorTypesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.FetchProcessorTypesRequest"; + }; + return FetchProcessorTypesRequest; })(); @@ -63469,11 +67732,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.processorTypes && message.processorTypes.length)) - message.processorTypes = []; - message.processorTypes.push($root.google.cloud.documentai.v1beta3.ProcessorType.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.processorTypes && message.processorTypes.length)) + message.processorTypes = []; + message.processorTypes.push($root.google.cloud.documentai.v1beta3.ProcessorType.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -63580,6 +67844,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FetchProcessorTypesResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FetchProcessorTypesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.FetchProcessorTypesResponse"; + }; + return FetchProcessorTypesResponse; })(); @@ -63697,15 +67976,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; @@ -63812,6 +68094,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListProcessorTypesRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProcessorTypesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ListProcessorTypesRequest"; + }; + return ListProcessorTypesRequest; })(); @@ -63920,14 +68217,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.processorTypes && message.processorTypes.length)) - message.processorTypes = []; - message.processorTypes.push($root.google.cloud.documentai.v1beta3.ProcessorType.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.processorTypes && message.processorTypes.length)) + message.processorTypes = []; + message.processorTypes.push($root.google.cloud.documentai.v1beta3.ProcessorType.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -64043,6 +68342,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListProcessorTypesResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProcessorTypesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ListProcessorTypesResponse"; + }; + return ListProcessorTypesResponse; })(); @@ -64160,15 +68474,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; @@ -64275,6 +68592,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListProcessorsRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProcessorsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ListProcessorsRequest"; + }; + return ListProcessorsRequest; })(); @@ -64383,14 +68715,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.processors && message.processors.length)) - message.processors = []; - message.processors.push($root.google.cloud.documentai.v1beta3.Processor.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.processors && message.processors.length)) + message.processors = []; + message.processors.push($root.google.cloud.documentai.v1beta3.Processor.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -64506,6 +68840,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListProcessorsResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProcessorsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ListProcessorsResponse"; + }; + return ListProcessorsResponse; })(); @@ -64601,9 +68950,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; @@ -64693,6 +69043,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetProcessorRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.GetProcessorRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetProcessorRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.GetProcessorRequest"; + }; + return GetProcessorRequest; })(); @@ -64788,9 +69153,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; @@ -64880,6 +69246,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetProcessorVersionRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.GetProcessorVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetProcessorVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.GetProcessorVersionRequest"; + }; + return GetProcessorVersionRequest; })(); @@ -64997,15 +69378,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; @@ -65112,6 +69496,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListProcessorVersionsRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProcessorVersionsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ListProcessorVersionsRequest"; + }; + return ListProcessorVersionsRequest; })(); @@ -65220,14 +69619,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.processorVersions && message.processorVersions.length)) - message.processorVersions = []; - message.processorVersions.push($root.google.cloud.documentai.v1beta3.ProcessorVersion.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.processorVersions && message.processorVersions.length)) + message.processorVersions = []; + message.processorVersions.push($root.google.cloud.documentai.v1beta3.ProcessorVersion.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -65343,6 +69744,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListProcessorVersionsResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProcessorVersionsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ListProcessorVersionsResponse"; + }; + return ListProcessorVersionsResponse; })(); @@ -65438,9 +69854,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; @@ -65530,6 +69947,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteProcessorVersionRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteProcessorVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest"; + }; + return DeleteProcessorVersionRequest; })(); @@ -65625,9 +70057,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); - break; + case 1: { + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -65722,6 +70155,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteProcessorVersionMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteProcessorVersionMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata"; + }; + return DeleteProcessorVersionMetadata; })(); @@ -65817,9 +70265,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; @@ -65909,6 +70358,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeployProcessorVersionRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeployProcessorVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DeployProcessorVersionRequest"; + }; + return DeployProcessorVersionRequest; })(); @@ -66069,6 +70533,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeployProcessorVersionResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeployProcessorVersionResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DeployProcessorVersionResponse"; + }; + return DeployProcessorVersionResponse; })(); @@ -66164,9 +70643,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); - break; + case 1: { + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -66261,6 +70741,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeployProcessorVersionMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeployProcessorVersionMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata"; + }; + return DeployProcessorVersionMetadata; })(); @@ -66356,9 +70851,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; @@ -66448,6 +70944,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UndeployProcessorVersionRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UndeployProcessorVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest"; + }; + return UndeployProcessorVersionRequest; })(); @@ -66608,6 +71119,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UndeployProcessorVersionResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UndeployProcessorVersionResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse"; + }; + return UndeployProcessorVersionResponse; })(); @@ -66703,9 +71229,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); - break; + case 1: { + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -66800,6 +71327,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UndeployProcessorVersionMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UndeployProcessorVersionMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata"; + }; + return UndeployProcessorVersionMetadata; })(); @@ -66906,12 +71448,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.processor = $root.google.cloud.documentai.v1beta3.Processor.decode(reader, reader.uint32()); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.processor = $root.google.cloud.documentai.v1beta3.Processor.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -67015,6 +71559,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CreateProcessorRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.CreateProcessorRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateProcessorRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.CreateProcessorRequest"; + }; + return CreateProcessorRequest; })(); @@ -67110,9 +71669,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; @@ -67202,6 +71762,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteProcessorRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteProcessorRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DeleteProcessorRequest"; + }; + return DeleteProcessorRequest; })(); @@ -67297,9 +71872,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 5: - message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); - break; + case 5: { + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -67394,6 +71970,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteProcessorMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteProcessorMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DeleteProcessorMetadata"; + }; + return DeleteProcessorMetadata; })(); @@ -67489,9 +72080,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; @@ -67581,6 +72173,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnableProcessorRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.EnableProcessorRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnableProcessorRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.EnableProcessorRequest"; + }; + return EnableProcessorRequest; })(); @@ -67741,6 +72348,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnableProcessorResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.EnableProcessorResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnableProcessorResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.EnableProcessorResponse"; + }; + return EnableProcessorResponse; })(); @@ -67836,9 +72458,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 5: - message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); - break; + case 5: { + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -67933,6 +72556,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnableProcessorMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.EnableProcessorMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnableProcessorMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.EnableProcessorMetadata"; + }; + return EnableProcessorMetadata; })(); @@ -68028,9 +72666,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; @@ -68120,6 +72759,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DisableProcessorRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DisableProcessorRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DisableProcessorRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DisableProcessorRequest"; + }; + return DisableProcessorRequest; })(); @@ -68280,6 +72934,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DisableProcessorResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DisableProcessorResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DisableProcessorResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DisableProcessorResponse"; + }; + return DisableProcessorResponse; })(); @@ -68375,9 +73044,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 5: - message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); - break; + case 5: { + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -68472,6 +73142,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DisableProcessorMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DisableProcessorMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DisableProcessorMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DisableProcessorMetadata"; + }; + return DisableProcessorMetadata; })(); @@ -68578,12 +73263,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.processor = reader.string(); - break; - case 2: - message.defaultProcessorVersion = reader.string(); - break; + case 1: { + message.processor = reader.string(); + break; + } + case 2: { + message.defaultProcessorVersion = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -68682,6 +73369,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SetDefaultProcessorVersionRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetDefaultProcessorVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest"; + }; + return SetDefaultProcessorVersionRequest; })(); @@ -68842,6 +73544,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SetDefaultProcessorVersionResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetDefaultProcessorVersionResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse"; + }; + return SetDefaultProcessorVersionResponse; })(); @@ -68937,9 +73654,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); - break; + case 1: { + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -69034,6 +73752,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SetDefaultProcessorVersionMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetDefaultProcessorVersionMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata"; + }; + return SetDefaultProcessorVersionMetadata; })(); @@ -69198,24 +73931,30 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 4: - message.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); - break; - case 1: - message.humanReviewConfig = reader.string(); - break; - case 2: - message.document = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); - break; - case 3: - message.enableSchemaValidation = reader.bool(); - break; - case 5: - message.priority = reader.int32(); - break; - case 6: - message.documentSchema = $root.google.cloud.documentai.v1beta3.DocumentSchema.decode(reader, reader.uint32()); - break; + case 4: { + message.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); + break; + } + case 1: { + message.humanReviewConfig = reader.string(); + break; + } + case 2: { + message.document = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); + break; + } + case 3: { + message.enableSchemaValidation = reader.bool(); + break; + } + case 5: { + message.priority = reader.int32(); + break; + } + case 6: { + message.documentSchema = $root.google.cloud.documentai.v1beta3.DocumentSchema.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -69380,6 +74119,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ReviewDocumentRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReviewDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ReviewDocumentRequest"; + }; + /** * Priority enum. * @name google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority @@ -69511,15 +74265,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsDestination = reader.string(); - break; - case 2: - message.state = reader.int32(); - break; - case 3: - message.rejectionReason = reader.string(); - break; + case 1: { + message.gcsDestination = reader.string(); + break; + } + case 2: { + message.state = reader.int32(); + break; + } + case 3: { + message.rejectionReason = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -69644,6 +74401,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ReviewDocumentResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReviewDocumentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ReviewDocumentResponse"; + }; + /** * State enum. * @name google.cloud.documentai.v1beta3.ReviewDocumentResponse.State @@ -69810,24 +74582,30 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.state = reader.int32(); - break; - case 2: - message.stateMessage = reader.string(); - break; - case 3: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 5: - message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); - break; - case 6: - message.questionId = reader.string(); - break; + case 1: { + message.state = reader.int32(); + break; + } + case 2: { + message.stateMessage = reader.string(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + } + case 6: { + message.questionId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -70006,6 +74784,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ReviewDocumentOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReviewDocumentOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata"; + }; + /** * State enum. * @name google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State @@ -70158,20 +74951,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.displayName = reader.string(); - break; - case 2: - message.description = reader.string(); - break; - case 3: - if (!(message.entityTypes && message.entityTypes.length)) - message.entityTypes = []; - message.entityTypes.push($root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.decode(reader, reader.uint32())); - break; - case 4: - message.metadata = $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata.decode(reader, reader.uint32()); - break; + case 1: { + message.displayName = reader.string(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + if (!(message.entityTypes && message.entityTypes.length)) + message.entityTypes = []; + message.entityTypes.push($root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.decode(reader, reader.uint32())); + break; + } + case 4: { + message.metadata = $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -70309,6 +75106,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DocumentSchema + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentSchema.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DocumentSchema"; + }; + DocumentSchema.EntityType = (function() { /** @@ -70463,25 +75275,30 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 14: - message.enumValues = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.decode(reader, reader.uint32()); - break; - case 13: - message.displayName = reader.string(); - break; - case 1: - message.name = reader.string(); - break; - case 2: - if (!(message.baseTypes && message.baseTypes.length)) - message.baseTypes = []; - message.baseTypes.push(reader.string()); - break; - case 6: - if (!(message.properties && message.properties.length)) - message.properties = []; - message.properties.push($root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.decode(reader, reader.uint32())); - break; + case 14: { + message.enumValues = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.decode(reader, reader.uint32()); + break; + } + case 13: { + message.displayName = reader.string(); + break; + } + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.baseTypes && message.baseTypes.length)) + message.baseTypes = []; + message.baseTypes.push(reader.string()); + break; + } + case 6: { + if (!(message.properties && message.properties.length)) + message.properties = []; + message.properties.push($root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -70646,6 +75463,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EntityType + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EntityType.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DocumentSchema.EntityType"; + }; + EntityType.EnumValues = (function() { /** @@ -70740,11 +75572,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(reader.string()); - break; + case 1: { + if (!(message.values && message.values.length)) + message.values = []; + message.values.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -70846,6 +75679,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnumValues + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumValues.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues"; + }; + return EnumValues; })(); @@ -70963,15 +75811,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.valueType = reader.string(); - break; - case 3: - message.occurrenceType = reader.int32(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.valueType = reader.string(); + break; + } + case 3: { + message.occurrenceType = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -71106,6 +75957,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Property + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Property.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property"; + }; + /** * OccurrenceType enum. * @name google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType @@ -71257,18 +76123,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.documentSplitter = reader.bool(); - break; - case 2: - message.documentAllowMultipleLabels = reader.bool(); - break; - case 6: - message.prefixedNamingOnProperties = reader.bool(); - break; - case 7: - message.skipNamingValidation = reader.bool(); - break; + case 1: { + message.documentSplitter = reader.bool(); + break; + } + case 2: { + message.documentAllowMultipleLabels = reader.bool(); + break; + } + case 6: { + message.prefixedNamingOnProperties = reader.bool(); + break; + } + case 7: { + message.skipNamingValidation = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -71383,6 +76253,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Metadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Metadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DocumentSchema.Metadata"; + }; + return Metadata; })(); @@ -71525,21 +76410,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.state = reader.int32(); - break; - case 2: - message.stateMessage = reader.string(); - break; - case 5: - message.resource = reader.string(); - break; - case 3: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; + case 1: { + message.state = reader.int32(); + break; + } + case 2: { + message.stateMessage = reader.string(); + break; + } + case 5: { + message.resource = reader.string(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -71705,6 +76595,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CommonOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.CommonOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CommonOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.CommonOperationMetadata"; + }; + /** * State enum. * @name google.cloud.documentai.v1beta3.CommonOperationMetadata.State @@ -71899,30 +76804,38 @@ 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 6: - message.state = reader.int32(); - break; - case 7: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 9: - message.kmsKeyName = reader.string(); - break; - case 10: - message.kmsKeyVersionName = reader.string(); - break; - case 11: - message.googleManaged = reader.bool(); - break; - case 13: - message.deprecationInfo = $root.google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo.decode(reader, reader.uint32()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 6: { + message.state = reader.int32(); + break; + } + case 7: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 9: { + message.kmsKeyName = reader.string(); + break; + } + case 10: { + message.kmsKeyVersionName = reader.string(); + break; + } + case 11: { + message.googleManaged = reader.bool(); + break; + } + case 13: { + message.deprecationInfo = $root.google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -72122,6 +77035,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProcessorVersion + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProcessorVersion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ProcessorVersion"; + }; + ProcessorVersion.DeprecationInfo = (function() { /** @@ -72225,12 +77153,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.deprecationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.replacementProcessorVersion = reader.string(); - break; + case 1: { + message.deprecationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.replacementProcessorVersion = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -72334,6 +77264,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeprecationInfo + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeprecationInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo"; + }; + return DeprecationInfo; })(); @@ -72535,30 +77480,38 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.type = reader.string(); - break; - case 3: - message.displayName = reader.string(); - break; - case 4: - message.state = reader.int32(); - break; - case 9: - message.defaultProcessorVersion = reader.string(); - break; - case 6: - message.processEndpoint = reader.string(); - break; - case 7: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 8: - message.kmsKeyName = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + message.displayName = reader.string(); + break; + } + case 4: { + message.state = reader.int32(); + break; + } + case 9: { + message.defaultProcessorVersion = reader.string(); + break; + } + case 6: { + message.processEndpoint = reader.string(); + break; + } + case 7: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 8: { + message.kmsKeyName = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -72753,6 +77706,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Processor + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Processor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Processor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Processor"; + }; + /** * State enum. * @name google.cloud.documentai.v1beta3.Processor.State @@ -72931,26 +77899,32 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.type = reader.string(); - break; - case 3: - message.category = reader.string(); - break; - case 4: - if (!(message.availableLocations && message.availableLocations.length)) - message.availableLocations = []; - message.availableLocations.push($root.google.cloud.documentai.v1beta3.ProcessorType.LocationInfo.decode(reader, reader.uint32())); - break; - case 6: - message.allowCreation = reader.bool(); - break; - case 8: - message.launchStage = reader.int32(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + message.category = reader.string(); + break; + } + case 4: { + if (!(message.availableLocations && message.availableLocations.length)) + message.availableLocations = []; + message.availableLocations.push($root.google.cloud.documentai.v1beta3.ProcessorType.LocationInfo.decode(reader, reader.uint32())); + break; + } + case 6: { + message.allowCreation = reader.bool(); + break; + } + case 8: { + message.launchStage = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -73142,6 +78116,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProcessorType + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.ProcessorType + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProcessorType.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ProcessorType"; + }; + ProcessorType.LocationInfo = (function() { /** @@ -73234,9 +78223,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.locationId = reader.string(); - break; + case 1: { + message.locationId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -73326,6 +78316,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for LocationInfo + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.ProcessorType.LocationInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LocationInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ProcessorType.LocationInfo"; + }; + return LocationInfo; })(); @@ -73481,14 +78486,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; @@ -73604,6 +78611,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; })(); @@ -73814,38 +78836,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; @@ -74067,6 +79099,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; })(); @@ -74173,12 +79220,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; @@ -74277,6 +79326,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; })(); @@ -74445,36 +79509,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; @@ -74672,6 +79743,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 @@ -74808,12 +79894,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; @@ -74912,6 +80000,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; })(); @@ -75047,11 +80150,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; @@ -75158,6 +80262,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; })(); @@ -75179,6 +80298,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 */ /** @@ -75299,6 +80419,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 @@ -75354,6 +80482,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; }; @@ -75388,66 +80518,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; @@ -75559,6 +80705,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; }; @@ -75651,6 +80800,8 @@ } if (object.syntax != null) message.syntax = String(object.syntax); + if (object.edition != null) + message.edition = String(object.edition); return message; }; @@ -75682,6 +80833,7 @@ object.options = null; object.sourceCodeInfo = null; object.syntax = ""; + object.edition = ""; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -75728,6 +80880,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; }; @@ -75742,6 +80896,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; })(); @@ -75952,52 +81121,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; @@ -76298,6 +81477,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() { /** @@ -76412,15 +81606,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; @@ -76532,6 +81729,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; })(); @@ -76638,12 +81850,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; @@ -76742,6 +81956,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; })(); @@ -76842,11 +82071,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; @@ -76953,6 +82183,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; })(); @@ -77158,39 +82403,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; @@ -77477,6 +82733,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 @@ -77645,12 +82916,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; @@ -77754,6 +83027,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; })(); @@ -77899,27 +83187,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; @@ -78095,6 +83388,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() { /** @@ -78198,12 +83506,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; @@ -78302,6 +83612,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; })(); @@ -78422,15 +83747,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; @@ -78542,6 +83870,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; })(); @@ -78661,17 +84004,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; @@ -78801,6 +84147,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; })(); @@ -78951,24 +84312,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; @@ -79104,6 +84471,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; })(); @@ -79434,76 +84816,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; @@ -79816,6 +85220,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 @@ -79984,26 +85403,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; @@ -80157,6 +85582,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; })(); @@ -80170,6 +85610,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 @@ -80226,6 +85667,14 @@ */ FieldOptions.prototype.lazy = false; + /** + * FieldOptions unverifiedLazy. + * @member {boolean} unverifiedLazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.unverifiedLazy = false; + /** * FieldOptions deprecated. * @member {boolean} deprecated @@ -80302,6 +85751,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(); @@ -80347,42 +85798,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; @@ -80442,6 +85906,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"; @@ -80527,6 +85994,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) @@ -80614,6 +86083,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")) @@ -80628,6 +86098,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) @@ -80654,6 +86126,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 @@ -80783,11 +86270,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; @@ -80894,6 +86382,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; })(); @@ -81013,17 +86516,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; @@ -81148,6 +86654,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; })(); @@ -81256,14 +86777,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; @@ -81379,6 +86902,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; })(); @@ -81509,20 +87047,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; @@ -81655,6 +87197,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; })(); @@ -81809,28 +87366,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; @@ -82020,6 +87583,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 @@ -82199,29 +87777,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; @@ -82334,7 +87919,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); @@ -82415,6 +88000,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() { /** @@ -82516,12 +88116,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; @@ -82622,6 +88224,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; })(); @@ -82722,11 +88339,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; @@ -82833,6 +88451,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() { /** @@ -82981,37 +88614,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; @@ -83172,6 +88810,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; })(); @@ -83272,11 +88925,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; @@ -83383,6 +89037,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() { /** @@ -83393,6 +89062,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 */ /** @@ -83443,6 +89113,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 @@ -83479,6 +89157,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; }; @@ -83513,25 +89193,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; @@ -83583,6 +89271,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; }; @@ -83611,6 +89308,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; }; @@ -83633,6 +89344,7 @@ object.sourceFile = ""; object.begin = 0; object.end = 0; + object.semantic = options.enums === String ? "NONE" : 0; } if (message.path && message.path.length) { object.path = []; @@ -83645,6 +89357,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; }; @@ -83659,6 +89373,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; })(); @@ -83768,12 +89513,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; @@ -83886,6 +89633,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; })(); @@ -83992,12 +89754,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; @@ -84059,7 +89823,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; }; @@ -84105,6 +89869,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; })(); @@ -84200,9 +89979,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; @@ -84292,6 +90072,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; })(); @@ -84387,9 +90182,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; @@ -84479,6 +90275,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; })(); @@ -84574,9 +90385,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; @@ -84680,6 +90492,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; })(); @@ -84775,9 +90602,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; @@ -84881,6 +90709,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; })(); @@ -84976,9 +90819,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; @@ -85068,6 +90912,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; })(); @@ -85163,9 +91022,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; @@ -85255,6 +91115,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; })(); @@ -85350,9 +91225,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; @@ -85442,6 +91318,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; })(); @@ -85537,9 +91428,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; @@ -85629,6 +91521,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; })(); @@ -85724,9 +91631,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; @@ -85783,7 +91691,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; }; @@ -85825,6 +91733,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; })(); @@ -85931,12 +91854,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; @@ -86049,6 +91974,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; })(); @@ -86209,6 +92149,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; })(); @@ -86306,11 +92261,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; @@ -86412,6 +92368,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; })(); @@ -86543,17 +92514,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; @@ -86678,6 +92652,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; })(); @@ -86818,18 +92807,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.red = reader.float(); - break; - case 2: - message.green = reader.float(); - break; - case 3: - message.blue = reader.float(); - break; - case 4: - message.alpha = $root.google.protobuf.FloatValue.decode(reader, reader.uint32()); - break; + case 1: { + message.red = reader.float(); + break; + } + case 2: { + message.green = reader.float(); + break; + } + case 3: { + message.blue = reader.float(); + break; + } + case 4: { + message.alpha = $root.google.protobuf.FloatValue.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -86949,6 +92942,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Color + * @function getTypeUrl + * @memberof google.type.Color + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Color.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.type.Color"; + }; + return Color; })(); @@ -87066,15 +93074,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; @@ -87181,6 +93192,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; })(); @@ -87378,33 +93404,42 @@ 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 4: - message.hours = reader.int32(); - break; - case 5: - message.minutes = reader.int32(); - break; - case 6: - message.seconds = reader.int32(); - break; - case 7: - message.nanos = reader.int32(); - break; - case 8: - message.utcOffset = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - case 9: - message.timeZone = $root.google.type.TimeZone.decode(reader, reader.uint32()); - break; + case 1: { + message.year = reader.int32(); + break; + } + case 2: { + message.month = reader.int32(); + break; + } + case 3: { + message.day = reader.int32(); + break; + } + case 4: { + message.hours = reader.int32(); + break; + } + case 5: { + message.minutes = reader.int32(); + break; + } + case 6: { + message.seconds = reader.int32(); + break; + } + case 7: { + message.nanos = reader.int32(); + break; + } + case 8: { + message.utcOffset = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 9: { + message.timeZone = $root.google.type.TimeZone.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -87582,6 +93617,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DateTime + * @function getTypeUrl + * @memberof google.type.DateTime + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DateTime.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.type.DateTime"; + }; + return DateTime; })(); @@ -87688,12 +93738,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - message.version = reader.string(); - break; + case 1: { + message.id = reader.string(); + break; + } + case 2: { + message.version = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -87792,6 +93844,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TimeZone + * @function getTypeUrl + * @memberof google.type.TimeZone + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TimeZone.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.type.TimeZone"; + }; + return TimeZone; })(); @@ -87909,15 +93976,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.currencyCode = reader.string(); - break; - case 2: - message.units = reader.int64(); - break; - case 3: - message.nanos = reader.int32(); - break; + case 1: { + message.currencyCode = reader.string(); + break; + } + case 2: { + message.units = reader.int64(); + break; + } + case 3: { + message.nanos = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -88038,6 +94108,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Money + * @function getTypeUrl + * @memberof google.type.Money + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Money.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.type.Money"; + }; + return Money; })(); @@ -88247,43 +94332,54 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.revision = reader.int32(); - break; - case 2: - message.regionCode = reader.string(); - break; - case 3: - message.languageCode = reader.string(); - break; - case 4: - message.postalCode = reader.string(); - break; - case 5: - message.sortingCode = reader.string(); - break; - case 6: - message.administrativeArea = reader.string(); - break; - case 7: - message.locality = reader.string(); - break; - case 8: - message.sublocality = reader.string(); - break; - case 9: - if (!(message.addressLines && message.addressLines.length)) - message.addressLines = []; - message.addressLines.push(reader.string()); - break; - case 10: - if (!(message.recipients && message.recipients.length)) - message.recipients = []; - message.recipients.push(reader.string()); - break; - case 11: - message.organization = reader.string(); - break; + case 1: { + message.revision = reader.int32(); + break; + } + case 2: { + message.regionCode = reader.string(); + break; + } + case 3: { + message.languageCode = reader.string(); + break; + } + case 4: { + message.postalCode = reader.string(); + break; + } + case 5: { + message.sortingCode = reader.string(); + break; + } + case 6: { + message.administrativeArea = reader.string(); + break; + } + case 7: { + message.locality = reader.string(); + break; + } + case 8: { + message.sublocality = reader.string(); + break; + } + case 9: { + if (!(message.addressLines && message.addressLines.length)) + message.addressLines = []; + message.addressLines.push(reader.string()); + break; + } + case 10: { + if (!(message.recipients && message.recipients.length)) + message.recipients = []; + message.recipients.push(reader.string()); + break; + } + case 11: { + message.organization = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -88480,6 +94576,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PostalAddress + * @function getTypeUrl + * @memberof google.type.PostalAddress + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PostalAddress.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.type.PostalAddress"; + }; + return PostalAddress; })(); @@ -88528,7 +94639,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} @@ -88561,7 +94672,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} @@ -88594,7 +94705,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} @@ -88627,7 +94738,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} @@ -88660,7 +94771,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} @@ -88845,21 +94956,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; @@ -89010,6 +95126,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; })(); @@ -89105,9 +95236,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; @@ -89197,6 +95329,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; })(); @@ -89325,18 +95472,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; @@ -89451,6 +95602,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; })(); @@ -89559,14 +95725,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; @@ -89682,6 +95850,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; })(); @@ -89777,9 +95960,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; @@ -89869,6 +96053,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; })(); @@ -89964,9 +96163,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; @@ -90056,6 +96256,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; })(); @@ -90162,12 +96377,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; @@ -90271,6 +96488,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; })(); @@ -90377,12 +96609,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; @@ -90481,6 +96715,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-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 5723fdf7380..4045eae1697 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -6982,6 +6982,10 @@ "syntax": { "type": "string", "id": 12 + }, + "edition": { + "type": "string", + "id": 13 } } }, @@ -7510,6 +7514,13 @@ "default": false } }, + "unverifiedLazy": { + "type": "bool", + "id": 15, + "options": { + "default": false + } + }, "deprecated": { "type": "bool", "id": 3, @@ -7802,6 +7813,19 @@ "end": { "type": "int32", "id": 4 + }, + "semantic": { + "type": "Semantic", + "id": 5 + } + }, + "nested": { + "Semantic": { + "values": { + "NONE": 0, + "SET": 1, + "ALIAS": 2 + } } } } From 5916f77426c3e04ab0bb9380e702f5e7c84c6c62 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:00:29 +0000 Subject: [PATCH 199/213] fix: do not import the whole google-gax from proto JS (#1553) (#353) 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-documentai/package.json | 2 +- packages/google-cloud-documentai/protos/protos.d.ts | 2 +- packages/google-cloud-documentai/protos/protos.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 15f81f95dc3..b2c1e3e1930 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -27,7 +27,7 @@ "precompile": "gts clean" }, "dependencies": { - "google-gax": "^3.0.1" + "google-gax": "^3.3.0" }, "devDependencies": { "@types/mocha": "^9.0.0", diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 32dc60eabe0..403351b11c7 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/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-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index fb691f3f478..0bf01ebda64 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/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 26195a04330f428c26cb5428a06cfcf99b8c1159 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 20:44:20 +0000 Subject: [PATCH 200/213] fix: allow passing gax instance to client constructor (#354) - [ ] 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 --- .../v1/document_processor_service_client.ts | 161 ++++++++++-------- .../document_understanding_service_client.ts | 37 ++-- .../document_understanding_service_client.ts | 39 +++-- .../document_processor_service_client.ts | 161 ++++++++++-------- 4 files changed, 239 insertions(+), 159 deletions(-) diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts index a07ef2ce69a..b5428dec3d9 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1/document_processor_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 './document_processor_service_client_config.json'; -import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -105,8 +103,18 @@ export class DocumentProcessorServiceClient { * 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 DocumentProcessorServiceClient({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 DocumentProcessorServiceClient; @@ -127,8 +135,13 @@ export class DocumentProcessorServiceClient { 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 +158,10 @@ export class DocumentProcessorServiceClient { // Set defaultServicePath on the auth object. this.auth.defaultServicePath = staticMembers.servicePath; - 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}`]; @@ -399,7 +415,7 @@ export class DocumentProcessorServiceClient { 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; } /** @@ -630,7 +646,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -724,7 +740,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -809,7 +825,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -900,7 +916,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -996,7 +1012,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -1112,7 +1128,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -1138,11 +1154,12 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1.BatchProcessMetadata > > { - 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.batchProcessDocuments, this._gaxModule.createDefaultBackoffSettings() @@ -1250,7 +1267,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -1280,11 +1297,12 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1.DeleteProcessorVersionMetadata > > { - 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.deleteProcessorVersion, this._gaxModule.createDefaultBackoffSettings() @@ -1391,7 +1409,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -1421,11 +1439,12 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1.DeployProcessorVersionMetadata > > { - 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.deployProcessorVersion, this._gaxModule.createDefaultBackoffSettings() @@ -1532,7 +1551,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -1562,11 +1581,12 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1.UndeployProcessorVersionMetadata > > { - 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.undeployProcessorVersion, this._gaxModule.createDefaultBackoffSettings() @@ -1674,7 +1694,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -1700,11 +1720,12 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1.DeleteProcessorMetadata > > { - 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.deleteProcessor, this._gaxModule.createDefaultBackoffSettings() @@ -1811,7 +1832,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -1837,11 +1858,12 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1.EnableProcessorMetadata > > { - 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.enableProcessor, this._gaxModule.createDefaultBackoffSettings() @@ -1948,7 +1970,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -1974,11 +1996,12 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1.DisableProcessorMetadata > > { - 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.disableProcessor, this._gaxModule.createDefaultBackoffSettings() @@ -2091,7 +2114,7 @@ export class DocumentProcessorServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ processor: request.processor || '', }); this.initialize(); @@ -2121,11 +2144,12 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata > > { - 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.setDefaultProcessorVersion, this._gaxModule.createDefaultBackoffSettings() @@ -2242,7 +2266,7 @@ export class DocumentProcessorServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ human_review_config: request.humanReviewConfig || '', }); this.initialize(); @@ -2268,11 +2292,12 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1.ReviewDocumentOperationMetadata > > { - 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.reviewDocument, this._gaxModule.createDefaultBackoffSettings() @@ -2378,7 +2403,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -2420,7 +2445,7 @@ export class DocumentProcessorServiceClient { 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['listProcessorTypes']; @@ -2471,7 +2496,7 @@ export class DocumentProcessorServiceClient { 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['listProcessorTypes']; @@ -2579,7 +2604,7 @@ export class DocumentProcessorServiceClient { 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 +2646,7 @@ export class DocumentProcessorServiceClient { 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['listProcessors']; @@ -2672,7 +2697,7 @@ export class DocumentProcessorServiceClient { 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['listProcessors']; @@ -2780,7 +2805,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -2822,7 +2847,7 @@ export class DocumentProcessorServiceClient { 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['listProcessorVersions']; @@ -2873,7 +2898,7 @@ export class DocumentProcessorServiceClient { 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['listProcessorVersions']; diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts index 5ea7ee87113..2aee4240321 100644 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_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, @@ -35,7 +35,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 './document_understanding_service_client_config.json'; -import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -97,8 +96,18 @@ export class DocumentUnderstandingServiceClient { * 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 DocumentUnderstandingServiceClient({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 DocumentUnderstandingServiceClient; @@ -119,8 +128,13 @@ export class DocumentUnderstandingServiceClient { 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); @@ -201,7 +215,7 @@ export class DocumentUnderstandingServiceClient { 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; } /** @@ -424,7 +438,7 @@ export class DocumentUnderstandingServiceClient { 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(); @@ -450,11 +464,12 @@ export class DocumentUnderstandingServiceClient { protos.google.cloud.documentai.v1beta1.OperationMetadata > > { - 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.batchProcessDocuments, this._gaxModule.createDefaultBackoffSettings() diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index 492b234d062..34afe2735d3 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_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, @@ -35,7 +35,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 './document_understanding_service_client_config.json'; -import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -97,8 +96,18 @@ export class DocumentUnderstandingServiceClient { * 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 DocumentUnderstandingServiceClient({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 DocumentUnderstandingServiceClient; @@ -119,8 +128,13 @@ export class DocumentUnderstandingServiceClient { 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); @@ -201,7 +215,7 @@ export class DocumentUnderstandingServiceClient { 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; } /** @@ -443,7 +457,7 @@ export class DocumentUnderstandingServiceClient { 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(); @@ -554,7 +568,7 @@ export class DocumentUnderstandingServiceClient { 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(); @@ -580,11 +594,12 @@ export class DocumentUnderstandingServiceClient { protos.google.cloud.documentai.v1beta2.OperationMetadata > > { - 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.batchProcessDocuments, this._gaxModule.createDefaultBackoffSettings() diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index d9aa8aca554..3fff170770d 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_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 './document_processor_service_client_config.json'; -import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -105,8 +103,18 @@ export class DocumentProcessorServiceClient { * 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 DocumentProcessorServiceClient({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 DocumentProcessorServiceClient; @@ -127,8 +135,13 @@ export class DocumentProcessorServiceClient { 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 +158,10 @@ export class DocumentProcessorServiceClient { // Set defaultServicePath on the auth object. this.auth.defaultServicePath = staticMembers.servicePath; - 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}`]; @@ -398,7 +414,7 @@ export class DocumentProcessorServiceClient { 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; } /** @@ -633,7 +649,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -733,7 +749,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -824,7 +840,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -921,7 +937,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -1023,7 +1039,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -1143,7 +1159,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -1169,11 +1185,12 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1beta3.BatchProcessMetadata > > { - 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.batchProcessDocuments, this._gaxModule.createDefaultBackoffSettings() @@ -1281,7 +1298,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -1311,11 +1328,12 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata > > { - 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.deleteProcessorVersion, this._gaxModule.createDefaultBackoffSettings() @@ -1422,7 +1440,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -1452,11 +1470,12 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata > > { - 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.deployProcessorVersion, this._gaxModule.createDefaultBackoffSettings() @@ -1563,7 +1582,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -1593,11 +1612,12 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata > > { - 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.undeployProcessorVersion, this._gaxModule.createDefaultBackoffSettings() @@ -1705,7 +1725,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -1731,11 +1751,12 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1beta3.DeleteProcessorMetadata > > { - 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.deleteProcessor, this._gaxModule.createDefaultBackoffSettings() @@ -1842,7 +1863,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -1868,11 +1889,12 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1beta3.EnableProcessorMetadata > > { - 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.enableProcessor, this._gaxModule.createDefaultBackoffSettings() @@ -1979,7 +2001,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -2005,11 +2027,12 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1beta3.DisableProcessorMetadata > > { - 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.disableProcessor, this._gaxModule.createDefaultBackoffSettings() @@ -2122,7 +2145,7 @@ export class DocumentProcessorServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ processor: request.processor || '', }); this.initialize(); @@ -2152,11 +2175,12 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata > > { - 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.setDefaultProcessorVersion, this._gaxModule.createDefaultBackoffSettings() @@ -2275,7 +2299,7 @@ export class DocumentProcessorServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ human_review_config: request.humanReviewConfig || '', }); this.initialize(); @@ -2301,11 +2325,12 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata > > { - 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.reviewDocument, this._gaxModule.createDefaultBackoffSettings() @@ -2411,7 +2436,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -2453,7 +2478,7 @@ export class DocumentProcessorServiceClient { 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['listProcessorTypes']; @@ -2504,7 +2529,7 @@ export class DocumentProcessorServiceClient { 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['listProcessorTypes']; @@ -2612,7 +2637,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -2654,7 +2679,7 @@ export class DocumentProcessorServiceClient { 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['listProcessors']; @@ -2705,7 +2730,7 @@ export class DocumentProcessorServiceClient { 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['listProcessors']; @@ -2813,7 +2838,7 @@ export class DocumentProcessorServiceClient { 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(); @@ -2855,7 +2880,7 @@ export class DocumentProcessorServiceClient { 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['listProcessorVersions']; @@ -2906,7 +2931,7 @@ export class DocumentProcessorServiceClient { 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['listProcessorVersions']; From c3b0b6e3d10bdd947120b981e48b62adcb09a863 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 9 Sep 2022 03:58:14 +0200 Subject: [PATCH 201/213] fix(deps): update dependency uuid to v9 (#356) 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 | |---|---|---|---|---|---| | [uuid](https://togithub.com/uuidjs/uuid) | [`^8.3.1` -> `^9.0.0`](https://renovatebot.com/diffs/npm/uuid/8.3.2/9.0.0) | [![age](https://badges.renovateapi.com/packages/npm/uuid/9.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/uuid/9.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/uuid/9.0.0/compatibility-slim/8.3.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/uuid/9.0.0/confidence-slim/8.3.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
uuidjs/uuid ### [`v9.0.0`](https://togithub.com/uuidjs/uuid/blob/HEAD/CHANGELOG.md#​900-httpsgithubcomuuidjsuuidcomparev832v900-2022-09-05) [Compare Source](https://togithub.com/uuidjs/uuid/compare/v8.3.2...v9.0.0) ##### ⚠ BREAKING CHANGES - Drop Node.js 10.x support. This library always aims at supporting one EOLed LTS release which by this time now is 12.x which has reached EOL 30 Apr 2022. - Remove the minified UMD build from the package. Minified code is hard to audit and since this is a widely used library it seems more appropriate nowadays to optimize for auditability than to ship a legacy module format that, at best, serves educational purposes nowadays. For production browser use cases, users should be using a bundler. For educational purposes, today's online sandboxes like replit.com offer convenient ways to load npm modules, so the use case for UMD through repos like UNPKG or jsDelivr has largely vanished. - Drop IE 11 and Safari 10 support. Drop support for browsers that don't correctly implement const/let and default arguments, and no longer transpile the browser build to ES2015. This also removes the fallback on msCrypto instead of the crypto API. Browser tests are run in the first supported version of each supported browser and in the latest (as of this commit) version available on Browserstack. ##### Features - optimize uuid.v1 by 1.3x uuid.v4 by 4.3x (430%) ([#​597](https://togithub.com/uuidjs/uuid/issues/597)) ([3a033f6](https://togithub.com/uuidjs/uuid/commit/3a033f6bab6bb3780ece6d645b902548043280bc)) - remove UMD build ([#​645](https://togithub.com/uuidjs/uuid/issues/645)) ([e948a0f](https://togithub.com/uuidjs/uuid/commit/e948a0f22bf22f4619b27bd913885e478e20fe6f)), closes [#​620](https://togithub.com/uuidjs/uuid/issues/620) - use native crypto.randomUUID when available ([#​600](https://togithub.com/uuidjs/uuid/issues/600)) ([c9e076c](https://togithub.com/uuidjs/uuid/commit/c9e076c852edad7e9a06baaa1d148cf4eda6c6c4)) ##### Bug Fixes - add Jest/jsdom compatibility ([#​642](https://togithub.com/uuidjs/uuid/issues/642)) ([16f9c46](https://togithub.com/uuidjs/uuid/commit/16f9c469edf46f0786164cdf4dc980743984a6fd)) - change default export to named function ([#​545](https://togithub.com/uuidjs/uuid/issues/545)) ([c57bc5a](https://togithub.com/uuidjs/uuid/commit/c57bc5a9a0653273aa639cda9177ce52efabe42a)) - handle error when parameter is not set in v3 and v5 ([#​622](https://togithub.com/uuidjs/uuid/issues/622)) ([fcd7388](https://togithub.com/uuidjs/uuid/commit/fcd73881692d9fabb63872576ba28e30ff852091)) - run npm audit fix ([#​644](https://togithub.com/uuidjs/uuid/issues/644)) ([04686f5](https://togithub.com/uuidjs/uuid/commit/04686f54c5fed2cfffc1b619f4970c4bb8532353)) - upgrading from uuid3 broken link ([#​568](https://togithub.com/uuidjs/uuid/issues/568)) ([1c849da](https://togithub.com/uuidjs/uuid/commit/1c849da6e164259e72e18636726345b13a7eddd6)) ##### build - drop Node.js 8.x from babel transpile target ([#​603](https://togithub.com/uuidjs/uuid/issues/603)) ([aa11485](https://togithub.com/uuidjs/uuid/commit/aa114858260402107ec8a1e1a825dea0a259bcb5)) - drop support for legacy browsers (IE11, Safari 10) ([#​604](https://togithub.com/uuidjs/uuid/issues/604)) ([0f433e5](https://togithub.com/uuidjs/uuid/commit/0f433e5ec444edacd53016de67db021102f36148)) - drop node 10.x to upgrade dev dependencies ([#​653](https://togithub.com/uuidjs/uuid/issues/653)) ([28a5712](https://togithub.com/uuidjs/uuid/commit/28a571283f8abda6b9d85e689f95b7d3ee9e282e)), closes [#​643](https://togithub.com/uuidjs/uuid/issues/643) ##### [8.3.2](https://togithub.com/uuidjs/uuid/compare/v8.3.1...v8.3.2) (2020-12-08) ##### Bug Fixes - lazy load getRandomValues ([#​537](https://togithub.com/uuidjs/uuid/issues/537)) ([16c8f6d](https://togithub.com/uuidjs/uuid/commit/16c8f6df2f6b09b4d6235602d6a591188320a82e)), closes [#​536](https://togithub.com/uuidjs/uuid/issues/536) ##### [8.3.1](https://togithub.com/uuidjs/uuid/compare/v8.3.0...v8.3.1) (2020-10-04) ##### Bug Fixes - support expo>=39.0.0 ([#​515](https://togithub.com/uuidjs/uuid/issues/515)) ([c65a0f3](https://togithub.com/uuidjs/uuid/commit/c65a0f3fa73b901959d638d1e3591dfacdbed867)), closes [#​375](https://togithub.com/uuidjs/uuid/issues/375)
--- ### 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-document-ai). --- packages/google-cloud-documentai/samples/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 30974c46656..2da3171d9cc 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -16,7 +16,7 @@ "@google-cloud/documentai": "^5.0.0", "@google-cloud/storage": "^6.0.0", "p-queue": "^6.6.2", - "uuid": "^8.3.1" + "uuid": "^9.0.0" }, "devDependencies": { "chai": "^4.2.0", From 91a4e4cdaf131a1cb5a4422af8ff235d9b7ba9d3 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 22 Sep 2022 12:50:58 -0700 Subject: [PATCH 202/213] fix: preserve default values in x-goog-request-params header (#357) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 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 * 🦉 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 --- .../v1/document_processor_service_client.ts | 46 +- .../document_understanding_service_client.ts | 2 +- .../document_understanding_service_client.ts | 4 +- .../document_processor_service_client.ts | 46 +- .../gapic_document_processor_service_v1.ts | 1963 +++++++++-------- ...apic_document_processor_service_v1beta3.ts | 1963 +++++++++-------- ..._document_understanding_service_v1beta1.ts | 127 +- ..._document_understanding_service_v1beta2.ts | 217 +- 8 files changed, 2310 insertions(+), 2058 deletions(-) diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts index b5428dec3d9..521d68f6bbb 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts @@ -647,7 +647,7 @@ export class DocumentProcessorServiceClient { 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.processDocument(request, options, callback); @@ -741,7 +741,7 @@ export class DocumentProcessorServiceClient { 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.fetchProcessorTypes(request, options, callback); @@ -826,7 +826,7 @@ export class DocumentProcessorServiceClient { 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.getProcessor(request, options, callback); @@ -917,7 +917,7 @@ export class DocumentProcessorServiceClient { 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.getProcessorVersion(request, options, callback); @@ -1013,7 +1013,7 @@ export class DocumentProcessorServiceClient { 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.createProcessor(request, options, callback); @@ -1129,7 +1129,7 @@ export class DocumentProcessorServiceClient { 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.batchProcessDocuments(request, options, callback); @@ -1268,7 +1268,7 @@ export class DocumentProcessorServiceClient { 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.deleteProcessorVersion( @@ -1410,7 +1410,7 @@ export class DocumentProcessorServiceClient { 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.deployProcessorVersion( @@ -1552,7 +1552,7 @@ export class DocumentProcessorServiceClient { 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.undeployProcessorVersion( @@ -1695,7 +1695,7 @@ export class DocumentProcessorServiceClient { 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.deleteProcessor(request, options, callback); @@ -1833,7 +1833,7 @@ export class DocumentProcessorServiceClient { 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.enableProcessor(request, options, callback); @@ -1971,7 +1971,7 @@ export class DocumentProcessorServiceClient { 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.disableProcessor(request, options, callback); @@ -2115,7 +2115,7 @@ export class DocumentProcessorServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - processor: request.processor || '', + processor: request.processor ?? '', }); this.initialize(); return this.innerApiCalls.setDefaultProcessorVersion( @@ -2267,7 +2267,7 @@ export class DocumentProcessorServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - human_review_config: request.humanReviewConfig || '', + human_review_config: request.humanReviewConfig ?? '', }); this.initialize(); return this.innerApiCalls.reviewDocument(request, options, callback); @@ -2404,7 +2404,7 @@ export class DocumentProcessorServiceClient { 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.listProcessorTypes(request, options, callback); @@ -2446,7 +2446,7 @@ export class DocumentProcessorServiceClient { 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['listProcessorTypes']; const callSettings = defaultCallSettings.merge(options); @@ -2497,7 +2497,7 @@ export class DocumentProcessorServiceClient { 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['listProcessorTypes']; const callSettings = defaultCallSettings.merge(options); @@ -2605,7 +2605,7 @@ export class DocumentProcessorServiceClient { 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.listProcessors(request, options, callback); @@ -2647,7 +2647,7 @@ export class DocumentProcessorServiceClient { 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['listProcessors']; const callSettings = defaultCallSettings.merge(options); @@ -2698,7 +2698,7 @@ export class DocumentProcessorServiceClient { 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['listProcessors']; const callSettings = defaultCallSettings.merge(options); @@ -2806,7 +2806,7 @@ export class DocumentProcessorServiceClient { 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.listProcessorVersions(request, options, callback); @@ -2848,7 +2848,7 @@ export class DocumentProcessorServiceClient { 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['listProcessorVersions']; const callSettings = defaultCallSettings.merge(options); @@ -2899,7 +2899,7 @@ export class DocumentProcessorServiceClient { 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['listProcessorVersions']; const callSettings = defaultCallSettings.merge(options); diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts index 2aee4240321..edd67bc8609 100644 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts @@ -439,7 +439,7 @@ export class DocumentUnderstandingServiceClient { 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.batchProcessDocuments(request, options, callback); diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index 34afe2735d3..295893caf18 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -458,7 +458,7 @@ export class DocumentUnderstandingServiceClient { 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.processDocument(request, options, callback); @@ -569,7 +569,7 @@ export class DocumentUnderstandingServiceClient { 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.batchProcessDocuments(request, options, callback); diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index 3fff170770d..230e98be983 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts @@ -650,7 +650,7 @@ export class DocumentProcessorServiceClient { 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.processDocument(request, options, callback); @@ -750,7 +750,7 @@ export class DocumentProcessorServiceClient { 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.fetchProcessorTypes(request, options, callback); @@ -841,7 +841,7 @@ export class DocumentProcessorServiceClient { 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.getProcessor(request, options, callback); @@ -938,7 +938,7 @@ export class DocumentProcessorServiceClient { 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.getProcessorVersion(request, options, callback); @@ -1040,7 +1040,7 @@ export class DocumentProcessorServiceClient { 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.createProcessor(request, options, callback); @@ -1160,7 +1160,7 @@ export class DocumentProcessorServiceClient { 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.batchProcessDocuments(request, options, callback); @@ -1299,7 +1299,7 @@ export class DocumentProcessorServiceClient { 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.deleteProcessorVersion( @@ -1441,7 +1441,7 @@ export class DocumentProcessorServiceClient { 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.deployProcessorVersion( @@ -1583,7 +1583,7 @@ export class DocumentProcessorServiceClient { 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.undeployProcessorVersion( @@ -1726,7 +1726,7 @@ export class DocumentProcessorServiceClient { 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.deleteProcessor(request, options, callback); @@ -1864,7 +1864,7 @@ export class DocumentProcessorServiceClient { 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.enableProcessor(request, options, callback); @@ -2002,7 +2002,7 @@ export class DocumentProcessorServiceClient { 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.disableProcessor(request, options, callback); @@ -2146,7 +2146,7 @@ export class DocumentProcessorServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - processor: request.processor || '', + processor: request.processor ?? '', }); this.initialize(); return this.innerApiCalls.setDefaultProcessorVersion( @@ -2300,7 +2300,7 @@ export class DocumentProcessorServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - human_review_config: request.humanReviewConfig || '', + human_review_config: request.humanReviewConfig ?? '', }); this.initialize(); return this.innerApiCalls.reviewDocument(request, options, callback); @@ -2437,7 +2437,7 @@ export class DocumentProcessorServiceClient { 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.listProcessorTypes(request, options, callback); @@ -2479,7 +2479,7 @@ export class DocumentProcessorServiceClient { 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['listProcessorTypes']; const callSettings = defaultCallSettings.merge(options); @@ -2530,7 +2530,7 @@ export class DocumentProcessorServiceClient { 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['listProcessorTypes']; const callSettings = defaultCallSettings.merge(options); @@ -2638,7 +2638,7 @@ export class DocumentProcessorServiceClient { 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.listProcessors(request, options, callback); @@ -2680,7 +2680,7 @@ export class DocumentProcessorServiceClient { 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['listProcessors']; const callSettings = defaultCallSettings.merge(options); @@ -2731,7 +2731,7 @@ export class DocumentProcessorServiceClient { 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['listProcessors']; const callSettings = defaultCallSettings.merge(options); @@ -2839,7 +2839,7 @@ export class DocumentProcessorServiceClient { 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.listProcessorVersions(request, options, callback); @@ -2881,7 +2881,7 @@ export class DocumentProcessorServiceClient { 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['listProcessorVersions']; const callSettings = defaultCallSettings.merge(options); @@ -2932,7 +2932,7 @@ export class DocumentProcessorServiceClient { 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['listProcessorVersions']; const callSettings = defaultCallSettings.merge(options); diff --git a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts index 0a56ba9cb4a..67db38aeeb0 100644 --- a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.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 @@ -270,26 +285,26 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ProcessRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ProcessRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1.ProcessResponse() ); client.innerApiCalls.processDocument = stubSimpleCall(expectedResponse); const [response] = await client.processDocument(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.processDocument as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.processDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.processDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes processDocument without error using callback', async () => { @@ -302,15 +317,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ProcessRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ProcessRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1.ProcessResponse() ); @@ -333,11 +345,14 @@ describe('v1.DocumentProcessorServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.processDocument as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.processDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.processDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes processDocument with error', async () => { @@ -350,26 +365,26 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ProcessRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ProcessRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.processDocument = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.processDocument(request), expectedError); - assert( - (client.innerApiCalls.processDocument as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.processDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.processDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes processDocument with closed client', async () => { @@ -382,7 +397,11 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ProcessRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ProcessRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.processDocument(request), expectedError); @@ -400,15 +419,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.FetchProcessorTypesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.FetchProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1.FetchProcessorTypesResponse() ); @@ -416,11 +432,14 @@ describe('v1.DocumentProcessorServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.fetchProcessorTypes(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.fetchProcessorTypes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.fetchProcessorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.fetchProcessorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes fetchProcessorTypes without error using callback', async () => { @@ -433,15 +452,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.FetchProcessorTypesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.FetchProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1.FetchProcessorTypesResponse() ); @@ -464,11 +480,14 @@ describe('v1.DocumentProcessorServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.fetchProcessorTypes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.fetchProcessorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.fetchProcessorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes fetchProcessorTypes with error', async () => { @@ -481,26 +500,26 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.FetchProcessorTypesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.FetchProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.fetchProcessorTypes = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.fetchProcessorTypes(request), expectedError); - assert( - (client.innerApiCalls.fetchProcessorTypes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.fetchProcessorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.fetchProcessorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes fetchProcessorTypes with closed client', async () => { @@ -513,7 +532,11 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.FetchProcessorTypesRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.FetchProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.fetchProcessorTypes(request), expectedError); @@ -531,26 +554,26 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.GetProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.GetProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1.Processor() ); client.innerApiCalls.getProcessor = stubSimpleCall(expectedResponse); const [response] = await client.getProcessor(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProcessor without error using callback', async () => { @@ -563,15 +586,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.GetProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.GetProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1.Processor() ); @@ -594,11 +614,14 @@ describe('v1.DocumentProcessorServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProcessor with error', async () => { @@ -611,26 +634,26 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.GetProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.GetProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getProcessor = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getProcessor(request), expectedError); - assert( - (client.innerApiCalls.getProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProcessor with closed client', async () => { @@ -643,7 +666,11 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.GetProcessorRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.GetProcessorRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getProcessor(request), expectedError); @@ -661,15 +688,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.GetProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.GetProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1.ProcessorVersion() ); @@ -677,11 +701,14 @@ describe('v1.DocumentProcessorServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.getProcessorVersion(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProcessorVersion without error using callback', async () => { @@ -694,15 +721,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.GetProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.GetProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1.ProcessorVersion() ); @@ -725,11 +749,14 @@ describe('v1.DocumentProcessorServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProcessorVersion with error', async () => { @@ -742,26 +769,26 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.GetProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.GetProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getProcessorVersion = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getProcessorVersion(request), expectedError); - assert( - (client.innerApiCalls.getProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProcessorVersion with closed client', async () => { @@ -774,7 +801,11 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.GetProcessorVersionRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.GetProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getProcessorVersion(request), expectedError); @@ -792,26 +823,26 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.CreateProcessorRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.CreateProcessorRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1.Processor() ); client.innerApiCalls.createProcessor = stubSimpleCall(expectedResponse); const [response] = await client.createProcessor(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createProcessor without error using callback', async () => { @@ -824,15 +855,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.CreateProcessorRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.CreateProcessorRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1.Processor() ); @@ -855,11 +883,14 @@ describe('v1.DocumentProcessorServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createProcessor with error', async () => { @@ -872,26 +903,26 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.CreateProcessorRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.CreateProcessorRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createProcessor = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.createProcessor(request), expectedError); - assert( - (client.innerApiCalls.createProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createProcessor with closed client', async () => { @@ -904,7 +935,11 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.CreateProcessorRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.CreateProcessorRequest', + ['parent'] + ); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createProcessor(request), expectedError); @@ -922,15 +957,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.BatchProcessRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.BatchProcessRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -939,11 +971,14 @@ describe('v1.DocumentProcessorServiceClient', () => { const [operation] = await client.batchProcessDocuments(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes batchProcessDocuments without error using callback', async () => { @@ -956,15 +991,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.BatchProcessRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.BatchProcessRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -994,11 +1026,14 @@ describe('v1.DocumentProcessorServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes batchProcessDocuments with call error', async () => { @@ -1011,15 +1046,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.BatchProcessRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.BatchProcessRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( undefined, @@ -1029,11 +1061,14 @@ describe('v1.DocumentProcessorServiceClient', () => { client.batchProcessDocuments(request), expectedError ); - assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes batchProcessDocuments with LRO error', async () => { @@ -1046,15 +1081,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.BatchProcessRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.BatchProcessRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( undefined, @@ -1063,11 +1095,14 @@ describe('v1.DocumentProcessorServiceClient', () => { ); const [operation] = await client.batchProcessDocuments(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkBatchProcessDocumentsProgress without error', async () => { @@ -1125,15 +1160,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.DeleteProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DeleteProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1142,11 +1174,14 @@ describe('v1.DocumentProcessorServiceClient', () => { const [operation] = await client.deleteProcessorVersion(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProcessorVersion without error using callback', async () => { @@ -1159,15 +1194,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.DeleteProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DeleteProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1197,11 +1229,14 @@ describe('v1.DocumentProcessorServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProcessorVersion with call error', async () => { @@ -1214,15 +1249,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.DeleteProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DeleteProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteProcessorVersion = stubLongRunningCall( undefined, @@ -1232,11 +1264,14 @@ describe('v1.DocumentProcessorServiceClient', () => { client.deleteProcessorVersion(request), expectedError ); - assert( - (client.innerApiCalls.deleteProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProcessorVersion with LRO error', async () => { @@ -1249,15 +1284,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.DeleteProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DeleteProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteProcessorVersion = stubLongRunningCall( undefined, @@ -1266,11 +1298,14 @@ describe('v1.DocumentProcessorServiceClient', () => { ); const [operation] = await client.deleteProcessorVersion(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.deleteProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkDeleteProcessorVersionProgress without error', async () => { @@ -1328,15 +1363,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.DeployProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1345,11 +1377,14 @@ describe('v1.DocumentProcessorServiceClient', () => { const [operation] = await client.deployProcessorVersion(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deployProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deployProcessorVersion without error using callback', async () => { @@ -1362,15 +1397,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.DeployProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1400,11 +1432,14 @@ describe('v1.DocumentProcessorServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deployProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deployProcessorVersion with call error', async () => { @@ -1417,15 +1452,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.DeployProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deployProcessorVersion = stubLongRunningCall( undefined, @@ -1435,11 +1467,14 @@ describe('v1.DocumentProcessorServiceClient', () => { client.deployProcessorVersion(request), expectedError ); - assert( - (client.innerApiCalls.deployProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deployProcessorVersion with LRO error', async () => { @@ -1452,15 +1487,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.DeployProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deployProcessorVersion = stubLongRunningCall( undefined, @@ -1469,11 +1501,14 @@ describe('v1.DocumentProcessorServiceClient', () => { ); const [operation] = await client.deployProcessorVersion(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.deployProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkDeployProcessorVersionProgress without error', async () => { @@ -1531,15 +1566,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.UndeployProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.UndeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1548,11 +1580,14 @@ describe('v1.DocumentProcessorServiceClient', () => { const [operation] = await client.undeployProcessorVersion(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.undeployProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.undeployProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeployProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes undeployProcessorVersion without error using callback', async () => { @@ -1565,15 +1600,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.UndeployProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.UndeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1603,11 +1635,14 @@ describe('v1.DocumentProcessorServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.undeployProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.undeployProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeployProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes undeployProcessorVersion with call error', async () => { @@ -1620,15 +1655,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.UndeployProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.UndeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.undeployProcessorVersion = stubLongRunningCall( undefined, @@ -1638,11 +1670,14 @@ describe('v1.DocumentProcessorServiceClient', () => { client.undeployProcessorVersion(request), expectedError ); - assert( - (client.innerApiCalls.undeployProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.undeployProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeployProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes undeployProcessorVersion with LRO error', async () => { @@ -1655,15 +1690,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.UndeployProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.UndeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.undeployProcessorVersion = stubLongRunningCall( undefined, @@ -1672,11 +1704,14 @@ describe('v1.DocumentProcessorServiceClient', () => { ); const [operation] = await client.undeployProcessorVersion(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.undeployProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.undeployProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeployProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkUndeployProcessorVersionProgress without error', async () => { @@ -1735,15 +1770,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.DeleteProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DeleteProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1752,11 +1784,14 @@ describe('v1.DocumentProcessorServiceClient', () => { const [operation] = await client.deleteProcessor(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProcessor without error using callback', async () => { @@ -1769,15 +1804,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.DeleteProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DeleteProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1807,11 +1839,14 @@ describe('v1.DocumentProcessorServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProcessor with call error', async () => { @@ -1824,26 +1859,26 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.DeleteProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DeleteProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteProcessor = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.deleteProcessor(request), expectedError); - assert( - (client.innerApiCalls.deleteProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProcessor with LRO error', async () => { @@ -1856,15 +1891,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.DeleteProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DeleteProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteProcessor = stubLongRunningCall( undefined, @@ -1873,11 +1905,14 @@ describe('v1.DocumentProcessorServiceClient', () => { ); const [operation] = await client.deleteProcessor(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.deleteProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkDeleteProcessorProgress without error', async () => { @@ -1935,15 +1970,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.EnableProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.EnableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1952,11 +1984,14 @@ describe('v1.DocumentProcessorServiceClient', () => { const [operation] = await client.enableProcessor(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.enableProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.enableProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.enableProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes enableProcessor without error using callback', async () => { @@ -1969,15 +2004,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.EnableProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.EnableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -2007,11 +2039,14 @@ describe('v1.DocumentProcessorServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.enableProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.enableProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.enableProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes enableProcessor with call error', async () => { @@ -2024,26 +2059,26 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.EnableProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.EnableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.enableProcessor = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.enableProcessor(request), expectedError); - assert( - (client.innerApiCalls.enableProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.enableProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.enableProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes enableProcessor with LRO error', async () => { @@ -2056,15 +2091,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.EnableProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.EnableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.enableProcessor = stubLongRunningCall( undefined, @@ -2073,11 +2105,14 @@ describe('v1.DocumentProcessorServiceClient', () => { ); const [operation] = await client.enableProcessor(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.enableProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.enableProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.enableProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkEnableProcessorProgress without error', async () => { @@ -2135,15 +2170,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.DisableProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DisableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -2152,11 +2184,14 @@ describe('v1.DocumentProcessorServiceClient', () => { const [operation] = await client.disableProcessor(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.disableProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.disableProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.disableProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes disableProcessor without error using callback', async () => { @@ -2169,15 +2204,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.DisableProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DisableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -2207,11 +2239,14 @@ describe('v1.DocumentProcessorServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.disableProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.disableProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.disableProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes disableProcessor with call error', async () => { @@ -2224,26 +2259,26 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.DisableProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DisableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.disableProcessor = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.disableProcessor(request), expectedError); - assert( - (client.innerApiCalls.disableProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.disableProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.disableProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes disableProcessor with LRO error', async () => { @@ -2256,15 +2291,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.DisableProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DisableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.disableProcessor = stubLongRunningCall( undefined, @@ -2273,11 +2305,14 @@ describe('v1.DocumentProcessorServiceClient', () => { ); const [operation] = await client.disableProcessor(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.disableProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.disableProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.disableProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkDisableProcessorProgress without error', async () => { @@ -2335,15 +2370,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest() ); - request.processor = ''; - const expectedHeaderRequestParams = 'processor='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest', + ['processor'] + ); + request.processor = defaultValue1; + const expectedHeaderRequestParams = `processor=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -2352,11 +2384,14 @@ describe('v1.DocumentProcessorServiceClient', () => { const [operation] = await client.setDefaultProcessorVersion(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setDefaultProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setDefaultProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setDefaultProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setDefaultProcessorVersion without error using callback', async () => { @@ -2369,15 +2404,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest() ); - request.processor = ''; - const expectedHeaderRequestParams = 'processor='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest', + ['processor'] + ); + request.processor = defaultValue1; + const expectedHeaderRequestParams = `processor=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -2407,11 +2439,14 @@ describe('v1.DocumentProcessorServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setDefaultProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.setDefaultProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setDefaultProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setDefaultProcessorVersion with call error', async () => { @@ -2424,15 +2459,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest() ); - request.processor = ''; - const expectedHeaderRequestParams = 'processor='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest', + ['processor'] + ); + request.processor = defaultValue1; + const expectedHeaderRequestParams = `processor=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.setDefaultProcessorVersion = stubLongRunningCall( undefined, @@ -2442,11 +2474,14 @@ describe('v1.DocumentProcessorServiceClient', () => { client.setDefaultProcessorVersion(request), expectedError ); - assert( - (client.innerApiCalls.setDefaultProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setDefaultProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setDefaultProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setDefaultProcessorVersion with LRO error', async () => { @@ -2459,15 +2494,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest() ); - request.processor = ''; - const expectedHeaderRequestParams = 'processor='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest', + ['processor'] + ); + request.processor = defaultValue1; + const expectedHeaderRequestParams = `processor=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.setDefaultProcessorVersion = stubLongRunningCall( undefined, @@ -2476,11 +2508,14 @@ describe('v1.DocumentProcessorServiceClient', () => { ); const [operation] = await client.setDefaultProcessorVersion(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.setDefaultProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setDefaultProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setDefaultProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkSetDefaultProcessorVersionProgress without error', async () => { @@ -2539,15 +2574,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ReviewDocumentRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ReviewDocumentRequest', + ['humanReviewConfig'] + ); + request.humanReviewConfig = defaultValue1; + const expectedHeaderRequestParams = `human_review_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -2556,11 +2588,14 @@ describe('v1.DocumentProcessorServiceClient', () => { const [operation] = await client.reviewDocument(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.reviewDocument as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.reviewDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reviewDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes reviewDocument without error using callback', async () => { @@ -2573,15 +2608,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ReviewDocumentRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ReviewDocumentRequest', + ['humanReviewConfig'] + ); + request.humanReviewConfig = defaultValue1; + const expectedHeaderRequestParams = `human_review_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -2611,11 +2643,14 @@ describe('v1.DocumentProcessorServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.reviewDocument as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.reviewDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reviewDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes reviewDocument with call error', async () => { @@ -2628,26 +2663,26 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ReviewDocumentRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ReviewDocumentRequest', + ['humanReviewConfig'] + ); + request.humanReviewConfig = defaultValue1; + const expectedHeaderRequestParams = `human_review_config=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.reviewDocument = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.reviewDocument(request), expectedError); - assert( - (client.innerApiCalls.reviewDocument as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.reviewDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reviewDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes reviewDocument with LRO error', async () => { @@ -2660,15 +2695,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ReviewDocumentRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ReviewDocumentRequest', + ['humanReviewConfig'] + ); + request.humanReviewConfig = defaultValue1; + const expectedHeaderRequestParams = `human_review_config=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.reviewDocument = stubLongRunningCall( undefined, @@ -2677,11 +2709,14 @@ describe('v1.DocumentProcessorServiceClient', () => { ); const [operation] = await client.reviewDocument(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.reviewDocument as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.reviewDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reviewDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkReviewDocumentProgress without error', async () => { @@ -2739,15 +2774,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1.ProcessorType() @@ -2763,11 +2795,14 @@ describe('v1.DocumentProcessorServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.listProcessorTypes(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProcessorTypes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listProcessorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProcessorTypes without error using callback', async () => { @@ -2780,15 +2815,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1.ProcessorType() @@ -2819,11 +2851,14 @@ describe('v1.DocumentProcessorServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProcessorTypes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listProcessorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProcessorTypes with error', async () => { @@ -2836,26 +2871,26 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listProcessorTypes = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listProcessorTypes(request), expectedError); - assert( - (client.innerApiCalls.listProcessorTypes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listProcessorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProcessorTypesStream without error', async () => { @@ -2868,8 +2903,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1.ProcessorType() @@ -2906,11 +2945,12 @@ describe('v1.DocumentProcessorServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listProcessorTypes, request) ); - assert.strictEqual( - ( - client.descriptors.page.listProcessorTypes.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProcessorTypes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2924,8 +2964,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listProcessorTypes.createStream = stubPageStreamingCall(undefined, expectedError); @@ -2951,11 +2995,12 @@ describe('v1.DocumentProcessorServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listProcessorTypes, request) ); - assert.strictEqual( - ( - client.descriptors.page.listProcessorTypes.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProcessorTypes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2969,8 +3014,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1.ProcessorType() @@ -2996,11 +3045,12 @@ describe('v1.DocumentProcessorServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -3014,8 +3064,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listProcessorTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -3033,11 +3087,12 @@ describe('v1.DocumentProcessorServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -3053,15 +3108,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1.Processor() @@ -3076,11 +3128,14 @@ describe('v1.DocumentProcessorServiceClient', () => { client.innerApiCalls.listProcessors = stubSimpleCall(expectedResponse); const [response] = await client.listProcessors(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProcessors as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listProcessors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProcessors without error using callback', async () => { @@ -3093,15 +3148,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1.Processor() @@ -3132,11 +3184,14 @@ describe('v1.DocumentProcessorServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProcessors as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listProcessors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProcessors with error', async () => { @@ -3149,26 +3204,26 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listProcessors = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listProcessors(request), expectedError); - assert( - (client.innerApiCalls.listProcessors as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listProcessors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProcessorsStream without error', async () => { @@ -3181,8 +3236,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1.Processor() @@ -3219,11 +3278,12 @@ describe('v1.DocumentProcessorServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listProcessors, request) ); - assert.strictEqual( - ( - client.descriptors.page.listProcessors.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProcessors.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -3237,8 +3297,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listProcessors.createStream = stubPageStreamingCall(undefined, expectedError); @@ -3264,11 +3328,12 @@ describe('v1.DocumentProcessorServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listProcessors, request) ); - assert.strictEqual( - ( - client.descriptors.page.listProcessors.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProcessors.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -3282,8 +3347,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1.Processor() @@ -3309,11 +3378,12 @@ describe('v1.DocumentProcessorServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listProcessors.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProcessors.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -3327,8 +3397,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listProcessors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -3345,11 +3419,12 @@ describe('v1.DocumentProcessorServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listProcessors.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProcessors.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -3365,15 +3440,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1.ProcessorVersion() @@ -3389,11 +3461,14 @@ describe('v1.DocumentProcessorServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.listProcessorVersions(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProcessorVersions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listProcessorVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessorVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProcessorVersions without error using callback', async () => { @@ -3406,15 +3481,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1.ProcessorVersion() @@ -3447,11 +3519,14 @@ describe('v1.DocumentProcessorServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProcessorVersions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listProcessorVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessorVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProcessorVersions with error', async () => { @@ -3464,15 +3539,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listProcessorVersions = stubSimpleCall( undefined, @@ -3482,11 +3554,14 @@ describe('v1.DocumentProcessorServiceClient', () => { client.listProcessorVersions(request), expectedError ); - assert( - (client.innerApiCalls.listProcessorVersions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listProcessorVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessorVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProcessorVersionsStream without error', async () => { @@ -3499,8 +3574,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1.ProcessorVersion() @@ -3541,12 +3620,15 @@ describe('v1.DocumentProcessorServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listProcessorVersions, request) ); - assert.strictEqual( + assert( ( client.descriptors.page.listProcessorVersions .createStream 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 + ) ); }); @@ -3560,8 +3642,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listProcessorVersions.createStream = stubPageStreamingCall(undefined, expectedError); @@ -3591,12 +3677,15 @@ describe('v1.DocumentProcessorServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listProcessorVersions, request) ); - assert.strictEqual( + assert( ( client.descriptors.page.listProcessorVersions .createStream 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 + ) ); }); @@ -3610,8 +3699,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1.ProcessorVersion() @@ -3639,12 +3732,15 @@ describe('v1.DocumentProcessorServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.descriptors.page.listProcessorVersions .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 + ) ); }); @@ -3658,8 +3754,12 @@ describe('v1.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.ListProcessorVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listProcessorVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -3678,12 +3778,15 @@ describe('v1.DocumentProcessorServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.descriptors.page.listProcessorVersions .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 + ) ); }); }); @@ -3838,12 +3941,15 @@ describe('v1.DocumentProcessorServiceClient', () => { ).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 () => { @@ -3875,12 +3981,15 @@ describe('v1.DocumentProcessorServiceClient', () => { ).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-documentai/test/gapic_document_processor_service_v1beta3.ts b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts index b0e9bbf525f..3791385f73f 100644 --- a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.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 @@ -285,26 +300,26 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ProcessRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessResponse() ); client.innerApiCalls.processDocument = stubSimpleCall(expectedResponse); const [response] = await client.processDocument(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.processDocument as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.processDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.processDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes processDocument without error using callback', async () => { @@ -319,15 +334,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ProcessRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessResponse() ); @@ -350,11 +362,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.processDocument as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.processDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.processDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes processDocument with error', async () => { @@ -369,26 +384,26 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ProcessRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.processDocument = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.processDocument(request), expectedError); - assert( - (client.innerApiCalls.processDocument as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.processDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.processDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes processDocument with closed client', async () => { @@ -403,7 +418,11 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ProcessRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.processDocument(request), expectedError); @@ -423,15 +442,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.FetchProcessorTypesResponse() ); @@ -439,11 +455,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.fetchProcessorTypes(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.fetchProcessorTypes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.fetchProcessorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.fetchProcessorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes fetchProcessorTypes without error using callback', async () => { @@ -458,15 +477,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.FetchProcessorTypesResponse() ); @@ -489,11 +505,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.fetchProcessorTypes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.fetchProcessorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.fetchProcessorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes fetchProcessorTypes with error', async () => { @@ -508,26 +527,26 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.fetchProcessorTypes = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.fetchProcessorTypes(request), expectedError); - assert( - (client.innerApiCalls.fetchProcessorTypes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.fetchProcessorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.fetchProcessorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes fetchProcessorTypes with closed client', async () => { @@ -542,7 +561,11 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.fetchProcessorTypes(request), expectedError); @@ -562,26 +585,26 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.GetProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.GetProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.Processor() ); client.innerApiCalls.getProcessor = stubSimpleCall(expectedResponse); const [response] = await client.getProcessor(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProcessor without error using callback', async () => { @@ -596,15 +619,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.GetProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.GetProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.Processor() ); @@ -627,11 +647,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProcessor with error', async () => { @@ -646,26 +669,26 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.GetProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.GetProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getProcessor = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getProcessor(request), expectedError); - assert( - (client.innerApiCalls.getProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProcessor with closed client', async () => { @@ -680,7 +703,11 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.GetProcessorRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.GetProcessorRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getProcessor(request), expectedError); @@ -700,15 +727,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.GetProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.GetProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessorVersion() ); @@ -716,11 +740,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.getProcessorVersion(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProcessorVersion without error using callback', async () => { @@ -735,15 +762,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.GetProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.GetProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessorVersion() ); @@ -766,11 +790,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProcessorVersion with error', async () => { @@ -785,26 +812,26 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.GetProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.GetProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getProcessorVersion = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getProcessorVersion(request), expectedError); - assert( - (client.innerApiCalls.getProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProcessorVersion with closed client', async () => { @@ -819,7 +846,11 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.GetProcessorVersionRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.GetProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getProcessorVersion(request), expectedError); @@ -839,26 +870,26 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.CreateProcessorRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.CreateProcessorRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.Processor() ); client.innerApiCalls.createProcessor = stubSimpleCall(expectedResponse); const [response] = await client.createProcessor(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createProcessor without error using callback', async () => { @@ -873,15 +904,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.CreateProcessorRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.CreateProcessorRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.Processor() ); @@ -904,11 +932,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createProcessor with error', async () => { @@ -923,26 +954,26 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.CreateProcessorRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.CreateProcessorRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createProcessor = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.createProcessor(request), expectedError); - assert( - (client.innerApiCalls.createProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createProcessor with closed client', async () => { @@ -957,7 +988,11 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.CreateProcessorRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.CreateProcessorRequest', + ['parent'] + ); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createProcessor(request), expectedError); @@ -977,15 +1012,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.BatchProcessRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.BatchProcessRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -994,11 +1026,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const [operation] = await client.batchProcessDocuments(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes batchProcessDocuments without error using callback', async () => { @@ -1013,15 +1048,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.BatchProcessRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.BatchProcessRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1051,11 +1083,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes batchProcessDocuments with call error', async () => { @@ -1070,15 +1105,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.BatchProcessRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.BatchProcessRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( undefined, @@ -1088,11 +1120,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { client.batchProcessDocuments(request), expectedError ); - assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes batchProcessDocuments with LRO error', async () => { @@ -1107,15 +1142,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.BatchProcessRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.BatchProcessRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( undefined, @@ -1124,11 +1156,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); const [operation] = await client.batchProcessDocuments(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkBatchProcessDocumentsProgress without error', async () => { @@ -1192,15 +1227,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1209,11 +1241,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const [operation] = await client.deleteProcessorVersion(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProcessorVersion without error using callback', async () => { @@ -1228,15 +1263,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1266,11 +1298,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProcessorVersion with call error', async () => { @@ -1285,15 +1320,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteProcessorVersion = stubLongRunningCall( undefined, @@ -1303,11 +1335,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { client.deleteProcessorVersion(request), expectedError ); - assert( - (client.innerApiCalls.deleteProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProcessorVersion with LRO error', async () => { @@ -1322,15 +1357,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteProcessorVersion = stubLongRunningCall( undefined, @@ -1339,11 +1371,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); const [operation] = await client.deleteProcessorVersion(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.deleteProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkDeleteProcessorVersionProgress without error', async () => { @@ -1407,15 +1442,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1424,11 +1456,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const [operation] = await client.deployProcessorVersion(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deployProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deployProcessorVersion without error using callback', async () => { @@ -1443,15 +1478,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1481,11 +1513,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deployProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deployProcessorVersion with call error', async () => { @@ -1500,15 +1535,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deployProcessorVersion = stubLongRunningCall( undefined, @@ -1518,11 +1550,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { client.deployProcessorVersion(request), expectedError ); - assert( - (client.innerApiCalls.deployProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deployProcessorVersion with LRO error', async () => { @@ -1537,15 +1572,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deployProcessorVersion = stubLongRunningCall( undefined, @@ -1554,11 +1586,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); const [operation] = await client.deployProcessorVersion(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.deployProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkDeployProcessorVersionProgress without error', async () => { @@ -1622,15 +1657,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1639,11 +1671,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const [operation] = await client.undeployProcessorVersion(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.undeployProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.undeployProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeployProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes undeployProcessorVersion without error using callback', async () => { @@ -1658,15 +1693,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1696,11 +1728,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.undeployProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.undeployProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeployProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes undeployProcessorVersion with call error', async () => { @@ -1715,15 +1750,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.undeployProcessorVersion = stubLongRunningCall( undefined, @@ -1733,11 +1765,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { client.undeployProcessorVersion(request), expectedError ); - assert( - (client.innerApiCalls.undeployProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.undeployProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeployProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes undeployProcessorVersion with LRO error', async () => { @@ -1752,15 +1787,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.undeployProcessorVersion = stubLongRunningCall( undefined, @@ -1769,11 +1801,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); const [operation] = await client.undeployProcessorVersion(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.undeployProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.undeployProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeployProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkUndeployProcessorVersionProgress without error', async () => { @@ -1838,15 +1873,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.DeleteProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeleteProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1855,11 +1887,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const [operation] = await client.deleteProcessor(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProcessor without error using callback', async () => { @@ -1874,15 +1909,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.DeleteProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeleteProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1912,11 +1944,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProcessor with call error', async () => { @@ -1931,26 +1966,26 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.DeleteProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeleteProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteProcessor = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.deleteProcessor(request), expectedError); - assert( - (client.innerApiCalls.deleteProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProcessor with LRO error', async () => { @@ -1965,15 +2000,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.DeleteProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeleteProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteProcessor = stubLongRunningCall( undefined, @@ -1982,11 +2014,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); const [operation] = await client.deleteProcessor(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.deleteProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkDeleteProcessorProgress without error', async () => { @@ -2050,15 +2085,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.EnableProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.EnableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -2067,11 +2099,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const [operation] = await client.enableProcessor(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.enableProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.enableProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.enableProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes enableProcessor without error using callback', async () => { @@ -2086,15 +2121,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.EnableProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.EnableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -2124,11 +2156,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.enableProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.enableProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.enableProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes enableProcessor with call error', async () => { @@ -2143,26 +2178,26 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.EnableProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.EnableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.enableProcessor = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.enableProcessor(request), expectedError); - assert( - (client.innerApiCalls.enableProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.enableProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.enableProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes enableProcessor with LRO error', async () => { @@ -2177,15 +2212,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.EnableProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.EnableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.enableProcessor = stubLongRunningCall( undefined, @@ -2194,11 +2226,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); const [operation] = await client.enableProcessor(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.enableProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.enableProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.enableProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkEnableProcessorProgress without error', async () => { @@ -2262,15 +2297,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.DisableProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DisableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -2279,11 +2311,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const [operation] = await client.disableProcessor(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.disableProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.disableProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.disableProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes disableProcessor without error using callback', async () => { @@ -2298,15 +2333,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.DisableProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DisableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -2336,11 +2368,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.disableProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.disableProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.disableProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes disableProcessor with call error', async () => { @@ -2355,26 +2390,26 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.DisableProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DisableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.disableProcessor = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.disableProcessor(request), expectedError); - assert( - (client.innerApiCalls.disableProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.disableProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.disableProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes disableProcessor with LRO error', async () => { @@ -2389,15 +2424,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.DisableProcessorRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DisableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.disableProcessor = stubLongRunningCall( undefined, @@ -2406,11 +2438,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); const [operation] = await client.disableProcessor(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.disableProcessor as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.disableProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.disableProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkDisableProcessorProgress without error', async () => { @@ -2474,15 +2509,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest() ); - request.processor = ''; - const expectedHeaderRequestParams = 'processor='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest', + ['processor'] + ); + request.processor = defaultValue1; + const expectedHeaderRequestParams = `processor=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -2491,11 +2523,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const [operation] = await client.setDefaultProcessorVersion(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setDefaultProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setDefaultProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setDefaultProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setDefaultProcessorVersion without error using callback', async () => { @@ -2510,15 +2545,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest() ); - request.processor = ''; - const expectedHeaderRequestParams = 'processor='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest', + ['processor'] + ); + request.processor = defaultValue1; + const expectedHeaderRequestParams = `processor=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -2548,11 +2580,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setDefaultProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.setDefaultProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setDefaultProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setDefaultProcessorVersion with call error', async () => { @@ -2567,15 +2602,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest() ); - request.processor = ''; - const expectedHeaderRequestParams = 'processor='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest', + ['processor'] + ); + request.processor = defaultValue1; + const expectedHeaderRequestParams = `processor=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.setDefaultProcessorVersion = stubLongRunningCall( undefined, @@ -2585,11 +2617,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { client.setDefaultProcessorVersion(request), expectedError ); - assert( - (client.innerApiCalls.setDefaultProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setDefaultProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setDefaultProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setDefaultProcessorVersion with LRO error', async () => { @@ -2604,15 +2639,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest() ); - request.processor = ''; - const expectedHeaderRequestParams = 'processor='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest', + ['processor'] + ); + request.processor = defaultValue1; + const expectedHeaderRequestParams = `processor=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.setDefaultProcessorVersion = stubLongRunningCall( undefined, @@ -2621,11 +2653,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); const [operation] = await client.setDefaultProcessorVersion(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.setDefaultProcessorVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setDefaultProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setDefaultProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkSetDefaultProcessorVersionProgress without error', async () => { @@ -2690,15 +2725,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ReviewDocumentRequest', + ['humanReviewConfig'] + ); + request.humanReviewConfig = defaultValue1; + const expectedHeaderRequestParams = `human_review_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -2707,11 +2739,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const [operation] = await client.reviewDocument(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.reviewDocument as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.reviewDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reviewDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes reviewDocument without error using callback', async () => { @@ -2726,15 +2761,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ReviewDocumentRequest', + ['humanReviewConfig'] + ); + request.humanReviewConfig = defaultValue1; + const expectedHeaderRequestParams = `human_review_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -2764,11 +2796,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.reviewDocument as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.reviewDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reviewDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes reviewDocument with call error', async () => { @@ -2783,26 +2818,26 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ReviewDocumentRequest', + ['humanReviewConfig'] + ); + request.humanReviewConfig = defaultValue1; + const expectedHeaderRequestParams = `human_review_config=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.reviewDocument = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.reviewDocument(request), expectedError); - assert( - (client.innerApiCalls.reviewDocument as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.reviewDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reviewDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes reviewDocument with LRO error', async () => { @@ -2817,15 +2852,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ReviewDocumentRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ReviewDocumentRequest', + ['humanReviewConfig'] + ); + request.humanReviewConfig = defaultValue1; + const expectedHeaderRequestParams = `human_review_config=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.reviewDocument = stubLongRunningCall( undefined, @@ -2834,11 +2866,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); const [operation] = await client.reviewDocument(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.reviewDocument as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.reviewDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reviewDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkReviewDocumentProgress without error', async () => { @@ -2902,15 +2937,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorTypesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessorType() @@ -2926,11 +2958,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.listProcessorTypes(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProcessorTypes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listProcessorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProcessorTypes without error using callback', async () => { @@ -2945,15 +2980,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorTypesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessorType() @@ -2986,11 +3018,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProcessorTypes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listProcessorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProcessorTypes with error', async () => { @@ -3005,26 +3040,26 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorTypesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listProcessorTypes = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listProcessorTypes(request), expectedError); - assert( - (client.innerApiCalls.listProcessorTypes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listProcessorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProcessorTypesStream without error', async () => { @@ -3039,8 +3074,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorTypesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessorType() @@ -3078,11 +3117,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listProcessorTypes, request) ); - assert.strictEqual( - ( - client.descriptors.page.listProcessorTypes.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProcessorTypes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -3098,8 +3138,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorTypesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listProcessorTypes.createStream = stubPageStreamingCall(undefined, expectedError); @@ -3126,11 +3170,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listProcessorTypes, request) ); - assert.strictEqual( - ( - client.descriptors.page.listProcessorTypes.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProcessorTypes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -3146,8 +3191,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorTypesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessorType() @@ -3174,11 +3223,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -3194,8 +3244,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorTypesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listProcessorTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -3213,11 +3267,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -3235,15 +3290,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1beta3.Processor() @@ -3258,11 +3310,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { client.innerApiCalls.listProcessors = stubSimpleCall(expectedResponse); const [response] = await client.listProcessors(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProcessors as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listProcessors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProcessors without error using callback', async () => { @@ -3277,15 +3332,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1beta3.Processor() @@ -3316,11 +3368,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProcessors as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listProcessors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProcessors with error', async () => { @@ -3335,26 +3390,26 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listProcessors = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listProcessors(request), expectedError); - assert( - (client.innerApiCalls.listProcessors as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listProcessors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProcessorsStream without error', async () => { @@ -3369,8 +3424,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1beta3.Processor() @@ -3408,11 +3467,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listProcessors, request) ); - assert.strictEqual( - ( - client.descriptors.page.listProcessors.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProcessors.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -3428,8 +3488,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listProcessors.createStream = stubPageStreamingCall(undefined, expectedError); @@ -3456,11 +3520,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listProcessors, request) ); - assert.strictEqual( - ( - client.descriptors.page.listProcessors.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProcessors.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -3476,8 +3541,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1beta3.Processor() @@ -3503,11 +3572,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listProcessors.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProcessors.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -3523,8 +3593,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listProcessors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -3542,11 +3616,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listProcessors.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProcessors.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -3564,15 +3639,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessorVersion() @@ -3588,11 +3660,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.listProcessorVersions(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProcessorVersions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listProcessorVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessorVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProcessorVersions without error using callback', async () => { @@ -3607,15 +3682,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessorVersion() @@ -3648,11 +3720,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProcessorVersions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listProcessorVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessorVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProcessorVersions with error', async () => { @@ -3667,15 +3742,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listProcessorVersions = stubSimpleCall( undefined, @@ -3685,11 +3757,14 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { client.listProcessorVersions(request), expectedError ); - assert( - (client.innerApiCalls.listProcessorVersions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listProcessorVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessorVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProcessorVersionsStream without error', async () => { @@ -3704,8 +3779,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessorVersion() @@ -3748,12 +3827,15 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listProcessorVersions, request) ); - assert.strictEqual( + assert( ( client.descriptors.page.listProcessorVersions .createStream 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 + ) ); }); @@ -3769,8 +3851,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listProcessorVersions.createStream = stubPageStreamingCall(undefined, expectedError); @@ -3802,12 +3888,15 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listProcessorVersions, request) ); - assert.strictEqual( + assert( ( client.descriptors.page.listProcessorVersions .createStream 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 + ) ); }); @@ -3823,8 +3912,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessorVersion() @@ -3852,12 +3945,15 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.descriptors.page.listProcessorVersions .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 + ) ); }); @@ -3873,8 +3969,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listProcessorVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -3893,12 +3993,15 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.descriptors.page.listProcessorVersions .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 + ) ); }); }); @@ -4061,12 +4164,15 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ).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 () => { @@ -4100,12 +4206,15 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ).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-documentai/test/gapic_document_understanding_service_v1beta1.ts b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts index bd1b6eba3cc..c1494ea8f35 100644 --- a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts +++ b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts @@ -25,6 +25,21 @@ import * as documentunderstandingserviceModule from '../src'; import {protobuf, LROperation, operationsProtos} 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 @@ -208,15 +223,12 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -225,11 +237,14 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { const [operation] = await client.batchProcessDocuments(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes batchProcessDocuments without error using callback', async () => { @@ -244,15 +259,12 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -282,11 +294,14 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes batchProcessDocuments with call error', async () => { @@ -301,15 +316,12 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( undefined, @@ -319,11 +331,14 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { client.batchProcessDocuments(request), expectedError ); - assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes batchProcessDocuments with LRO error', async () => { @@ -338,15 +353,12 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( undefined, @@ -355,11 +367,14 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { ); const [operation] = await client.batchProcessDocuments(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkBatchProcessDocumentsProgress without error', async () => { diff --git a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts index ff88e78d06e..1d81f5d0306 100644 --- a/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts +++ b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts @@ -25,6 +25,21 @@ import * as documentunderstandingserviceModule from '../src'; import {protobuf, LROperation, operationsProtos} 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 @@ -217,26 +232,26 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta2.ProcessDocumentRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta2.ProcessDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1beta2.Document() ); client.innerApiCalls.processDocument = stubSimpleCall(expectedResponse); const [response] = await client.processDocument(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.processDocument as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.processDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.processDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes processDocument without error using callback', async () => { @@ -251,15 +266,12 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta2.ProcessDocumentRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta2.ProcessDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.documentai.v1beta2.Document() ); @@ -282,11 +294,14 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.processDocument as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.processDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.processDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes processDocument with error', async () => { @@ -301,26 +316,26 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta2.ProcessDocumentRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta2.ProcessDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.processDocument = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.processDocument(request), expectedError); - assert( - (client.innerApiCalls.processDocument as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.processDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.processDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes processDocument with closed client', async () => { @@ -335,7 +350,11 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta2.ProcessDocumentRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta2.ProcessDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.processDocument(request), expectedError); @@ -355,15 +374,12 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -372,11 +388,14 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { const [operation] = await client.batchProcessDocuments(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes batchProcessDocuments without error using callback', async () => { @@ -391,15 +410,12 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -429,11 +445,14 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes batchProcessDocuments with call error', async () => { @@ -448,15 +467,12 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( undefined, @@ -466,11 +482,14 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { client.batchProcessDocuments(request), expectedError ); - assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes batchProcessDocuments with LRO error', async () => { @@ -485,15 +504,12 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( undefined, @@ -502,11 +518,14 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { ); const [operation] = await client.batchProcessDocuments(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchProcessDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkBatchProcessDocumentsProgress without error', async () => { From 506721083b2525123edb0fe922754d692df18ab8 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 22 Sep 2022 14:49:25 -0700 Subject: [PATCH 203/213] chore(main): release 6.0.0 (#347) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 6.0.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-documentai/CHANGELOG.md | 23 +++++++++++++++++++ packages/google-cloud-documentai/package.json | 2 +- ...t_metadata.google.cloud.documentai.v1.json | 2 +- ...adata.google.cloud.documentai.v1beta1.json | 2 +- ...adata.google.cloud.documentai.v1beta2.json | 2 +- ...adata.google.cloud.documentai.v1beta3.json | 2 +- .../samples/package.json | 2 +- 7 files changed, 29 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index 2ef0a0fb09f..d7a24367d7d 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog +## [6.0.0](https://github.com/googleapis/nodejs-document-ai/compare/v5.0.0...v6.0.0) (2022-09-22) + + +### ⚠ BREAKING CHANGES + +* Changed the name field for ProcessRequest and BatchProcessorRequest to accept * so the name field can accept Processor and ProcessorVersion. + +### Bug Fixes + +* Allow passing gax instance to client constructor ([#354](https://github.com/googleapis/nodejs-document-ai/issues/354)) ([bfa1e06](https://github.com/googleapis/nodejs-document-ai/commit/bfa1e0694cd8529b04175970cc08035ddf1692c4)) +* Better support for fallback mode ([#348](https://github.com/googleapis/nodejs-document-ai/issues/348)) ([ae5f1ae](https://github.com/googleapis/nodejs-document-ai/commit/ae5f1aef32f87c7a8ca6a1d4189bf12369d0259e)) +* Change import long to require ([#350](https://github.com/googleapis/nodejs-document-ai/issues/350)) ([ba282ff](https://github.com/googleapis/nodejs-document-ai/commit/ba282ff23872947ef2df2dffb31ff978f2a5a6d9)) +* **deps:** Update dependency uuid to v9 ([#356](https://github.com/googleapis/nodejs-document-ai/issues/356)) ([b465fd2](https://github.com/googleapis/nodejs-document-ai/commit/b465fd2088b9e9269e5b5f2b24aa64fd42bdfffb)) +* Do not import the whole google-gax from proto JS ([#1553](https://github.com/googleapis/nodejs-document-ai/issues/1553)) ([#353](https://github.com/googleapis/nodejs-document-ai/issues/353)) ([3e0beda](https://github.com/googleapis/nodejs-document-ai/commit/3e0beda24c8393e1b1b4e81b71a4ca95fee0056b)) +* Preserve default values in x-goog-request-params header ([#357](https://github.com/googleapis/nodejs-document-ai/issues/357)) ([17f61ed](https://github.com/googleapis/nodejs-document-ai/commit/17f61ed8fa6690845826987fb0f7471e289443b7)) +* Remove pip install statements ([#1546](https://github.com/googleapis/nodejs-document-ai/issues/1546)) ([#352](https://github.com/googleapis/nodejs-document-ai/issues/352)) ([0624e90](https://github.com/googleapis/nodejs-document-ai/commit/0624e90f6e5944f2ee41294fa1e39d5c0b9916c5)) +* use google-gax v3.3.0 ([3e0beda](https://github.com/googleapis/nodejs-document-ai/commit/3e0beda24c8393e1b1b4e81b71a4ca95fee0056b)) + + +### Miscellaneous Chores + +* Remove unused proto imports ([#345](https://github.com/googleapis/nodejs-document-ai/issues/345)) ([5da430e](https://github.com/googleapis/nodejs-document-ai/commit/5da430e28bbd1298db8cda588c896873b1614191)) + ## [5.0.0](https://github.com/googleapis/nodejs-document-ai/compare/v4.1.0...v5.0.0) (2022-08-12) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index b2c1e3e1930..71ea758a511 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "5.0.0", + "version": "6.0.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json index 245fbffc2e6..cf16eb5ab44 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json +++ b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-documentai", - "version": "5.0.0", + "version": "6.0.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json b/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json index 753d665edfa..630d58cf67a 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-documentai", - "version": "5.0.0", + "version": "6.0.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json b/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json index 8583d825470..5fde2a5a76c 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-documentai", - "version": "5.0.0", + "version": "6.0.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json index 8d3945829d4..c6292fde1d0 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-documentai", - "version": "5.0.0", + "version": "6.0.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index 2da3171d9cc..b9e3a955acd 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^5.0.0", + "@google-cloud/documentai": "^6.0.0", "@google-cloud/storage": "^6.0.0", "p-queue": "^6.6.2", "uuid": "^9.0.0" From 4492d7e185bf7bd9471def21e56141a89139d5db Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Thu, 3 Nov 2022 23:47:40 -0700 Subject: [PATCH 204/213] fix(deps): use google-gax v3.5.2 (#372) --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 71ea758a511..469bcee3ce9 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -27,7 +27,7 @@ "precompile": "gts clean" }, "dependencies": { - "google-gax": "^3.3.0" + "google-gax": "^3.5.2" }, "devDependencies": { "@types/mocha": "^9.0.0", From 5d351b24ee3648ddbf1d401416693897b7256fea Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 10 Nov 2022 10:28:22 +0100 Subject: [PATCH 205/213] chore(deps): update dependency jsdoc to v4 (#375) 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](https://togithub.com/jsdoc/jsdoc) | [`^3.6.3` -> `^4.0.0`](https://renovatebot.com/diffs/npm/jsdoc/3.6.11/4.0.0) | [![age](https://badges.renovateapi.com/packages/npm/jsdoc/4.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/jsdoc/4.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/jsdoc/4.0.0/compatibility-slim/3.6.11)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/jsdoc/4.0.0/confidence-slim/3.6.11)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
jsdoc/jsdoc ### [`v4.0.0`](https://togithub.com/jsdoc/jsdoc/blob/HEAD/CHANGES.md#​400-November-2022) [Compare Source](https://togithub.com/jsdoc/jsdoc/compare/3.6.11...084218523a7d69fec14a852ce680f374f526af28) - JSDoc releases now use [semantic versioning](https://semver.org/). If JSDoc makes backwards-incompatible changes in the future, the major version will be incremented. - JSDoc no longer uses the [`taffydb`](https://taffydb.com/) package. If your JSDoc template or plugin uses the `taffydb` package, see the [instructions for replacing `taffydb` with `@jsdoc/salty`](https://togithub.com/jsdoc/jsdoc/tree/main/packages/jsdoc-salty#use-salty-in-a-jsdoc-template). - JSDoc now supports Node.js 12.0.0 and later.
--- ### 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-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 469bcee3ce9..0e76d173f07 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -36,7 +36,7 @@ "c8": "^7.1.0", "chai": "^4.2.0", "gts": "^3.1.0", - "jsdoc": "^3.6.3", + "jsdoc": "^4.0.0", "jsdoc-fresh": "^2.0.0", "jsdoc-region-tag": "^2.0.0", "linkinator": "^4.0.0", From f13e84576339b07f4e9176aabefb8f39975dcb4b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 10 Nov 2022 10:22:16 +0000 Subject: [PATCH 206/213] fix: regenerated protos JS and TS definitions (#376) samples: pull in latest typeless bot, clean up some comments Source-Link: https://togithub.com/googleapis/synthtool/commit/0a68e568b6911b60bb6fd452eba4848b176031d8 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:5b05f26103855c3a15433141389c478d1d3fe088fb5d4e3217c4793f6b3f245e --- .../protos/protos.d.ts | 2 +- .../google-cloud-documentai/protos/protos.js | 348 +++++++++++++++--- 2 files changed, 305 insertions(+), 45 deletions(-) diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 403351b11c7..383050386aa 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/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-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 0bf01ebda64..e1286d21a73 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -3658,6 +3658,12 @@ message.boundingPoly = $root.google.cloud.documentai.v1.BoundingPoly.fromObject(object.boundingPoly); } switch (object.orientation) { + default: + if (typeof object.orientation === "number") { + message.orientation = object.orientation; + break; + } + break; case "ORIENTATION_UNSPECIFIED": case 0: message.orientation = 0; @@ -3708,7 +3714,7 @@ if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) object.boundingPoly = $root.google.cloud.documentai.v1.BoundingPoly.toObject(message.boundingPoly, options); if (message.orientation != null && message.hasOwnProperty("orientation")) - object.orientation = options.enums === String ? $root.google.cloud.documentai.v1.Document.Page.Layout.Orientation[message.orientation] : message.orientation; + object.orientation = options.enums === String ? $root.google.cloud.documentai.v1.Document.Page.Layout.Orientation[message.orientation] === undefined ? message.orientation : $root.google.cloud.documentai.v1.Document.Page.Layout.Orientation[message.orientation] : message.orientation; return object; }; @@ -5071,6 +5077,12 @@ return object; var message = new $root.google.cloud.documentai.v1.Document.Page.Token.DetectedBreak(); switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; case "TYPE_UNSPECIFIED": case 0: message.type = 0; @@ -5107,7 +5119,7 @@ if (options.defaults) object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type[message.type] : message.type; + object.type = options.enums === String ? $root.google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type[message.type] === undefined ? message.type : $root.google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type[message.type] : message.type; return object; }; @@ -9585,6 +9597,12 @@ else if (typeof object.page === "object") message.page = new $util.LongBits(object.page.low >>> 0, object.page.high >>> 0).toNumber(); switch (object.layoutType) { + default: + if (typeof object.layoutType === "number") { + message.layoutType = object.layoutType; + break; + } + break; case "LAYOUT_TYPE_UNSPECIFIED": case 0: message.layoutType = 0; @@ -9660,7 +9678,7 @@ else object.page = options.longs === String ? $util.Long.prototype.toString.call(message.page) : options.longs === Number ? new $util.LongBits(message.page.low >>> 0, message.page.high >>> 0).toNumber() : message.page; if (message.layoutType != null && message.hasOwnProperty("layoutType")) - object.layoutType = options.enums === String ? $root.google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType[message.layoutType] : message.layoutType; + object.layoutType = options.enums === String ? $root.google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType[message.layoutType] === undefined ? message.layoutType : $root.google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType[message.layoutType] : message.layoutType; if (message.layoutId != null && message.hasOwnProperty("layoutId")) object.layoutId = message.layoutId; if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) @@ -9966,6 +9984,12 @@ } } switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; case "OPERATION_TYPE_UNSPECIFIED": case 0: message.type = 0; @@ -10028,7 +10052,7 @@ object.parents[j] = $root.google.cloud.documentai.v1.Document.Provenance.Parent.toObject(message.parents[j], options); } if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.documentai.v1.Document.Provenance.OperationType[message.type] : message.type; + object.type = options.enums === String ? $root.google.cloud.documentai.v1.Document.Provenance.OperationType[message.type] === undefined ? message.type : $root.google.cloud.documentai.v1.Document.Provenance.OperationType[message.type] : message.type; return object; }; @@ -14694,6 +14718,12 @@ return object; var message = new $root.google.cloud.documentai.v1.HumanReviewStatus(); switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -14741,7 +14771,7 @@ object.humanReviewOperation = ""; } if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1.HumanReviewStatus.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.documentai.v1.HumanReviewStatus.State[message.state] === undefined ? message.state : $root.google.cloud.documentai.v1.HumanReviewStatus.State[message.state] : message.state; if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) object.stateMessage = message.stateMessage; if (message.humanReviewOperation != null && message.hasOwnProperty("humanReviewOperation")) @@ -15739,6 +15769,12 @@ return object; var message = new $root.google.cloud.documentai.v1.BatchProcessMetadata(); switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -15815,7 +15851,7 @@ object.updateTime = null; } if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1.BatchProcessMetadata.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.documentai.v1.BatchProcessMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.documentai.v1.BatchProcessMetadata.State[message.state] : message.state; if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) object.stateMessage = message.stateMessage; if (message.createTime != null && message.hasOwnProperty("createTime")) @@ -22759,6 +22795,12 @@ if (object.enableSchemaValidation != null) message.enableSchemaValidation = Boolean(object.enableSchemaValidation); switch (object.priority) { + default: + if (typeof object.priority === "number") { + message.priority = object.priority; + break; + } + break; case "DEFAULT": case 0: message.priority = 0; @@ -22805,7 +22847,7 @@ object.source = "inlineDocument"; } if (message.priority != null && message.hasOwnProperty("priority")) - object.priority = options.enums === String ? $root.google.cloud.documentai.v1.ReviewDocumentRequest.Priority[message.priority] : message.priority; + object.priority = options.enums === String ? $root.google.cloud.documentai.v1.ReviewDocumentRequest.Priority[message.priority] === undefined ? message.priority : $root.google.cloud.documentai.v1.ReviewDocumentRequest.Priority[message.priority] : message.priority; if (message.documentSchema != null && message.hasOwnProperty("documentSchema")) object.documentSchema = $root.google.cloud.documentai.v1.DocumentSchema.toObject(message.documentSchema, options); return object; @@ -23048,6 +23090,12 @@ if (object.gcsDestination != null) message.gcsDestination = String(object.gcsDestination); switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -23087,7 +23135,7 @@ if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) object.gcsDestination = message.gcsDestination; if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1.ReviewDocumentResponse.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.documentai.v1.ReviewDocumentResponse.State[message.state] === undefined ? message.state : $root.google.cloud.documentai.v1.ReviewDocumentResponse.State[message.state] : message.state; if (message.rejectionReason != null && message.hasOwnProperty("rejectionReason")) object.rejectionReason = message.rejectionReason; return object; @@ -24441,6 +24489,12 @@ if (object.valueType != null) message.valueType = String(object.valueType); switch (object.occurrenceType) { + default: + if (typeof object.occurrenceType === "number") { + message.occurrenceType = object.occurrenceType; + break; + } + break; case "OCCURRENCE_TYPE_UNSPECIFIED": case 0: message.occurrenceType = 0; @@ -24488,7 +24542,7 @@ if (message.valueType != null && message.hasOwnProperty("valueType")) object.valueType = message.valueType; if (message.occurrenceType != null && message.hasOwnProperty("occurrenceType")) - object.occurrenceType = options.enums === String ? $root.google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType[message.occurrenceType] : message.occurrenceType; + object.occurrenceType = options.enums === String ? $root.google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType[message.occurrenceType] === undefined ? message.occurrenceType : $root.google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType[message.occurrenceType] : message.occurrenceType; return object; }; @@ -25055,6 +25109,12 @@ return object; var message = new $root.google.cloud.documentai.v1.CommonOperationMetadata(); switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -25118,7 +25178,7 @@ object.resource = ""; } if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1.CommonOperationMetadata.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.documentai.v1.CommonOperationMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.documentai.v1.CommonOperationMetadata.State[message.state] : message.state; if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) object.stateMessage = message.stateMessage; if (message.createTime != null && message.hasOwnProperty("createTime")) @@ -25476,6 +25536,12 @@ if (object.displayName != null) message.displayName = String(object.displayName); switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -25556,7 +25622,7 @@ if (message.displayName != null && message.hasOwnProperty("displayName")) object.displayName = message.displayName; if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1.ProcessorVersion.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.documentai.v1.ProcessorVersion.State[message.state] === undefined ? message.state : $root.google.cloud.documentai.v1.ProcessorVersion.State[message.state] : message.state; if (message.createTime != null && message.hasOwnProperty("createTime")) object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) @@ -26152,6 +26218,12 @@ if (object.displayName != null) message.displayName = String(object.displayName); switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -26229,7 +26301,7 @@ if (message.displayName != null && message.hasOwnProperty("displayName")) object.displayName = message.displayName; if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1.Processor.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.documentai.v1.Processor.State[message.state] === undefined ? message.state : $root.google.cloud.documentai.v1.Processor.State[message.state] : message.state; if (message.processEndpoint != null && message.hasOwnProperty("processEndpoint")) object.processEndpoint = message.processEndpoint; if (message.createTime != null && message.hasOwnProperty("createTime")) @@ -26575,6 +26647,12 @@ if (object.allowCreation != null) message.allowCreation = Boolean(object.allowCreation); switch (object.launchStage) { + default: + if (typeof object.launchStage === "number") { + message.launchStage = object.launchStage; + break; + } + break; case "LAUNCH_STAGE_UNSPECIFIED": case 0: message.launchStage = 0; @@ -26647,7 +26725,7 @@ if (message.allowCreation != null && message.hasOwnProperty("allowCreation")) object.allowCreation = message.allowCreation; if (message.launchStage != null && message.hasOwnProperty("launchStage")) - object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] : message.launchStage; + object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] === undefined ? message.launchStage : $root.google.api.LaunchStage[message.launchStage] : message.launchStage; return object; }; @@ -29397,6 +29475,12 @@ message.boundingPoly = $root.google.cloud.documentai.v1beta1.BoundingPoly.fromObject(object.boundingPoly); } switch (object.orientation) { + default: + if (typeof object.orientation === "number") { + message.orientation = object.orientation; + break; + } + break; case "ORIENTATION_UNSPECIFIED": case 0: message.orientation = 0; @@ -29447,7 +29531,7 @@ if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) object.boundingPoly = $root.google.cloud.documentai.v1beta1.BoundingPoly.toObject(message.boundingPoly, options); if (message.orientation != null && message.hasOwnProperty("orientation")) - object.orientation = options.enums === String ? $root.google.cloud.documentai.v1beta1.Document.Page.Layout.Orientation[message.orientation] : message.orientation; + object.orientation = options.enums === String ? $root.google.cloud.documentai.v1beta1.Document.Page.Layout.Orientation[message.orientation] === undefined ? message.orientation : $root.google.cloud.documentai.v1beta1.Document.Page.Layout.Orientation[message.orientation] : message.orientation; return object; }; @@ -30695,6 +30779,12 @@ return object; var message = new $root.google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak(); switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; case "TYPE_UNSPECIFIED": case 0: message.type = 0; @@ -30731,7 +30821,7 @@ if (options.defaults) object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.Type[message.type] : message.type; + object.type = options.enums === String ? $root.google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.Type[message.type] === undefined ? message.type : $root.google.cloud.documentai.v1beta1.Document.Page.Token.DetectedBreak.Type[message.type] : message.type; return object; }; @@ -37998,6 +38088,12 @@ return object; var message = new $root.google.cloud.documentai.v1beta1.OperationMetadata(); switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -38062,7 +38158,7 @@ object.updateTime = null; } if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1beta1.OperationMetadata.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta1.OperationMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.documentai.v1beta1.OperationMetadata.State[message.state] : message.state; if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) object.stateMessage = message.stateMessage; if (message.createTime != null && message.hasOwnProperty("createTime")) @@ -40970,6 +41066,12 @@ message.boundingPoly = $root.google.cloud.documentai.v1beta2.BoundingPoly.fromObject(object.boundingPoly); } switch (object.orientation) { + default: + if (typeof object.orientation === "number") { + message.orientation = object.orientation; + break; + } + break; case "ORIENTATION_UNSPECIFIED": case 0: message.orientation = 0; @@ -41023,7 +41125,7 @@ if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) object.boundingPoly = $root.google.cloud.documentai.v1beta2.BoundingPoly.toObject(message.boundingPoly, options); if (message.orientation != null && message.hasOwnProperty("orientation")) - object.orientation = options.enums === String ? $root.google.cloud.documentai.v1beta2.Document.Page.Layout.Orientation[message.orientation] : message.orientation; + object.orientation = options.enums === String ? $root.google.cloud.documentai.v1beta2.Document.Page.Layout.Orientation[message.orientation] === undefined ? message.orientation : $root.google.cloud.documentai.v1beta2.Document.Page.Layout.Orientation[message.orientation] : message.orientation; if (message.id != null && message.hasOwnProperty("id")) object.id = message.id; return object; @@ -42273,6 +42375,12 @@ return object; var message = new $root.google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak(); switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; case "TYPE_UNSPECIFIED": case 0: message.type = 0; @@ -42309,7 +42417,7 @@ if (options.defaults) object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.Type[message.type] : message.type; + object.type = options.enums === String ? $root.google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.Type[message.type] === undefined ? message.type : $root.google.cloud.documentai.v1beta2.Document.Page.Token.DetectedBreak.Type[message.type] : message.type; return object; }; @@ -45664,6 +45772,12 @@ else if (typeof object.page === "object") message.page = new $util.LongBits(object.page.low >>> 0, object.page.high >>> 0).toNumber(); switch (object.layoutType) { + default: + if (typeof object.layoutType === "number") { + message.layoutType = object.layoutType; + break; + } + break; case "LAYOUT_TYPE_UNSPECIFIED": case 0: message.layoutType = 0; @@ -45730,7 +45844,7 @@ else object.page = options.longs === String ? $util.Long.prototype.toString.call(message.page) : options.longs === Number ? new $util.LongBits(message.page.low >>> 0, message.page.high >>> 0).toNumber() : message.page; if (message.layoutType != null && message.hasOwnProperty("layoutType")) - object.layoutType = options.enums === String ? $root.google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.LayoutType[message.layoutType] : message.layoutType; + object.layoutType = options.enums === String ? $root.google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.LayoutType[message.layoutType] === undefined ? message.layoutType : $root.google.cloud.documentai.v1beta2.Document.PageAnchor.PageRef.LayoutType[message.layoutType] : message.layoutType; if (message.layoutId != null && message.hasOwnProperty("layoutId")) object.layoutId = message.layoutId; return object; @@ -50619,6 +50733,12 @@ return object; var message = new $root.google.cloud.documentai.v1beta2.OperationMetadata(); switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -50683,7 +50803,7 @@ object.updateTime = null; } if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1beta2.OperationMetadata.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta2.OperationMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.documentai.v1beta2.OperationMetadata.State[message.state] : message.state; if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) object.stateMessage = message.stateMessage; if (message.createTime != null && message.hasOwnProperty("createTime")) @@ -54350,6 +54470,12 @@ message.boundingPoly = $root.google.cloud.documentai.v1beta3.BoundingPoly.fromObject(object.boundingPoly); } switch (object.orientation) { + default: + if (typeof object.orientation === "number") { + message.orientation = object.orientation; + break; + } + break; case "ORIENTATION_UNSPECIFIED": case 0: message.orientation = 0; @@ -54400,7 +54526,7 @@ if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) object.boundingPoly = $root.google.cloud.documentai.v1beta3.BoundingPoly.toObject(message.boundingPoly, options); if (message.orientation != null && message.hasOwnProperty("orientation")) - object.orientation = options.enums === String ? $root.google.cloud.documentai.v1beta3.Document.Page.Layout.Orientation[message.orientation] : message.orientation; + object.orientation = options.enums === String ? $root.google.cloud.documentai.v1beta3.Document.Page.Layout.Orientation[message.orientation] === undefined ? message.orientation : $root.google.cloud.documentai.v1beta3.Document.Page.Layout.Orientation[message.orientation] : message.orientation; return object; }; @@ -55763,6 +55889,12 @@ return object; var message = new $root.google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak(); switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; case "TYPE_UNSPECIFIED": case 0: message.type = 0; @@ -55799,7 +55931,7 @@ if (options.defaults) object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.Type[message.type] : message.type; + object.type = options.enums === String ? $root.google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.Type[message.type] === undefined ? message.type : $root.google.cloud.documentai.v1beta3.Document.Page.Token.DetectedBreak.Type[message.type] : message.type; return object; }; @@ -60277,6 +60409,12 @@ else if (typeof object.page === "object") message.page = new $util.LongBits(object.page.low >>> 0, object.page.high >>> 0).toNumber(); switch (object.layoutType) { + default: + if (typeof object.layoutType === "number") { + message.layoutType = object.layoutType; + break; + } + break; case "LAYOUT_TYPE_UNSPECIFIED": case 0: message.layoutType = 0; @@ -60352,7 +60490,7 @@ else object.page = options.longs === String ? $util.Long.prototype.toString.call(message.page) : options.longs === Number ? new $util.LongBits(message.page.low >>> 0, message.page.high >>> 0).toNumber() : message.page; if (message.layoutType != null && message.hasOwnProperty("layoutType")) - object.layoutType = options.enums === String ? $root.google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.LayoutType[message.layoutType] : message.layoutType; + object.layoutType = options.enums === String ? $root.google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.LayoutType[message.layoutType] === undefined ? message.layoutType : $root.google.cloud.documentai.v1beta3.Document.PageAnchor.PageRef.LayoutType[message.layoutType] : message.layoutType; if (message.layoutId != null && message.hasOwnProperty("layoutId")) object.layoutId = message.layoutId; if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) @@ -60658,6 +60796,12 @@ } } switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; case "OPERATION_TYPE_UNSPECIFIED": case 0: message.type = 0; @@ -60720,7 +60864,7 @@ object.parents[j] = $root.google.cloud.documentai.v1beta3.Document.Provenance.Parent.toObject(message.parents[j], options); } if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.documentai.v1beta3.Document.Provenance.OperationType[message.type] : message.type; + object.type = options.enums === String ? $root.google.cloud.documentai.v1beta3.Document.Provenance.OperationType[message.type] === undefined ? message.type : $root.google.cloud.documentai.v1beta3.Document.Provenance.OperationType[message.type] : message.type; return object; }; @@ -65414,6 +65558,12 @@ return object; var message = new $root.google.cloud.documentai.v1beta3.HumanReviewStatus(); switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -65461,7 +65611,7 @@ object.humanReviewOperation = ""; } if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.HumanReviewStatus.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.HumanReviewStatus.State[message.state] === undefined ? message.state : $root.google.cloud.documentai.v1beta3.HumanReviewStatus.State[message.state] : message.state; if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) object.stateMessage = message.stateMessage; if (message.humanReviewOperation != null && message.hasOwnProperty("humanReviewOperation")) @@ -66985,6 +67135,12 @@ return object; var message = new $root.google.cloud.documentai.v1beta3.BatchProcessMetadata(); switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -67061,7 +67217,7 @@ object.updateTime = null; } if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.BatchProcessMetadata.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.BatchProcessMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.documentai.v1beta3.BatchProcessMetadata.State[message.state] : message.state; if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) object.stateMessage = message.stateMessage; if (message.createTime != null && message.hasOwnProperty("createTime")) @@ -74053,6 +74209,12 @@ if (object.enableSchemaValidation != null) message.enableSchemaValidation = Boolean(object.enableSchemaValidation); switch (object.priority) { + default: + if (typeof object.priority === "number") { + message.priority = object.priority; + break; + } + break; case "DEFAULT": case 0: message.priority = 0; @@ -74102,7 +74264,7 @@ object.source = "inlineDocument"; } if (message.priority != null && message.hasOwnProperty("priority")) - object.priority = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority[message.priority] : message.priority; + object.priority = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority[message.priority] === undefined ? message.priority : $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority[message.priority] : message.priority; if (message.documentSchema != null && message.hasOwnProperty("documentSchema")) object.documentSchema = $root.google.cloud.documentai.v1beta3.DocumentSchema.toObject(message.documentSchema, options); return object; @@ -74345,6 +74507,12 @@ if (object.gcsDestination != null) message.gcsDestination = String(object.gcsDestination); switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -74384,7 +74552,7 @@ if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) object.gcsDestination = message.gcsDestination; if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse.State[message.state] === undefined ? message.state : $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse.State[message.state] : message.state; if (message.rejectionReason != null && message.hasOwnProperty("rejectionReason")) object.rejectionReason = message.rejectionReason; return object; @@ -74690,6 +74858,12 @@ return object; var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata(); switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -74759,7 +74933,7 @@ object.questionId = ""; } if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State[message.state] : message.state; if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) object.stateMessage = message.stateMessage; if (message.createTime != null && message.hasOwnProperty("createTime")) @@ -75895,6 +76069,12 @@ if (object.valueType != null) message.valueType = String(object.valueType); switch (object.occurrenceType) { + default: + if (typeof object.occurrenceType === "number") { + message.occurrenceType = object.occurrenceType; + break; + } + break; case "OCCURRENCE_TYPE_UNSPECIFIED": case 0: message.occurrenceType = 0; @@ -75942,7 +76122,7 @@ if (message.valueType != null && message.hasOwnProperty("valueType")) object.valueType = message.valueType; if (message.occurrenceType != null && message.hasOwnProperty("occurrenceType")) - object.occurrenceType = options.enums === String ? $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType[message.occurrenceType] : message.occurrenceType; + object.occurrenceType = options.enums === String ? $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType[message.occurrenceType] === undefined ? message.occurrenceType : $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType[message.occurrenceType] : message.occurrenceType; return object; }; @@ -76509,6 +76689,12 @@ return object; var message = new $root.google.cloud.documentai.v1beta3.CommonOperationMetadata(); switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -76572,7 +76758,7 @@ object.resource = ""; } if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.State[message.state] : message.state; if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) object.stateMessage = message.stateMessage; if (message.createTime != null && message.hasOwnProperty("createTime")) @@ -76930,6 +77116,12 @@ if (object.displayName != null) message.displayName = String(object.displayName); switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -77010,7 +77202,7 @@ if (message.displayName != null && message.hasOwnProperty("displayName")) object.displayName = message.displayName; if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.ProcessorVersion.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.ProcessorVersion.State[message.state] === undefined ? message.state : $root.google.cloud.documentai.v1beta3.ProcessorVersion.State[message.state] : message.state; if (message.createTime != null && message.hasOwnProperty("createTime")) object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) @@ -77606,6 +77798,12 @@ if (object.displayName != null) message.displayName = String(object.displayName); switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -77683,7 +77881,7 @@ if (message.displayName != null && message.hasOwnProperty("displayName")) object.displayName = message.displayName; if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.Processor.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.Processor.State[message.state] === undefined ? message.state : $root.google.cloud.documentai.v1beta3.Processor.State[message.state] : message.state; if (message.processEndpoint != null && message.hasOwnProperty("processEndpoint")) object.processEndpoint = message.processEndpoint; if (message.createTime != null && message.hasOwnProperty("createTime")) @@ -78029,6 +78227,12 @@ if (object.allowCreation != null) message.allowCreation = Boolean(object.allowCreation); switch (object.launchStage) { + default: + if (typeof object.launchStage === "number") { + message.launchStage = object.launchStage; + break; + } + break; case "LAUNCH_STAGE_UNSPECIFIED": case 0: message.launchStage = 0; @@ -78101,7 +78305,7 @@ if (message.allowCreation != null && message.hasOwnProperty("allowCreation")) object.allowCreation = message.allowCreation; if (message.launchStage != null && message.hasOwnProperty("launchStage")) - object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] : message.launchStage; + object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] === undefined ? message.launchStage : $root.google.api.LaunchStage[message.launchStage] : message.launchStage; return object; }; @@ -79648,6 +79852,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; @@ -79672,6 +79882,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; @@ -79719,7 +79933,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")) @@ -79727,7 +79941,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; }; @@ -82564,6 +82778,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; @@ -82578,6 +82798,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; @@ -82704,9 +82930,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")) @@ -85053,6 +85279,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; @@ -85161,7 +85393,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")) @@ -85963,6 +86195,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; @@ -85979,6 +86217,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; @@ -86017,6 +86261,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; @@ -86087,7 +86335,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")) @@ -86095,7 +86343,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")) @@ -86108,7 +86356,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); @@ -87485,6 +87733,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; @@ -87554,7 +87808,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) @@ -89309,6 +89563,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; @@ -89358,7 +89618,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; }; From 85067bc56f6db6b0298b22b22152e08e8420755d Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 10 Nov 2022 13:58:17 +0100 Subject: [PATCH 207/213] chore(deps): update dependency @types/node to v18 (#370) 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-document-ai). --- packages/google-cloud-documentai/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index 0e76d173f07..b346c908fe2 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -31,7 +31,7 @@ }, "devDependencies": { "@types/mocha": "^9.0.0", - "@types/node": "^16.0.0", + "@types/node": "^18.0.0", "@types/sinon": "^10.0.0", "c8": "^7.1.0", "chai": "^4.2.0", From 4a45623e119013d27d07075e9fab7b6f15fe3666 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 11 Nov 2022 01:48:17 +0000 Subject: [PATCH 208/213] feat: added font_family to document.proto (#377) - [ ] Regenerate this pull request now. feat: added ImageQualityScores message to document.proto feat: added PropertyMetadata and EntityTypeMetadata to document_schema.proto PiperOrigin-RevId: 486975621 Source-Link: https://togithub.com/googleapis/googleapis/commit/398c9f9fccf4dea8d12e0b5a90ed671dec2ee387 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/7cd1f5f4e435777cb824af268dc8d37134613e6a Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiN2NkMWY1ZjRlNDM1Nzc3Y2I4MjRhZjI2OGRjOGQzNzEzNDYxM2U2YSJ9 --- .../google/cloud/documentai/v1/barcode.proto | 56 +- .../google/cloud/documentai/v1/document.proto | 72 +- .../cloud/documentai/v1/document_io.proto | 11 +- .../v1/document_processor_service.proto | 2 + .../cloud/documentai/v1/document_schema.proto | 7 +- .../cloud/documentai/v1/processor.proto | 14 +- .../cloud/documentai/v1/processor_type.proto | 4 +- .../protos/protos.d.ts | 371 +++++-- .../google-cloud-documentai/protos/protos.js | 916 +++++++++++++++--- .../protos/protos.json | 83 +- ...ment_processor_service.process_document.js | 2 + ...t_metadata.google.cloud.documentai.v1.json | 2 +- .../v1/document_processor_service_client.ts | 2 + 13 files changed, 1258 insertions(+), 284 deletions(-) diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/barcode.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/barcode.proto index 28e588d6c6e..bb841771ade 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/barcode.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/barcode.proto @@ -28,40 +28,42 @@ option ruby_package = "Google::Cloud::DocumentAI::V1"; message Barcode { // Format of a barcode. // The supported formats are: - // CODE_128: Code 128 type. - // CODE_39: Code 39 type. - // CODE_93: Code 93 type. - // CODABAR: Codabar type. - // DATA_MATRIX: 2D Data Matrix type. - // ITF: ITF type. - // EAN_13: EAN-13 type. - // EAN_8: EAN-8 type. - // QR_CODE: 2D QR code type. - // UPC_A: UPC-A type. - // UPC_E: UPC-E type. - // PDF417: PDF417 type. - // AZTEC: 2D Aztec code type. - // DATABAR: GS1 DataBar code type. + // + // - `CODE_128`: Code 128 type. + // - `CODE_39`: Code 39 type. + // - `CODE_93`: Code 93 type. + // - `CODABAR`: Codabar type. + // - `DATA_MATRIX`: 2D Data Matrix type. + // - `ITF`: ITF type. + // - `EAN_13`: EAN-13 type. + // - `EAN_8`: EAN-8 type. + // - `QR_CODE`: 2D QR code type. + // - `UPC_A`: UPC-A type. + // - `UPC_E`: UPC-E type. + // - `PDF417`: PDF417 type. + // - `AZTEC`: 2D Aztec code type. + // - `DATABAR`: GS1 DataBar code type. string format = 1; // Value format describes the format of the value that a barcode // encodes. // The supported formats are: - // CONTACT_INFO: Contact information. - // EMAIL: Email address. - // ISBN: ISBN identifier. - // PHONE: Phone number. - // PRODUCT: Product. - // SMS: SMS message. - // TEXT: Text string. - // URL: URL address. - // WIFI: Wifi information. - // GEO: Geo-localization. - // CALENDAR_EVENT: Calendar event. - // DRIVER_LICENSE: Driver's license. + // + // - `CONTACT_INFO`: Contact information. + // - `EMAIL`: Email address. + // - `ISBN`: ISBN identifier. + // - `PHONE`: Phone number. + // - `PRODUCT`: Product. + // - `SMS`: SMS message. + // - `TEXT`: Text string. + // - `URL`: URL address. + // - `WIFI`: Wifi information. + // - `GEO`: Geo-localization. + // - `CALENDAR_EVENT`: Calendar event. + // - `DRIVER_LICENSE`: Driver's license. string value_format = 2; // Raw value encoded in the barcode. - // For example, 'MEBKM:TITLE:Google;URL:https://www.google.com;;'. + // For example: `'MEBKM:TITLE:Google;URL:https://www.google.com;;'`. string raw_value = 3; } diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto index d8bbf6b574d..c4fbb21ceca 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto @@ -91,6 +91,10 @@ message Document { // Font size. FontSize font_size = 7; + + // Font family such as `Arial`, `Times New Roman`. + // https://www.w3schools.com/cssref/pr_font_font-family.asp + string font_family = 8; } // A page in a [Document][google.cloud.documentai.v1.Document]. @@ -169,7 +173,7 @@ message Document { // Confidence of the current [Layout][google.cloud.documentai.v1.Document.Page.Layout] within context of the object this // layout is for. e.g. confidence can be for a single token, a table, - // a visual element, etc. depending on context. Range [0, 1]. + // a visual element, etc. depending on context. Range `[0, 1]`. float confidence = 2; // The bounding polygon for the [Layout][google.cloud.documentai.v1.Document.Page.Layout]. @@ -189,7 +193,7 @@ message Document { repeated DetectedLanguage detected_languages = 2; // The history of this annotation. - Provenance provenance = 3; + Provenance provenance = 3 [deprecated = true]; } // A collection of lines that a human would perceive as a paragraph. @@ -201,7 +205,7 @@ message Document { repeated DetectedLanguage detected_languages = 2; // The history of this annotation. - Provenance provenance = 3; + Provenance provenance = 3 [deprecated = true]; } // A collection of tokens that a human would perceive as a line. @@ -214,7 +218,7 @@ message Document { repeated DetectedLanguage detected_languages = 2; // The history of this annotation. - Provenance provenance = 3; + Provenance provenance = 3 [deprecated = true]; } // A detected token. @@ -249,8 +253,8 @@ message Document { // A list of detected languages together with confidence. repeated DetectedLanguage detected_languages = 3; - // The history of this annotation. - Provenance provenance = 4; + // The history of this annotation. + Provenance provenance = 4 [deprecated = true]; } // A detected symbol. @@ -309,6 +313,9 @@ message Document { // A list of detected languages together with confidence. repeated DetectedLanguage detected_languages = 4; + + // The history of this table. + Provenance provenance = 5; } // A form field detected on the page. @@ -358,15 +365,43 @@ message Document { // Detected language for a structural component. message DetectedLanguage { - // The BCP-47 language code, such as "en-US" or "sr-Latn". For more + // The BCP-47 language code, such as `en-US` or `sr-Latn`. For more // information, see // https://www.unicode.org/reports/tr35/#Unicode_locale_identifier. string language_code = 1; - // Confidence of detected language. Range [0, 1]. + // Confidence of detected language. Range `[0, 1]`. float confidence = 2; } + // Image Quality Scores for the page image + message ImageQualityScores { + // Image Quality Defects + message DetectedDefect { + // Name of the defect type. Supported values are: + // + // - `quality/defect_blurry` + // - `quality/defect_noisy` + // - `quality/defect_dark` + // - `quality/defect_faint` + // - `quality/defect_text_too_small` + // - `quality/defect_document_cutoff` + // - `quality/defect_text_cutoff` + // - `quality/defect_glare` + string type = 1; + + // Confidence of detected defect. Range `[0, 1]` where 1 indicates + // strong confidence of that the defect exists. + float confidence = 2; + } + + // The overall quality score. Range `[0, 1]` where 1 is perfect quality. + float quality_score = 1; + + // A list of detected defects. + repeated DetectedDefect detected_defects = 2; + } + // 1-based index for current [Page][google.cloud.documentai.v1.Document.Page] in a parent [Document][google.cloud.documentai.v1.Document]. // Useful when a page is taken out of a [Document][google.cloud.documentai.v1.Document] for individual // processing. @@ -422,8 +457,11 @@ message Document { // A list of detected barcodes. repeated DetectedBarcode detected_barcodes = 15; + // Image Quality Scores. + ImageQualityScores image_quality_scores = 17; + // The history of this page. - Provenance provenance = 16; + Provenance provenance = 16 [deprecated = true]; } // An entity that could be a phrase in the text or a property that belongs to @@ -471,6 +509,7 @@ message Document { // or int normalized text by default. // // Below are sample formats mapped to structured values. + // // - Money/Currency type (`money_value`) is in the ISO 4217 text format. // - Date type (`date_value`) is in the ISO 8601 text format. // - Datetime type (`datetime_value`) is in the ISO 8601 text format. @@ -484,14 +523,13 @@ message Document { // Required. Entity type from a schema e.g. `Address`. string type = 2 [(google.api.field_behavior) = REQUIRED]; - // Optional. Text value in the document e.g. `1600 Amphitheatre Pkwy`. If the entity - // is not present in the document, this field will be empty. + // Optional. Text value of the entity e.g. `1600 Amphitheatre Pkwy`. string mention_text = 3 [(google.api.field_behavior) = OPTIONAL]; // Optional. Deprecated. Use `id` field instead. string mention_id = 4 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Confidence of detected Schema entity. Range [0, 1]. + // Optional. Confidence of detected Schema entity. Range `[0, 1]`. float confidence = 5 [(google.api.field_behavior) = OPTIONAL]; // Optional. Represents the provenance of this entity wrt. the location on the @@ -605,7 +643,7 @@ message Document { // Optional. Identifies the bounding polygon of a layout element on the page. BoundingPoly bounding_poly = 4 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Confidence of detected page element, if applicable. Range [0, 1]. + // Optional. Confidence of detected page element, if applicable. Range `[0, 1]`. float confidence = 5 [(google.api.field_behavior) = OPTIONAL]; } @@ -726,7 +764,7 @@ message Document { string changed_text = 2; // The history of this annotation. - repeated Provenance provenance = 3; + repeated Provenance provenance = 3 [deprecated = true]; } // Original source document from the user. @@ -765,9 +803,9 @@ message Document { // Placeholder. Relationship among [Document.entities][google.cloud.documentai.v1.Document.entities]. repeated EntityRelation entity_relations = 8; - // Placeholder. A list of text corrections made to [Document.text]. This is - // usually used for annotating corrections to OCR mistakes. Text changes for - // a given revision may not overlap with each other. + // Placeholder. A list of text corrections made to [Document.text][google.cloud.documentai.v1.Document.text]. This + // is usually used for annotating corrections to OCR mistakes. Text changes + // for a given revision may not overlap with each other. repeated TextChange text_changes = 14; // Information about the sharding if this document is sharded part of a larger diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto index 17630a03592..3240d494e8f 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto @@ -16,6 +16,8 @@ syntax = "proto3"; package google.cloud.documentai.v1; +import "google/protobuf/field_mask.proto"; + option csharp_namespace = "Google.Cloud.DocumentAI.V1"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai"; option java_multiple_files = true; @@ -30,7 +32,7 @@ message RawDocument { bytes content = 1; // An IANA MIME type (RFC6838) indicating the nature and format of the - // [content]. + // [content][google.cloud.documentai.v1.RawDocument.content]. string mime_type = 2; } @@ -59,7 +61,7 @@ message GcsPrefix { message BatchDocumentsInputConfig { // The source. oneof source { - // The set of documents that match the specified Cloud Storage [gcs_prefix]. + // The set of documents that match the specified Cloud Storage `gcs_prefix`. GcsPrefix gcs_prefix = 1; // The set of documents individually specified on Cloud Storage. @@ -74,6 +76,11 @@ message DocumentOutputConfig { message GcsOutputConfig { // The Cloud Storage uri (a directory) of the output. string gcs_uri = 1; + + // Specifies which fields to include in the output documents. + // Only supports top level document and pages field so it must be in the + // form of `{document_field_name}` or `pages.{page_field_name}`. + google.protobuf.FieldMask field_mask = 2; } // The destination of the results. diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto index 9c944f259a0..e748ae1f748 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto @@ -279,6 +279,8 @@ message ProcessRequest { bool skip_human_review = 3; // Specifies which fields to include in ProcessResponse's document. + // Only supports top level document and pages field so it must be in the form + // of `{document_field_name}` or `pages.{page_field_name}`. google.protobuf.FieldMask field_mask = 6; } diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_schema.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_schema.proto index 24bd42285d9..ceb25a1d69a 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_schema.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_schema.proto @@ -86,15 +86,16 @@ message DocumentSchema { // Name of the type. It must be unique within the schema file and // cannot be a 'Common Type'. Besides that we use the following naming // conventions: - // - *use snake_casing* + // + // - *use `snake_casing`* // - name matching is case-insensitive // - Maximum 64 characters. // - Must start with a letter. // - Allowed characters: ASCII letters `[a-z0-9_-]`. (For backward // compatibility internal infrastructure and tooling can handle any ascii // character) - // - The '/' is sometimes used to denote a property of a type. For example - // line_item/amount. This convention is deprecated, but will still be + // - The `/` is sometimes used to denote a property of a type. For example + // `line_item/amount`. This convention is deprecated, but will still be // honored for backward compatibility. string name = 1; diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor.proto index b7eb95ef3f5..3ffe6927df9 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor.proto @@ -18,6 +18,7 @@ package google.cloud.documentai.v1; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; +import "google/cloud/documentai/v1/document_schema.proto"; import "google/protobuf/timestamp.proto"; option csharp_namespace = "Google.Cloud.DocumentAI.V1"; @@ -85,6 +86,9 @@ message ProcessorVersion { // The display name of the processor version. string display_name = 2; + // The schema of the processor version. Describes the output. + DocumentSchema document_schema = 12; + // The state of the processor version. State state = 6; @@ -125,14 +129,14 @@ message Processor { // The processor is disabled. DISABLED = 2; - // The processor is being enabled, will become ENABLED if successful. + // The processor is being enabled, will become `ENABLED` if successful. ENABLING = 3; - // The processor is being disabled, will become DISABLED if successful. + // The processor is being disabled, will become `DISABLED` if successful. DISABLING = 4; - // The processor is being created, will become either ENABLED (for - // successful creation) or FAILED (for failed ones). + // The processor is being created, will become either `ENABLED` (for + // successful creation) or `FAILED` (for failed ones). // Once a processor is in this state, it can then be used for document // processing, but the feature dependencies of the processor might not be // fully created yet. @@ -154,7 +158,7 @@ message Processor { (google.api.field_behavior) = OUTPUT_ONLY ]; - // The processor type, e.g., OCR_PROCESSOR, INVOICE_PROCESSOR, etc. + // The processor type, e.g., `OCR_PROCESSOR`, `INVOICE_PROCESSOR`, etc. // To get a list of processors types, see // [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]. string type = 2; diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor_type.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor_type.proto index dd5ef470011..2c9ee923051 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor_type.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor_type.proto @@ -42,10 +42,10 @@ message ProcessorType { } // The resource name of the processor type. - // Format: projects/{project}/processorTypes/{processor_type} + // Format: `projects/{project}/processorTypes/{processor_type}` string name = 1; - // The type of the processor, e.g., "invoice_parsing". + // The processor type, e.g., `OCR_PROCESSOR`, `INVOICE_PROCESSOR`, etc. string type = 2; // The processor category, used by UI to group processor types. diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 383050386aa..af6c5eac483 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -435,6 +435,9 @@ export namespace google { /** Style fontSize */ fontSize?: (google.cloud.documentai.v1.Document.Style.IFontSize|null); + + /** Style fontFamily */ + fontFamily?: (string|null); } /** Represents a Style. */ @@ -467,6 +470,9 @@ export namespace google { /** Style fontSize. */ public fontSize?: (google.cloud.documentai.v1.Document.Style.IFontSize|null); + /** Style fontFamily. */ + public fontFamily: string; + /** * Creates a new Style instance using the specified properties. * @param [properties] Properties to set @@ -699,6 +705,9 @@ export namespace google { /** Page detectedBarcodes */ detectedBarcodes?: (google.cloud.documentai.v1.Document.Page.IDetectedBarcode[]|null); + /** Page imageQualityScores */ + imageQualityScores?: (google.cloud.documentai.v1.Document.Page.IImageQualityScores|null); + /** Page provenance */ provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); } @@ -757,6 +766,9 @@ export namespace google { /** Page detectedBarcodes. */ public detectedBarcodes: google.cloud.documentai.v1.Document.Page.IDetectedBarcode[]; + /** Page imageQualityScores. */ + public imageQualityScores?: (google.cloud.documentai.v1.Document.Page.IImageQualityScores|null); + /** Page provenance. */ public provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); @@ -2085,6 +2097,9 @@ export namespace google { /** Table detectedLanguages */ detectedLanguages?: (google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]|null); + + /** Table provenance */ + provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); } /** Represents a Table. */ @@ -2108,6 +2123,9 @@ export namespace google { /** Table detectedLanguages. */ public detectedLanguages: google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]; + /** Table provenance. */ + public provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); + /** * Creates a new Table instance using the specified properties. * @param [properties] Properties to set @@ -2745,6 +2763,215 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of an ImageQualityScores. */ + interface IImageQualityScores { + + /** ImageQualityScores qualityScore */ + qualityScore?: (number|null); + + /** ImageQualityScores detectedDefects */ + detectedDefects?: (google.cloud.documentai.v1.Document.Page.ImageQualityScores.IDetectedDefect[]|null); + } + + /** Represents an ImageQualityScores. */ + class ImageQualityScores implements IImageQualityScores { + + /** + * Constructs a new ImageQualityScores. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.IImageQualityScores); + + /** ImageQualityScores qualityScore. */ + public qualityScore: number; + + /** ImageQualityScores detectedDefects. */ + public detectedDefects: google.cloud.documentai.v1.Document.Page.ImageQualityScores.IDetectedDefect[]; + + /** + * Creates a new ImageQualityScores instance using the specified properties. + * @param [properties] Properties to set + * @returns ImageQualityScores instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.IImageQualityScores): google.cloud.documentai.v1.Document.Page.ImageQualityScores; + + /** + * Encodes the specified ImageQualityScores message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.ImageQualityScores.verify|verify} messages. + * @param message ImageQualityScores message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Page.IImageQualityScores, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImageQualityScores message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.ImageQualityScores.verify|verify} messages. + * @param message ImageQualityScores message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Page.IImageQualityScores, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImageQualityScores message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImageQualityScores + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Page.ImageQualityScores; + + /** + * Decodes an ImageQualityScores message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImageQualityScores + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Page.ImageQualityScores; + + /** + * Verifies an ImageQualityScores message. + * @param message Plain 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 ImageQualityScores message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImageQualityScores + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page.ImageQualityScores; + + /** + * Creates a plain object from an ImageQualityScores message. Also converts values to other types if specified. + * @param message ImageQualityScores + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page.ImageQualityScores, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImageQualityScores to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImageQualityScores + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ImageQualityScores { + + /** Properties of a DetectedDefect. */ + interface IDetectedDefect { + + /** DetectedDefect type */ + type?: (string|null); + + /** DetectedDefect confidence */ + confidence?: (number|null); + } + + /** Represents a DetectedDefect. */ + class DetectedDefect implements IDetectedDefect { + + /** + * Constructs a new DetectedDefect. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.ImageQualityScores.IDetectedDefect); + + /** DetectedDefect type. */ + public type: string; + + /** DetectedDefect confidence. */ + public confidence: number; + + /** + * Creates a new DetectedDefect instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectedDefect instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.ImageQualityScores.IDetectedDefect): google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect; + + /** + * Encodes the specified DetectedDefect message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect.verify|verify} messages. + * @param message DetectedDefect message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Page.ImageQualityScores.IDetectedDefect, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectedDefect message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect.verify|verify} messages. + * @param message DetectedDefect message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Page.ImageQualityScores.IDetectedDefect, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectedDefect message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectedDefect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect; + + /** + * Decodes a DetectedDefect message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectedDefect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect; + + /** + * Verifies a DetectedDefect message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DetectedDefect message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectedDefect + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect; + + /** + * Creates a plain object from a DetectedDefect message. Also converts values to other types if specified. + * @param message DetectedDefect + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectedDefect to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DetectedDefect + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } } /** Properties of an Entity. */ @@ -5115,6 +5342,9 @@ export namespace google { /** GcsOutputConfig gcsUri */ gcsUri?: (string|null); + + /** GcsOutputConfig fieldMask */ + fieldMask?: (google.protobuf.IFieldMask|null); } /** Represents a GcsOutputConfig. */ @@ -5129,6 +5359,9 @@ export namespace google { /** GcsOutputConfig gcsUri. */ public gcsUri: string; + /** GcsOutputConfig fieldMask. */ + public fieldMask?: (google.protobuf.IFieldMask|null); + /** * Creates a new GcsOutputConfig instance using the specified properties. * @param [properties] Properties to set @@ -10415,6 +10648,9 @@ export namespace google { /** ProcessorVersion displayName */ displayName?: (string|null); + /** ProcessorVersion documentSchema */ + documentSchema?: (google.cloud.documentai.v1.IDocumentSchema|null); + /** ProcessorVersion state */ state?: (google.cloud.documentai.v1.ProcessorVersion.State|keyof typeof google.cloud.documentai.v1.ProcessorVersion.State|null); @@ -10449,6 +10685,9 @@ export namespace google { /** ProcessorVersion displayName. */ public displayName: string; + /** ProcessorVersion documentSchema. */ + public documentSchema?: (google.cloud.documentai.v1.IDocumentSchema|null); + /** ProcessorVersion state. */ public state: (google.cloud.documentai.v1.ProcessorVersion.State|keyof typeof google.cloud.documentai.v1.ProcessorVersion.State); @@ -36988,188 +37227,188 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of an Empty. */ - interface IEmpty { + /** Properties of a FieldMask. */ + interface IFieldMask { + + /** FieldMask paths */ + paths?: (string[]|null); } - /** Represents an Empty. */ - class Empty implements IEmpty { + /** Represents a FieldMask. */ + class FieldMask implements IFieldMask { /** - * Constructs a new Empty. + * Constructs a new FieldMask. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IEmpty); + constructor(properties?: google.protobuf.IFieldMask); + + /** FieldMask paths. */ + public paths: string[]; /** - * Creates a new Empty instance using the specified properties. + * Creates a new FieldMask instance using the specified properties. * @param [properties] Properties to set - * @returns Empty instance + * @returns FieldMask instance */ - public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; + public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; /** - * 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 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.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IFieldMask, 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 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.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Empty 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 Empty + * @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.Empty; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldMask; /** - * Decodes an Empty 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 Empty + * @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.Empty; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldMask; /** - * Verifies an Empty 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 an Empty 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 Empty + * @returns FieldMask */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; /** - * 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 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.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Empty to JSON. + * Converts this FieldMask to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for Empty + * 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 FieldMask. */ - interface IFieldMask { - - /** FieldMask paths */ - paths?: (string[]|null); + /** Properties of an Empty. */ + interface IEmpty { } - /** Represents a FieldMask. */ - class FieldMask implements IFieldMask { + /** Represents an Empty. */ + class Empty implements IEmpty { /** - * Constructs a new FieldMask. + * Constructs a new Empty. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IFieldMask); - - /** FieldMask paths. */ - public paths: string[]; + constructor(properties?: google.protobuf.IEmpty); /** - * Creates a new FieldMask instance using the specified properties. + * Creates a new Empty instance using the specified properties. * @param [properties] Properties to set - * @returns FieldMask instance + * @returns Empty instance */ - public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; + public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; /** - * 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 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.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IEmpty, 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 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.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a FieldMask 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 FieldMask + * @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.FieldMask; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Empty; /** - * Decodes a FieldMask 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 FieldMask + * @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.FieldMask; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Empty; /** - * Verifies a FieldMask 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 FieldMask 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 FieldMask + * @returns Empty */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; + public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; /** - * Creates a plain object from a FieldMask message. Also converts values to other types if specified. - * @param message FieldMask + * 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.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this FieldMask to JSON. + * Converts this Empty to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for FieldMask + * Gets the default type url for Empty * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index e1286d21a73..3a0d67dc16f 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -1241,6 +1241,7 @@ * @property {string|null} [textStyle] Style textStyle * @property {string|null} [textDecoration] Style textDecoration * @property {google.cloud.documentai.v1.Document.Style.IFontSize|null} [fontSize] Style fontSize + * @property {string|null} [fontFamily] Style fontFamily */ /** @@ -1314,6 +1315,14 @@ */ Style.prototype.fontSize = null; + /** + * Style fontFamily. + * @member {string} fontFamily + * @memberof google.cloud.documentai.v1.Document.Style + * @instance + */ + Style.prototype.fontFamily = ""; + /** * Creates a new Style instance using the specified properties. * @function create @@ -1352,6 +1361,8 @@ writer.uint32(/* id 6, wireType 2 =*/50).string(message.textDecoration); if (message.fontSize != null && Object.hasOwnProperty.call(message, "fontSize")) $root.google.cloud.documentai.v1.Document.Style.FontSize.encode(message.fontSize, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.fontFamily != null && Object.hasOwnProperty.call(message, "fontFamily")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.fontFamily); return writer; }; @@ -1414,6 +1425,10 @@ message.fontSize = $root.google.cloud.documentai.v1.Document.Style.FontSize.decode(reader, reader.uint32()); break; } + case 8: { + message.fontFamily = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -1478,6 +1493,9 @@ if (error) return "fontSize." + error; } + if (message.fontFamily != null && message.hasOwnProperty("fontFamily")) + if (!$util.isString(message.fontFamily)) + return "fontFamily: string expected"; return null; }; @@ -1519,6 +1537,8 @@ throw TypeError(".google.cloud.documentai.v1.Document.Style.fontSize: object expected"); message.fontSize = $root.google.cloud.documentai.v1.Document.Style.FontSize.fromObject(object.fontSize); } + if (object.fontFamily != null) + message.fontFamily = String(object.fontFamily); return message; }; @@ -1543,6 +1563,7 @@ object.textStyle = ""; object.textDecoration = ""; object.fontSize = null; + object.fontFamily = ""; } if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) object.textAnchor = $root.google.cloud.documentai.v1.Document.TextAnchor.toObject(message.textAnchor, options); @@ -1558,6 +1579,8 @@ object.textDecoration = message.textDecoration; if (message.fontSize != null && message.hasOwnProperty("fontSize")) object.fontSize = $root.google.cloud.documentai.v1.Document.Style.FontSize.toObject(message.fontSize, options); + if (message.fontFamily != null && message.hasOwnProperty("fontFamily")) + object.fontFamily = message.fontFamily; return object; }; @@ -1838,6 +1861,7 @@ * @property {Array.|null} [formFields] Page formFields * @property {Array.|null} [symbols] Page symbols * @property {Array.|null} [detectedBarcodes] Page detectedBarcodes + * @property {google.cloud.documentai.v1.Document.Page.IImageQualityScores|null} [imageQualityScores] Page imageQualityScores * @property {google.cloud.documentai.v1.Document.IProvenance|null} [provenance] Page provenance */ @@ -1987,6 +2011,14 @@ */ Page.prototype.detectedBarcodes = $util.emptyArray; + /** + * Page imageQualityScores. + * @member {google.cloud.documentai.v1.Document.Page.IImageQualityScores|null|undefined} imageQualityScores + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.imageQualityScores = null; + /** * Page provenance. * @member {google.cloud.documentai.v1.Document.IProvenance|null|undefined} provenance @@ -2062,6 +2094,8 @@ $root.google.cloud.documentai.v1.Document.Page.DetectedBarcode.encode(message.detectedBarcodes[i], writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) $root.google.cloud.documentai.v1.Document.Provenance.encode(message.provenance, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.imageQualityScores != null && Object.hasOwnProperty.call(message, "imageQualityScores")) + $root.google.cloud.documentai.v1.Document.Page.ImageQualityScores.encode(message.imageQualityScores, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); return writer; }; @@ -2178,6 +2212,10 @@ message.detectedBarcodes.push($root.google.cloud.documentai.v1.Document.Page.DetectedBarcode.decode(reader, reader.uint32())); break; } + case 17: { + message.imageQualityScores = $root.google.cloud.documentai.v1.Document.Page.ImageQualityScores.decode(reader, reader.uint32()); + break; + } case 16: { message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); break; @@ -2334,6 +2372,11 @@ return "detectedBarcodes." + error; } } + if (message.imageQualityScores != null && message.hasOwnProperty("imageQualityScores")) { + var error = $root.google.cloud.documentai.v1.Document.Page.ImageQualityScores.verify(message.imageQualityScores); + if (error) + return "imageQualityScores." + error; + } if (message.provenance != null && message.hasOwnProperty("provenance")) { var error = $root.google.cloud.documentai.v1.Document.Provenance.verify(message.provenance); if (error) @@ -2481,6 +2524,11 @@ message.detectedBarcodes[i] = $root.google.cloud.documentai.v1.Document.Page.DetectedBarcode.fromObject(object.detectedBarcodes[i]); } } + if (object.imageQualityScores != null) { + if (typeof object.imageQualityScores !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.imageQualityScores: object expected"); + message.imageQualityScores = $root.google.cloud.documentai.v1.Document.Page.ImageQualityScores.fromObject(object.imageQualityScores); + } if (object.provenance != null) { if (typeof object.provenance !== "object") throw TypeError(".google.cloud.documentai.v1.Document.Page.provenance: object expected"); @@ -2521,6 +2569,7 @@ object.layout = null; object.image = null; object.provenance = null; + object.imageQualityScores = null; } if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) object.pageNumber = message.pageNumber; @@ -2587,6 +2636,8 @@ } if (message.provenance != null && message.hasOwnProperty("provenance")) object.provenance = $root.google.cloud.documentai.v1.Document.Provenance.toObject(message.provenance, options); + if (message.imageQualityScores != null && message.hasOwnProperty("imageQualityScores")) + object.imageQualityScores = $root.google.cloud.documentai.v1.Document.Page.ImageQualityScores.toObject(message.imageQualityScores, options); return object; }; @@ -5713,6 +5764,7 @@ * @property {Array.|null} [headerRows] Table headerRows * @property {Array.|null} [bodyRows] Table bodyRows * @property {Array.|null} [detectedLanguages] Table detectedLanguages + * @property {google.cloud.documentai.v1.Document.IProvenance|null} [provenance] Table provenance */ /** @@ -5765,6 +5817,14 @@ */ Table.prototype.detectedLanguages = $util.emptyArray; + /** + * Table provenance. + * @member {google.cloud.documentai.v1.Document.IProvenance|null|undefined} provenance + * @memberof google.cloud.documentai.v1.Document.Page.Table + * @instance + */ + Table.prototype.provenance = null; + /** * Creates a new Table instance using the specified properties. * @function create @@ -5800,6 +5860,8 @@ if (message.detectedLanguages != null && message.detectedLanguages.length) for (var i = 0; i < message.detectedLanguages.length; ++i) $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) + $root.google.cloud.documentai.v1.Document.Provenance.encode(message.provenance, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; @@ -5856,6 +5918,10 @@ message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); break; } + case 5: { + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -5923,6 +5989,11 @@ return "detectedLanguages." + error; } } + if (message.provenance != null && message.hasOwnProperty("provenance")) { + var error = $root.google.cloud.documentai.v1.Document.Provenance.verify(message.provenance); + if (error) + return "provenance." + error; + } return null; }; @@ -5973,6 +6044,11 @@ message.detectedLanguages[i] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); } } + if (object.provenance != null) { + if (typeof object.provenance !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Table.provenance: object expected"); + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.fromObject(object.provenance); + } return message; }; @@ -5994,8 +6070,10 @@ object.bodyRows = []; object.detectedLanguages = []; } - if (options.defaults) + if (options.defaults) { object.layout = null; + object.provenance = null; + } if (message.layout != null && message.hasOwnProperty("layout")) object.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.toObject(message.layout, options); if (message.headerRows && message.headerRows.length) { @@ -6013,6 +6091,8 @@ for (var j = 0; j < message.detectedLanguages.length; ++j) object.detectedLanguages[j] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); } + if (message.provenance != null && message.hasOwnProperty("provenance")) + object.provenance = $root.google.cloud.documentai.v1.Document.Provenance.toObject(message.provenance, options); return object; }; @@ -7457,6 +7537,481 @@ return DetectedLanguage; })(); + Page.ImageQualityScores = (function() { + + /** + * Properties of an ImageQualityScores. + * @memberof google.cloud.documentai.v1.Document.Page + * @interface IImageQualityScores + * @property {number|null} [qualityScore] ImageQualityScores qualityScore + * @property {Array.|null} [detectedDefects] ImageQualityScores detectedDefects + */ + + /** + * Constructs a new ImageQualityScores. + * @memberof google.cloud.documentai.v1.Document.Page + * @classdesc Represents an ImageQualityScores. + * @implements IImageQualityScores + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.IImageQualityScores=} [properties] Properties to set + */ + function ImageQualityScores(properties) { + this.detectedDefects = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImageQualityScores qualityScore. + * @member {number} qualityScore + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores + * @instance + */ + ImageQualityScores.prototype.qualityScore = 0; + + /** + * ImageQualityScores detectedDefects. + * @member {Array.} detectedDefects + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores + * @instance + */ + ImageQualityScores.prototype.detectedDefects = $util.emptyArray; + + /** + * Creates a new ImageQualityScores instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores + * @static + * @param {google.cloud.documentai.v1.Document.Page.IImageQualityScores=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.ImageQualityScores} ImageQualityScores instance + */ + ImageQualityScores.create = function create(properties) { + return new ImageQualityScores(properties); + }; + + /** + * Encodes the specified ImageQualityScores message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.ImageQualityScores.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores + * @static + * @param {google.cloud.documentai.v1.Document.Page.IImageQualityScores} message ImageQualityScores message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImageQualityScores.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.qualityScore != null && Object.hasOwnProperty.call(message, "qualityScore")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.qualityScore); + if (message.detectedDefects != null && message.detectedDefects.length) + for (var i = 0; i < message.detectedDefects.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect.encode(message.detectedDefects[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImageQualityScores message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.ImageQualityScores.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores + * @static + * @param {google.cloud.documentai.v1.Document.Page.IImageQualityScores} message ImageQualityScores message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImageQualityScores.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImageQualityScores message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page.ImageQualityScores} ImageQualityScores + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImageQualityScores.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Page.ImageQualityScores(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.qualityScore = reader.float(); + break; + } + case 2: { + if (!(message.detectedDefects && message.detectedDefects.length)) + message.detectedDefects = []; + message.detectedDefects.push($root.google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImageQualityScores message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.ImageQualityScores} ImageQualityScores + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImageQualityScores.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImageQualityScores message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImageQualityScores.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.qualityScore != null && message.hasOwnProperty("qualityScore")) + if (typeof message.qualityScore !== "number") + return "qualityScore: number expected"; + if (message.detectedDefects != null && message.hasOwnProperty("detectedDefects")) { + if (!Array.isArray(message.detectedDefects)) + return "detectedDefects: array expected"; + for (var i = 0; i < message.detectedDefects.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect.verify(message.detectedDefects[i]); + if (error) + return "detectedDefects." + error; + } + } + return null; + }; + + /** + * Creates an ImageQualityScores message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.ImageQualityScores} ImageQualityScores + */ + ImageQualityScores.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.ImageQualityScores) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.ImageQualityScores(); + if (object.qualityScore != null) + message.qualityScore = Number(object.qualityScore); + if (object.detectedDefects) { + if (!Array.isArray(object.detectedDefects)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.ImageQualityScores.detectedDefects: array expected"); + message.detectedDefects = []; + for (var i = 0; i < object.detectedDefects.length; ++i) { + if (typeof object.detectedDefects[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.ImageQualityScores.detectedDefects: object expected"); + message.detectedDefects[i] = $root.google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect.fromObject(object.detectedDefects[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an ImageQualityScores message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores + * @static + * @param {google.cloud.documentai.v1.Document.Page.ImageQualityScores} message ImageQualityScores + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImageQualityScores.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedDefects = []; + if (options.defaults) + object.qualityScore = 0; + if (message.qualityScore != null && message.hasOwnProperty("qualityScore")) + object.qualityScore = options.json && !isFinite(message.qualityScore) ? String(message.qualityScore) : message.qualityScore; + if (message.detectedDefects && message.detectedDefects.length) { + object.detectedDefects = []; + for (var j = 0; j < message.detectedDefects.length; ++j) + object.detectedDefects[j] = $root.google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect.toObject(message.detectedDefects[j], options); + } + return object; + }; + + /** + * Converts this ImageQualityScores to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores + * @instance + * @returns {Object.} JSON object + */ + ImageQualityScores.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ImageQualityScores + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImageQualityScores.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Page.ImageQualityScores"; + }; + + ImageQualityScores.DetectedDefect = (function() { + + /** + * Properties of a DetectedDefect. + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores + * @interface IDetectedDefect + * @property {string|null} [type] DetectedDefect type + * @property {number|null} [confidence] DetectedDefect confidence + */ + + /** + * Constructs a new DetectedDefect. + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores + * @classdesc Represents a DetectedDefect. + * @implements IDetectedDefect + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.ImageQualityScores.IDetectedDefect=} [properties] Properties to set + */ + function DetectedDefect(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DetectedDefect type. + * @member {string} type + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect + * @instance + */ + DetectedDefect.prototype.type = ""; + + /** + * DetectedDefect confidence. + * @member {number} confidence + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect + * @instance + */ + DetectedDefect.prototype.confidence = 0; + + /** + * Creates a new DetectedDefect instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect + * @static + * @param {google.cloud.documentai.v1.Document.Page.ImageQualityScores.IDetectedDefect=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect} DetectedDefect instance + */ + DetectedDefect.create = function create(properties) { + return new DetectedDefect(properties); + }; + + /** + * Encodes the specified DetectedDefect message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect + * @static + * @param {google.cloud.documentai.v1.Document.Page.ImageQualityScores.IDetectedDefect} message DetectedDefect message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedDefect.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.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + return writer; + }; + + /** + * Encodes the specified DetectedDefect message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect + * @static + * @param {google.cloud.documentai.v1.Document.Page.ImageQualityScores.IDetectedDefect} message DetectedDefect message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedDefect.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectedDefect message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect} DetectedDefect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedDefect.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 2: { + message.confidence = reader.float(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectedDefect message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect} DetectedDefect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedDefect.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectedDefect message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectedDefect.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.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + return null; + }; + + /** + * Creates a DetectedDefect message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect} DetectedDefect + */ + DetectedDefect.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect(); + if (object.type != null) + message.type = String(object.type); + if (object.confidence != null) + message.confidence = Number(object.confidence); + return message; + }; + + /** + * Creates a plain object from a DetectedDefect message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect + * @static + * @param {google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect} message DetectedDefect + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectedDefect.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = ""; + object.confidence = 0; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + return object; + }; + + /** + * Converts this DetectedDefect to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect + * @instance + * @returns {Object.} JSON object + */ + DetectedDefect.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DetectedDefect + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DetectedDefect.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect"; + }; + + return DetectedDefect; + })(); + + return ImageQualityScores; + })(); + return Page; })(); @@ -13391,6 +13946,7 @@ * @memberof google.cloud.documentai.v1.DocumentOutputConfig * @interface IGcsOutputConfig * @property {string|null} [gcsUri] GcsOutputConfig gcsUri + * @property {google.protobuf.IFieldMask|null} [fieldMask] GcsOutputConfig fieldMask */ /** @@ -13416,6 +13972,14 @@ */ GcsOutputConfig.prototype.gcsUri = ""; + /** + * GcsOutputConfig fieldMask. + * @member {google.protobuf.IFieldMask|null|undefined} fieldMask + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig + * @instance + */ + GcsOutputConfig.prototype.fieldMask = null; + /** * Creates a new GcsOutputConfig instance using the specified properties. * @function create @@ -13442,6 +14006,8 @@ writer = $Writer.create(); if (message.gcsUri != null && Object.hasOwnProperty.call(message, "gcsUri")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsUri); + if (message.fieldMask != null && Object.hasOwnProperty.call(message, "fieldMask")) + $root.google.protobuf.FieldMask.encode(message.fieldMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -13480,6 +14046,10 @@ message.gcsUri = reader.string(); break; } + case 2: { + message.fieldMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -13518,6 +14088,11 @@ if (message.gcsUri != null && message.hasOwnProperty("gcsUri")) if (!$util.isString(message.gcsUri)) return "gcsUri: string expected"; + if (message.fieldMask != null && message.hasOwnProperty("fieldMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.fieldMask); + if (error) + return "fieldMask." + error; + } return null; }; @@ -13535,6 +14110,11 @@ var message = new $root.google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig(); if (object.gcsUri != null) message.gcsUri = String(object.gcsUri); + if (object.fieldMask != null) { + if (typeof object.fieldMask !== "object") + throw TypeError(".google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.fieldMask: object expected"); + message.fieldMask = $root.google.protobuf.FieldMask.fromObject(object.fieldMask); + } return message; }; @@ -13551,10 +14131,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.gcsUri = ""; + object.fieldMask = null; + } if (message.gcsUri != null && message.hasOwnProperty("gcsUri")) object.gcsUri = message.gcsUri; + if (message.fieldMask != null && message.hasOwnProperty("fieldMask")) + object.fieldMask = $root.google.protobuf.FieldMask.toObject(message.fieldMask, options); return object; }; @@ -25249,6 +25833,7 @@ * @interface IProcessorVersion * @property {string|null} [name] ProcessorVersion name * @property {string|null} [displayName] ProcessorVersion displayName + * @property {google.cloud.documentai.v1.IDocumentSchema|null} [documentSchema] ProcessorVersion documentSchema * @property {google.cloud.documentai.v1.ProcessorVersion.State|null} [state] ProcessorVersion state * @property {google.protobuf.ITimestamp|null} [createTime] ProcessorVersion createTime * @property {string|null} [kmsKeyName] ProcessorVersion kmsKeyName @@ -25288,6 +25873,14 @@ */ ProcessorVersion.prototype.displayName = ""; + /** + * ProcessorVersion documentSchema. + * @member {google.cloud.documentai.v1.IDocumentSchema|null|undefined} documentSchema + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.documentSchema = null; + /** * ProcessorVersion state. * @member {google.cloud.documentai.v1.ProcessorVersion.State} state @@ -25374,6 +25967,8 @@ writer.uint32(/* id 10, wireType 2 =*/82).string(message.kmsKeyVersionName); if (message.googleManaged != null && Object.hasOwnProperty.call(message, "googleManaged")) writer.uint32(/* id 11, wireType 0 =*/88).bool(message.googleManaged); + if (message.documentSchema != null && Object.hasOwnProperty.call(message, "documentSchema")) + $root.google.cloud.documentai.v1.DocumentSchema.encode(message.documentSchema, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); if (message.deprecationInfo != null && Object.hasOwnProperty.call(message, "deprecationInfo")) $root.google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.encode(message.deprecationInfo, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); return writer; @@ -25418,6 +26013,10 @@ message.displayName = reader.string(); break; } + case 12: { + message.documentSchema = $root.google.cloud.documentai.v1.DocumentSchema.decode(reader, reader.uint32()); + break; + } case 6: { message.state = reader.int32(); break; @@ -25483,6 +26082,11 @@ if (message.displayName != null && message.hasOwnProperty("displayName")) if (!$util.isString(message.displayName)) return "displayName: string expected"; + if (message.documentSchema != null && message.hasOwnProperty("documentSchema")) { + var error = $root.google.cloud.documentai.v1.DocumentSchema.verify(message.documentSchema); + if (error) + return "documentSchema." + error; + } if (message.state != null && message.hasOwnProperty("state")) switch (message.state) { default: @@ -25535,6 +26139,11 @@ message.name = String(object.name); if (object.displayName != null) message.displayName = String(object.displayName); + if (object.documentSchema != null) { + if (typeof object.documentSchema !== "object") + throw TypeError(".google.cloud.documentai.v1.ProcessorVersion.documentSchema: object expected"); + message.documentSchema = $root.google.cloud.documentai.v1.DocumentSchema.fromObject(object.documentSchema); + } switch (object.state) { default: if (typeof object.state === "number") { @@ -25615,6 +26224,7 @@ object.kmsKeyName = ""; object.kmsKeyVersionName = ""; object.googleManaged = false; + object.documentSchema = null; object.deprecationInfo = null; } if (message.name != null && message.hasOwnProperty("name")) @@ -25631,6 +26241,8 @@ object.kmsKeyVersionName = message.kmsKeyVersionName; if (message.googleManaged != null && message.hasOwnProperty("googleManaged")) object.googleManaged = message.googleManaged; + if (message.documentSchema != null && message.hasOwnProperty("documentSchema")) + object.documentSchema = $root.google.cloud.documentai.v1.DocumentSchema.toObject(message.documentSchema, options); if (message.deprecationInfo != null && message.hasOwnProperty("deprecationInfo")) object.deprecationInfo = $root.google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.toObject(message.deprecationInfo, options); return object; @@ -92252,23 +92864,25 @@ return Duration; })(); - protobuf.Empty = (function() { + protobuf.FieldMask = (function() { /** - * Properties of an Empty. + * Properties of a FieldMask. * @memberof google.protobuf - * @interface IEmpty + * @interface IFieldMask + * @property {Array.|null} [paths] FieldMask paths */ /** - * Constructs a new Empty. + * Constructs a new FieldMask. * @memberof google.protobuf - * @classdesc Represents an Empty. - * @implements IEmpty + * @classdesc Represents a FieldMask. + * @implements IFieldMask * @constructor - * @param {google.protobuf.IEmpty=} [properties] Properties to set + * @param {google.protobuf.IFieldMask=} [properties] Properties to set */ - function Empty(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) @@ -92276,63 +92890,80 @@ } /** - * Creates a new Empty instance using the specified properties. + * 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.Empty + * @memberof google.protobuf.FieldMask * @static - * @param {google.protobuf.IEmpty=} [properties] Properties to set - * @returns {google.protobuf.Empty} Empty instance + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @returns {google.protobuf.FieldMask} FieldMask instance */ - Empty.create = function create(properties) { - return new Empty(properties); + FieldMask.create = function create(properties) { + return new FieldMask(properties); }; /** - * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. * @function encode - * @memberof google.protobuf.Empty + * @memberof google.protobuf.FieldMask * @static - * @param {google.protobuf.IEmpty} message Empty 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 */ - Empty.encode = function encode(message, 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 Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.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.Empty + * @memberof google.protobuf.FieldMask * @static - * @param {google.protobuf.IEmpty} message Empty 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 */ - Empty.encodeDelimited = function encodeDelimited(message, writer) { + FieldMask.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Empty message from the specified reader or buffer. + * Decodes a FieldMask message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.Empty + * @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.Empty} Empty + * @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 */ - Empty.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.Empty(); + 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; @@ -92342,110 +92973,133 @@ }; /** - * Decodes an Empty 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.Empty + * @memberof google.protobuf.FieldMask * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Empty} Empty + * @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 */ - Empty.decodeDelimited = function decodeDelimited(reader) { + FieldMask.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Empty message. + * Verifies a FieldMask message. * @function verify - * @memberof google.protobuf.Empty + * @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 */ - Empty.verify = function verify(message) { + 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 an Empty 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.Empty + * @memberof google.protobuf.FieldMask * @static * @param {Object.} object Plain object - * @returns {google.protobuf.Empty} Empty + * @returns {google.protobuf.FieldMask} FieldMask */ - Empty.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Empty) + FieldMask.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldMask) return object; - return new $root.google.protobuf.Empty(); + 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 an Empty 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.Empty + * @memberof google.protobuf.FieldMask * @static - * @param {google.protobuf.Empty} message Empty + * @param {google.protobuf.FieldMask} message FieldMask * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Empty.toObject = function toObject() { - return {}; + 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 Empty to JSON. + * Converts this FieldMask to JSON. * @function toJSON - * @memberof google.protobuf.Empty + * @memberof google.protobuf.FieldMask * @instance * @returns {Object.} JSON object */ - Empty.prototype.toJSON = function toJSON() { + FieldMask.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for Empty + * Gets the default type url for FieldMask * @function getTypeUrl - * @memberof google.protobuf.Empty + * @memberof google.protobuf.FieldMask * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - Empty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + FieldMask.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.Empty"; + return typeUrlPrefix + "/google.protobuf.FieldMask"; }; - return Empty; + return FieldMask; })(); - protobuf.FieldMask = (function() { + protobuf.Empty = (function() { /** - * Properties of a FieldMask. + * Properties of an Empty. * @memberof google.protobuf - * @interface IFieldMask - * @property {Array.|null} [paths] FieldMask paths + * @interface IEmpty */ /** - * Constructs a new FieldMask. + * Constructs a new Empty. * @memberof google.protobuf - * @classdesc Represents a FieldMask. - * @implements IFieldMask + * @classdesc Represents an Empty. + * @implements IEmpty * @constructor - * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @param {google.protobuf.IEmpty=} [properties] Properties to set */ - function FieldMask(properties) { - this.paths = []; + function Empty(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -92453,80 +93107,63 @@ } /** - * FieldMask paths. - * @member {Array.} paths - * @memberof google.protobuf.FieldMask - * @instance - */ - FieldMask.prototype.paths = $util.emptyArray; - - /** - * Creates a new FieldMask instance using the specified properties. + * Creates a new Empty instance using the specified properties. * @function create - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Empty * @static - * @param {google.protobuf.IFieldMask=} [properties] Properties to set - * @returns {google.protobuf.FieldMask} FieldMask instance + * @param {google.protobuf.IEmpty=} [properties] Properties to set + * @returns {google.protobuf.Empty} Empty instance */ - FieldMask.create = function create(properties) { - return new FieldMask(properties); + Empty.create = function create(properties) { + return new Empty(properties); }; /** - * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. * @function encode - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Empty * @static - * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FieldMask.encode = function encode(message, writer) { + Empty.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. + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Empty * @static - * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FieldMask.encodeDelimited = function encodeDelimited(message, writer) { + Empty.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FieldMask message from the specified reader or buffer. + * Decodes an Empty message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.FieldMask + * @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.FieldMask} FieldMask + * @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 */ - FieldMask.decode = function decode(reader, length) { + 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.FieldMask(); + 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) { - case 1: { - if (!(message.paths && message.paths.length)) - message.paths = []; - message.paths.push(reader.string()); - break; - } default: reader.skipType(tag & 7); break; @@ -92536,114 +93173,89 @@ }; /** - * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * Decodes an Empty message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Empty * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldMask} FieldMask + * @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 */ - FieldMask.decodeDelimited = function decodeDelimited(reader) { + Empty.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FieldMask message. + * Verifies an Empty message. * @function verify - * @memberof google.protobuf.FieldMask + * @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 */ - FieldMask.verify = function verify(message) { + Empty.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. + * Creates an Empty message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Empty * @static * @param {Object.} object Plain object - * @returns {google.protobuf.FieldMask} FieldMask + * @returns {google.protobuf.Empty} Empty */ - FieldMask.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldMask) + Empty.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Empty) 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; + return new $root.google.protobuf.Empty(); }; /** - * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * Creates a plain object from an Empty message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Empty * @static - * @param {google.protobuf.FieldMask} message FieldMask + * @param {google.protobuf.Empty} message Empty * @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; + Empty.toObject = function toObject() { + return {}; }; /** - * Converts this FieldMask to JSON. + * Converts this Empty to JSON. * @function toJSON - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Empty * @instance * @returns {Object.} JSON object */ - FieldMask.prototype.toJSON = function toJSON() { + Empty.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 Empty * @function getTypeUrl - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Empty * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - FieldMask.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Empty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.FieldMask"; + return typeUrlPrefix + "/google.protobuf.Empty"; }; - return FieldMask; + return Empty; })(); return protobuf; diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 4045eae1697..f8ada9d376b 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -155,6 +155,10 @@ "fontSize": { "type": "FontSize", "id": 7 + }, + "fontFamily": { + "type": "string", + "id": 8 } }, "nested": { @@ -245,9 +249,16 @@ "type": "DetectedBarcode", "id": 15 }, + "imageQualityScores": { + "type": "ImageQualityScores", + "id": 17 + }, "provenance": { "type": "Provenance", - "id": 16 + "id": 16, + "options": { + "deprecated": true + } } }, "nested": { @@ -351,7 +362,10 @@ }, "provenance": { "type": "Provenance", - "id": 3 + "id": 3, + "options": { + "deprecated": true + } } } }, @@ -368,7 +382,10 @@ }, "provenance": { "type": "Provenance", - "id": 3 + "id": 3, + "options": { + "deprecated": true + } } } }, @@ -385,7 +402,10 @@ }, "provenance": { "type": "Provenance", - "id": 3 + "id": 3, + "options": { + "deprecated": true + } } } }, @@ -406,7 +426,10 @@ }, "provenance": { "type": "Provenance", - "id": 4 + "id": 4, + "options": { + "deprecated": true + } } }, "nested": { @@ -480,6 +503,10 @@ "rule": "repeated", "type": "DetectedLanguage", "id": 4 + }, + "provenance": { + "type": "Provenance", + "id": 5 } }, "nested": { @@ -576,6 +603,33 @@ "id": 2 } } + }, + "ImageQualityScores": { + "fields": { + "qualityScore": { + "type": "float", + "id": 1 + }, + "detectedDefects": { + "rule": "repeated", + "type": "DetectedDefect", + "id": 2 + } + }, + "nested": { + "DetectedDefect": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "confidence": { + "type": "float", + "id": 2 + } + } + } + } } } }, @@ -951,7 +1005,10 @@ "provenance": { "rule": "repeated", "type": "Provenance", - "id": 3 + "id": 3, + "options": { + "deprecated": true + } } } } @@ -1076,6 +1133,10 @@ "gcsUri": { "type": "string", "id": 1 + }, + "fieldMask": { + "type": "google.protobuf.FieldMask", + "id": 2 } } } @@ -2215,6 +2276,10 @@ "type": "string", "id": 2 }, + "documentSchema": { + "type": "DocumentSchema", + "id": 12 + }, "state": { "type": "State", "id": 6 @@ -7939,9 +8004,6 @@ } } }, - "Empty": { - "fields": {} - }, "FieldMask": { "fields": { "paths": { @@ -7950,6 +8012,9 @@ "id": 1 } } + }, + "Empty": { + "fields": {} } } }, diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js index f32cd03e0f0..dfcb92d5a7d 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js @@ -52,6 +52,8 @@ function main(name) { // const skipHumanReview = true /** * Specifies which fields to include in ProcessResponse's document. + * Only supports top level document and pages field so it must be in the form + * of `{document_field_name}` or `pages.{page_field_name}`. */ // const fieldMask = {} diff --git a/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json index cf16eb5ab44..75bac43037d 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json +++ b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 75, + "end": 77, "type": "FULL" } ], diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts index 521d68f6bbb..33fffdda1f0 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts @@ -576,6 +576,8 @@ export class DocumentProcessorServiceClient { * false. * @param {google.protobuf.FieldMask} request.fieldMask * Specifies which fields to include in ProcessResponse's document. + * Only supports top level document and pages field so it must be in the form + * of `{document_field_name}` or `pages.{page_field_name}`. * @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. From d517c012dbe0bb2e0892ba708accb97abba28ed6 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 11 Nov 2022 01:34:16 -0800 Subject: [PATCH 209/213] chore(main): release 6.1.0 (#374) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 6.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-documentai/CHANGELOG.md | 15 +++++++++++++++ packages/google-cloud-documentai/package.json | 2 +- ...ippet_metadata.google.cloud.documentai.v1.json | 2 +- ..._metadata.google.cloud.documentai.v1beta1.json | 2 +- ..._metadata.google.cloud.documentai.v1beta2.json | 2 +- ..._metadata.google.cloud.documentai.v1beta3.json | 2 +- .../google-cloud-documentai/samples/package.json | 2 +- 7 files changed, 21 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md index d7a24367d7d..f144e97701e 100644 --- a/packages/google-cloud-documentai/CHANGELOG.md +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## [6.1.0](https://github.com/googleapis/nodejs-document-ai/compare/v6.0.0...v6.1.0) (2022-11-11) + + +### Features + +* Added font_family to document.proto ([#377](https://github.com/googleapis/nodejs-document-ai/issues/377)) ([7ded563](https://github.com/googleapis/nodejs-document-ai/commit/7ded5630ed4e589d7a77a91722531fc4f62810b6)) +* added ImageQualityScores message to document.proto ([7ded563](https://github.com/googleapis/nodejs-document-ai/commit/7ded5630ed4e589d7a77a91722531fc4f62810b6)) +* added PropertyMetadata and EntityTypeMetadata to document_schema.proto ([7ded563](https://github.com/googleapis/nodejs-document-ai/commit/7ded5630ed4e589d7a77a91722531fc4f62810b6)) + + +### Bug Fixes + +* **deps:** Use google-gax v3.5.2 ([#372](https://github.com/googleapis/nodejs-document-ai/issues/372)) ([a612f68](https://github.com/googleapis/nodejs-document-ai/commit/a612f68401bdd63eba38f4830db1d83ab7d5bef2)) +* Regenerated protos JS and TS definitions ([#376](https://github.com/googleapis/nodejs-document-ai/issues/376)) ([64223b5](https://github.com/googleapis/nodejs-document-ai/commit/64223b5d6b5fe5ee4d3922162dbbc63a9401c41a)) + ## [6.0.0](https://github.com/googleapis/nodejs-document-ai/compare/v5.0.0...v6.0.0) (2022-09-22) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index b346c908fe2..ccf81bd766b 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/documentai", - "version": "6.0.0", + "version": "6.1.0", "description": "Document AI client for Node.js", "repository": "googleapis/nodejs-document-ai", "license": "Apache-2.0", diff --git a/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json index 75bac43037d..eae3a1d5f10 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json +++ b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-documentai", - "version": "6.0.0", + "version": "6.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json b/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json index 630d58cf67a..e512be85388 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-documentai", - "version": "6.0.0", + "version": "6.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json b/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json index 5fde2a5a76c..468d13fb3f4 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-documentai", - "version": "6.0.0", + "version": "6.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json index c6292fde1d0..bd2acbac3df 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-documentai", - "version": "6.0.0", + "version": "6.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json index b9e3a955acd..5f5b7a6ae39 100644 --- a/packages/google-cloud-documentai/samples/package.json +++ b/packages/google-cloud-documentai/samples/package.json @@ -13,7 +13,7 @@ "test": "mocha test/*.js --timeout 600000" }, "dependencies": { - "@google-cloud/documentai": "^6.0.0", + "@google-cloud/documentai": "^6.1.0", "@google-cloud/storage": "^6.0.0", "p-queue": "^6.6.2", "uuid": "^9.0.0" From 74d174d78b9ae3478543e9c3aa3644baac510e2b Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 11 Nov 2022 01:37:53 -0800 Subject: [PATCH 210/213] build: add release-please config, fix owlbot-config --- .release-please-manifest.json | 1 + .../{.github => }/.OwlBot.yaml | 6 ++---- .../google-cloud-documentai/.repo-metadata.json | 2 +- packages/google-cloud-documentai/owlbot.py | 4 ++-- packages/google-cloud-documentai/package.json | 13 +++++++++---- release-please-config.json | 3 ++- 6 files changed, 17 insertions(+), 12 deletions(-) rename packages/google-cloud-documentai/{.github => }/.OwlBot.yaml (79%) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c38b0a70276..2eea92d53be 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -18,6 +18,7 @@ "packages/google-cloud-dataproc": "4.1.1", "packages/google-cloud-deploy": "2.2.2", "packages/google-cloud-discoveryengine": "0.2.0", + "packages/google-cloud-documentai": "6.1.0", "packages/google-cloud-gkeconnect-gateway": "2.0.5", "packages/google-cloud-gkemulticloud": "0.1.4", "packages/google-cloud-language": "5.1.2", diff --git a/packages/google-cloud-documentai/.github/.OwlBot.yaml b/packages/google-cloud-documentai/.OwlBot.yaml similarity index 79% rename from packages/google-cloud-documentai/.github/.OwlBot.yaml rename to packages/google-cloud-documentai/.OwlBot.yaml index 7c4d3838232..5e095ce5be2 100644 --- a/packages/google-cloud-documentai/.github/.OwlBot.yaml +++ b/packages/google-cloud-documentai/.OwlBot.yaml @@ -11,12 +11,10 @@ # WITHOUT 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/documentai/(.*)/.*-nodejs/(.*) - dest: /owl-bot-staging/$1/$2 + - source: /google/cloud/documentai/(.*)/.*-nodejs + dest: /owl-bot-staging/google-cloud-documentai/$1 diff --git a/packages/google-cloud-documentai/.repo-metadata.json b/packages/google-cloud-documentai/.repo-metadata.json index a4985047d99..bd9f0e591b4 100644 --- a/packages/google-cloud-documentai/.repo-metadata.json +++ b/packages/google-cloud-documentai/.repo-metadata.json @@ -6,7 +6,7 @@ "issue_tracker": "", "release_level": "stable", "language": "nodejs", - "repo": "googleapis/nodejs-document-ai", + "repo": "googleapis/google-cloud-node", "distribution_name": "@google-cloud/documentai", "api_id": "documentai.googleapis.com", "requires_billing": true, diff --git a/packages/google-cloud-documentai/owlbot.py b/packages/google-cloud-documentai/owlbot.py index 763cdf629f3..3a0575fbd7d 100644 --- a/packages/google-cloud-documentai/owlbot.py +++ b/packages/google-cloud-documentai/owlbot.py @@ -16,12 +16,12 @@ import os import synthtool as s import synthtool.gcp as gcp -import synthtool.languages.node as node +import synthtool.languages.node_mono_repo as node import json import logging from pathlib import Path -node.owlbot_main() +node.owlbot_main(relative_dir="packages/google-cloud-documentai",) ## Note: this API only supports regional endpoints and does not support default scopes. s.replace(f"src/*/document_*_service_client.ts", diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json index ccf81bd766b..c344a9ea087 100644 --- a/packages/google-cloud-documentai/package.json +++ b/packages/google-cloud-documentai/package.json @@ -2,7 +2,11 @@ "name": "@google-cloud/documentai", "version": "6.1.0", "description": "Document AI client for Node.js", - "repository": "googleapis/nodejs-document-ai", + "repository": { + "type": "git", + "directory": "packages/google-cloud-documentai", + "url": "https://github.com/googleapis/google-cloud-node.git" + }, "license": "Apache-2.0", "author": "Google LLC", "files": [ @@ -21,8 +25,8 @@ "prelint": "cd samples; npm link ../; npm install", "predocs-test": "npm run docs", "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", + "system-test": "npm run compile && c8 mocha build/system-test", + "samples-test": "npm run compile && cd samples/ && npm link ../ && npm i && npm test", "test": "c8 mocha build/test", "precompile": "gts clean" }, @@ -51,5 +55,6 @@ }, "engines": { "node": ">=12.0.0" - } + }, + "homepage": "https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-documentai" } diff --git a/release-please-config.json b/release-please-config.json index ca8fb90627b..e52a1f5ba03 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -19,6 +19,7 @@ "packages/google-cloud-dataproc": {}, "packages/google-cloud-deploy": {}, "packages/google-cloud-discoveryengine": {}, + "packages/google-cloud-documentai": {}, "packages/google-cloud-gkeconnect-gateway": {}, "packages/google-cloud-gkemulticloud": {}, "packages/google-cloud-language": {}, @@ -49,4 +50,4 @@ } ], "release-type": "node" -} \ No newline at end of file +} From c4d2af01cd55f5081716f62e8d2bac78e35711fd Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 11 Nov 2022 09:52:33 +0000 Subject: [PATCH 211/213] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot?= =?UTF-8?q?=20post-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- packages/google-cloud-documentai/.mocharc.js | 2 +- .../google-cloud-documentai/.prettierrc.js | 2 +- packages/google-cloud-documentai/README.md | 59 +- .../google-cloud-documentai/samples/README.md | 640 ++++++++++++++++-- packages/google-cloud-documentai/src/index.ts | 2 +- release-please-config.json | 2 +- 6 files changed, 648 insertions(+), 59 deletions(-) diff --git a/packages/google-cloud-documentai/.mocharc.js b/packages/google-cloud-documentai/.mocharc.js index 0b600509bed..cdb7b752160 100644 --- a/packages/google-cloud-documentai/.mocharc.js +++ b/packages/google-cloud-documentai/.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-documentai/.prettierrc.js b/packages/google-cloud-documentai/.prettierrc.js index d1b95106f4c..d546a4ad546 100644 --- a/packages/google-cloud-documentai/.prettierrc.js +++ b/packages/google-cloud-documentai/.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-documentai/README.md b/packages/google-cloud-documentai/README.md index 4601929647c..58ebf7d8167 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -2,7 +2,7 @@ [//]: # "To regenerate it, use `python -m synthtool`." Google Cloud Platform logo -# [Document AI: Node.js Client](https://github.com/googleapis/nodejs-document-ai) +# [Document AI: 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/documentai.svg)](https://www.npmjs.org/package/@google-cloud/documentai) @@ -14,11 +14,11 @@ Document AI client for Node.js A comprehensive list of changes in each version may be found in -[the CHANGELOG](https://github.com/googleapis/nodejs-document-ai/blob/main/CHANGELOG.md). +[the CHANGELOG](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-documentai/CHANGELOG.md). * [Document AI Node.js Client API Reference][client-docs] * [Document AI Documentation][product-docs] -* [github.com/googleapis/nodejs-document-ai](https://github.com/googleapis/nodejs-document-ai) +* [github.com/googleapis/google-cloud-node/packages/google-cloud-documentai](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-documentai) Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in [Client Libraries Explained][explained]. @@ -131,18 +131,49 @@ async function quickstart() { ## Samples -Samples are in the [`samples/`](https://github.com/googleapis/nodejs-document-ai/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 | | --------------------------- | --------------------------------- | ------ | -| Batch-process-document | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/batch-process-document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-process-document.js,samples/README.md) | -| Process-document-form | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-form.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-form.js,samples/README.md) | -| Process-document-ocr | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-ocr.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-ocr.js,samples/README.md) | -| Process-document-quality | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-quality.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-quality.js,samples/README.md) | -| Process-document-specialized | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-specialized.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-specialized.js,samples/README.md) | -| Process-document-splitter | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-splitter.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-splitter.js,samples/README.md) | -| Process-document | [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document.js,samples/README.md) | -| Quickstart | [source code](https://github.com/googleapis/nodejs-document-ai/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-document-ai&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | +| Document_processor_service.batch_process_documents | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js,samples/README.md) | +| Document_processor_service.create_processor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.create_processor.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.create_processor.js,samples/README.md) | +| Document_processor_service.delete_processor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor.js,samples/README.md) | +| Document_processor_service.delete_processor_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor_version.js,samples/README.md) | +| Document_processor_service.deploy_processor_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.deploy_processor_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.deploy_processor_version.js,samples/README.md) | +| Document_processor_service.disable_processor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.disable_processor.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.disable_processor.js,samples/README.md) | +| Document_processor_service.enable_processor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.enable_processor.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.enable_processor.js,samples/README.md) | +| Document_processor_service.fetch_processor_types | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.fetch_processor_types.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.fetch_processor_types.js,samples/README.md) | +| Document_processor_service.get_processor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor.js,samples/README.md) | +| Document_processor_service.get_processor_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor_version.js,samples/README.md) | +| Document_processor_service.list_processor_types | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_types.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_types.js,samples/README.md) | +| Document_processor_service.list_processor_versions | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_versions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_versions.js,samples/README.md) | +| Document_processor_service.list_processors | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processors.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processors.js,samples/README.md) | +| Document_processor_service.process_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js,samples/README.md) | +| Document_processor_service.review_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js,samples/README.md) | +| Document_processor_service.set_default_processor_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.set_default_processor_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.set_default_processor_version.js,samples/README.md) | +| Document_processor_service.undeploy_processor_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.undeploy_processor_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.undeploy_processor_version.js,samples/README.md) | +| Document_understanding_service.batch_process_documents | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js,samples/README.md) | +| Document_understanding_service.batch_process_documents | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js,samples/README.md) | +| Document_understanding_service.process_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js,samples/README.md) | +| Document_processor_service.batch_process_documents | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js,samples/README.md) | +| Document_processor_service.create_processor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js,samples/README.md) | +| Document_processor_service.delete_processor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js,samples/README.md) | +| Document_processor_service.delete_processor_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor_version.js,samples/README.md) | +| Document_processor_service.deploy_processor_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.deploy_processor_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.deploy_processor_version.js,samples/README.md) | +| Document_processor_service.disable_processor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js,samples/README.md) | +| Document_processor_service.enable_processor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js,samples/README.md) | +| Document_processor_service.fetch_processor_types | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js,samples/README.md) | +| Document_processor_service.get_processor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor.js,samples/README.md) | +| Document_processor_service.get_processor_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor_version.js,samples/README.md) | +| Document_processor_service.list_processor_types | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_types.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_types.js,samples/README.md) | +| Document_processor_service.list_processor_versions | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_versions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_versions.js,samples/README.md) | +| Document_processor_service.list_processors | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js,samples/README.md) | +| Document_processor_service.process_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js,samples/README.md) | +| Document_processor_service.review_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js,samples/README.md) | +| Document_processor_service.set_default_processor_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.set_default_processor_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.set_default_processor_version.js,samples/README.md) | +| Document_processor_service.undeploy_processor_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.undeploy_processor_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.undeploy_processor_version.js,samples/README.md) | +| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/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=packages/google-cloud-documentai/samples/quickstart.js,samples/README.md) | +| Quickstart.test | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/test/quickstart.test.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/test/quickstart.test.js,samples/README.md) | @@ -192,7 +223,7 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] ## Contributing -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-document-ai/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`) @@ -204,7 +235,7 @@ to its templates in Apache Version 2.0 -See [LICENSE](https://github.com/googleapis/nodejs-document-ai/blob/main/LICENSE) +See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) [client-docs]: https://cloud.google.com/nodejs/docs/reference/documentai/latest [product-docs]: https://cloud.google.com/document-ai/docs/ diff --git a/packages/google-cloud-documentai/samples/README.md b/packages/google-cloud-documentai/samples/README.md index 25a1e445fe4..c3fdc979a96 100644 --- a/packages/google-cloud-documentai/samples/README.md +++ b/packages/google-cloud-documentai/samples/README.md @@ -2,7 +2,7 @@ [//]: # "To regenerate it, use `python -m synthtool`." Google Cloud Platform logo -# [Document AI: Node.js Samples](https://github.com/googleapis/nodejs-document-ai) +# [Document AI: Node.js Samples](https://github.com/googleapis/google-cloud-node) [![Open in Cloud Shell][shell_img]][shell_link] @@ -12,19 +12,50 @@ * [Before you begin](#before-you-begin) * [Samples](#samples) - * [Batch-process-document](#batch-process-document) - * [Process-document-form](#process-document-form) - * [Process-document-ocr](#process-document-ocr) - * [Process-document-quality](#process-document-quality) - * [Process-document-specialized](#process-document-specialized) - * [Process-document-splitter](#process-document-splitter) - * [Process-document](#process-document) + * [Document_processor_service.batch_process_documents](#document_processor_service.batch_process_documents) + * [Document_processor_service.create_processor](#document_processor_service.create_processor) + * [Document_processor_service.delete_processor](#document_processor_service.delete_processor) + * [Document_processor_service.delete_processor_version](#document_processor_service.delete_processor_version) + * [Document_processor_service.deploy_processor_version](#document_processor_service.deploy_processor_version) + * [Document_processor_service.disable_processor](#document_processor_service.disable_processor) + * [Document_processor_service.enable_processor](#document_processor_service.enable_processor) + * [Document_processor_service.fetch_processor_types](#document_processor_service.fetch_processor_types) + * [Document_processor_service.get_processor](#document_processor_service.get_processor) + * [Document_processor_service.get_processor_version](#document_processor_service.get_processor_version) + * [Document_processor_service.list_processor_types](#document_processor_service.list_processor_types) + * [Document_processor_service.list_processor_versions](#document_processor_service.list_processor_versions) + * [Document_processor_service.list_processors](#document_processor_service.list_processors) + * [Document_processor_service.process_document](#document_processor_service.process_document) + * [Document_processor_service.review_document](#document_processor_service.review_document) + * [Document_processor_service.set_default_processor_version](#document_processor_service.set_default_processor_version) + * [Document_processor_service.undeploy_processor_version](#document_processor_service.undeploy_processor_version) + * [Document_understanding_service.batch_process_documents](#document_understanding_service.batch_process_documents) + * [Document_understanding_service.batch_process_documents](#document_understanding_service.batch_process_documents) + * [Document_understanding_service.process_document](#document_understanding_service.process_document) + * [Document_processor_service.batch_process_documents](#document_processor_service.batch_process_documents) + * [Document_processor_service.create_processor](#document_processor_service.create_processor) + * [Document_processor_service.delete_processor](#document_processor_service.delete_processor) + * [Document_processor_service.delete_processor_version](#document_processor_service.delete_processor_version) + * [Document_processor_service.deploy_processor_version](#document_processor_service.deploy_processor_version) + * [Document_processor_service.disable_processor](#document_processor_service.disable_processor) + * [Document_processor_service.enable_processor](#document_processor_service.enable_processor) + * [Document_processor_service.fetch_processor_types](#document_processor_service.fetch_processor_types) + * [Document_processor_service.get_processor](#document_processor_service.get_processor) + * [Document_processor_service.get_processor_version](#document_processor_service.get_processor_version) + * [Document_processor_service.list_processor_types](#document_processor_service.list_processor_types) + * [Document_processor_service.list_processor_versions](#document_processor_service.list_processor_versions) + * [Document_processor_service.list_processors](#document_processor_service.list_processors) + * [Document_processor_service.process_document](#document_processor_service.process_document) + * [Document_processor_service.review_document](#document_processor_service.review_document) + * [Document_processor_service.set_default_processor_version](#document_processor_service.set_default_processor_version) + * [Document_processor_service.undeploy_processor_version](#document_processor_service.undeploy_processor_version) * [Quickstart](#quickstart) + * [Quickstart.test](#quickstart.test) ## 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-document-ai#using-the-client-library). +[Using the client library](https://github.com/googleapis/google-cloud-node#using-the-client-library). `cd samples` @@ -36,16 +67,16 @@ Before running the samples, make sure you've followed the steps outlined in -### Batch-process-document +### Document_processor_service.batch_process_documents -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/batch-process-document.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/batch-process-document.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=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js,samples/README.md) __Usage:__ -`node samples/batch-process-document.js` +`node packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js` ----- @@ -53,16 +84,16 @@ __Usage:__ -### Process-document-form +### Document_processor_service.create_processor -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-form.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.create_processor.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-form.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=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.create_processor.js,samples/README.md) __Usage:__ -`node samples/process-document-form.js` +`node packages/google-cloud-documentai/samples/generated/v1/document_processor_service.create_processor.js` ----- @@ -70,16 +101,16 @@ __Usage:__ -### Process-document-ocr +### Document_processor_service.delete_processor -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-ocr.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-ocr.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=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor.js,samples/README.md) __Usage:__ -`node samples/process-document-ocr.js` +`node packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor.js` ----- @@ -87,16 +118,16 @@ __Usage:__ -### Process-document-quality +### Document_processor_service.delete_processor_version -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-quality.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor_version.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-quality.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=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor_version.js,samples/README.md) __Usage:__ -`node samples/process-document-quality.js` +`node packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor_version.js` ----- @@ -104,16 +135,16 @@ __Usage:__ -### Process-document-specialized +### Document_processor_service.deploy_processor_version -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-specialized.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.deploy_processor_version.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-specialized.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=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.deploy_processor_version.js,samples/README.md) __Usage:__ -`node samples/process-document-specialized.js` +`node packages/google-cloud-documentai/samples/generated/v1/document_processor_service.deploy_processor_version.js` ----- @@ -121,16 +152,16 @@ __Usage:__ -### Process-document-splitter +### Document_processor_service.disable_processor -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document-splitter.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.disable_processor.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document-splitter.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=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.disable_processor.js,samples/README.md) __Usage:__ -`node samples/process-document-splitter.js` +`node packages/google-cloud-documentai/samples/generated/v1/document_processor_service.disable_processor.js` ----- @@ -138,16 +169,526 @@ __Usage:__ -### Process-document +### Document_processor_service.enable_processor -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/process-document.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.enable_processor.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&page=editor&open_in_editor=samples/process-document.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=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.enable_processor.js,samples/README.md) __Usage:__ -`node samples/process-document.js` +`node packages/google-cloud-documentai/samples/generated/v1/document_processor_service.enable_processor.js` + + +----- + + + + +### Document_processor_service.fetch_processor_types + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.fetch_processor_types.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.fetch_processor_types.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1/document_processor_service.fetch_processor_types.js` + + +----- + + + + +### Document_processor_service.get_processor + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor.js` + + +----- + + + + +### Document_processor_service.get_processor_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor_version.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor_version.js` + + +----- + + + + +### Document_processor_service.list_processor_types + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_types.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_types.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_types.js` + + +----- + + + + +### Document_processor_service.list_processor_versions + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_versions.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_versions.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_versions.js` + + +----- + + + + +### Document_processor_service.list_processors + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processors.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processors.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processors.js` + + +----- + + + + +### Document_processor_service.process_document + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js` + + +----- + + + + +### Document_processor_service.review_document + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js` + + +----- + + + + +### Document_processor_service.set_default_processor_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.set_default_processor_version.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.set_default_processor_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1/document_processor_service.set_default_processor_version.js` + + +----- + + + + +### Document_processor_service.undeploy_processor_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.undeploy_processor_version.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1/document_processor_service.undeploy_processor_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1/document_processor_service.undeploy_processor_version.js` + + +----- + + + + +### Document_understanding_service.batch_process_documents + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js` + + +----- + + + + +### Document_understanding_service.batch_process_documents + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js` + + +----- + + + + +### Document_understanding_service.process_document + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js` + + +----- + + + + +### Document_processor_service.batch_process_documents + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js` + + +----- + + + + +### Document_processor_service.create_processor + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js` + + +----- + + + + +### Document_processor_service.delete_processor + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js` + + +----- + + + + +### Document_processor_service.delete_processor_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor_version.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor_version.js` + + +----- + + + + +### Document_processor_service.deploy_processor_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.deploy_processor_version.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.deploy_processor_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.deploy_processor_version.js` + + +----- + + + + +### Document_processor_service.disable_processor + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js` + + +----- + + + + +### Document_processor_service.enable_processor + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js` + + +----- + + + + +### Document_processor_service.fetch_processor_types + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js` + + +----- + + + + +### Document_processor_service.get_processor + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor.js` + + +----- + + + + +### Document_processor_service.get_processor_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor_version.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor_version.js` + + +----- + + + + +### Document_processor_service.list_processor_types + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_types.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_types.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_types.js` + + +----- + + + + +### Document_processor_service.list_processor_versions + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_versions.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_versions.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_versions.js` + + +----- + + + + +### Document_processor_service.list_processors + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js` + + +----- + + + + +### Document_processor_service.process_document + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js` + + +----- + + + + +### Document_processor_service.review_document + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js` + + +----- + + + + +### Document_processor_service.set_default_processor_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.set_default_processor_version.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.set_default_processor_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.set_default_processor_version.js` + + +----- + + + + +### Document_processor_service.undeploy_processor_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.undeploy_processor_version.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.undeploy_processor_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.undeploy_processor_version.js` ----- @@ -157,14 +698,31 @@ __Usage:__ ### Quickstart -View the [source code](https://github.com/googleapis/nodejs-document-ai/blob/main/samples/quickstart.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/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=packages/google-cloud-documentai/samples/quickstart.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/quickstart.js` + + +----- + + + + +### Quickstart.test + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/test/quickstart.test.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-document-ai&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=packages/google-cloud-documentai/samples/test/quickstart.test.js,samples/README.md) __Usage:__ -`node samples/quickstart.js` +`node packages/google-cloud-documentai/samples/test/quickstart.test.js` @@ -172,5 +730,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-document-ai&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/document-ai/docs/ diff --git a/packages/google-cloud-documentai/src/index.ts b/packages/google-cloud-documentai/src/index.ts index 3486f063d88..75c5e3d2de6 100644 --- a/packages/google-cloud-documentai/src/index.ts +++ b/packages/google-cloud-documentai/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 e52a1f5ba03..71ecdf42c73 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -50,4 +50,4 @@ } ], "release-type": "node" -} +} \ No newline at end of file From a631fba59990ad4d81be61c6f0423642cda3ff2a Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 11 Nov 2022 15:21:26 -0800 Subject: [PATCH 212/213] add resources --- .../samples/resources/invoice.pdf | Bin 0 -> 58980 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 packages/google-cloud-documentai/samples/resources/invoice.pdf diff --git a/packages/google-cloud-documentai/samples/resources/invoice.pdf b/packages/google-cloud-documentai/samples/resources/invoice.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7722734a4305b3e2f4f473b2c5783f90062ffdc7 GIT binary patch literal 58980 zcmc$^b6_oBw=Edkwsm6LwsT@<$F^;Xg!8p;6E?`Z&R&794N*jb1e#4W6y0gm6jwV^XW6ku#;@@@4W zy`rI`jT6y7Ac)vmyV%$|5wQ|6C^`a6ER3D)9Eq5izvo88p#F^n6A|(NIB)ki%`k>xu)wTCn58yMPjNfXMn<0yT&+$^NZR4ld?@EWd^PZTNrAT^ZnH=i+GmjmAIP7ISx&P;vei z|G!2OEJRHIg#U&}f}Mzo>tCDy$Xxt8+P^HsS&5kb9Z{T(h>7z*jKw*KnE#2Y{I6?5 z(b3LW1@N!58NNSSzTpPAJAYptHs2fw|GO9YcQ5sw;XeUXoE=?^o&O_Mr*BXHrsyBq z{tG|Lg z5mHIvk0d;QB>F~aVb)@XcZoQd-Y2kR6Ng1&xxc>%4Scl{h55bT+~%c;)(M;T<$Za+ zyy=JfNl-gc2=IL26QYZ}z8s7*e(p_g>G69j_1k?-;&s*rZ4Xgk^bi!j5|T;%n~WsfiQAlUWv zfSLYk(J3Atf*^Gaf|BK?(fhRYE!Zy1 zq}RBzqHS##uf`Tlwi15d)9#a#G^)xD`xC=yZ`zs4KNXA(Rjw3;^X860%r=GAco2wB zIF!em!|z=e>HT!oUCavv`3{;jk!Vjt`fAboD5C8aNpbq zMesuFta~i{TR2Tncrx6Xa}vtM9X#_BEVsve>;hgi^NQNOVkCW&eM|R!Qs&gLIiDK1 z)GNI+*=dOSLZ*M;8EpQ>r}M`|KAJ^Ao2~)R5EHhUPnrI+)S5*dw-Ha6P{=YgFdVXU zKRuhqe*`#Qjx`4a=!8?)|KxGwWeNLqlZKzTVanj|3^*-F`yI+R^GuDEzC z5{+^@Qmwd>Q*K(d3#W6q#eun;CR@@^>en32AZ7=Wd~eZwvZ(_~L1kxiGd#dj#Hk$% zn2EL5L$eB+DB;us{=SYu}2|u#@}X-CF|zT*OmJ&V77rBJ~UpaEDf*< zTI@n{PlI(W4o37ZxQS9;N3jU#gF2}hG!x!>iM3`4c%F1Y;rvE0Pu4GIgKzK;x_*W~-4(kJkM!@e)Kq{98bPZ6x^iB#U91m^yTBRYUY!77b7M zRH&3Lp7;o%Ep0EW(=6|`3^|g^=!8zg)nd{7%#kaA)EU_6S~OiZ$Gucc{1Y!eHIhh` z*!IXFWqPX6*Uig0EH$DJ-|e*WmQDEFAggv{qf8Ie@Y+X!xK!4zYlRSA_V~V);c0Q* z=35-GH(QCj$kj}L_0K6@>36$K zk&Dir@!(duzS(mv+}=vpDHr+bEXVs&YO=<5>%RWr%lLqJi;GofT43;CGMTu}RVK0o zp+J+#@j_sh19hPAPaU>_fud(dXDSEtGlPorn8&<6tux(mkgElfS}g7Hr$wWC5k|Rg ziO&<-HZ8Sl3qH9-T*xTRNC%i=w|$-YKmrqTfo(qU)dcPZ#VmM!!^)T~Cnf9`dj zycc#_Twr%v0gRGc)juuxa&d3C_V#ZpH*ydQ^08k%pb=Lne+d%Y2~4uWQ1p!g%ylU| z>@EbPcNtZ39{A08r%FGfSi<(by|zvOUnW-^H0B`g zO`r5p7vLuu!WBlnPOJTF^5AoLN1~Q+HRt*2Eg)Zq55|o(H?Et)iz|2eynbj@e%1iV zEnJYchy|_DgP^W5orSM4UC%M4HY-PzKiuZO1Ye96*1~X(epaoTND^P#e+Zr}nD_BM zq_i^tC?ZmUKDJiA`j~k-P2Y2N9Bf$W=We{}7VEW5Wnq!F9cPGUL#vb}N{!h{o|Frz z0TPlEPjS_=nIjyvawT8386_tG> z{Y8IB4Wd)}<6g8JxufCPb24NpcWuPx{f^*^ruy+E-Nt3>?91+5Zxj$cERjHaTbWGu-FVicgrK0dToj8Nq&`5Nd_mX6=wt4 zHg2W5{Y`ZICoL$+WF=H~qTJsja;X1(yajpo|27_`bQj=P^wgR}UkQ~}=Y)gYSn@cl zvqr3|o)Yz`A~noeMroriQ*|&4j5TW_2uXUK;g3fL3b?aM_$c78lx}X6kSqRD(z6c& zI2aRhWEvsRv&}vF5My6jQTn2u*vk;aoF>MC)S8ltjy0|9UlYE%-9hr>sgtP-1)HDz z?4~AXU6(uOrl?>1t;rho3Y@0%@=gNex0*lMOkvJFPD2V;l&_UKOxPE>ThikTn?$m&b;A}fP2l%GqSF%p604sFqEw9o?tGYUNf(9WL<6H;UGm;*Y`tHB%9b3$64cE zl-5sQ%joW{>h;B#+bUz>qnaKAGz#@4g{avK%$JeLPX5QqI9z%c)(_$cP!=y7PR68; zv(mxiF9rCCmhG=MU}Xj%dku;$auI zSe0ur8eu~4p#uZtZdCP+U&$VKl6U7uM443vX;9Cu7HI2tUm$Vc zM-LxXEOmdM{eF&Skb9vb*DrfP3QWL4l9zbcPas$tCsVT-IbT<0jZbUjjeRpS|AT3k z{H%9t6pc^T_bIpas;CQ|qAi(s&S%AU-skB^fkp=Xf&TS0yk85kW-kbc%da+MgDACu z5)?ReBJ;k-KIUA5w9`-E*YT5&b5=vqhspy*=wLeZJY9kJdYYa)CMhN!<-;Ou?HK)P z(>dh0Gn0vE%q7UQ11ay?-qdtm9E?fWdV0~|Ra8V|HDU^O*(GUUE z4}QLXRPs^OB7x_XJsH)*q{~LWB3{&`dl(U`8fiEoL+}NAeaD}mxm3|A=}KE)I2G{9 zs~@y#UtRQB4v8>O$Wt%h+#ixU8Vpgs`+^#RAMH&A(YAZeB>B4}NcAgLpi+@3L&{8! zj|8bE_UI(52;7+m!LJ_^9d~E`tbvm3`SB7!C`qwp$?Yn}LG)|e1A)7_cMEL2+|Rq# zs@|hl!A!#Vs{JZLK`(xFt+l>d{anp`bCTEO6dD zsG6CGSXnsOzf14`ETUQ1IsRGX{$Fdy^DYl>6|pA)U(?I=bFVcrxp@kUOf;PQUo;`o z{mNh~W1Ao;^>!r5ATaf4E92DEAk0HlHRu%?>9roTetaz=?qJLt&7JY@UM)lEl^B^r4aNumu+)cjikt zmtQv0iWtQjC48~C4f1Y(E&O}Nh@tbJSQJstw8}};Wa>Vi$F_p72IsV zubdus!LWN09*ew+eboSTcUPx}GIV6P9QqMYyhy4OPH_(y`88{gWI-M4C+NN&?q&c- zcsI#p_(kgTsvi8d{P5EttA==;mBSgj{5G|FBf`TiKPny=U2>Ro7pd#mA^lG~u#j&R zDnr1ZfW*-kX9NdCTwp#%`Pw|60ZWbPz3@wvF%kH4>}4{Yke}%sBFzxPOdu~CC=T$- zCjtd+6QE9t-Q2q$M61DUYT}-5MfdH;x6qmm zG7d(TU?s6hLZ1qd6SKwqJ?!>;jF6c{c?-dJQH)@XcnjHf)kIOPacgyj64jHj>9Z2O z^R2_Lh!E@S5+_23YlSkWuQONh+A!^g$-S_LB(`^-_Rm7bX&(V@dtEP?yUg>F z%lw94*F7^lLI`1ZoCmFJS6{3jUkJw*4v?o4_yvT6Dg{WfW^DSXw|SB{eJheoT`)=k zl1k4bT7&M&q*ss-*sJUVqK9FB3ke;U4YTvG7VcUx7`yVG(eY4H`%zq}@43qTVLV|l z#*7W9bc49z*9uDw2_Sm}=A>FiW^I_=N@>3*=Fyepm_wNG15z2gx(AV@6|0wR;EGCO zI>8>7OGiNF5!i**$WTL1WXW#qNXZ@eWKR60Q$&7vi#RWn=ipYJdIe+QD&`FBt*+SN zT}QwXf7pd=$w_CLHMJ*cQ@JP6R)Xu$^O+May7FuQ>aw5T7hm(OEX<)BGFZ4?z97wH zv7jpON26M5?9Mcj(J?vRQ$L4|r4kiZU8x+djRhzELX4~Ggg-R0&tqq?oo@&w8PBTz zX`XU3>|yu==T#Z#uTR^^N}+wqM=xF)vD}(40B5X*A#$~ZtOVR4Z^9wSpRo&&mWaNj z5i{GU)PCL_xL4RtTL>(2uLMNU+AE1)tc~T_x2z68)(IbACzXV!tNo0D)98edSBQCD zgQ_#sMv4mAfvMKGsS&{FscU36e-Ig@9DC1VC3>JdhzSuKlUE2dLbvQ1REH5upagQ$ z+=&+@^n=GSkH9xoFhIM={dOsrsUCxXTSM8$X$%@F39H+%mLs3sfzKZHe0n|ENA(1t zgY13i#5WqTTo5F01sGKs&i~x-MtkBDs}jYz`m0q662ztrZ6<`coRf6>248F+Fq3$p zJTN{{<_1e227#=&Ys6ZNi!CHAUnwjp@05zruQV76O_I3pu?~9*_TJ#CD`!vt) zvOM=1?B1ug-zV+}v}BSyR_NDXCiW@F@2UsH%&tIQp0s)AOX=(L3h2lUp-^=9Y8nYO zff%0)K0@-1^nyV)B#eu36K`)Y=AEqdEu|KnAZ^ZWN}m%S0N#>pKb>>pHguJ}^o3FC zwH=~8O9jbsV8}LcWbmRv;9#cXfOhCK@)_Xq^}NLCb<$%%R19_Yi$8$O*lhs7H)~2_ zj`Fxjv8XxZz~T$C#2lEGa%yGB71rpA+=w&exIQs0{1MX{QnQj>vs{wA#VHVT=XmsP z@b!KUIw07HPAG^o$1l0YHkWmaKa1Hi>RnUYxfSiC>v$5&>{k=fvor*4YxViT_w@y) z!!wL@MYQ?()lOFpXpLpG=X1dLi1)rHRVeUdhB^dh&8Kfmh;&DOP}DEZGs4ljGEfP| z=ogp8jk(wKf8Ao@#hzCPK`x|4U>AEI(~w=mEUyS(uTg0A{pbK%QYx&zf?2BBip2`s z(MM`vd?%mdh_4>J6)@_0k=%ki;(+UYW*rcU{tCW8XDX4JAi18hVS zrEu^b-!s|w2a*s{a-eoPohr%k};Lv_t4^voXfh@BpF3t8O zTrAmDIUZBZQ?XMKQ(RL=ISgF-t`XH#X)7tmx9wW3ukDv^d?%}!lBj@)S5Xxs*+RP6 zgk{#*v}G;_^Ib^}7u`7!rOc_zXU%C^t(j?;@>H9NujWb5!Foz?WU!ok49l2> z19yVckC8TKGuvRNy?Cc-;-luRp*H?%p=vb_E;G@oK?({{PW4Pq;oa;zzipizxv8pK z>s#xd(Kh3ew&{4MDmzEpVz>1t(OtZ@zEfyN`d{7Xj#K(u1>Gt>U$58?DGxNKcI&M@ z1$2(pfll=I@Gyr-1?Ha7-4w;4Q*%!aV#i7(>PcZE?#wSk6wz@9%((a9DuHrAa*Uj) zrhi!7frbP*%)R!;an0n?{@aT&Ijqqm0bCfb<3hKe|bHb;P- zOTf0z8g^7ZU}2FIeA$ls-eLWGnjZQ@u)NR%JRgJ)LNxW|_yjKB?_ry^SUYNW-~ZlO zO;vHV9IPw*J2Bk0AJH9+O%<5(r@2n~(eLTZt;n0fP95e<@@4t3?^&;|l$fDT59P%0 z%S^p{AC|Ig<+V82Wrk$@XSEnyuzYaVNPCxlr`FF1v0# zrtG-f-|MCIQ2G7*jDELx@qFQa(RxvOk$*9L5pUEN7+H;M zM(I{P9h0b%Xdm_N*@OEA99*N( zhH~uC>V(4A;`;{a?@(I@r0wXs{UTem3HH%gQPkKN6lzMI@R_Je>${ zLV8*_DJrEZD#vO9>w!?+OStcG3*wQ`DcYQ9W5Tl{q({LsN>kPVV!}~Q;HBiiBX7 zoN`3!miQ&yTb5r4kvM~uSWXH?Cs<}5Ej#q?n#&v5Y#YxTMn7?UALa$zX0c|U!!bpN z)GuCORDYlQCc)D&h&7(bBGeU*svsFASt((xEStJ4@wcSY?-HEfzqo&wLRc14;D{AT z!QzNalBE~{EPM{w`!v>4>p%}K+D!c2rD{D~lMy1|?8)nstEdMx1afS5?`RKFi!|f9YF6wj8 zsUU?&2DbZ)#V| zv7&tr^#K2!*POsI&x3#9LnY#S>uAGkbr6%ns0zO!; zhs*gE{V!m#K~P9|`Zhnw6Gbd`?|~7eqTy(Kj?VySMEPu0_BQXa1q(zzUY{XS7PHA* z6{e?Ik2_3Sokn-5gE_#sdZo_8^67A%yW^ya)l!w;Ylazz^?IYnxYKmc^{$L|i_I2s zXXjmtZor0`*YBrGuO?H!i-4e-F5ly8T)S?UeL}mQyUSVQt1iFyAXLho{y6^6{e=?+ zfw%W47PB5+x6kS;_a(Q^GoH-{{HxbkH=p5-?mgYDo9e6Qo;&=Hi`AFAwauiZ5*OQw z?8=Gg`&5f^x=fC{U#vEX=MQ9UsJikJ!kv6m7*hVJnTfxj~B;G?9*3 zZDavL780EswoSi-I{GEm?o4a7e+}j1hyX`<&Dk1R$P@!Lp*3#G2^9>=gIiz5f(K~0 zNo)rBZ~wsJCQ)3jD9bm_9#>oM)bw}8x+K5=a(naNq(l!uP-X$v4D;8q9O6oigGl9e z^ELR`DRs-0*x|KN$_;BcYRa<;O~R@5}WKii)j z8xx!QQ=%uV}CH?(fu!>ZQCt#MHE# zmQa=N=uSf$nr9T)1VU;rJ_M1BFHHkq<-uJ;h{ShH`tviky=y`DX?jg1R9xAFp#SPm zkdC}z=AfaMZlX+_Qwo0~Q3FvTVahwH5R@c`jt*w;TH#(Zjl^Lb4S=g&zmfFp6&`_c$ zv%|>CmAP8za|?Jr`@wR`Yz9D~E^hzBEqa9(Fd9!FpWYD6rD$4ec!kBJW84G<5Y z{}^V_`2ExD*(#nkWhB=Du~=rdVCQ%ngDnC@%{2Z5Tdr zvbIbU7YG0fG&0WHo)iG4EJRX@Ob?DXJZ24*7XddyH$o-xk2lPj*EnMR%N6QQ=zuea zY7zOgahv#btnao7l3>+ zozv{{$z$kB%-2j!KO8 zdBWP=Vr&Y=EqMN|iHz0}WCWS8( z>AI^EcVsXEdRs~ z!?4$-)Bf6(+kS`);D-AR&te%|pEEr$$Hp=Z$Awao<2+48Wav3-bZI1NpYLGh*4cxl zP3AIwczkbv7AC1Lf93}(Op0(p{EzfNYC&XO)b{PC8_;d@i~!WnDIj2q5cp*M7fq%m zD^Z~xekf6BU5h3D3#p|)J3BKj=`8kDaUG#$Gyaj6k7Nd?FuHHeh>f={RS999kdEHE zptpTOVja+$O3~%O?X98t4;943xs61z9lzfKkoE!(9J1LpYdc%9Di1AQ{(7ru8{3w~ zejO^~w7q_QYS_UJL;iKXP(fQJ(8rTJ3Q+WRSo*WKp0*M9c0>b?|FriLN6KN=w}9@Y zDW5|DbJdlW{!&ZiRp#K2ly9#i6;qGo0UGr7{=uJeNvJe!Li(fLR}K0IRN7M2Kndz2 zCF);}(btY0<4G{wm-5nyV;b3t^eI1DIPK`1CV~LG1m)3fAhA+_*bEx?3_t1g{#Z!8$2r78m9QGlcGOR=AO9DN-6(V<;FnGfLlbM77qoBerQ!@aK|I`afo5!WOP%=BeQbjb&fX1}qxDm^dyy67+N7Egvh3|^L3U#cx8(+O zSZhr0G{cA#av5XT1l_M=U!{nL=-b^@#xH38)d9);x}Yz|N0+JNOijs%KW5sQ*OE4DY;D0b6F@}3Z?1I~8xV>jHkX)Xi7>uYw!m0yXk<3xQcL;fw{~N`M7{d@% zKTzWkoJR1NXW%ItVmP$>=p}oOu+Cl%3`pCM5*wCh2dPu48c1Me4RP@gUvBI*+(a;? z0kT$IKzcox=brk&J*A{|8IH0c%WB=EJ>EEi|B524sS*4Kkdr~cHPc@$AT7yYS4AjP zL#`8yOqie@-YiJ28F+$VsbUgUG%aK;d`|*B|Bt?o0tm$*_|Uy4_hYl0h8a!sShn0? z7yI1GpO@eQ&B_7fc_E{@Qtwe!i z>-Q<-P179V3!yM?k7y^{PhfpyTq$xsDZkZZ`C{DQ(fmIc+PiLG(PF+egB^JyUJ(WQOJM!}vW&&be}F>^ctz+g?5ym;6x^eY@+z*f?I-aSJv2^kDOvCIf+WJttv zg;*c;`z3m}5xZ+(Nc{B4E{;P{tJ*qo_h??}D4|%==V#0jjxx>^IB_dyD}@GnC4vt) z6K9w?tvzf?SQlaBmILROmEx{z@33f4XF~$oT&lCk6dduMB(?_@7gt^-C4;1oUkIKk zy^l1#abD8`{X-l0WZ{K{!uzIz#2oW|*Ux!N&rChc{qJQqER%4geT^bXG+GJNdCLyo z9t<84-oL!_-ciMV2#AGrU7uFPagTr-Rx1*nhoG|t4erJsfF>UiGYTKeD=DA+tWTdJ zS!9*+*7zIROw6|pV|$U8Z#N%vk7GmXOsOkHh&BABoZ@FP8~t_QM&Jc|x-5jZ2I+nj z2Ebv?(o40-kCgP|kozPqX3D!J@FvctbZo|+VnnZt=YCC83|GF!v7*5Uka365LmnHU zU6z3bQhkU7P!02qxGuo@NO8ZYKou;lf&QYBc!oIab$`WP*x}ZLQ%FFzX07yxV@B-` z!gNq$MJG)DHDWZP#GR@(N2Ls(Y_sP#Et?olB;N0>Oj4PqTawqW%Gs-GFYk`+z*X`*37z~!5)h_kni|Xk zeS32uSOaR?`pYj=^j>DY3Mlas@_O5+%M3VCA#8RZOK=_%Sotz)+sxmTbL!9ni0*qi z%#SCI^H*W`)68IH0vl)r$6rSctIDq{s-yLP`+}lMAZQJLukz(;tSQ+ql>Pp}^`%JA z1QT3wbVUrL4kp7r0S3}SMlsQ)7+k|A)XD?igAY#quAO6Fh(8pb<9d#H65x!@=T7`* zJ5+_!yMJ20-mSjBGlah2kXHIHf^t52BT3#f9}6m!j8$q*&g$smv|74WBA+}~F1LvL zh+6Ke1j4pBSUQU08|2!R zPKc;$yP|D+jZYxoIIB)wB%Wk>|FCIgOAO2CZm)2O_d}nrIXt+FD%dH!r)e{1)pW!> z(R#)>F~y(VD+OdW^*ew0RO891CJtXn-9s@ash2LDmeUTWEGC(-_R2JrVek>l1*KUl zROAjEOjx93WN)G}&t>8Iq+diu$}hGIkkGMNZu?w|(HlxX@6Dp=kFB?1f#^g3KyJ{Q z*~e=bv}W>5>e{TF$Ue`mjK<0(dh$$)F_i&{iAWta2FswOShbEAo0=NCr%2i^w23Qw z95Qji<#3SxN*oM&jP`Q9X0@s^G@0Es^%*|+d|z#?o0kw^wmnZQi1X30!Mi@J9~kCN z{e8m6bTQW~VEQynM7+cgr379@C16q_D{{LH)X+bo>7ZHm5!T9f zdQpLXP5Y-}BKWZcw=au|X69w2;wrY|jc|BW2y|RLJZ4)reZVJeD}6V60GX~0<1mCi zSF5@kvE^zYf}WIH)7w6dEpThpLp!6nkD8R^ZM3BjJ9V%3XNMEIj2Smp^>?hZ#}!23 zV;wbT`azc+H}NBWawKYNG*@WVbO^G{FJg*bN9rA~{H-LMdK(6yHJ1J{vvbQF;H#L# z21)B3nhXHv9CJ+avo{l2P`ph=pjh3mK#jy*&+a+qYb^F)zk$E|vNoO55Y9PU0gc*1 zxi6nH@B|d9a9o80RuWxd)MC_wgiE1vb@N15u~%RLLtyW= zHqTPGbS^x<%L@#)$j}F`D{)@b-AKOYehkdmhkS1hn`x|>)3J2Be6OCVC^T~djC6uI z6<0~(tL-i+$nHQpd(83DDa+sx@vn%1AFpE6L%*%02sD9oFm(o$UW)5Nnyk9X)3BUg zpb7?#9B~269vEX95LGp{PYzq9-SRno1QtB=H)CDHq1T@WJKp1Ue$dxB0v$2S;;w?c zWIRNE5)KRWSA{?R-Y>>1MbAt!PKIk4ahtcBbfCEnmT(pOvPBMIpNG1O1PVQR9>a_{ z1fol(6wvr;2ae^(kH)Up%(`~S8MYKm{IGTv$}$iH?0Yk~h@Kk%v%#dV)7*PA3NfsoBQETR@ewj&K1JP1I{Q+{^?#M>a5t_V%jQFz z7K3b5R1lAoQG7IjVISP-in04x#hZZI{AuDfraw})y)4Aw50y=96iCp^n=PznJg~G9 z&U;?OZWA`T(+LNjou9gywBqFaI32*rB~c|Ik82!7Ee0;!qktPjW$u9l%t&^t~T;Ym$qriPlGb zP+ri^oX=!&fB__{r5T|nTNq`wV~EKJZWx9u52hCu#-7~IwwIYV%2COFQsqz+57n#{ z7jfro5{eiZol~Hdt3O10pAVZV&b-^E8Z6<2VYO=NS{Q`Fc(kd_;r;~q8I+=>&Lsya zg>gKZluusu+t~}6kIm%aQe4-u>C#d(FCQ90>iPCewym689E|!UDhiFx zn}ivY3_3YDE;&W?AiYh?BDsS~Jz7R^MZ``pR%>|eswv$CkyoqBX~iEP*IbpK$I-d! z^l2OxVKjDIam5}FBXTfDs{L2}VS-~`Uk^bZ7q9bihbK-=cN?db$B_j>-GSFrM(uO| zrmnbXop7G1xyUKMyvC`MQJ7ztX^ORvON?o;Td;1%SL-HXg-YV9jCb{-}}u74#s=&QW6 z*7Bwi7~nr|lmHvnb14&KYn#ijhcOH?&6rEp8XZ=cOMW6R^Nu&k>5MXTD9< zVLLcW6YGhNd?{8F@HFJ~@S4?F*ig)EJZmOn*wp8`7?o$4Ra*?auWKl-K1cPGK_v!0 zlNmYt61P(wUPm^ zEYp>GCm#1#?WjG-wpWgetzWHQl4p|BWhL|0EW4DHbhT40bW!@JTKh4J*f1_c_d7=A zbCjj!u#2j69EABf1)$EqAb;~TVyGfiziXkE+9k%lT1vS|mOwuKa+RMOhrV1me0d1% zYmPTrEmn|bkxgXBUbDZdFW~M`lSWBZ56rT?rpeJHqiHt(Q$N%t4yx`>?xOyyO9a38 z?_$cfa(6iIC_`I#5^jQptsb8@cN+}@muhM@95HVk*GfsHZ05ea$?PZF?pXB>yr01=4?h+5$?8do809()ClvfLvZZfbfO9T z@tnze1$Y{8wMQ4t|+wdsWL5+b{Maq^%jUi8lE-aIbhi)~@*;fw~z6;9x>UE)0 z0wuQWk=hGRa4c{m=INbcF+?Y=3`Oc`S9H?w)g!H(LxPXPy}w0u4N* z^`Zsw`I(Z)`tQXZy9Q?U|){`zvPvfvh(MQ)BOqI4RmpTfbc|%P1>L}4apCv%q zQ+bwbK8<8m<3<7*gnuGfZ~7%Np0*pQ8`S;^xnHAH@8t9m67AynTUb@>g zqGr-S%1eq8eW`tkjXM=;LC@PQC(CkT5E#{&vH#K~bT-5bqC09&9p432-E+C>zI_&3 zdOBerv)`)B?ab?-NSr}~D}Ofz&^tWJ=cK){)HGj&8)!BX{MLmJ(R}%~U%xG1*X;f^ z@}@r_$*;lW>1H8Q&@#*W+bb4HJ>=b8g33hu5;g z`NBROOl6nG!1tY6gW(cMZ{`y7chi-*Lf_!?)@}^9N+%P)o@4?WQ^|5ptXI=V5#+#q z96o7moZmp>LZhBWskYsgbZ)73OsTUH5$;bHCF48*`nPhs`r_)?)7}BTLOYzF8Smt-kAH{jm;KZ?)63AQFlq>!NDuXND!ee z$%m`Hd(BJ9qIO^!ArI1f!7b70Hhe1tWMTAig23H}UTKiCVld^Vx#Ua`2+waa=`7Ms zq>QKFo}(Nd8V<@XfL7Sar!}#Bb^H%ea1}<)%0<&(%uUiobH5cUGKwaZOocEgHFO4w z`=ith-H;o`jzI_o&Ln%Mbx5Ei2CaLm0IXujH?7|{e#Cos9o!Lp9*8OWT;)yUA>(08 zFt?=jVLfxrnU8Wv&vUqLhQC7tZnzk{4*S0h?AK=Qb5`hJecf-?1e8%)(X4x${%nz` z_Y?U=%gQQJ?K>i25td13H)#%UjQIPWpl=fGZ;@nD6l6@SXd zTXw1~(kly>xJLEOqy+4e$@#uUsd+{huRd0OV%e(Z>rHMos}bkOiUC~`OO1sV8beet z|6hfB`r)|GG(?%%>8&tXYkl&VGP{9Z1;1eyn#l(NNq0EXI9s1bS+tukaC-$DZ4mw4 zhr!*bq0(9v9b1fvv8i$eDuAf}gRy%E5+&Nw1zb91+qP}nJZ0OqPuaF@+qP}nw!3Z* z-iwZ&^ekg%=4fXmcCPjPO%YLyBqF-w$F6lCU5aPQWym_tVNBud1)mB*3PlRk;cj^q z<~fUcS$Tz*m@B=l+2{9dRZ&)?^$oQQW4h1HYa}_$ofEC3wx~UKr&uFnq!-I+IOC>J zJ=>vG9IV&aITcL+j6Ban{KfAl083Q)=9&I73)G996$pvxwCS`Sc@z(38E4^v0#@nI z`dfrmf-)i^)vTH;2`(shnt7+y)-_61MHhiA_blO6{ZbBTVdu{6%yFU-gvz_stTKP~ zFs)YKh3AJ1^Gz)AG-U~Iyb5m98jv45$x-dD^ zfn2HjY+I8Rur^w3M$@E|tT7OePWQkpTjoM61rR!6(!86G={Uof(bqs6-_hLXbU0IH zW3Dmy*3TqWSRTi_Ono>wIG=GS+SxivM_opG51HNNRthVE4qA;(6VMiHh;I(ICjWL2 zn;)xf5+dF4*Zx%N#i?ojTo`6S<)GSV-3)G5%ow1ZXL()QLE&>2IzJ!SB&1JRtNfKN z_V@hb@aG*2k`fIhC|;pFkt%gJacmH=B%OUuj#^nxQMFX02?#CMX|%8}JuV3y)f7+F z*X;G7&=Ke_P`pw|a#j;KQ|K*UZJEj|*Ab*!fOnPy%J-ukJ&$TOIu#E6b;OXK2m7ef z)}EnQ6PIdrgsAY{>yozudL$g!0R#F#fbVs5*e#`(^d-~}hb%)ivHyKkrpGak-*UGj zQRrpb#4)}le@_;b2wF2n%po0jVdJ8u2wRvx<#9V8iU45!ij~M4wDeN_u6QNqi zlQ!bd83rQTSI7u2xQ}E^9K_)oTL4`q58h_ui#Fr!(=J{g5^=)d6~XyPKnlLqni}wQ z4{9ZSZw|{mJ8!xRi&GS?5jyhJVmgSHzg}IibM;t7Er&ITFKY#BzLTM?v)#C4wR25J znInng%ITcA>Gk3fqrq!&R=$j?tFNB(-ArFW-_T)P0G4EXQzo7k;qtjO(TfZ_yp@@o zI{w5lbT(SSP&R6iN+{n!<{&?k!F>(x{?=(x-Et;+c{3B3U`0D2VLo>ny zbye5apiMIEHey{)$0(PAmvAZpEmCrrT))Sj`zk@EztXXk-I&9eMMDIyIKoC~rLdN@ z_5sh4F|K1c+d}5WmBEz(ogH#(hsOt1c;uG>=sMW&iz~DptT;ARbU4P1_h3hVcfaSb z$1)aHz(oTkE!r!`3Xgr;UwSr#Lzzw$CL7Q>lBTdkF@9-D@mZ+9af$e<>zxWO3K>jA zgh9ovovoFNbuzYSA=mn!t^HS(U{S}-gv2#%KU3aaK7zv)Ez^B`-A~y zYY6HL4t-;HqzyZ0GSgePmySPfWNvn<|B$hd?jQ69S~STn`Rm@eUs=MqxJ+(y<7Sdy zQIB{TPw6o}hfa)yudw>ix>vEdd$^kpG2%5v{>Fgu!5HlAf{j@l*t@V6;0mZB6_Lj| zJzU6G;4m0(fN_dakg}(ikv=}*CeR?ACGmufrHSIk$W1c~m;Qc9{xtC1ZQJoCvk8;W zyrdZR7Ie(`mz})ZGTGkS7y9S#(fOdqcA+N<{V~!(HqFO!Gct85V6z#p)CDCJ( zS7H0?X~*xVx>7TG{KwLR`$>ylrt<3T`q5N5MQ8YVd|`5~oAaRRFt5`$ym28W18 z1|9o7`YW*87Zc=b1{y86!9gF=F#C|2U}an2l<)>sclR`Pk)ka|o*ECEFLx}STpOv1 zEsPXmEZfSvxTBy1-#NFTrz7VC@QMA(ZL9P&Zu#sSV;$pNJ-AHbC_6~7$Rn&-v1hXu z-#pv2$tB81M%tfDqC`1@_A&ne*#QHoG}0{|kpU*FtM!;lVPr8aug#BLf`Eb~VU%(+ zY$f*J&H^_Y|Eygb#4q~~|GPn9@QED!!yg3>sq zM)wHDwnq=8BVsxwJm7$57;z)FYMrgN8j%#70~T$vmt|}=@-Z7P_RRh_T@>VS!?<2% z=~mmryR8-^Yr&M%AZtP1WX=6~gj(Ewsef9VK3jqQjFB~R)~a{7`8(Rs&65L+JP{vL z{Y2uNj>bMSQc2sawA56>B#KF2{ivhTgX?Rz2H%@)VSBX8aF@HJfkTehY^BOf@A?O&XAu1gt0 z9;!~dN1ld;=2;L2@lM|$#R}=LrFF%03nj(bk;t(y%dB~lB4N#VMp-V_BIYW^j@mPi zhlOVA^;9&&7Pd7s&)l)NRU{eS@VEM~{DL%gYS@Yzbx9N23G3w`XPaeRg-fg=^oxvQ z^+JyFH>r=5nbd?bqRH6wL~{vO5zP?htkp!;rjqk}XDVkbXM(I&g%&ASb+S_@mp(-+HSC7F>*C-QxC7+_uVm)h!!-=#N@#Mmx)>;B(M@WbS{$!HXofHSuWJa)D0qyk|q-O zzi_NQC9RVh&5aelr`|NU-HJWC*(!$;ao_M{=HWAG)OZ zqB+DSVSn;dZ@}402ja|TYFk?594Z|~HN=k69;~(|x2#CQ5v}982fcc%Gxq_n(7ytX z!K_1YaxA-Ry%0W}7x`#@BELw#{fQ1kox{uC7f+cPbZ^i)&Y*@A_R;Qo8ZJPi2t-GW zkoPYcITVIgoh>ZqC0H0rzfQMRO4B?bIm2TK+{k&P<-x280Ud(q!N$mV!uSo4uBXDV zC*-CtY|L86o21kSjZUP%xb}c2>&N7e9SW=pI0fWJ0j>v)0Gr09$lwd#q?Qs~;Wm_y z;lAJ3`|g+yPDoibi(0-k$BX>Vooaf;baB zu&`ftDi+~Gx`h6MN#&ICCeN2DPAoi{>vui74?M6&31U@Xij6=X43?!!tV3Q!q<4*b zmv>=CVZ4~_$P1*f3-c-PiP4=xpe@sy&*L^BlkQzRA!+q?l_NfSuuzgDXw$T;r>$3$ zy%TF2U_TQ|Tsgw~XQ<2%;U+i<%3|MpaU``wPH+>R>r7J<*t&imsdj^ZGrWb6aLsVK3{7LSx_vx6 zj8x%6QP*VS-w8i4<~h1rM`Qi;YU1ViJSZeq%8nL2#65H^eB)4#H{x0sHy5Z(hELbS z<$5c36@09UEgJ3z&oqm>w9cEDamWZ~K#) zYo=;0P+O~N2hg!N<3%1akiB+#i9$8u%0T^FFFwAnn74tf&#`U+%TZa zVutmdvL$0uMNYC0B|3@w2>R&Y#xqTKWIG7pX2hzaBUD~HlPk`1;ku)dWR2amnB9q7 zjkjO9VGl`jp4xb|E?FGLag-ECe;DbUr7!ZpOsAB{dg@;g!P)Ax>Z^Y_Vui`CRp2aX z-w4ax;CUWg(QWhjb6qZnTX4b$CyQ|n(B*D=H8Z;{kqd);tU>`YMS!d{t>!m4CD0-KOK#_QC5Zurn7wYf1YnV?=d=No!`0FVzJMqosA{!bL{JZ zp4M(M98G}Yigb_DTq0+dLpjw{*NfpJ(2#hnE2}fF`(Bl(le5g8vss|DS|?rSzuZ$p zoe*0YJRXfyHTx5_T}{Zah=wx+f>FvUns6$gn4``O4bq-2{&B@aqiHPpVUx5K*9N)a zF^%aNyXX&9jew$N|9ToKNoRJHhxb>tU;7{TSyiysH>KF``hZ!0LUG~*vY8_EDfRDW z3{k6cvQDvJUwWkHVI}l85Xv}8wNN*-;cLQcc@$QG)kCo}7WN8dm+J@;S>V&e_^_!9 zrk;n&Qkm0gJ=Q0)HNwB!u0y%YZ8(!}PJu|0g@O7&pgffckZ&jUF~kgW1$35SGXdh< zmWX?^CdmVZccywKAxQ@{i9{Y^u)+AWEDU;Gh6RaZnd5&PMkXehR}eXzgL->ZpI^je znZnvbxnh%DLCd2PRP%2EHx{orS)H}AqA7ITURly)FQ-Q7?D@*Oy?%IzlSehNZ;buv zm^?fM8{{;E>XG&ePnQD=I%gU@&R%=>+L+>cO-uoGdAh>e3B42jSD84Le%B$jd=MM6rZ(P#XVPGm@u zzD5vu2a^K6r0?i83Ry!D_2XERh-6q6nq%)DbDzgTXRp6iLOK&5q)5{u<&hp#psud2 zHsQ-+SHK(SeA2x=kUu3iHXFt7kM~JAvQR z(df-0(p;m67KMQk0Uds;-zuv=>xlxYjID5fXb+zaqS*f-=Riy{%p>^yX`}CKCvDJ7 zMApGsu%)EE3Ww+Ox_mmOsgx9CK!QFW%Zm8LeC#*%tQPm$(pQf&#zRW0% zG!WA412+{5FdwK z7&U^Fa~!LRVHhESwb;H+ye8l-#j(&jUc}=-LW3c`yw&;2O4iqYv#|ubA;x;OdxWR; zs*tQaLewc^Bi%jclEFw#;i}pjX6$hdEV$9<{w=t~Y-s=vt=hM8?;#ZR4YkcU_~lC> zA3q{r6NV+&Ht;6D8hj<+sFKuaXa^C4eT#n?Q&xjcO-SYVukc0w6zN|wVUy+ZM$RZ& z37RuxmcE?!5ao37YNblmN~d_|1QtCWD`OQulfhIXi=jt4i=p4=W%Y5;m(5?w`Dw}+ zs8^XPgJg^(${@*VL?h4|h2jVzk0gqI`tQ?XXcpRxO>$G>{vtz-4a!zBf zllzp^mon`?3GF2_7UU&Rc$u>{PaiO!=6}T+r^iN-Xa@VSz7Z3&P%7F~m(}NVRVvYG zuqxz@Ff}qXG8!uX{HR*W0bz?dAKhd(cvfd;*A>pKB|ERhlc*=tNTG8Nvkrr+3&dxw zCjVQOjw!xs<6bDJ>!r{`Gr$jwEmZWgYIgWt@QjD)u9HzKr7lDihctDxu215p+=j^r zMD93}Z@Oq|yy^LN9NiapQ7Sld|N8iH{dw8B`7VeHKH4j{W=Uw4(3eh+FDW0kh;J^0 zPl|V_r_@l|O@?sEFwHUUXC=6HB%@B3K|->rYu`S<6&n4cdFw8hTh!FE(uWXoD6f~V z{lE#sYz8-1hOTD|1py2R!<=1NRRbaWNhsFKGf9B9AMN^hNkTDiHH z4RAd|VC5>Cn{T(~@tBwL6I9Xu;fm+${ay7y7UOk!SOylIc?hiaQPA+v)BgUo^M$f9 z>fZfw{^E0cUr_^aLG;k>%&{s$8gQQ=~e6D%^%>L3wRzY_0%mvr#Orh?bdo6Ml(xo(LN;k~z68BE*d%N3-`s7ls?99hRmWE_mTl+tvtB{d z)dZL=u1C4|M=@7}s;_Xv7isCG+`rGR&6$2z&5VF4p?;eF<>aj?jR*Zbg}v|O8qn_L zCz=Sc((0(s!NHcsJLxTBvX&M*8j|Hn^zIZC<4nwWF7H*S<(G?zsyly z;?o$8XJBn?tarRQe_enjZ^l)aV7;G}t~$-X%x;CiRat&bw&b91b?Psb4D-Ez>ipQd z%JOygl$V!Wf1~lXX#PBl>3(3idVl#I?T7Tp5>*-R@x3WGljVl@yl^9&3GFod_-VK^0lWm~`a60GPYae4=Pi&4 zGS;?wDKeQKb30UIXxg#2Kx|w)8DYP0;yS897|qdfM04plX*sRppuK(-25b5fn!uuN zuEHr_6ir~+*SR_qO##c(?|u1@pK4Z2HQ`oGegU`Aq28q2DPC1!l^|)q?D(EfrtzDK z9sKr~Z{>Oi#c=m?AU@={9iE$twp-MR`YSwue!sMy%p_>EPy1trssbrLvVLsrB{|gg zF!eUE11sCm${+ay-hereu9q*TTVx7Xw4qhBoo6+%U!DlsZ-QPs^84`&O{~3YzqKl3+z-bm13TRK>3xJlwiC#(+%btGMFav45G^ zw^}TD$08BPuI9IN!9We3-y2#^6c6xqe~l@OIjDinS7bj!?sK;5zYAf6};Xy(Ydo-=o~Q-&Y<4zG~mszdGI< z-n|^I?4vlSUm}LdR1zo~fSDtK4Jsg_{?SycK5q%iLq^1rHLbu0{UZ=KLPiY7L}v?3PEGEWYU%RzoMV^4Z+&{c zxKy^D-a;!=cNJblM)2K7BG<*mrC(h0c@t!0!O_CXkEZ~(?6AppjPzqy)>Kyf@N#mZ zwA@_rGE+!q@&eY+jJU#08+<_hZ(D~(mQ~4?Ofs!|Hbc2tR?P42JqkRow zgAeS`_r`E?kUZ0tv!8vO;&r)k9st{)-; zFH$mbg-X(cH@tF7ffbkJ2*uUUFn6N-J$GYA3EM;M+CPtms;e`1W%J|~fE%-N_VUIl zVhZ1mq&XH5c!FKOboS8Eg*!*5K~q0+RovlJs%ebptw9C46UV)oh3io;v(GWYgMyl* z5GNJ!658n&y@P@(`lYq*8W%TJ7bCrQWAIWPKNOz#bcXN&nWY96z%@@h-l zDZuXLiAI}E+Qlov+j0wPb2CKaGcfWo!sn39{yT0rtKBnO>*e+Os?k|alwbtx+jsbvQ0H7V>gyBAHWLx0La^tkuH;n&^rk;% zdOV;|YB;2m3@G3g22|@{j~5#A5dFZ<0`ruL`U=&??Yj+XgjIb7m+NQ9c_qi&tS!|QT<=54_A`-CO*`{e^+-jrIc2 zdo9y@ndzj5%59|{j2rF)FAfia8`(?CYyC;)jN>P0*LG+J0kH9#Ovy#! z0K8Z2c$Z{LgkXQ(hP6fEM2g@em4xlmvbZgQu*K=2I8m$#9@!SRMF9RoJ)Ic8n)T*s z;OM=-m}PIl48lu)#$eMesp{U$Za>`&EOhu3aDa~ZzG*Vd`x$RCX3wdW&H3lk+1uc8^7cT-$BAjQ1P+Zem>0}) zbcNjE4Hx$WUh939sm&&n&9_{41~pgMo78OJWW!El{+ryPjUK&RXR~hnKAq@}jb~in zG9)%uS>2akpUZv|8{?{gPQ5F`s>C{W2nKa*2#**BwMI`+CdDP;!nO@)hs5LudH~P! z!gCA8B}u}zt0Z5OTa0aFAAQs7cR(Mv{b&Y;6#VSRc@u%2K~xoT@jUUTs8W+5B%2>;2&a^t0OYcn$rkRC~o~3l2xcA0tOqZGlzL z+P_zVtFjvv7w|56o?QL1fne~csWH;4k8uzgyo~w_Vx(48y$s$){l))t@O?B;1~0Al zj0lPKzju;TtDIg4YBv*IR-3)#U*n0Y<+uNx!N&$rtDYvpuI$wnJ)>_e&*usBj=|Ro z>6A`~L1C9cv4h(8Mcq>d=L@^F2$YjwRVV0a@K5Q;-_l+*_MeP{o)eEOB?iiYa zKooNeER=xU1|3iwMP;7=l8&Klya>(XmjZfs1#U#ySo$F=%8oaJ#0a5+`1EE+A_KGL z+Fdwo35M>kNU1cD$7{9;#)Wvr4&Y_N5Af?6{-*=GtC$0EJI zH%w=?AmwAic%mqVQ?V4Nxl$M*xiW0q92GKOcuw)B`(ZJDh-8^lp>6LIayDA5OQ!t_ zx(%jzT4%%+M4>f(gz)ZU<7AT?= z6Qx6_-jDjQvT6FfWiiWyN+=*{kx6s%RXNi|aT+P-{>feCNFwJi}nb;|7 z%r?S>Bc)w5muRS6<;;QefWFg7suR0ND;t-SH#KVsI3PyYVyhvg*0Crv+1-tes|vqZYQLyuQ}G^Dmi za6NVh99zuK6`H8Ui~%!)qtPW(;ewP4&=$xfCS$kj4|D!4dE@*yTi>0E)eb1lfnA}Y z9+#RuR;OsKv%lNz$04CbS%baX6}E;I8wo2x;f}-g!s=-*MtNq<6n9?3W~O1AA!wOd(WaDjM~Hoax>54c z<=K3t={@uI2;C1J`AbB^A->(jp7*sE*+cqj9+|CX;XC(UN*) zA7o*D_=nyN+F6>RqG8kUK1Q3kZ5f`7WfIi^_`DWpbOf$aO`Y@QOnkG|Q4u!k3Q7dY zyjqi0FSL3gziHakZ2NDwkv;Gk88AH_rJWYAX@!2*9NdkL;7Vr4DE+|YkS^I-ND2g8 zY}0LV*K&e$Eo+{wBu_Mp1nBEiZ^geFo6HTgm{)L!FfW9rfdD=A~l z0ch*#JTCRDBoh>FoSb9n^dTxv4?XPYBliGN6m9i6&b^t04zRm3I`5a>xn5`i@1+38 z860#H6P`Kk{?7>qay=NmeG6X%+96Axl|jR>=Rqyeh%y8jj$-LS7GvTpNvzpID+yDk zvr3E8v&47_;r67e@;n~^ML3e;$Py&?^>`(h!rYzozP{}xyVDC5Rx-r#R9+-Dhw;?p zh57~!Cn-*2GYLszu9CyQryy4z(qR@H-lR)KR@3Jef?)v3xn*6%>D}rzp-+^MO;ORU#}9Xi}t19mCVZDJf@X#P-9d#m^{)MoXBB zaU}QsZ*l;Qpp9WbHo8c>w!LuFjG&<%y><6%Q*~b^OQCGImyJ@%+?CC1tYEA0b-Q} zzQu9Ti{$G|tEUUko&>ePU=B10fl(!>nBFUc!B35qCH`?F7J@cQogwh6GGV|>riPpK z4l=jMMirTb@TV0frz-KcV6$@wm=iyNq_61NCm4Pb&Khbc-E+`bXee=|mh>MJEq+T< z!%zZ?$dA)METr2RTNR&Dz{<+GU zhir>X2b=>Sfh5HAh(;_vO|#-m6SdeHQo~_X##%7BhhX7q#Co4Ay}H<*EphrS5wuEw zHzP5KlHMIz7#BwM%K6&>Ryurx_Le&V4Uz|X7tHXdv|~64t}J-ISUQrtpiYeqvY5m{ zg8`UYOUGPE2G~1W3}0uXv0O;O*n=f0ZbK{MrKP8 zBETWH$xnxT448Jy`pYGI-V_GmgjXf*LV&lZsz(F6i`fscXH);J?*SzpDucg_aUiX5qeC z@+V+d!9lqb7^W2x zfSe2`y|MC1zZd-}15f>5$3K;+{oqC3OJ;vdc!NjB4EBF%GWA9plR(Qr$y13eN)T!I zn%HUF(KNp(hRCQhph0OL&b*WTM7UYTsjR?V(6>J2G>#!?Hn%LK6mPn$#w8X4C0c78_mKrcx^fK-M8<7I%hO# z)w*>Aq=x!)-M*;`t7!I%X!3&}E2EZKmh~@OE}rbLL99?xLKRe^2itzl2O1D5ZVx2V zh$D<5fzcnJHZJd;|CKrQpID;*gJ+J<#K`eK_;PK<37Y_V_|6Y1FKIZ0W?%^-g2F^* z#1P)U>u~tb@q{Rb7$?0uE0^(qDG}9}vN3MzWyjCe)@W}Jx8T}?dpD*r;STJcFkdlf zvy2t(7tU(&KhL}Esl$#vFo7SFtih5`GRg4lU7>yUD*`a4Z+qj}Y^qitVcUGZlwFXOe z-za$h09$@vl^k-mym#D{ZVNZTOCpE51S$%W36kVj3O8;TUdQ7P(cJoUCzd8)q~**} zQ>fwEt;u&63cC|K#1v{kt{=oJYKJF=CsI(b`Fq6(}~bFO(vXCZ`QK`HaknjjA^^rh^xu~_ zM5asU1qQX$b^7irSwuJJAK!z!4F8Hm03?7dZZI`JB8_#p`9lEyow@9Km*8dj;D>Y5 z6Skk4Mri|oK0LOFNMv4jR`2x&K~-57Z>KA$sYKvg0D6t{_J4U23e<7fGIwkSpnh6`X)%2X(v^ zd`dzrK)3-ZRQKr=DJSwyPXpbg|E3>Wf{+FO1<(8Y8$5#$J(64?+Z7?BE*hZ|H^~Po z;Sg?*(+Uc{0-gvVCUjs|VN#O@rJp=I+L~s7lN;R!dLbv4bwCojrtgzdN2Ms!7k%^J zn>xCW8a68A7~H=|^M8A+(k*%)aCf{!Px>E9Ym2iO(541k-VDA3^LgSS!ta(!13M15 z&Xrz~5$@;Mjp9$>M8M*Gj3SSm;P_L+&z>T~ zFz2oI*eSz-U#cIEBfE?=ZP=@1ywysfa0p;@7aL1%yO7dBig^i~zFw1{!mjTGkHT#r zZ>@tjf<1P*Ccnn{l}M-+w9_KL8Pjuv+9seSeRc@BA_EGzCRjp{BRd$^u8lbgchDI> z7vXe3N;YW7VGvNFF3GYlk^%MdTYEX2p&OoHNgU^z>uztm1$;v7mFvdQpmD$*FMCar zT60njdg6uG;BQMT=Ad?`@2U@M3di&ZosrtDJN1VDRidL_hAayE^KECp(_xOkGeT3= zEq5RV&;wbXw61WczgyBv9!`0-NbYhI21q-{qg-JfIM}|>pk%deD5fwEUBJ~vZKv## z>LNyUh8AC|O{i@}J7?+(4>zbY4Rusy8dvO(Ngz%ft#yzlq4-F>7H>i8^!?Mk4%-S% z^~%-XrL&FJ?F776_BL5Xsi>#?K_?l<)Dm!o$yR4)4W!W~Z z*6O>b(G}r96)o1~%2CWQ!EYnw6$P{n^A2j-IpA8<3vALVVV*C9_lB9go?F02G*cpP z@R1g*1v~Cb_-lP1^jz~`=*$Vg(T`PSCzuegQ0e~WbJ!F6aeMdeAJ(rQh|`jN)L%FmZ&2u$m_H%tCOyQHpzU9hW#|G_ z2pL^`9mAZmE|kE9B!#fXGGJ87%_!vuv)jd{j>bT`i6kp`=)_E z5+KGNWfv^BA3NSQpx zR#7=gypZSdp}eks&%CaA!#tRK>pa&&oIGdt>qsfqCXUXOyQf7PskY2kZL5}oe7Iqe z=Y}Q=bt~Pbf`LVEfWo!bZ_+;U$`@c8)i+M$<-K+xcLVQ-RnpchZ(yq0o4NjGJ5DU< zuea<`6Fu|=d%2T0g?>mDU-%EQNj(ho?Z8L-&^V)1g05kALA-MFo!|$zbarf&g6*T) zq1(z<9LhJXJNwz`yqDL_gLGH3^IZrG`H&vJrc0pcHjI(iW=TBNr?3asVA|Wev8_Hz zNOoQw&_4G;vR;(95lUs$sq#o%WoLBbzKcX&g)bO*IK#ImyBJY0OBVB1zAtE4j2FbF zsw=w$QH7)Fzn)*NT6lc<(J(X36**E z+Y@W>_QXO@IQ^52nuPvQe}mC)2nTa5H@1-I@a$ZWy0r*08Yg|0Eu6hy1DvaJMm z+eqb=f0Ap>QWOMx^N7pnBc)p9P2TgC|KhV!eTDt_pr`KdDinSo;wEZq)fECi*I~>z zM7QvwHGnlxN4H3)kPgGTXcd#egSwfW0uuQ;e!HnZvA^PhCFvKPt+PMn`viC}gQZ4( zFWAl!$RNPS8&*dxgfh+5dR1=XgA&0(E0Ykja18x$}V%$;<@Sn6#JcJr{1^7N*Vc-2)3 z*V%*K-PzMwlk$#nc7XRJheK9__O{3<)>eYs?8-n582VIYQl z9|4AbeWl;nBbM}u=e)8#_f4fq0>PW_`OFW91Av1vMsS`M@9^^*zr`D!-6iAsKJtnx zYs<_}i}&Xa(1|OpK_}&p$7$~QtVCiDv_?Ig4GB%D@5QcYw0Ngz(n&(=HPJ)hS;XRF z#W9?7Q3O4BV#NXjcT53~&r|2OoPFi*-Pvpu)u^Xc@B}RQ=}R&5 zhGa)u`S^w9?qj{T>Hg;Y^9RZ9sx!n5>u&jH#rjS=_y&QrTh1%;TNJ>1$@Dhzjh7o> zwi$ePzXG6&$PTYx$@u~*l@)n_x6oH?mEM|Au~8IFVM0RzDI(e^ z=h%7!zHA2T_{0lscB5^TWYX83VBa44=Z~L;%bjy!4E`6!1XyehyCsfoZpm+BRJ1y78=LnN5*U;N1jlW}P&g#BA)_Y?8xmW>R z#rx*wuRXuC!&~^CK=T8z3D5`4tw^s4|qBAw>2*3!M#WRDF_^K=?~z# z0Qx{|HDYQrR8PRsO71Mm)v8u~Cbw|*Z^de4pc#sHMz>TCd?-G+Mjz26LNfS7U`b#P zJr7o|jXu%pfEA0UKhFT>nvP3g7NToJO$1-)32|29qu`U`=-vVV$HVY{jj_B zwyJLg2of|YI@ne<=ez6(DLP&chDFZus@5yKzGZn! z@$Qk91KPf(JUH^?yP2Vn;m3d6r+ZQoIcl(Z5yK`q-IZ}ErQLSs0hW6mAKZFSueWMPyX4$0cY z^w6Gm+FGD0~c%7^39+sMLiCQ=*TA?{5xG+O=FQ+~PWKNMj|ELHt zS?&oK6E;P!EviOdg{vC`eCe4|5u`_UbM|af0b2$@S`j=NedatWpY$$1s%WZwt$BK- znt7Moi=8bmlwKd~E;g6nsvb1Rnq7cin=yAY4EHp@l0Oh)e7qeeK9hI4w-*_a4Cx3| z@RJ)iAD$j-NWED)jAvTZY2bXC&MK63tKaX>=u&{Z+Wa1TjK3VlQ(6an(>{vsjZ5g1 zVv=w!yem)D_UdRyIB_O;lI^LF)cWgM4G&LuqQBi959e;8eFoa1yPY4C3h3~LRHD1x zAKMBxqMv!!AI!$)77HlEw!{)}rlO&uYh>sON?z(a1$+c`$oOb$lJF8%MsLRHM&-sX z=6tf^Jwo9^@gt8dQ=HoFdH#IyMpEsY-c2IEfgA4fc?Et8ZuN}0!}~P{J(&im!OSb9 zoa}SJ-+mVF?|7^I0mDKLd-{?4Y7Ji)nWqa<`Z1K)>X~Z03oiwj>Gf*WZADS(d#MG$ z4J^6^;f9;ZkEjJ1^1$PUHr=~vm8uCAxy8f|$k~-xh5iZj?d5R8Z0_f}MePJA(EHWC z7;bSRgIe~qU!gkT@One+fQI|T>;Pc18|><~@zTxNp#`glrD==zlC(T@3XHlg@>%~xeq;+6st{pbn% zMa)PnM-7c=+_Bg3#fb@#U;;-u??K$-D@VFcDe_4;5k(#k&F`TzLv%+Q4ms-mtcWv4 zAB>pR1e@d0Mk88H|BSlK^JDI*vI{5278!x9Nw~zNh$At;6RpWS$C?=sG7Lh~+_Hp` z*c;KUiS364Q4@WPO&p@kOY4x-AW+ryv4X>M*~hMoVG;Wg#}mg(Zxh@0+1dei``Lyi zw1#FB#y61TP^E}oK4JkyVyNd%p#D5F@O#0>L{dkC@3KO8?Ax8GN9Kd;l zYIecBV8!;NUZK13`QjQ5Z_Fyb1->Pw;~oyt?y26QwD5f#;u_;w5sB5!M*bm6mhoet zlnEP`=V_D^tucq6m-%6uGqcR0TNKwZM?2--Eebk_(>5t$H7S9~3i}4g9$rS0F7nn0=naoO`mqeTz%n=XI<^*~MeFT041@#;30qVEi*4~!hrrv^R zOrHdv1kvc?Nucp z%>!(6!f#t#Ue?;wb8go5$a6!=8dYUl*SL;hO#|C%#wE=&t7k~p#J1s01KeuJCEX#8^mHEtJm4f&$UyKQ=ww z&heY7K)`*`Y1vs5pBbQ-J`An2nLeRH^yCCY#(+v;&pY}w z2${o~L+CfGjQ(qbm-;fnBzmn@^;VHmlZQ1Y)`YDYliEL4teT^!bwgGVn&ZiJ>X!)5 z0G_clViBE+O=B?)&Zi69VcAod&*&W?Ri;mu6pf2B;8{Vm{d|AERWyLid=;c;iNHLT zngh~+kVw=EmPF2AhRu{BIaq184Vu<)Ai^ZZWK+0?63(BBicF2(8|t|Z4_ziN5_j69 z1XlWOwj!!86e<%RFO}CjF5h{*ZOMD;e(8CXUwIyv(P>pCNqNAwyXbuxfrUta@sz=E zBr1pAe%`ue$NuDSox)Wni`9F0QoZ5kdm-m0jj82&+x=y#$G5LvBqD`c`?)vZ*P-`1 z-4nyrZt|Eiw8YbW8BDmi$np5q=yNt|?H3+0TEI1R-Rw2>JcSOTvpRGv*1Jq^y1(dp z=0DFZYkKaEHUGoVd*1lo?&-o}2gZEA-;sszeqG+i&BWk->`&BGzeTTjjaYUcu5Ob7& z)1`Yp7H&b9ta__gqM)j_8-a?d{}x+4z{X9a)#f{jkt;TEi!P4NSX5H7{%kn^cKi0r z_nwz+$yV}&V&*PyZ#65;qSq<`hLkkA_FhvQ@qmMGZxfAxP=cyF)5_R&RMa;B6|R`g zlmfVUfaZT$Ae1nC5$45IJ73RU>NHYMfDm1JeKO=W6x~+DfEQJ{V>S3( zwK4DYc(LEOQK;P9tZ>*nYJ=#H-);`0#nrAi%A=a)uD!q4V)Io|*2fu@>M~}L8m~Pw zCLg@-qqU0K)>X#9e=$s;N4@B!$#6(ibn#fOQo<;bSc8vh1QHtya4cH5d19+s<9@vWT0d z5cMSQULb{7$}NW5TY&(mdXDx|q6lncF^O;3C5WV;!+_!QFTx>YWFJNv`s{PLy21JI z0*5dEV}3;Iq3PzjCAX=p?k_VCPv|bg2Mp)H(^hDax`PY*`sFwIJ6jHPnM#+2a4g## zT$Z9pSNmlwZLztpxj@ET_2rtd;X7ByNS%!mehTOii!hbYBii(od4P%7zRLfWZ!?dd zGhg$#OR9NJ5Iv*7SlmNAP9xyVyi$A$WRh36k=p-+9`PB)z?`JOJtx9p>zti;6_OHe z+!Lq{_P=S<9sLsYt2#-7K)(dNf9`R<;eazo;;K_)d`0_YJ$%wwo3&b9HK@73 ze@u(imFCPtM-(#shEa2M?vh~=Zpf7I$UuU8W}@<`)Rlp4;Ne3PSoK`TSI2&$Sqw9Q zM=AbL3L)^hxH-a6RNy*3=7yC)s=m5HPLbm;CBd7YcDZv#6BXoPNG5;?!;r52V3}@u z9Z2zU(W2@9Mc6sUiqeEz`kZaswr$(CZQDHCwr$(CZQHgz` zSE|-pflf#qvmi}55{8ZBH82~L!}~)5Tt<2>;2!JlVv@k1M5RN;tY`yQQnq3hE_JPJ{GtcUE{p1{DKUCvityJ~z2UW8+X4h?bT=&c;QMjO;A7Bt)5l%?0~U25 zZq%zfF(A^UG8oXqoyQ1Ovw)6(r%$YeZkCi7-r5hjgQSImH2(Q=CkAFTKL}m5K!TEX z>B+l`RDEUY{#|MS2=8kV^rrO5WAN9(8u}!ae3c_~0~80Ca{e7ld=?(tHhna!atOs; zWSstG(IQoGFO$o9(aI5P7*E5U`(OP^X#a9o-^`;_G`A1C1d2HlD@8N`OiQh2&*hz# zZ?*6Wf@b=B@a4r+h~o++@Z|Of+5F7zglnrTT*^e8o=|itJ<$ zNC}qMxR?6cO18MypaZ?M+n@sdmq$9qVWvFKz=IcxPp;As#(*Xt#-5hWYdh){aepS% zb1~68^ei;3)q9aZl-l7JRpaszSWTn?8u#Q2;)7WL?Vp!lB(WLBFto7z1|J(f^%z^H?qF?%Q#XxtHAJ(iL>48a7y z5jz_CJCiaR(vr#leK>vY8F4M>|3Ur8T4l+S!~X#!mhd0e-$Ss{|9~g@haG_8Ka9f5 zv7g5k;QR-jqf*gmkHi0vRG_20c?LFp*P}ZA^RzhYDP9B;MOj6NPLTy!qRasbQ}Kwi zT0PG@0Fv|#eq8owLne17bz6pXp?Jn*XCW5QfY(0gui5)&5NyzB&|{EgkP=KC8k^56 z2yAXz0wN+AboAoL`ku1BRoW)bypf4dgVs7hCvMPMAwo!-7<@7Jx}deG*WrmBHHQ~} zHgvZ^4H|jD%Ze5EWo`O3LG~djm9aX9Va!kJUV>yTSv=V^9)Y?mo6fn!k^gUYQ)Z#U z+=mAnEFpxKIk%muhuw;KMMK}p(3;S5ka+OEs0T(JcHLikSowdWf<}a$U?u6vVMmln ziDF3~aOPmF{X-dlAbVUGN6Zqp7Wr71x_@nVZAq!I-=0|tj|j{y#4!II76muTPa{yT z0h@0^6L8ueH{)$B?{Y=2(FTq!gPiCPWng5!iIro{bKteL;a>@whWSAOlO9wG5;)OC zXDskTPwT5$=>;$XhV|f2jYygr2|RC_74@l)N?PJY$#TWv zX;$5LU_PL(K+`F{%Ca^So}0LfPLtyv-8<;(p3U z0hE9l3FQFpTyPTQ6tJ5UvOOKYtF=d(E$OICCFN_ACZ_fmyzFTU$%@)l`zADt2KWem z3{o|z1w^e*v};msclyi%J9gZ9Lv~hDH5t=CIU3U?jHO3tdq>TARD*A8XIoqs}> z7(%-2)X^8w4ym`UAIgfjXcWdI<0N7vuhfDy;ugY$>$5E2{e7}D;u1=ufE|2j_oI-` zyvoE(o2dOhb%xPt5L32wNNBJpUVmtL4L#q*4S%ClbWTtqn6tMH;hFu47)e$EoC~z7 zuN;d-Z7{r;3q)jhoeo!fon}_&d$DB8EImh7e(*k=v$y6H+p%?SxC0X*_NUYA% z(SR??O}mg5MXuxHleV0?z%F&?HEtd-kQGABgn~y|vQ4LKP)}dm-$CFh%-_|*)6vb> zzo?B#H`nHuF&~@>4IuR(YmEv7Qlgw!Tc_FCRf2(#uo!&d-g{GXFH2nB`K`QKsC}9O z#L291q15zleuao2lLN8WzbEzc=u&(JkHYNOKJL$N4@*?O3KljQ0!jvkZ7XVLaLP7w zkof&?!$|=xP8QHAXhw{~o}aMokIHM(s<`NBMEMKkyYWUYG|te#JDi&Eq#IsCuiU95 zTJqfh!@ZlC$SIN*C~V(CUdm|atjVM;p3NXQ<%TiPf4BV{uN=tFHc0hwR?Y(<{RXrQrGkegZuqDsFGL6ArY zN&ZIyfMhA}qxmW2Ek80Bpk|${&-~>3KTMl|4}Iu5NL&3=c{db)A=!!`oqftx1zj`{ z*M2EAfQ&tE0}|wY{X45u**wHjgSyyg?{u&dG1K`No{`5qoV=MmlU3-OUAH$`#*Q>= zBwHAikZiE7V9|?|(CACTnsE310PC0FY=|x}k4st6L@{40Q>0DMn*NSk*H_Ri%ydX^ zJ-X&k5^(~WeZeqai7O|VEJ80RY`ey#)s3@S8~`>#Pd(a8(KW0fl-KCNI3Nc=bYYcv zUpa1UL0GUDNX|f6H2s-^PVQY{bm@Q-y_EOl>p$>y-&zX%BynR#%-9)-RKv29~p5t}|5_Z8d=v8=Y>yx3j^ZVP55^J3&&Bh`9f$K~>0 z@>RG%YkEi2KHy&gy7%4#o?J->#;R7wmFh#e1a$Cz?JP%O*(BtA70g^U!mDJ8UGp-J z=R(d1SKt5oMDg>M=+5Gv&G?fQf@uem_bUqUnIXVH>@Xre)WK8|V)h0%z)eeKyLGXt zZ4%kQ>mtrb2+yOHsc?|bB%E0Cm`zxHFo5-e_wm)jJF5nyJF!aai@RYw`G8LMd6Lcb z=*4L6Vom!8w2EUqcf=;fIn2jw3fbTrj&aq;atSTRj*KlF3S<3^_8VVy<)zLGI1}SY zo-Tnr19SrYzRbIsmp#+>0P(az=JMA)C3{rfIoJ#{OfB|FFd+W6LV*Fpg(MA3=ts|F zrj#^USlha!Z;rdt!wq8%cio*?*rzmTc#T`7XqHfN5DQa?W)fc~@+OpYKy4Gyq4Fj8 zQB;&f5GQ%wbbgC4uoz)Zm113BV@b*E3nb!F5IPwBVuKB^SN{ABtH7I%h&wUd*)Pi) za*z?%|LcR#|14m7PcoTQ`cDVf(htNTvblEU%-Jq<5sq_%Y?HiObgLHFwE)=(cT3Wv zA4WqcWX>5N_Gb3bJLH`Q5(mE}uB0i%3 zFZJ|x7rs6vG7x)cnGif*y6ayx}lK+>+OT~C<3Hg zuSt5JS`E4dsn=rcaXNri+hJbfxwMv$>9B@-xmz!)pnwG~1YUwnLP!QaMm_zE;vfrg zRD}>7koq`Z8?d5di&|l7er66nU2}HP%z|-4quj)CszVs}q3nZN)qk@*sC>wrh0JF{ zM&t{6_^p@sz(fW_Zvj6AnAlidM*Y1mZB;Kli8o~`0>5S>*m6-;tT?U@xCsf~RF`}+4YqK2^AHb-({+izM%!iU2+O13n;@WSD%p=Qg zsORcQSJnL}iK(TozFcSXpn?eyuYH;du zf3hb1fi5w`p%nCS@BEU1LZPjE7T)rk^S_H7g}>IrbI}HhRlJ-gokv;?J74j7bC-yj zS|~nYtFAuaj?t^n)*y#I zrXaOnOfQIYhE529kEhp+58p5I@=b!>H7+Bq_)Wvl^qR)5nf7ZD*YP>0Pz{$;d*frT zWAiuL6U_?7jwa#a`z*v~PGhkRS%e>YM4QXR-(+JxpZN)#Ie%Ut;zD5CuWrS*qvy!KpE7TfAm#s4O z5~a#qY;sLi6}Lrf0dD$#G!}=!_==N8tOK$bSmu*UG!K7=fBnmfu9a5sQ*`3NoOZbb5FET%2+IO0BOTh#q8jP<(?lr7liW z&@N+ArshbYHhm;TF-V+}>Q2nLlqeqK+F@cfcSo2KClC+cj?FQeF(>$H?lE~dD10wb zdf{Xo@~!rO;Q7dymiJnlEzfrv0@fJSYOxRIT1QF>8qC`q-aaQSG*4OA9R? zr`eiFj88ghfkE>L1nv)td-z6;rrs!Scmt1i|& z$w1t=k4%{GjB>iY!QhUJsTz#N$S5CNsLn0uHnYoLKh9U#SbIe;Pb~jv;qrIYhT24l1vDhiOk+3z}p~K1(Es|}_K{JqINr_s2CGwE3vchBn zF?Et*iaM4+>H7QYt_p~zAD!4bAn)=rvZsFOO2XwV7uhf}N1vhu7|uRp5k@~2PYP@x z1*~039#1utN|h|*t_{&XnCivzdyZ!L9+?r=8>92zj0|#e;pgA1ejzKJ20}IhwFXP% zGf9?MQr9XDWro9OJRcopiQr8cvb>t)T%ercqiaEQGyT;3uBh)Ynj>G4RUrlp(NH0) z{Fd&*xp1IIja5ksd6PgDN)Y(egf_K*^d>7;_?Y6{fxy~}F*huwwnM@vq3?MI2i3v?=T!^}DRPF1xVOl{Cw_m+;lRtk5)#G*fD6 z?6v2Q2dBg_7>Uy2wZyR#Oo*mrHR2x4<4MA1B8X{tc*D{k=fp`eUB{h;`GGAgc9c#P zqY_UG-dsPpWW1xZ&)+uBSO>$`2T&l<|7p9h6~JbgD0n)20A(wh)|Qs$fRolu@gA|+ zG=86x3%5p!Ns;<8{}h7}1*KyeK)B;#FN z0?Dq29ajm=Kp8n&+0&fUiEQ3oW;L7x%_P@U&P zF`Pbu2qL=6+k;Wbz@_p%P2!=EE%;TUr9*?#*QXQ)fIzQDYxklt@FA9M;?u1B<^kq~ zuMyRx=*9uB!D~yMC`eolb03P#i!Rk3C`z4FeB@=@6H|&51b1NC=moWE`bnUKV}D-a zEMU&f&1prphJTtJa3sjkXYF&-69vz*TW6f+$lk0Yb7B5|Bc~x}8n@piZ^5KVctH#L zfA9spgf|0NR7CGx0x3e{ptoJf;gccZsY!@Q7KBT9G!Lu z_^DOq041EN>1VR>GwQf1gm&`_(3^+lE?A^h5)T49VEv;qM|TWU$Rv}%$l4b>&pVJ7 zVvoOf)}a7HIMA(7j*OQQ9tJaeRH*=Db}B?TB05LqIuGSbH!II~wh*swmXU1oG^3!S z%5&a(ZxY?&X!nL}%&E!t5AI)H?s-|Azp;-(NwZ6P<_vHUq}+Q!wO^y|Jc$azw#poB z-J|t7fKD`U$Fs0=$8+DcThzx#vYMsa%9eu@UTD`g(C!dXVyx`6VaoB(Xf*`p_ac6E z(B7zC>uWJ{RY-l?)-2SmmET-w4{Tr8ue&;DoW+XZwZU27QFd7W7Ev!Lk<9^7+`vntODf;E zBr_rchqQ)XU&ctI*ls{A3i5lBy}K%V0Q;#mM-gYYIp`KzJ~4G92n1o1recWV{k1t% z1tE%vl4Lr&4^|d51{gK2L!5`+3M1k7-E^}VX1wW96MYgY3hVsoC$?BP`7!l;@Q`m77%NC_32h-sVV-T8csSc>-UF?&D7!_p? zvLmk7pgMkKQ{U&!u7!BY)v}Ze!O0V+UE17GO3s zENLa3d(pTZ)OFcb4P}ph#EDDQf1&2 zj;FLiEF-f3J{ET6FL@I26GlIK)8OoK0I6ZbcW4>V-d}#f{_e75po%RX@!E^*Ny}O{hc0 zUTL(`CinuBNy=$dsZ~ozVPq>Mf^78SY6Yb%edRpb*S~N9M@tJ=02W~R>hHr9(?R^_k_BY%w-Rk(q79J#1Oy0OAwcuct# zk4z2hK66t=k2yGc;m*m+27(s?`D;q)ur_18xKWziVfA$k3~_d&*PXu11R+L1HC?o) zePaYhgnBtpqgk}A6}eJ{x7_CS?~DmsQs8X>OCNAY{3S65L4tQ5V;`;m4oHuXrWvA) z4w>Nt&GcTcyH0>-H0X)CBnz2H6`uK}zw*FjX&&3stXVV#N_v06vC`P!UvT$&5}9OX z|6m36+5A>HC4d7!6R%z>S&m$fdr9OD1Z8+-MB+t}CE>aE(qppo@bM@CdP~A23*{20 z+g&f~?DDFqO@;GwV4zGnmOv@71!Jh~mLO(02+Nk| zLDuR2Zo^3^E`6NOGi8%x%0HI!(H!pY%OZFWTc=a&HRjqm4;S!Xsg{nM!(E#-K#oPCc->R+6mU!`&Ki!1`WEI&mW0X!BbbU9V({21J&k+nf9{JY zNL<5CgI~j5!%X92_w00kZP4m?lm+?B*B3YU?NGa!+F9R*?HVyvA^JcD3*;^9(mJr) zaXwI5u%--14N-=59Jp)*UI;Vjd@21-O>`_@_OFAS!>HqWeD_NBuVNKlZVIh}WI;}air4hwR4u)k1=X`JdnS{^K`FRK@+ z7kgGRYC}3fMn*_Q?4yvH6%tjg#KEN?oiuyeHf%$uoAZ?)f|nXJU^gU~b|jBR7@}~Z zwBjVJh*X8U>uejlPu!Og7vtqInB;TGyRuFu6Z>s~we()~Do~S~o0p-W1BJaKG!z6i zl6V}*?EFi#qCP^1h#o7EHmXIS_R3#+_mc6%px#LqpM*D0A6SnsGg>xUHd!`aHkGKJ zY)E5TNK>gHo%1N+QKhvLZKpr5u;y>Wu@!`b89JGMmA2+z#6)Q0rl5-4gt>DpSM5T+ zFA~4%Mjy<5*uO%UD{#BcMSh)!pfVWYJik6ILetf#qkc8G)!~|ZBsMmZIeFa8?(a{| z;_UhMs8C?*^tcuDe0O~%ng7M{RJU?G`C zL&Y{dH@HOb_I`9auv!>tFI8Vxe?}LNXpFdoj3=rhmZ^wgfnkwhoo3}R@ERt=&<63& z?8}W=9>J_cv8^PJUL0H+nQLXUYilDYkQfOV9*wa#*P}x(-Af2;^dQG$mIS>U?5aWy1<>SsyP2G9Ij=@au#g9L3HJi!X1nc} zL+qkmOZ*B=zO8U%qe=QGTXpF^Fy#^VLBtx^ZTiD^HAC?CsC|oGTD)U^XWYQeEp%i+ zuycx61uKI`I^8%m*+=N7OjNfB(*i49;V3N^*A(X_JC%pW(q!JhP}!zyZQv`}$dspK zT&;u9S8tqerh>f2V>L06Jlj+8`pGNnzDe}{f&sdWyewNlu)9P{)rL&^>?q9$?IO*( zmD9LRUwj;7OJtxpQLReGGFE{oM%$ECP2mtJX1X`jIaRu@%C)`0EHN|I{&%&KPE)zH%vvWAQBNZm*VAT#Zie$iAv@j z4VscSENr`}RDjc|l!P3EenhjGZ%ZRq3S6x=?8Iv2^RoJ$GcJW6?N6$K8>_F8fk&Dj zdo4cwg8cR&az*a5%#Vc!qG+|F-Mv-M>$VnK85LCoHac&0Fdgu3xX(ndxK@X`OTRa7#7XRS*o-fO ztBZs0yKMdO(`oXcx9v=O*GpZFlU3`$A5Y%zF3V=kF7r0YyF)Wa^=h@es-%LekVbU?0c*sv*$6K>Vy~^CC#^~zY$aQ9GO+p1+wYIGM#fW}Z z;n!2{=0~?d45Ts{mL8=25{P@{T3k=O)ts*9i(gTRFNiyuwKK)@IE-Xsb-l>)ILRha zrLT-N3^|I~Rq(kona?3u=vMBqf-$xm~Wz?&#A|y)96-p*d zSiAkyIyG`Jp&!;K3zy_fzHZ`&t7Mvg-tmU}b6+=RGE7q7<>2E>J7kC6XDPzJhZ*hj z=|NeU5Eqx@gi9jphgQ}eELzq-2ZJ9E!{?a+wH!1IKicMPDqVK0 z41rrwV2Im^=m(Wt%eeq8ZQ^|Kr(swPF-*b9F^FT2G7mV0<=iu~pX~AAC6+ArlZP?| z&LD-hW2PTj$-BCJ-ImjFOq$oRC?UH4pc(8FD2s)4Z<;Mn-ugrgJS`lhP;-NKh#OVc zbY<@?N?>PJeA(~m5A0#w_c+j6o;XqhRWv5TJJItK4zo9M!S89>hMhx9Q`{TPUC+_) zTEhTC*Zz%YSA@rSqtF&H7s>QQcwOThanxDpd6_e6@gIqActmN5sSC6OV=?7V?0dze zL?^G+gnQDG=HmH9h9?}h6|^j0ZG^p-CBI*hgqnf^${7$uvBOMMzg$Z^n&PDjg4Am* z`~8-*)4B}F1#~-=%^baKQEHU}Ra_7;5-|-$TY+pso;0fx`_sh}QVb71*B6qn%#-&fP8`zQPiuW)~2pV!O zfKtyii@48EW<=i?qSBiPrMCxcQs@^{n}|TRh^4A_U<3=g9T$jpq(E+fe(d^JwriBz z4QmFL!=DR3Z|Nfef7VyQL~)dNF3qpYZ~YkF$KxpEgo%(?&5qAl4LNlW!yB1mvUll_ zrWhq^AM(}4%Wq6X$jkKl`e5M!Tr%0mb_CGpYn;yt_L*drMQ^q28a!vJ7g&^iE#7>O z{IJ_W8@do5WeyQ!6e6u0zNvvi{dWCi{pRvPU86F_3!77%4fZ@%O4h`Y=UD16S_KtiK506s#&z9Pb4_u@lWp2|y|>BxqKgDa5j(Oc#kVSXv!&I_ zE9NAt+PIbSdzeRCMq96f9->J&V*zS7WIpN!YZ|MDONOg@qloek!hO^^K=cHw3&Smv zr$aaXehS7j90*5Z8aoLD5)}kQa)1n_9OTRHaUb1;aT2&JvCSy`?Y}wUX;cZkjLA--=uMUp4o% zAc6)?2A%P-iMTarhW7;rx?#L-=iIH?qrXgk2@+OgqVmW&{x9tit=CZNq^}Ev_?6%^p1#TOP8MH3W%=_o?=QXq93S>G_1Ev za}y&w~VAOP0FOFO%~L1VD}|y)910X=ec+L3d!TdrZx79X_@kJ)hFY zo%y|ADz`bu=^RtXgC=*muZpi6PSt8L-~=ury+!1&V2v+8 zmzTO825=V`Pv|oem`Bj>S@Sa9cn5kSlELr{4h$4@2T74N424ibajCkIcO1-$iCa=G zMCz~G6$x$FO7Uq{;bG#EVp5MqXL6ZyBsuIN=-X{1!BQf7Omhsx>v6l15`&FnVTB}d zLb9kFQ*{?n4Is-BiNPO^?DX+&C(V8$pi|Ek4nh5swZZ|Ib)xd)8Vp?r79#5 z@urfJGf*T9&7U7_Bi5yj2j`Ay{iUsiPvmFjj<|S>)_1-&w49Zs&bxirJPSHLH)Rlf zD><_H1?0qnH`iPiMEn%ne`{$4CD;y@WyN%x$&cyo=#mxabWKZF^;K8A@)E{{-mqTUpItk*>XSj8L+?n~463?ga zILV)=F1o#L>C0o|&ABQdvc<5~R$bF^lXSJ-?Vr~F%A|KXTdjn@LGzP7RBg;z_J8u; zHF1EwTs5&N0BUqCN#rCP1|FxZ>h7;?JQj*gxy)4;DHrS44NxgJFF8duiZp2K6mkpw zIsrF^JdzF~&Wi__7aV)P`#rWFQ+KgxH>jo8z#Ax0N7g&Q57Dz%%egEPEt1Rv6<}7= zDe4>6=+u=3`#@-TTnR0(J+Ms(VG?f69^_H&L=O1BvN1iD@z`$OnE1@bH#_^1zV*4v z@*;g2gWFfNKTM0_c0EihGZ~}DB?IkzpWXDWoP@A&x0x$`wM%Ebx}|{FnpW6%l04cj zQ((6bKZg|^d*#i_p=IRAQ9Lp~Mo~+@Qu9xEXHht=Zm`q-B0~x$%<5fSj~@Zrg;T>uV=~+Jo!&**Sx^oG^*}WP&w$1xLR)hZU)pTm3mpuX ztP}{)0Kq{l*4Zk|t40V}5(Ny|?>otl(yL;SqFGK!l^nThIkoW=mJGfB^(eQ^XH0@p z7x_XdEtCYU63>VTkuP?hWUgUdfIn_KwmuFpF=6qG0Xu&suOfUp1zR@^cTEs7bG@M{ zdw8?(>^aa=e7R;U-3oHomzVOp|L08ibMxydYp=6H@x;lXFRo^+JZ31yy>hD4lC-S! z8%O251$socbG{+L`Lmg4_j zdPo|}v!a0rrL=h#kCK;}cLR8vx}GFXXHS>a7a|%q+GOBM=fubF$0;f%R+hc1+czAT z8cEG)A@TA$T7MR#aVogDK{*?>Ij3FyMprTdsw+q+o_-BKN^#W(numL=C5#_XM@=u< zZC=YANC1G?Fvil58&LjqaOYq1USd6bjp%M>OfQ*dPGetKxK9ffQu4s0ur%=3a2LDxfoT@Rm`(58zpE{CnAk7BJOaM9$W$ zw<63^g%Sh#2@Pe9Y>Ae_&T)V?p?qnB=xJalMpbstcKk=yas>x-#D3fK=6M@7e1vmb zUZpCGSaC6cOQBFGE}D9r$ygCdJfqO4qKe?^>go=qvxEEU`c8&5E+vbLSKeOVp7SKxMA_wL;f!O|UH?xq~Z>PzsOoAk(>@SF>X$0D`ijSPb` zAz1}+QZ8}g18CrWKQj=(t)cmuB3&_0+Ws?+&9(0Q(iOdd7)*oYepj=tGB+lK@!*C? z<0MGB0zU%_yn`!Q(&@rz(i~|Y#_Gs9gZN!;um(GO{djiwtVl9#&$RT6?cSs#V9vge&ut+&NKZPzXzy~nz=I9f_y$Ac2zMt9`T z2lZ002@BrJBVW2CpH9!F5Az(>!(7rndX@Sop@|N< zH*d!)%aWw-Ey)qwI#@FAnd~v|OG{bL?2XAyx@*nKt}?9@-T#S*|B=$_(kcpqAETo zB==J!qddHCf|ucz7ue{neBGU$)bsPLU-i&SU_6fO=t+!_(aTh*za0hiR-DhVB*U+t zlUFSVuwWk8L)SjJ?n6xQE)z01Mns*dA*;c5DryFI0lbyWCQ^&|F0m!Z z&B^=m-gGqFL^xXCU)&t*&P6wWlGu4Kb~FJuxSg&xBT6?k<;0lB$6dkS*}t5t?G5-E_196_i?6#YZRpts~PH!O{8 z)A6}K%JdJc57(`|ZgqpriX5<)W+?%zz1<(+o<5t)OaGF~$=xX2^ zNAANLzRix4Z10cLI1#LCsU78KE1j%v*I$(-uD4a*O&?)f%v0Id%?S6;clHVAiQ~)8 z!k5S-J8Ad9p}$8^SWo@%q^~ zC!>k1OIDJaes}dx;_ATSVC0~V3z@x=K~fOn2=Q~B*?!`nPcM5IAXQ4K7?u$?cNap) zs?^QjumPN^3+6CFtHPCdws8^9oCLPxucyHnqUeUa?VNqx8s)BBO)l&NHDk^N2z}hf zkcAH-6?NNpntmU%my(+lHRG^Hu)ROS#9d_cg9O~tY+zS&jWl)R3}++YAx2)nD0j$e zgQ|M)x_-j{-wvvMs@IbyLO~5x|Er1(!IyEEvWx3G#U9z)A#vCo=?r4@0cuN$FIC;R zOVLl}EzJHy{NSkQ>`Uy7FAe?sCoUMNc+T%|o*#ZT;HxpIoI#2Mbod>e!Wk(ssK+$^ zes7^3D*Aa|saKjwzeqy*Lq3zF+nP9@h~FUu%N=3g<%42B;QgNTpbRq-Q0%d9-2I@l zylE-KAU{UmskeA{ZnBI-lG;<ATH-@%Oj>LI?n?PP#F4NxB@JhqY$ zuS&%+Lm{)}Nh6%-il~+MqcF}2lLY5$LC+qXP~KO>Fi63#G|~olg1#ZNSHfK7 zC0L27ggXN-MLfgYI_3#Ew7_SqiX8n)_;u*_sN62z56q$X_5XRw1q7v>q?(#OKKP(ct=%h$UBo6N)~QiIp)(lW)@Sg zs*?Cn7hTtd;!L|r;QFnL?IQo($s7#ocjLLV20W)PY>l$D95RcowW z*p#tOqkK4#6N+M49G-do>M|}78d zF?MEK`?@69m5MReXRXaNwX-fm*8`N;A7(vNBrKHFE8|CYN7w$`^4)AOAr3;V?+hE) zjv3=PbS!;Ck2`Ble=!`*XfRIythCb_G*DFJ;ah4|sDM|S>Phcj%45u^^NwYN91x7s z$UU=k2EU!fjzq+7z-j(zM^@vP={Loo66gf0V*4h-l2!bGYNQ%~Kj|B&b(rj(;cBX` zMf;Mhq*FH^Z)d!*#56Y*17c&2qSZIg?N_)r>r0v*CG*QmWEC*t@-dgJRk^lfNaav%KWI9Mg*g60*BzHOSL?-=iZ<{_GEDz$IV67H)8!6Ui`-^$wu>p(l- zT?ldi8>Ci}gRil}Y1%21bQ7=)E(AMwS;_h!Q0ZS>*<8ASplntbOf%Y*Oze8c#ycco zp%^0$uNG`*xz$_Q-$A)a|LNdi8iw<8Zif<0qYM_QoV=V3nMiEFOTSq7xg=4#fWtS7 z(Stx9)qR=lWp%H!R*C^E&HAePCNa1Bpfco;7bdIevQ*E!(n!&%F(2|Om|o!xCXbSK zXI!B)fD$sJqPICZICzVP1p|ABScIUU_Tv1 z?&6Qd^DrD~irPhRm7jaHwV4fiyWKw>Ktyb$V>Mv81SPUX3F3c+l%cemc!QOPmeG>M z9M>XaW-mY>BmCsS+ANep`kI!#Du7>47+~eGChm%wO|?BbOnv?N^5y=bRNWTUm_mH= z%WmMCeG?$B)duH$)yfqht#$dBctWikLZ4t|vtWlE8O3lRuKkj`134VlVN9`uY$kHv)p&b`k{dDZR4C92YRF)O%$PECM z(5k#dnIHoX#fsGCm}CH=s*&xAOXay3v4{M^D^9WW@v7DpR`4x(BGobw3pkAuZ(|K~ zV2aPTvvmVrdfSWEkbsRjVjyuwK0&vtui?;hw3g2p>s}?Bpq485(9ol7;}m$@4U@P_ zTH7DZDf_dFpvT!w7M4r@wkrg$qV)&sqt*!w4XYVrYxbq;KAdW9Q#Q0Qe>->P zApvcxFoXoc=CDBj24&7HY3V^*XwboKK&_uJCHgIVRRv7NsW#bS`3zRy@xM zeo6%~co*mcuM!0SCI}qJEX_{&m)W*t2B1YbH{p z86!di;0vj?Tr!ImvKZ4dYdDXlX;d3=2qyw|26jxuZs+m_mbdo_k4wTjLlF2*qG$~3 zPjx6UVj%!7DX?CKH})obAl4~1S`={|p0}GX3de1j@XYfQL6>5_spwm+gIUP4FK?+t z&e2I*Xt#1}DzvflsX&f_9hzMeA!Mra^nt$h*45p8d3hbK?%uB6+L1Y#z+i-kiVP3$ zvhi?CkHp}lu`$3yqH4Erq)jbfJmonM-nJ{-L2vDKuZIG}gyabD}a;A_}g)_F&1eO3Ye#y~1^l zOYkB%j~v7UdpznbP^T`>9n_~I1Q>r`MK1$bV{T~5jE_iLTW{|?`Rsg@zku3#-8Iio zTF=V>BD4UbJS}s0;1*x$9H_wChH@~wVNP3KqSC!vo7vuQN)oPX;^aO2pT^DtrjD;& z_dp92FHmUljk|4}jTM*T#jQAOw8+N2xVy7)cX#*V?oyz*yB|*O&6oS#e@@Of$z-jS zS(#+sck-;6c{9IyKXUe^B%+6!P~<@*09 z%FEziET7zO=`R)p81UzRGX+g7G2Km|)IGy+@mRm(2uSicJ0)NX^+zBZN#-#{kpGkK z0j{%S@N9_P8?5?jZf>4YuKE!)Ew&$2@QrTMn#R3vA(iH4bQK7~*W&-CsKSct~NiV;~H{2PsncPq~R}tvBRV+_lG=`z|{P>8JO~ z?o0vd_$(6mtWqhm%!4-%!iw>C$~6bu@LGr^dz0(^|24pok4xi!A zX!0ulnFQc}mIPJ+D<>B>%fHCUoIsX;Ps*_-l7sfF%gcHjTMR>Zm}MG(!LOXpIgxV9 zf1%skl2KCESO!ATL;40Do#Oj4idrLCj~wAG6sG>C(NaqCKtbtdJ2`4DD~^{@_5+fX zG>yW+_Lmqex9lNi%%-FYYNp`>lm4KwC%93t(wt)`$Z7|Z zZixJT@%G);>Gm@lf^$o_U~7g|pTz57y@sQ@2< zwoyRX(H`J`T$Jg}z)WRK(XnEztl;43{(E|C;I4b8G_Ts!bW}}HeiK|HwpILX ztAdGD%)9!h!&>A!ml$d-Pq@N&QSU;i9Hoh*Z)kbtr?hPrEFuK@ppSe8DCnzV4(>v5 zpcJf=hqxc}`PNQ#xz^P9Q&!xb*eCNc6KnFs0DN5uhittm{^!bhn?uLr0PEiIQ}`F& zGnswi#5_BV;~VdKM4nRq7xcp~FL)M2Yk5SHFBx^vq+yedCeyo0$l>`w@EUUisSC%E zGfbdQhffPh4-X3o7YvAWm;P*-DX_M_?l$;ScYJ|m)BQ^T>xAOf7qH@h@L;gh_wX)v!rE<#x+fbs;KrHj6NKtWGUJ+gIBa4IKTHr>{ zB(f`Cu*NsejeFSaTTf93OW95b3kM0h|JNWAB9_pR+)%uG*DE1jkKU5hq!zr;UOacNH7cw=@U!$9rw3xeTj zaXpk=d6@xmsYY`&H)8Ce*SJ61U&`3tUxN9w$RC%vB?1Dvj!DTqO1jRWLC43ct^pW$ z{Fc{e;;NulsYkI30MsQrCV12TsHErCT%H1DAy34<4!Z|_31y&Vak)q2XyQz3DQnwf zpGTP=1oQ*H0PQckE>-y_OT&{{`$F-QYclFdT?Y1YYBOR>={Mx_Ca6UO5ueEa4BP{D zIqzvb`EcR^KU4Gfj4mZL5%8;_I$sBmWskp~X@etuBWC7V9+xNl`XC)cYdp<3&e3IR zQvtf(Pj9q}r?;EIU_cpk?v9U<2azIP9^Y0jTy(OPSV!MI>nZw8AxT*KNXQMolw5MQ ztrN}{bZqclt)%=K=;c)Ka(c4@tGE4P;l51NxWm;HN6@v;iD zZf$#UD{<#!*A%?pN?nKeXvKQt+;r+|x+m7@CH&ch>R$Tcq@C1}jKEHF-wp{rQBm>5 z{`^vy&k%Md|ll?Yc*(xZjaEQe_P)Bmqax zX&di2VFN$+H$`JkChP^6Ri<*Mc@DuTeu~~SsQ>=xF6o^1_lr^M+_r~b$Yt!{=-{II zgW}lg%7DOJ6DWl9V8sJz_oS104cjuR&O`SPWOZS5-=3!lj^B2o{MOA`k1xdja(tz!K(HYf+*00i3Hz8Vn}2#H zVP2Fyo(Z!5OQ%~`zKw3QT`y$a?zg*3SYWVn`AJ(s_lExgeVYJwUT7V>f+O^5j_w(L zV}(>iT~%(o&@4VReHbE`wXG&3w{cImF|E&raXW;CIAY>VZmX|m^n2ee=qDv}4)a#K zINT#^+3@T>>inr0${NzL9q8l0_4cf$x!?Oewa&ze>m!zjEN{BFHbir315L*3-%0AE zs~8?sKS(Xh{Fw1m#b3R5!;kcrHX=G-0HXs-jDz>e*4eL7>>1KT(aky-il2B3-u;SA zwYYmM`m`+FmZ^i$=-XE0upYw({e%A9_Y|weWDB+`sx+rq1s9-}3Y%CxRJ0DKv@tow zkp?qYSjS*{K=b$qzaU@>V2Z(EGS7ilxC<&Y{&G72Gj240L1C-HIhexB&z5d8d(*5t zU8$B4<+hvBO58gq&wQS9^*e3W0p^U%V75TjE3V*}nNxTv7ag=0%tT~!%0_NoQ z&%O1$axL;9M)OJL08AuYw)Z=4Qy6BLc6eu@3mJ{Q=c-h5yLvD92lA%CeHTw}h9Z>P z&)QCt7Tlj>8Y})5m_xgs2R7RHo$xhcGPKg9O&q#N2x@t%$BpHy?#3)8L()WTO$Ci6(u#MU%e-1iDNsj8xkARL=4HYRQ9jlbMNrhog zsJbKLM(OUn%$sa?8c&wG!|=>oY)y&K9@FzhcXa6Q-Sc~QSms?67x;?p(7PsgR=w`T z3**vI_@p5wQ?*LKp$RFj2_}RxwE9bE&HKZ*{}MsVT@MR-l_d+ameh}Yhr7Gy<7YeW z@D&F0l@^PRM<_?Gkav${%YD{H?~bS-Y%Tt)!|lD08s-}QBj!b`BM1bsC3dy1y}Nz5 zy?=a{{vQ5G7{c{bVQN#|^WUJ#N1GeB8+5nCXCJg`@*^6z$hPr_sx8YP%0(7Xmr`0| zKi=+2-zs0=?ggJf@cf0lZYO_hl>FaxM=bXxi|;tDJwWtF ztsAs!+R)HYc52iRzmAjDYQg0`O!6g|saYDZn{sf225eQA(`NDH$|Os3<57N#rK_or z&$;$_S}o_RZZyoeF8{ht=$@xv;n3p$^e3wn6)U@(TY;XTOlL;pn%~E#`9^bZSuIL$ ztBm#HbHa4{6I>>IXKB;gpn%nhe~R$JN^`MC*adQ)M(B9)^t0-8{#^4?Om#Jzs!I!&i4r3pVaV?9{!?(po zn6uQ*#wxw86UEqq%M{ft!A&(<4V93T`_$v`%q-+Y!OjGSh%|WkBb#}*D?ard0tTj@ zM)K88{`2gN4`PXza>+A8Va~QD6qoQKY=PhP>AwX14^_ z(Y0Y(q&U@$!uUpUu%v3m2a%h|mQ)q4?n-LJJJwAxD{@WfT7YOAUAXEzp$WO@$69pK z?Jd6&lv1yH9vsj@fGyUUv+L&Z^@(?r(DdxO+>v5yk%y($GV#WWX7Oiq_%mo-)D z(wWThu8k^~$4hzCALtP-S}jr$DI(`J$XF-LFjFe<4eQ+xlu|V#J-|OQ*XR!rmk_U> zi(b$xXfDu?v|1nlrFo`wOR?_T0^*LM-r|m?Q93Y&nTk?J!=&Jbm9_TX>E*o zw5>)_0gRb?3ByGGMD5fY7<7s)Br#6adY-PpBHk1n&#!4*MKu)AQTm;n<#7iJSLt8o zc@;*x#H2sE!oIO;tzxs*&a8LTeNt=uD3D)Pe-~B_98GCXn5!?Xmz%e>(Y2~dQPs34 zTWOt3nQ@Rh6p(GHD>FLwv~uEvZRsw5#;;Q^*LlRVR<@|unQGPpDKqKnU3g5fSI^b! zdC8>CIwb7qEw6yDp|d8834d1A4G!ZOheln0Qw2gyG?% zD}joe_i0D`VSYvJC*_OG%irMl_d3vb1J75E&Cs@^pb7!_f{jmUzRI@9a$U6C|95ca z1(WpjYTXL$kV~^OcXjkhmA6wY7iVJ7xjGUX2gi@&KEHXZer8No;xtxWjH~vP>v;~7 z+t{_LZq$1o^)U;m=eR^n>Jv?VjZ6%sCNS+(F4KGsCsC3)}1z87f9$1WE}QTdYK*MK$3r1X&}pxpxtCd^;iIX`$b)1x{=VVXHUO$ol>U@lyQj zFTc;OCZA_`?~K5LTNjAEf5bu)La+0g@gw{}TiH~E;lFZRS5O1#dW(N3h>n&E@lj=q zj|AO(c?k)<7S%rG?c->#oR#rMF=49$P0EdGbplkjQo945hJ#(&(YvGe`RlP?VaL zWEMSigqU^6d0xd>(_cvvJUA78T#NP(#p(G#_(YWF#vJocNNu}n;TUJ z5Niq~2&diFX(y0@ORVSR7c;Sic!(?%vn0-QW(gr@)W^00!`fzHVM={ny{0(t=N3X$ zm2Rm;Y0>h8HnplwYg4(k$7%p>G;|$HC``$%;DpVn6-X3q#%&@kI8 z@AeyuIfz{=Xa|rRJ9ezc#pV?Z6l=#ELzFPXelnRsQh}0R6d6dPg9ZcTumwhRIOVSb za@2bNfHhV0=&Ux^qJk)ReW?PF0!Yp0^R?DVKYlsDUnH#o#q>`m7-!&vBz$K@K)vxu zF$AFdl)&Q+VAcH zqF@gqZqu<#63g{0f0#w-v%UARj!!Li=W(%9Ftl5{xIE0FW3=R|BlHpdb_xW>2fs)A zmj1?frfPn=KK^EzYrC4 zyGa`m_CB+5y0_3@v<8VFSkCsxxY(`N++L8rNm!&!ozw#n5|u%>AT>QnGF>(oJg?SW zjy})p3r}!kaC;TOaOJ#sya2J7IhOcGl%4DW$)wJQZD9t?uy=kIg$75lJS7s2O-_Rk zc_q7Sr>IDl#EQ@eBK7w@3-Z?CkT)-tm#fy)=7p?;N_o=g8znMariM_{peR&Q{De1K zR@4d>Utm$EfKQ?=dMdo|O{#}v=zcCGvHadwCO5O`T}6Bu4Z-&wiwXgH*KyEc zz#9K#sxxw!@g>W-@{u<&CXV-Oep?q6UOs>W;$USxwFe%oiy8KZr^BTUX=I!VF1SyA zD5+`hSMy(&JbW-aD=L+!Z2mZf0E||^D^f^14@*Z^4=LjPKn>Eejo0iR2JJVER~40% zN*3Xo$^UTdt*8tkE#waS_Fl}|)v%aaIAX_v0cj`Hmcn62)=+f@r#SRa zrG{Ai-A%C#Jdmq7;%_0HYT<|GuGax6uA;Hq9vSGtj!8kNalMgfe6ssYLPBAU_0VX5XXMCyU3u3}cOj3n#0vmUIo@bx=# z>SslS`TGzj(YRC0o$zfOuxH;ul6Q1S${0mK$!yluu>yZoJ-z*0PU#|!9QSI*YSqu{ zm9jf48>2oyIRTMm-905uR9k$x&mX|{r9&qNKY1(3r{7>DcZf#RZC=;K!Ev8N`fzOB zuS`d675e6jfD6yjb_p3HEE!=8Wo;4R!AFnr6+bx|h`=dFG`wkG|1=s<4UjvA9y&ZB zNhLTk5b~3VeT|%r&7Z$dH$rX=m>+yu#3g>?SYG!%bYd4;;P~|@j9$- zy5w>Nd5>O}T%HOe`<~$MO?Y}58n8vr(vH@>z^dF^nGA@xl}g3L0$H-ITCo*b2D5AN~#iSoDQyN0dCT2kIQ$-!G*N* zMEk_EZ22{66lv)bLV8Gn))Jpdb~Xoird#wYfIS*K{jVXYkzqfH<{oA=p{~^DAbjit zFt@V#K;u_OPiPIUy(`6r^GXrLbHulr1A(lyzq~|5tftJdm|m)4g!W^2TjN+3%2ex^ zbzTEAM&mqEUSUwN)#T_*`}(_Cyd;6wy!>A=^|z@$$5MuM4Jxq z-?2|;T^myvfd6ixkB({1B##N2nmF#bJhYMXdl{O_XQ+B9;7z8NKE%bXC!bYbdS2*- ztbcFsubz__b5b5U9*nsFt?np;HiNzkA1m+VP>m}zNvn|-kEN>rJ;Ij5AOPRqm9nMw zC-HB|C(86JI);6Ve+Ek*TeA*0$Y?u;mOF%uqzXTzkA6Qi$rl{h6?VGNFE%?4iyV{U zwg{Y3K^*&OvRXe8Xmcl@kt+Do5MgCr>Z#KvW%WuDmCQCcVgu>a zErisB4oV_=ZzJ{3FtPtXVfyZ3YYbqPHvlU;SpBO`!^6%AU=}yGbTGDiYc2I1j75zN zZH(R~$^lq8{`-)fy#s)ih4bH{*r&Q`v&{L?YhCYWe*#m`^mW&n zAKA}xRSkAayrkDhqJ8yjwgUAKcz?8DUgA^F+jCGbZDuF?2ZRxCrA`K>vjo3PRBre# z99sk>@CM=c2rgLhYz5yco(;~NFt~X$i7iY&&QkaYFLOmS71X!4RF`*)$4hF;1=}1cL$(*VSeKdXyh+tqYA7>yW7MdB@3>6%oh|XP!k#_HlPV zf(b05KPXA$Mn>zQ*!pvnEZscBv4OzD+p^hX4?>T)$gfMg_Eb{T2L$}VFXR-C=Zp)JJLm{^&5833j?G zZm*K%ini(cYi9B5#Mdd+wKn_B`wjyvvdE;|%HCF(nY?v_wJ$~;b1F1%mav8uZdwd0 z`51tia=$dX?(nF+r)qT%+v`6vhyk<)JYo=mxkf)s)3EJtO5qBr231J5BFRilPwRW& z+&T(rMMHgxMv4G@x~RbwET4p^((aGq_WFjE&S%ZmgorK7ZXewl5|}oZa_Li=2^&KD zv*b9BS1vH3J}@*SCDtm#^*gp5JUtN1w54gwIuWn~&0nvooI3)se&O0dX-M3&S_`WZ#A%u0zgn{Q94)wue=d)6Z}yD*nX#A&Lm?d=d}?!xzHPld}h z<5dJEKW5sg8(Dk%SB|0aQ@?1LD5#?Pf_cm~R(iX*%m5gsLpOxKkjvz%%D@N$1oZ-@v-Xc^E;=CE+D2 zmN<41rLQ=FuNhweN5Th1*1SlU{ynMeYv#mQOOeMBmQeCNO3Op57r^lTd{&x^Ff9e3 z8mxeM#}gYPiSS#*6neqp@OW5dx)9EnLK%d3?UETMmE&S0b80<~o0_9C>@c1{;X9b1 zOFAS&vUL7|r*9RzbrX)(;QSJ>89o{oBSe z9aAJy4-_l^_2k}b?OR(Di757?K?+6eF$r=m`tv`9;UBu7u4HWTFI8aupG4vRh=YQ@ zos~U+j}O2sVq@uOWo-{&2QVwx85@}!I@s6&Sb=Y10bo`GXaQIOz_(ooz^rWUYW&t` zmJ$VM@c~(Z#%vrMJVvZ0Kn`OTV^(7h4pvqkLjxlq4;QN;P~d-`q4RHgWM}{bN7Y~8 ng9`J`1C|f@AD0XG_YK+JLEp~7+0NJm8OX|sOi3vwFOK|QaA>S{ literal 0 HcmV?d00001 From 08d8cbded30c658002415aa89e2e9e869a8f3c0c Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 11 Nov 2022 16:54:50 -0800 Subject: [PATCH 213/213] add mocha imports --- packages/google-cloud-documentai/samples/test/quickstart.test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/google-cloud-documentai/samples/test/quickstart.test.js b/packages/google-cloud-documentai/samples/test/quickstart.test.js index ae274f1d50b..de00aec977f 100644 --- a/packages/google-cloud-documentai/samples/test/quickstart.test.js +++ b/packages/google-cloud-documentai/samples/test/quickstart.test.js @@ -18,6 +18,7 @@ const path = require('path'); const assert = require('assert'); const cp = require('child_process'); +const {describe, it, before} = require('mocha'); const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3;